[SERVER-30392] Query does not return a document when the sub-document fields are not listed in the same order as they exist in the document Created: 28/Jul/17  Updated: 24/Aug/17  Resolved: 28/Jul/17

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.2.16
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Shyam Prakash RK Assignee: Mark Agarunov
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-5030 Document equality should be independe... Backlog
Operating System: ALL
Steps To Reproduce:

As provided in description. I have tested this in MongoDB 3.2

Participants:

 Description   

Assume the collection name "groups"

Sample Document:

{
    "_id" : ObjectId("597620fcba76f211586c9203"),
    "task" : {
        "taskId" : ObjectId("597620fcba76f211586c9402"),
        "hasTasks" : true
    }
}

Failing Query:

db.getCollection('groups').find({task: { hasTasks: true, taskId: ObjectId("597620fcba76f211586c9402")}, _id: ObjectId("597620fcba76f211586c9203") })

Passing Query:

db.getCollection('groups').find({task: { taskId: ObjectId("597620fcba76f211586c9402"), hasTasks: true, }, _id: ObjectId("597620fcba76f211586c9203") })

As you can see, if the order of the query fields in the sub-document (viz. task) does not match the order in which it exists in the document, query does not return any results.



 Comments   
Comment by Mark Agarunov [ 28/Jul/17 ]

Hello catchshyam,

Thank you for the report. The behavior you're describing appears to be the same as the behavior in SERVER-5030 so I've closed this ticket as a duplicate. For updates on the progress of this, please watch SERVER-5030.

Thanks,
Mark

Generated at Thu Feb 08 04:23:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.