首页 > 解决方案 > 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”,这一项也将被忽略。如果两个字段都匹配,是否有忽略文档的解决方案

标签: mongodbasp.net-coremongodb-query

解决方案


推荐阅读