Diferencia entre revisiones de «Mongo DB»
De enunpimpam
Línea 49: | Línea 49: | ||
* timestamp | * timestamp | ||
* regex | * regex | ||
+ | https://docs.mongodb.com/manual/reference/operator/query/type/#document-type-available-types |
Revisión del 17:46 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/
http://mongodb.github.io/node-mongodb-native/3.5/api/
Ejecutar la conexión
node App.js
Mongoose
Scheme
https://docs.mongodb.com/realm/mongodb/document-schemas/ Type
- Arrays
- Objets
- Strings
- Numbers
- Booleans
bsonType
- objectId
- int
- long
- double
- decimal
- date
- timestamp
- regex
https://docs.mongodb.com/manual/reference/operator/query/type/#document-type-available-types