Table in mongo is collection.
Row = document
Column = value (attribute)
cardinal (n, n) generates additional table.
Foreign Key (FK) Primary Key (PK)




https://josejuansanchez.org/bd/unidad-03-teoria/index.html#relaciones-con-cardinalidad-11
https://openwebinars.net/blog/como-realizar-la-normalizacion-de-bases-de-datos-y-por-que/
Normalization
Todos atributos tiene que ser indivisibles. street, nr, zip
Todo los atributos tiene que ser del mismo tipo en la misma columna.
no deben existir grupos de valores repetidos.
T3
db = db.getSiblingDB(“vet”);
db.getCollection(“animals”).find({},{name:true, _id:false});
animals = db.getCollection(“animals”).find({}).toArray()
clients = db.getCollection(“clients”).find({_id: animals[0].clientId})
newClients = db.getCollection(“clients”).find({}).toArray()
newClients[0]._id
newAnimals = db.getCollection(“animals”).find({clientId: newClients[0]._id})
newerClients = db.getCollection(“clients”).find({fName: “Janis”}).toArray()
newerAnimals = db.getCollection(“animals”).find({clientId: newerClients[0]._id})
newerClients = db.getCollection(“clients”).find({“document.number”:“555654LV”}).toArray() //
newerAnimals = db.getCollection(“animals”).find({“clientId”: newerClients[0]._id})
newerClients = db.getCollection(“clients”).find({“document.number”:/555/}).toArray() // parcial text search
newerAnimals = db.getCollection(“animals”).find({“clientId”: newerClients[0]._id})
Leave a Reply