文档数据库是否支持“不在”

问题描述

文档数据库是否支持 NOT IN 运算符。我可以在本文档中看到 https://docs.aws.amazon.com/documentdb/latest/developerguide/querying.html 其他示例,但不是针对此示例。需要语法方面的帮助才能获得类似

db.example.find( NOT IN { "Item": ["item1","item2"]} AND {"Code":"code1"} ).pretty()

解决方法

DocumentDB 支持 $nin 运算符,您可以使用此运算符选择字段不在指定数组中的文档。请在下面找到更新的查询。

db.example.find({ $and: [{Item: {$nin:["item1","item2"]}},{Code:"code1"}] })