How To Update Values In MongoDB (NoSQL Database)

Praveen Singh         No comments

Let's first look at the SQL's way...

I have created  Info table here and inserted some values into it...


We all know how to UPDATE table values in sql...


So now, MongoDB's way....

I have already covered how to insert and select values in MongoDB in my previous posts...


db.info.update () :

We can pass 4 parameters here....

Criteria : It lets you specify the query that selects the record you want to update.
             { Name : " Praveen " } in our case.
Objnew: It lets you to specify the updated information.
             { Name : " Praveen ", City : " Pune" } in our case.
Upsert: This argument tells MongoDB to update the record if it exists, and create it if it doesn’t.
Multi: This lets you specify whether all matching documents should be updated or just the first one.

Published by Praveen Singh

A blogger by passion.You can find me tucked in my bed and blogging on weekends when not roaming around. Besides blogging, I love music and you can find my songs on my fb page:PraveenUnplugged
.
Follow on Youtube : Videos On Latest Happenings |ThingsToKnow
.
Follow us Talend In Action

0 responses:

© 2015 Techie's House. Designed by Bloggertheme9