1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| mongo > show dbs admin 0.000GB config 0.000GB ecommerce 0.000GB local 0.000GB > use ecommerce switched to db ecommerce > show collections cartitems categories orders products users > db.users.find().pretty(); { "_id" : ObjectId("61b9fb27ab69c8a07dd86b2d"), "name" : "key1", "email" : "key1@gmail.com", "hashed_password" : "da975a7c93e9abf2a4d24729372865afbc6bc3a3", "salt" : "094ec890-5db3-11ec-920a-cf7ca48b09d9", "role" : 0, "history" : [ ], "createdAt" : ISODate("2021-12-15T14:26:47.837Z"), "updatedAt" : ISODate("2021-12-15T14:26:47.837Z"), "__v" : 0 } > db.users.update({_id: ObjectId("61b9fb27ab69c8a07dd86b2d")} , {$set: {role:1}}); WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) > db.users.find().pretty(); { "_id" : ObjectId("61b9fb27ab69c8a07dd86b2d"), "name" : "key1", "email" : "key1@gmail.com", "hashed_password" : "da975a7c93e9abf2a4d24729372865afbc6bc3a3", "salt" : "094ec890-5db3-11ec-920a-cf7ca48b09d9", "role" : 1, "history" : [ ], "createdAt" : ISODate("2021-12-15T14:26:47.837Z"), "updatedAt" : ISODate("2021-12-15T14:26:47.837Z"), "__v" : 0 } > exit bye
|