文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Querying(Chapter 4 of MongoDB The Definitive Guild)

Querying(Chapter 4 of MongoDB The Definitive Guild)

时间:2010-10-01  来源:Ray Z

  Sometimes, you do not need all of the key/value pairs in a document returned. If this is the case, you can pass a second argument to find (or findOne) specifying the keys you want. This reduces both the amount of data sent over the wire and the time and memory used to decode documents on the client side. > db.users.find({}, {"username" : 1, "email" : 1})
{
"_id" : ObjectId("4ba0f0dfd22aa494fd523620"),
"username" : "joe",
"email" : "[email protected]"
}

 

  "$lt", "$lte", "$gt", and "$gte" are all comparison operators, corresponding to <, <=, >, and >=, respectively. 

  There are two ways to do an OR query in MongoDB. "$in" can be used to query for a variety of values for a single key. "$or" is more general; it can be used to query for any of the given values across multiple keys. 

相关阅读 更多 +
排行榜 更多 +
XLM币最具爆发力的安全交易所欧易okex下载

XLM币最具爆发力的安全交易所欧易okex下载

金融理财 下载
XEM币最安全隐私链的全球交易所欧易okex下载

XEM币最安全隐私链的全球交易所欧易okex下载

金融理财 下载
WAVES币最新上线的优质交易所欧易okex下载

WAVES币最新上线的优质交易所欧易okex下载

金融理财 下载