rs.add("<hostname>")
replicaSetAdd("<hostname>")
rs.insert("<hostname>")
replica.add("<hostname>")
restore
backup
mongobackup
mongodump
db.citizens.select('WHERE age >= 21')
db.citizens.where('age >= 21')
db.citizens.find('WHERE age >= 21')
db.citizens.find({age: {$gte: 21}})
_id
中的 ObjectId,如何获取其创建时间?getDateTime(_id)
_id.createDate()
_id.getTimestamp()
_id.getDateTime()
myCursor.hasNext()
myCursor.sort()
myCursor.next()
myCursor.find()
db.users.find({_id: 1})
db.users.seek({_id: 1})
db.users.query({_id: 1})
db.query.users({_id: 1})
--type jsonArray
--json
--type json
--jsonArray
mongo
mongod
mongoconnect
dbconnect
db.customers.find({lastName: 'smith'}).explain()
db.customers.find({lastName: 'smith'}).perf()
db.customers.find({lastName: 'smith'}).plan()
db.customers.find({lastName: 'smith'}).usedIndex()
db.deleteUser("user")
db.removeUser("user") DEPRECATED
db.remove("user")
db.dropUser("user")
--setParameter authenticationMechanisms=GSSAPI
--setAuthentication=GSSAPI
--setParam auth=K
--setAuth method=Kerberos
db.product.group({_id: "$category", count: {$sum:1}})
db.product.aggregate($sum: {_id: "$category", count: {$group:1}})
db.product.aggregate($group: {_id: "$category", count: {$sum:1}})
db.product.aggregate($count: {_id: "$category", count: {$group:1}})
db.restaurants.createIndex({location: "2dsphere"})
db.restaurants.geospatial({location: "2dsphere"})
db.restaurants.createIndex("2dsphere":"location")
db.restaurants.createIndex({geospatial: "location"})
db.customers.findmatch ({"jobs":"secretary"})
db.customers.find ({"jobs:secretary"})
db.customers.find ({"jobs":["secretary"]})
db.customers.find ({"jobs":"secretary"})
db.customers.find({}, {skip: 5, limit: 10})
db.customers.find({}.page(5).take(10))
.customers.find({}).skip(5).take(10)`
db.customers.find({}).skip(5).limit(10)