首页 > 其他 > 详细

$or操作符

时间:2015-10-22 17:14:19      阅读:246      评论:0      收藏:0      [点我收藏+]

$or操作符

  The $or operator performs a logical OR operation on an array of two or more <expressions> and selects the documents that satisfy at least one of the <expressions>. The $or has the following syntax:

{ $or: [ { <expression1> }, { <expression2> }, ... , { <expressionN> } ] }

  Consider the following example:

db.inventory.find( { $or: [ { quantity: { $lt: 20 } }, { price: 10 } ] } )

  This query will select all documents in the inventory collection where either the quantity field value is less than 20 or the price field value equals 10.

  

$or操作符

原文:http://www.cnblogs.com/tekkaman/p/4901222.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!