robb33
3/20/2017 - 11:40 PM

Difference between two

Difference between two

Mysql:

INSERT INTO users (user_id, age, status)
VALUES ('bcd001', 45, 'A')

Mongo DB:

db.users.insert({
  user_id: 'bcd001',
  age: 45,
  status: 'A'
})

Mysql:

SELECT * FROM users

Mongo DB:

db.users.find()

Mysql:

UPDATE users SET status = 'C'
WHERE age > 25

Mongo DB:

db.users.update(
  { age: { $gt: 25 } },
  { $set: { status: 'C' } },
  { multi: true }
)