MongoDb Concepts
Carlos Rodrigues
carlos.rodrigues@duratex.com.br
O que significa NoSql ?
Not Only Sql.
CREATE TABLE people (
id MEDIUMINT NOT NULL
AUTO_INCREMENT,
user_id Varchar(30),
age Number,
status char(1),
PRIMARY KEY (id)
);
GO
INSERT INTO people(user_id,
age,
status)
VALUES ("bcd001",
45,
"A");
db.people.insertOne( {
user_id: "abc123",
age: 55,
status: "A"
} )SQL
MongoDB
Insert
ALTER TABLE people
ADD join_date DATETIME
GO
UPDATE people
SET join_date = "23/11/2018"
WHERE id = 25
db.people.updateMany(
{ },
{ $set: {
join_date: new Date()
}
}
)SQL
MongoDB
Update
Blog - Relacional
Blog - MongoDB Way
db.restaurants.find({ location:
{ $geoWithin:
{ $centerSphere: [
[ -73.93414657, 40.82302903 ],
5 / 3963.2
]
}
}
})https://info-
https://docs.mongodb.com/manual/
https://cloud.mongodb.com
Carlos Rodrigues
carlos.rodrigues@duratex.com.br