假设我有这样的记录
{ "name" : "Kobe Bryant",
"jersey_numbers" : [8,24]
}
{ "name" : "Michael Jordan",
"jersey_numbers" : [23]
}
如何找到字段“jersey_number”中不包含数字 23 的所有记录?
最佳答案
您可以使用 $nin 运算符 ( https://docs.mongodb.com/manual/reference/operator/query/nin/ )
players = db['players'].find({ 'jersey_numbers': { "$nin": [ 23 ] } })
关于python - 如何在 pymongo 中检查该项目不在列表字段中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59948501/