wickywills
10/2/2019 - 9:33 AM

Mongo DB - useful stuff

Differences between MySQL and MongoDB

Selecting records from the customer table:

MySQL: SELECT * FROM customer

MongoDB: db.customer.find()

Inserting records into the customer table:

MySQL: INSERT INTO customer (cust_id, branch, status) VALUES ('appl01', 'main', 'A')

MongoDB: db.customer.insert({ cust_id: 'appl01', branch: 'main', status: 'A' })

Updating records in the customer table:

MySQL:  UPDATE customer SET branch = 'main' WHERE custage > 2

MongoDB:  db.customer.update( { custage: { $gt: 2 } }, { $set: { branch: 'main' } }, { multi: true } )