我想在mongodb中找到所有在“emotations”键中有“emotion1”键的文档。 我的数据库结构是这样的
{
"word" : "word1",
"emotions" :
{
"emotion1" : "0.25",
"emotion2" : "0.25",
"emotion3" : "0.35"
}
}
我试过了
db.collection.find({"emotions":{"emotion1":{"$exists":True}}})
db.collection.find({"emotions":{"emotion1":{"$exists":True}}})
但这对“情绪”有效,关键是
db.collection.find({"emotions": {"$exists": True}})
您需要使用dot notation
相关问题 更多 >
编程相关推荐