博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c# Mongodb两个字段不相等 MongoDB原生查询
阅读量:4500 次
发布时间:2019-06-08

本文共 687 字,大约阅读时间需要 2 分钟。

var document = new BsonDocument{{ "$where","this.StarTime!=this.EndTime"},{ "Closed",1},{ "StarTime",new BsonDocument("$gte",request.Stime)},{ "EndTime",new BsonDocument("$lte",request.Etime)},{ "TotalSecond",new BsonDocument(para,request.TotalMin * 60)}};var list= collection.Find(document);

其中this不能省略,写法同mongodb命令,使用此写法可以自由拼接参数

 

//判断时间范围,单位:秒

var document = new BsonDocument{{ "$where","this.StarTime-this.EndTime>10"},{ "Closed",1},{ "StarTime",new BsonDocument("$gte",request.Stime)},{ "EndTime",new BsonDocument("$lte",request.Etime)},{ "TotalSecond",new BsonDocument(para,request.TotalMin * 60)}};var list= collection.Find(document);

 

转载于:https://www.cnblogs.com/ives/p/9580632.html

你可能感兴趣的文章
java开发知识IO知识之输入输出流以及文件
查看>>
SurfaceViewVideoList网络获取视频播放
查看>>
Oracle 笔记(二)
查看>>
微信公众号开发--访问网络用到的工具类
查看>>
wpf中利用多重绑定实现表中数据越界自动报警
查看>>
为Linux配置常用源:epel和IUS
查看>>
天府地
查看>>
C#高级编程
查看>>
JS实现从照片中裁切自已的肖像
查看>>
使用 https://git.io 缩短 a GitHub.com URL.
查看>>
拷贝、浅拷贝、深拷贝解答
查看>>
NS3 实验脚本的编写步骤
查看>>
四元数
查看>>
【Linux】Linux查看程序端口占用情况
查看>>
微软职位内部推荐-Software Development Engineer
查看>>
Git常用命令
查看>>
Windows 2003+IIS6+PHP5.4.10配置PHP支持空间的方法(转)
查看>>
去除express.js 3.5中报connect.multipart() will be removed in connect 3.0的警告(转)
查看>>
Android WIFI 无缝切换 小结(1)
查看>>
BZOJ 5194--[Usaco2018 Feb]Snow Boots(STL)
查看>>