当我尝试运行以下形式的LINQ查询时:
MongoCollection<MyEntity> collection;
collection.AsQueryable().Where(entity =>
(entity.Flags & MyFlags.AFlag) != MyFlags.None);
Run Code Online (Sandbox Code Playgroud)
我收到一条ArgumentException消息Unsupported where clause: ((Int32)((Int32)entity.Flags & 4) != 0).
这是已知的错误/功能吗?
有什么解决方法吗?
从文档看来,MongoDB似乎有按位更新,但没有按位查询。
为了进行比较,使用ServiceStack作为客户端,同一查询在Redis上运行平稳。
我确实找到了这两个建议使用JavaScript的链接(link1,link2),但这将使服务层的实现非常依赖于DB技术。