vendredi 3 février 2017

creating indexes with new MongoDB C++ driver

I have been trying to get the new C++ driver for mongodb working. At this point I can create new data bases/collections, add documents, and generate queries. My problem is when I try to create an index using the create_index method.

The syntax from the documentation is:

bsoncxx::document::value mongocxx::collection::create_index ( bsoncxx::document::view_or_value keys, const options::index & options = options::index()

I get the keys part, it looks like {'some type': 1}

What I am having problems with is trying to figure out what the options part should look like. I am relatively new to c++11 (but have lots of C and old C++ experience) and am having problems trying to parse the options part. Can someone provide an example of what the options part should look like assuming I am trying to specify a "name" and something else like "default_language"??

Thanks

Aucun commentaire:

Enregistrer un commentaire