#19 MongoDB
#19.0 Introduction
#19.1 Installation
#19.2 Creating Documents
#19.3 Reading Documents
db.movies.find({director:"Christopher Nolan"})
db.movies.find({rating: { $gte: 8 }})
// $gte ๊ฐ๊ฑฐ๋ ํฐ
db.movies.find({ year: { $gt: 2000, $lt: 2010}})
// and
db.movies.find({ $or: [{ rating: {$gt:9}}, {year: {$gte: 2020}})
// or
db.movies.find({ genres: { $in: ["Drama", "Crime"]}})
// ๋ฐฐ์ด ์์
db.movies.find({ genres: { $all: ["Drama", "Crime"]}})
// ๋ฐฐ์ด
db.movies.find({ title: { $regex: /the/i }})
// ์ ๊ทํํ์
db.movies.find({ genres: { $size: 3}})
// ํฌ๊ธฐ
db.movies.find({ director: { $exists: false }})
// ํน์ key ๊ฐ ์กด์ฌ
db.movies.find({ "cast.0": "Keanu Reeves"})
// ๋ฐฐ์ด ๋ด ์์ ๊ฐ
db.movies.find({ "director.alive": true })
// ์ค์ฒฉ๋ ๋ฌธ์ ๋ด๋ถ ๊ฒ์
db.movies.find().skip(10)
// skip
db.movies.find().limit(10).skip(10)
// limit
db.movies.find().sort({rating: 1}).limit(10).skip(10)
db.movies.find().sort({rating: -1}).limit(10).skip(10)
db.movies.find().sort({rating: -1, title: 1}).limit(10).skip(10)
// sort#19.4 Updating Documents
#19.5 Aggregating Documents
Last updated