I have following in my accounts collection:
{ "_id" : ObjectId("4fc55125476e0a27d9000003"),
"created_at" : ISODate("2012-05-29T22:43:49Z"),
"teachers" : [ {
"_id" : ObjectId("4fc55125476e0a27d9000004"),
"updated_at" : ISODate("2012-05-29T22:43:49Z"),
"created_at" : ISODate("2012-05-29T22:43:49Z")
} ],
"updated_at" : ISODate("2012-05-29T22:43:49Z")
}
I want to query for an account that has a teacher with _id 4fc55125476e0a27d9000003.
If I use the command
db.accounts.findOne({"teachers._id" : ObjectId("4fc55125476e0a27d9000004")})
it returns null.
Also, why does the mongo command line thing hang when I use find instead of findOne with the above command.