How is their query different?

  • Selecting records from the users table:
    MySQL: SELECT * FROM users
    MongoDB: db.users.find ()
  • Inserting records into the users table:
    MySQL: INSERT INTO users (user_id, fname, lname, phone) VALUES (‘jane’, ‘deo’, ‘7858458891’)
    MongoDB: db.users.insert ({user_id :’1’, fname: ‘jane’, lname: ‘deo’, phone: ”7858458891′ })
  • Updating records in the users table:
    MySQL: UPDATE users SET fname = ‘Robert’ WHERE user_id = 2
    MongoDB: db.users.update( { user_id: { $eq: 2 } }, { $set: { fname: ‘Robert ‘ } }, { multi: true } )

When to use MySQL and MongoDB :

Pros and Cons of MongoDB and MySQL :



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chirag Dave

Chirag Dave

Dave Chirag represents Vibidsoft, a Web and Mobile Application development company providing enterprise IT solutions comprising the full range of services