Aprenda MongoDB em 15 minutos, sem enrolação.
Comandos utilizados no vídeo
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 |
show dbs; use canalti; show collections; db.createCollection("item"); db.item.insert({ "name": "Item 1", "price": 10.0 }); db.item.find(); db.item.insertMany([ { "name": "Item 2", "price": 20.0 }, { "name": "Item 3", "price": 30.0 }]); db.item.find().limit(1); db.item.find({_id: ObjectId("5ff5f14c92040feeff5e12d7")}); db.item.find({name: "Item 2"}); db.item.find({name: "Item 2"}, {name: 1}); db.item.find({name: "Item 2"}, {_id: 0, name: 1}); db.item.find().count(); db.item.find({name: "Item 2"}).count(); db.item.remove({_id: ObjectId("5ff5f14c92040feeff5e12d8")}); db.item.update({_id: ObjectId("5ff5f0f092040feeff5e12d6")}, {$set: {price: 30.00}}); db.item.update({_id: ObjectId("5ff5f0f092040feeff5e12d6")}, {$set: {name: "Item 11", price: 30.00}}); db.item.find({price: { $gt: 25 }}); db.item.find({price: { $eq: 25 }}); db.item.find({price: { $gt: 25 }}); db.item.find({price: { $lt: 25 }}); db.item.find({price: { $in: [20.0, 30.0] }}); db.item.find({price: { $lt: 20.0 }}); db.item.find({price: { $lte: 20.0 }}); db.item.find({price: { $gt: 30 }}); db.item.find({price: { $gte: 30 }}); db.item.find({price: { $ne: 30 }}); db.item.find({price: { $nin: [20.0, 30.0] }}); db.item.find({$and: [{name: "Item 11"}, {price: 30.0}]}); db.item.find({$or: [{name: "Item 12"}, {price: 30.0}]}); |
Links úteis
Documentação do MongoDB ► https://docs.mongodb.com/manual/introduction/
Site do MongoDB ► https://www.mongodb.com
Site do Robo3T ► https://robomongo.org