mongodb - FilterDefinitionBuidler 忽略与字段的给定值匹配的文档
问题描述
我需要创建一个 filterDefinitioBuilder 来忽略具有以下匹配值的对象。BookingType =“应用”状态 =“待定”。如果特定文档(Mongo Document)字段值具有这两个值,那么我应该忽略它
//Ignore the hire which which fields and value as follows (BookingType = App and status is pending)
combinedFilter = combinedFilter & !(builder.Eq("BookingType", "APP") & builder.Eq("Status", "Pending"));
这样,它会忽略所有值为 BookingType = "App", Status = "Pending" 的文档。例如,如果 BookingType 为“APP”,Status 为“ONHIRE”,这一项也将被忽略。如果两个字段都匹配,是否有忽略文档的解决方案
解决方案
推荐阅读
- azure - Azure AD B2C:从 Json 数组中提取单个项目
- postgresql - postgresql 8.0中的汇总数据层次结构?
- amazon-ecs - 从 CloudWatch 规则向 ECS 任务传递输入
- python - 如何修复kivy不是命令行中的包错误?
- google-sheets - 我想在 Google 表格中填充或更改相邻单元格时使用日期自动填充单元格
- transactions - 使用 Galleon 安装 Wildfly
- python-3.6 - 如何错误检查包含带有占位符 %s 的 SQL 查询的函数
- laravel - 如何将数据提取给特定类型的用户
- python-3.7 - 程序未运行,错误为 + 不支持的操作数类型:'function' 和 'int'
- c# - 如何使变量在脚本中的任何位置可见?