[DOCS-8334] Comment on: "manual/core/index-single.txt" Created: 13/Jul/16  Updated: 03/Nov/17  Resolved: 14/Jul/16

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

3.2.7-windows

Location: https://docs.mongodb.com/manual/core/index-single/
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
Referrer: https://docs.mongodb.com/manual/
Screen Resolution: 1920 x 1080


Participants:
Days since reply: 7 years, 30 weeks, 6 days ago

 Description   

If I do this:
db.records.insert({
"_id": ObjectId("570c04a4ad233577f97dc459"),
"score": 1034,
"location":

{ state: "NY", city: "New York" }

})
after this step is done, I do this to create an index:
db.records.createIndex(

{ "location.state": 1 }

)

now when I query this collection, I find this command cannot find any document:
db.records.find( { location:

{ city: "New York", state: "NY" }

} )
but, this command can do it:
db.records.find( { location:

{ state: "NY", city: "New York" }

} )



 Comments   
Comment by Kay Kim (Inactive) [ 14/Jul/16 ]

Emailed user about querying for exact match on embedded documents, which requires field order to match as well:

https://docs.mongodb.com/manual/tutorial/query-documents/#query-on-embedded-documents

Generated at Thu Feb 08 07:56:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.