Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1539

Consider additional "opts" validation

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.5.0
    • Affects Version/s: 1.5.0
    • Component/s: libmongoc
    • None

      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?

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: