Now that mongoc_collection_find calls _mongoc_cursor_new_with_opts, users could cause weird behavior by calling mongoc_collection_find with a query like:
query = BCON_NEW ("$query", "{", "}", "$limit", BCON_INT64 (3)); mongoc_collection_find (collection, MONGOC_QUERY_NONE, 0, 2 /* limit */, 0, query, NULL, NULL);
The driver will translate the unrecognized $-modifier "$limit" into an "opt" without the dollar called "limit", then add another "limit" to the opts from the limit parameter to mongoc_collection_find. It will send a find command like:
{find: 'collection', filter: {}, limit: 3, limit: 2}
Test and warn for invalid $-modifiers that conflict with mongoc_collection_find parameters?
- depends on
-
CDRIVER-1522 Add mongoc_collection_find_with_opts
- Closed