Reputation: 375
Could someone explain me why do I have the following result with the following data in my db :
Data in the DB :
{
"_id": { "$oid" : "4E4BDA5A068E2C5B0E450100" },
"name" : "john",
"object" : {
"A":"1",
"B":"2"
},
"array" : [
{"A":"1"},
{"B":"2"}
]
}
Query :
db.collection.find( { name : "john" } );
Result :
{ "_id" : ObjectId("4e4bda5a068e2c5b0e450100"), "name" : "john", "object" : { "A" : "1", "B" : "2" }, "array" : [ { "B" : "2" } ] }
Where is my array A:1 ??? Thx for your help.
Mongo 2.0.1
Upvotes: 1
Views: 59
Reputation: 30136
Something in your syntax must be wrong.
Inserting your doc:
db.free4297.insert({
"_id": { _id: ObjectId("4E4BDA5A068E2C5B0E450100") },
"name" : "john",
"object" : {
"A":"1",
"B":"2"
},
"array" : [
{"A":"1"},
{"B":"2"}
]
})
Then:
db.free4297.findOne( { name: "john" } )
{
"_id" : {
"_id" : ObjectId("4e4bda5a068e2c5b0e450100")
},
"name" : "john",
"object" : {
"A" : "1",
"B" : "2"
},
"array" : [
{
"A" : "1"
},
{
"B" : "2"
}
]
}
Upvotes: 2