[DOCS-1823] Issues about mongodb array and subdocument Created: 19/Aug/13  Updated: 03/Nov/17  Resolved: 19/Aug/13

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

Type: Improvement Priority: Major - P3
Reporter: auto Assignee: Barrie Segal
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

windows server 2008 r2 + mongodb-win32-x86_64-2.4.5

Location: http://docs.mongodb.org/manual/
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET4.0C; .NET4.0E)
Referrer: http://www.mongodb.org/user-groups
Screen Resolution: 1600 x 900
repo: docs
source: index


Participants:
Days since reply: 10 years, 26 weeks, 3 days ago

 Description   

First, I have test this on db "test" with auth login, I have create a collection "entities" and then insert a record like this "var single = { "id" : 123, "person" : [

{ "birthday" : "12/3/2013" }

] };".
And then I can't use below command to find this record: "var record = db.entities.findOne(

{"person[0].birthday": "12/3/2013"}

);", why? Instead, I can use another command to show record: "var record = db.entities.findOne(

{"person.birthday": "12/3/2013"}

);". I think the value of person should be an array, so I can use person[0], but it seems like does not work.
Interestingly,I can use "record.person[0].birthday" to get value of birthday, but command "record.person.birthday" get nothing.
Please give me some reply ASAP. Thanks in advance!!!

Reporter: Kevin Zhang
E-mail: zxz414644665@163.com


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