Here's the current docs and code.
/* MongoDB 3.2+, "explain" command syntax */ command = BCON_NEW ("explain", "{", "find", BCON_UTF8 ("collection_name"), "filter", "{", "foo", BCON_INT32 (1), "}", "}", "}"); cursor = mongoc_collection_find (collection, MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
The two problems are imbalanced braces and not using the command syntax. I believe it should be:
command = BCON_NEW ("explain", "{", "find", BCON_UTF8 ("collection_name"), "filter", "{", "foo", BCON_INT32 (1), "}", "}"); mongoc_collection_command_simple (collection, command, NULL, &reply, &error)
Thanks,
Kevin
- related to
-
CDRIVER-1201 Examples for common tasks with no helper functions
- Closed