码迷,mamicode.com
首页 > 其他好文 > 详细

$and $not null 正则表达式

时间:2016-09-20 13:29:35      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

查询MasterID大于1且MasterType等于TestType的文档:

db.SysCore.find({$and:[{"MasterID":{$gt:1}},{"MasterType":"TestType"}]}).pretty()

结果如下:

技术分享

 

查询MasterID不等于2且MasterName以"测试"开头的文档:

db.SysCore.find({$and:[{"MasterID":{ $not:/2/}},{"MasterName":/测试+/}]})

 

Syntaxfield: $not: <operator-expression> }

db.inventory.find( { price: { $not: { $gt: 1.99 } } } )
db.inventory.find( { item: { $not: /^p.*/ } } )

结果如下:

技术分享

 

查询MasterSort为null的文档:

既要查询为null,同时也要保证存在。

db.SysCore.find({"MasterSort":{$in:[null],$exists:true}}).pretty()

结果如下:

技术分享

$and $not null 正则表达式

标签:

原文地址:http://www.cnblogs.com/Andy-Li/p/5888222.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!