> 数据库 > MongoDB >

mongodb - 命令行增删改查

# 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)