0
我在我的文檔中有一個名爲「tag」的密鑰。現在這樣的結構如下:如何在密鑰有多個值時在mongokit中使用AND condtion
"tag": [
{
"schemeName": "http:\/\/somesite.com\/categoryscheme2",
"name": "Test Tag2",
"value": 1,
"slug": "test_tag2"
},
{
"schemaName": "http:\/\/somesite.com\/categoryscheme3",
"name": "Test Tag3",
"value": 1,
"slug": "test_tag3"
}
],
標記的值可以通過','分隔。 如何使用這些值在A和條件話說返回其標籤= test_tag3 & test_tag2
的enrty Itried這樣的:conditions['tag.slug'] = { '$and': tags }
其中tags
是標籤陣列,但我得到:
pymongo.errors.OperationFailure
OperationFailure: database error: invalid operator: $and