// db.collection.find(query, projection)
db.Users.find(
{ status: "A" },
{ user_id: 1, status: 1, _id: 0 }
)
db.Users.find(
{ age: { $gt: 25 } }
)
db.Users.find( { status: /^bc/ } ).sort( { user_id: 1 } )
db.Users.find().limit(5).skip(10)
// db.collection.count(query)
db.Users.count( { user_id: { $exists: true } } )
db.Users.count( { age: { $gt: 30 } } )
// db.collection.distinct(field, query, options)
db.Users.distinct( "status" )
db.Article.distinct("Comment.Reply.ip", {"Comment.Reply.email" : /gmail/})
RDBMS | --- | MongoDB |
---|---|---|
Table | Collection | |
Row | Document | |
Column | Field |
MongoDB stores JSON documents in a binaryrepresentation called BSON (Binary JSON).
Object Relational Mappers