[CDRIVER-1200] Documentation error for "explain" Created: 14/Apr/16  Updated: 10/Aug/16  Resolved: 14/Apr/16

Status: Closed
Project: C Driver
Component/s: docs, libmongoc
Affects Version/s: 1.3.0
Fix Version/s: 1.4.0

Type: Bug Priority: Minor - P4
Reporter: Kevin Arhelger Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-1201 Examples for common tasks with no hel... Closed

 Description   

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



 Comments   
Comment by Githook User [ 14/Apr/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1200 fix explain-command example
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/cb52969bcd0a8baf6af14c2336cd184b1b398e7d

Generated at Wed Feb 07 21:11:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.