SQL 更新语句 | MongoDB update() 语句 |
UPDATE usersSET status = “C”WHERE age > 25 | db.users.update( { age: { $gt: 25 } }, { $set: { status: “C” } }, { multi: true }) |
UPDATE usersSET age = age + 3WHERE status = “A” | db.users.update( { status: “A” } , { $inc: { age: 3 } }, { multi: true }) |
SQL 删除语句 | MongoDB remove() 语句 |
DELETE FROM usersWHERE status = “D” | db.users.remove( { status: “D” } ) |
DELETE FROM users | db.users.remove({}) |