My mongoDB commands

Lists all mongo databases

show dbs

Switches to a database

use <database_name>

Lists all database collections

show collections

Deletes all collection content


Selects documents having offers with sub-type SingleOffer


Displays all collection content


Select with AND

db.user.find({"offers.offers.offerID":"1", "productID":"1"})

Single field update 

The follwing command updates the type of the nested under offer
"_id" : "1",
   "offer" : {
      "@type" : "foo",
db.user.update({"_id":"1"}, {$set:{"foo.@type":"bar"}})


Popular posts from this blog

Oracle - duplicate fields in RECORD,TABLE or argument list are not permitted

Oracle - ORA-29282: invalid file ID, ORA-06512: at "SYS.UTL_FILE"