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

Document within the domain of an index is not returned by query

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • None
    • Environment:
      MongoDB Atlas 3-nodes replica set
      MongoDB v3.2.13
    • ALL

      I have a document that should be returned by a query but isn't.

      Query:

      db.collection1.find({
          location: {
              $near: {
                  $geometry: {
                      'type': 'Point',
                      'coordinates': [ 2.350051, 48.8606455 ]
                  },
                  $maxDistance: 100000
              }
          },
          $or: [
              { booleanField3: false },
              { booleanField3: { $exists: false } }
          ],
          stringField1: { $in: [ "bar" ] },
          dateField1: ISODate("2017-07-05T00:00:00.000Z")
      })
      

      Index (not sparse, not background):

      {
          "stringField1" : 1,
          "booleanField1" : 1,
          "booleanField2" : 1,
          "booleanField3" : 1,
          "booleanField4" : 1,
          "booleanField5" : 1,
          "booleanField6" : 1,
          "intField1" : -1,
          "stringField2" : 1,
          "dateField1" : 1,
          "dateField2" : 1,
          "intField2" : 1,
          "intField3" : 1,
          "intField4" : 1,
          "location" : "2dsphere"
      }
      

      Document:

      {
          _id: ObjectId("SOME_ID"),
          "location" : {
              "latitude" : 48.8620365,
              "longitude" : 2.3202073
          },
          booleanField1: true,
          booleanField2: true,
          booleanField3: false,
          booleanField5: true,
          stringField1: "bar",
          dateField1: ISODate("2017-07-05T00:00:00.000Z")
          /*
              Other fields
          */
      }
      

      When I insert a document with a new ID and the same exact field values, it doesn't get returned either.

      When I insert a document with the same field values but a different value for the date field, the document is returned.

      I am available for a live demo.

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            technical@tootsweet-app.com Elyes Gherib
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: