Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-55158

Missing objects in request rersponse.

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.22
    • Component/s: Querying
    • Labels:
      None

      Hello,

       

      I have an issue when querying a collection using this criteria : 

      {deleted_at: null, event_campaign_optin: true, event_id: ObjectId('5ea92da4a5522a080614d29f'), status: "registered", "label_ids": [ObjectId('6048a3c4b3d10c003c14b22e')]}

      => It returns only one Object (instead of 5)

       

      So I tried to add a filter on the ids of expected objects :

      _id: {"$in": [ObjectId('60377e2172fcdc005b32e9ff'), ObjectId('5efdaeafa62e5400233657a0'), ObjectId('5efca695f820c7144e46ffda'), ObjectId('5ee0cebdb28593001c8bfaf2'), ObjectId('5ed65cd396f090255d089b77')]}

       

      The complete query : 

      {deleted_at: null, event_campaign_optin: true, event_id: ObjectId('5ea92da4a5522a080614d29f'), status: "registered", "label_ids": [ObjectId('6048a3c4b3d10c003c14b22e')], _id: {"$in": [ObjectId('60377e2172fcdc005b32e9ff'), ObjectId('5efdaeafa62e5400233657a0'), ObjectId('5efca695f820c7144e46ffda'), ObjectId('5ee0cebdb28593001c8bfaf2'), ObjectId('5ed65cd396f090255d089b77')]}}

      => This one returns 5 objects

       

      I do not understand how adding a AND filter on 5 ids could return more results ...

      I executed this requests on the Atlas interface, same issue form mongoid ODM form the ruby console.

       

      Any idea of what happen ? I have no clue.

      I thought that the index used for the request could change the result, one request using a sparse index maybe ... so I forced the index to use with :

      .extras(hint: {deleted_at: 1, event_id: 1, created_at: -1})

      (from the ruby console this time, not atlas)

      And still the same results.

       

      Any clue is welcome. Thanks for your help.

        1. documents_content-1.txt
          2 kB
        2. query_ok_explain-1.txt
          4 kB
        3. wrong_results_query_explain-1.txt
          3 kB

            Assignee:
            eric.sedor@mongodb.com Eric Sedor
            Reporter:
            ivan.maireaux@eventmaker.io Ivan Maireaux
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: