mongodb - 命令行增删改查
时间:2016-11-24 03:22 来源:linux.it.net.cn 作者:IT
# insert
db.person.insert({ "name": "kelvin", "age": 35 })
db.person.insert({ "name": "huahua", "age": 25 })
db.person.insert({ "name": "xiaomeng", "age": 24 })
db.person.insert({ "name": "laozhang", "age": 32 })
# select
db.person.find()
db.person.count()
db.person.find({ "name": "kelvin" })
# update
db.person.update({ "name": "laozhang" }, { "name": "oldzhang", "age": 33 })
# delete
db.person.remove({ "name": "oldzhang" })
(责任编辑:IT)
# insert db.person.insert({ "name": "kelvin", "age": 35 }) db.person.insert({ "name": "huahua", "age": 25 }) db.person.insert({ "name": "xiaomeng", "age": 24 }) db.person.insert({ "name": "laozhang", "age": 32 }) # select db.person.find() db.person.count() db.person.find({ "name": "kelvin" }) # update db.person.update({ "name": "laozhang" }, { "name": "oldzhang", "age": 33 }) # delete db.person.remove({ "name": "oldzhang" }) (责任编辑:IT) |