MONGODB

Edwar Diaz Ruiz

Estudiante de ultimos semestres de ingenieria de sistemas

Desarrolador WEB full stack

BOTOOM
SrBotom
@sr.botom
SR.BOTOM
eddiazr@correo.udistrital.edu.co

Que Es??? ...

Tipos de datos

datos en mongo

Relaciones

1 a 1


            {
              "_id":ObjectId("514ed98d44aee1b035ee756f"),
              "nombre":"Adrian",
              "apellido":"Alonso",
              "numerodecontacto":"412312",
              "direccion": {
                "tipo":"Calle",
                "nombre":"Buenavista",
                "numero":2,
                "piso": Noveno B,
                "codigopostal":28823
              },
              "email":"prueba@email.com",
              "password":"example",
              "privilegios":0
              }
                        

1 a muchos

Embeber documentos


          {
            "_id":ObjectId("52ffc33cd85242f436000001"),
            "contact": "987654321",
            "dob": "01-01-1991",
            "name": "Tom Benzamin",
            "address": [
               {
                  "building": "22 A, Indiana Apt",
                  "pincode": 123456,
                  "city": "Los Angeles",
                  "state": "California"
               },
               {
                  "building": "170 A, Acropolis Apt",
                  "pincode": 456789,
                  "city": "Chicago",
                  "state": "Illinois"
               }]
         } 
                        

Referencia a documentos


            {
              "_id":ObjectId("52ffc33cd85242f436000001"),
              "contact": "987654321",
              "dob": "01-01-1991",
              "name": "Tom Benzamin",
              "address_ids": [
                 ObjectId("52ffc4a5d85242602e000000"),
                 ObjectId("52ffc4a5d85242602e000001")
              ]
           } 
                        

Muchos a muchos

Referencia a documentos


            // publicacion
            {
              "_id": ObjectId("514d920b44ae16d201a3ff51"),
              "nombre":"Capucchino",
              "precio":20,
              "marca":"Nescafé",
              "comentarios": [
                DBRef("Comentario",
                ObjectId("514d91a644ae16d201a3ff50"))
              ]
              }


            {
              "_id" : ObjectId("514d91a644ae16d201a3ff50"),
              "usuario" : DBRef("Usuario", ObjectId("514ed98d44aee1b035ee756f")),
              "texto" : "Me gusta"
            }