0
benim toplama şu şekildedir:sorgu Mongo db
{
"_id" : ObjectId("56b888ae31c1d1d3bf79f8c6"),
"_class" : "fore.server.domain.post.UserPost",
"image" : { "_id" : null, "statusText" : "This food i cooked" },
"healthRates" : [
{
"_id" : null,
"rateValue" : "VerryPoor",
"uid" : { "_id" : "HS-56541" }
}
]
}
ve ben şöyle bir kullanıcı kimliğine sahip tüm koleksiyonu için sorgulamak istiyorum:
{"uid" : { "_id" : "HS-56541" }}
ama benim sorgum hiçbir şey almaz! Aşağıdakileri denedim!
db.userPost.find({healthRates:{$elemMatch: "uid" : { "_id" : "HS-56541" } })
ve ben bir sonucu olmadan
db.userPost.find({"healthRates.uid.id" : "HS-56541" })
çalıştı! herhangi bir öneri lütfen?
Thx :) ben sadece ur talimat çift tırnak eklemek zorunda ve bu db.userPost.find ({healthRates gibi çalışır: {$ elemMatch: {uid._id: "HS-56.541"}}}) –