名前の一意性を保証するために mongodb _id 属性を使用したいと考えています。
mongo_cursor_init( cursor, &conn, &database );
bson_iterator iterator[1];
bson_find( iterator, mongo_cursor_bson( cursor ), "name" );
const char *filename = bson_iterator_string( iterator );
bson_find( iterator, mongo_cursor_bson( cursor ), "_id" );
const char *mongoid = bson_iterator_string(iterator);
char name[255];
strcpy(name,filename);
strcat(name,".");
strcat(name,mongoid);
ただし、変数 mongoid は正しく入力されません (まったく...)。_id のデータ型を見つける方法がわかりません。誰もこれをやったことがありますか?ありがとう!
編集:答えはここにあると思いますが、わかりません...