文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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. 

相关阅读 更多 +
排行榜 更多 +
战舰猎手无限金币版

战舰猎手无限金币版

飞行射击 下载
火柴人空岛生存MOD菜单

火柴人空岛生存MOD菜单

休闲益智 下载
呕吐大战无限呕吐版

呕吐大战无限呕吐版

休闲益智 下载