Why when I do a findOne (same with find), does it only show me the last item in my "acts" array. My collection only contains one document for test purposes.
I'm doing this in the mongo cli: db.mycollection.findOne();
My result of findOne():
{
"_id" : ObjectId("4f0db64659d044892271018f"),
"title" : "Awards Show 2012",
"description" : "An amazing awards show",
"acts" : [
{
"name" : "Act 3",
"description" : "My act description"
}
]
}
Here is my document:
{
"_id": { "$oid" : "4F0DB64659D044892271018F" },
"title": "Awards Show 2012",
"description": "An amazing awards show",
"acts": [
{
"name": "Act 1",
"description": "My act description"
},
{
"name": "Act 2",
"description": "My act description"
},
{
"name": "Act 3",
"description": "My act description"
}
]
}
EDIT: Fixed the document - had a typo
findOnereturns a document with only one item, andfinddoes the same, how do you know 'your document' is in the database at all?