Diferencia entre revisiones de «Mongo DB»
De enunpimpam
Línea 22: | Línea 22: | ||
Modificar un objeto | Modificar un objeto | ||
db.products.updateOne({_id: 1}, {$set: {stock: 32}}) | db.products.updateOne({_id: 1}, {$set: {stock: 32}}) | ||
+ | |||
====8. Working with The Native MongoDB Driver==== | ====8. Working with The Native MongoDB Driver==== | ||
+ | |||
http://mongodb.github.io/node-mongodb-native/3.5/quick-start/quick-start/ | http://mongodb.github.io/node-mongodb-native/3.5/quick-start/quick-start/ | ||
+ | |||
http://mongodb.github.io/node-mongodb-native/3.5/api/ | http://mongodb.github.io/node-mongodb-native/3.5/api/ |
Revisión del 13:07 9 sep 2020
https://docs.mongodb.com/manual/crud/
show collections
db.products.find()
db.inventory.insertOne(
{ "item" : "canvas", "qty" : 100, "tags" : ["cotton"], "size" : { "h" : 28, "w" : 35.5, "uom" : "cm" } }
)
db.collection.find() https://docs.mongodb.com/manual/reference/method/db.collection.find/#db.collection.find
https://docs.mongodb.com/manual/reference/operator/query/
busca los que tienen mas de 5 en stock
db.products.find({stock: {$gt: 5}})
Modificar un objeto
db.products.updateOne({_id: 1}, {$set: {stock: 32}})
8. Working with The Native MongoDB Driver
http://mongodb.github.io/node-mongodb-native/3.5/quick-start/quick-start/