You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
191 lines
4.3 KiB
191 lines
4.3 KiB
db.mydb.find()
|
|
|
|
db.films.insertMany([
|
|
{
|
|
"titre" : "Le parrain",
|
|
"titre_original" : "The Godfather", "annee" : 1972,
|
|
"realisation" : {"nom" : "Copolla", "prenom" : "Fracis Ford"}
|
|
},
|
|
{
|
|
"titre" : "Le silence des agneaux",
|
|
"titre_original" : "The Silence of the Lambs", "annee" : 1992,
|
|
"realisation" : {"nom" : "Demme", "prenom" : "Jonathan"}
|
|
},
|
|
{
|
|
"titre" : "Forrest Gump",
|
|
"annee" : 1994,
|
|
"realisation" : {"nom" : "Zemeckis", "prenom" : "Robert"}
|
|
},
|
|
])
|
|
|
|
db.films.find()
|
|
|
|
db.films.find().sort({"titre" : 1})
|
|
|
|
db.films.find().sort({"annee" : -1})
|
|
|
|
db.films.find({},["titre"])
|
|
|
|
db.films.find({},["titre", "annee"])
|
|
|
|
db.films.find({"annee" : 1972})
|
|
|
|
db.films.updateOne(
|
|
{"titre" : "Le silence des agneaux"},
|
|
{
|
|
$set : {"annee" : 1991}
|
|
}
|
|
)
|
|
|
|
db.films.find({"titre" : "Le silence des agneaux"})
|
|
|
|
db.films.find({"realisation" : {"nom" : "Darabont ", "prenom" : "Franck"}})
|
|
db.films.find({"realisation.nom" : "Darabont "})
|
|
|
|
db.films.insertOne(
|
|
{
|
|
"titre" : "La marraine",
|
|
"annee" : 2024,
|
|
"realisation" : {"nom" : "Nope", "prenom" : "Epon"}
|
|
})
|
|
|
|
db.films.aggregate({
|
|
$set : {
|
|
"casting" : [{
|
|
"nom" : "", "prenom" : ""
|
|
},
|
|
{
|
|
"nom" : "", "prenom" : ""
|
|
}
|
|
]
|
|
}
|
|
})
|
|
db.films.aggregate({
|
|
$addFields : {
|
|
"casting" : [{
|
|
"nom" : "", "prenom" : ""
|
|
},
|
|
{
|
|
"nom" : "", "prenom" : ""
|
|
}
|
|
]
|
|
}
|
|
})
|
|
|
|
db.films.updateOne(
|
|
{
|
|
"titre" : "La ligne verte"
|
|
},
|
|
{
|
|
$set : {"casting" : [
|
|
{
|
|
"nom" : "Hanks", "prenom" : "Tom"
|
|
},
|
|
{
|
|
"nom" : "Duncan", "prenom" : "Michael Clarke"
|
|
},
|
|
{
|
|
"nom" : "Hanks", "prenom" : "Tom"
|
|
}
|
|
]}
|
|
}
|
|
)
|
|
|
|
db.films.updateOne(
|
|
{
|
|
"titre" : "Le parrain"
|
|
},
|
|
{
|
|
$set : {"casting" : [
|
|
{
|
|
"nom" : "Brando", "prenom" : "Marlon"
|
|
},
|
|
{
|
|
"nom" : "Pacino", "prenom" : "Al"
|
|
},
|
|
{
|
|
"nom" : "Caan", "prenom" : "James"
|
|
}
|
|
]}
|
|
}
|
|
)
|
|
|
|
db.films.updateOne(
|
|
{
|
|
"titre" : "Le silence des agneaux"
|
|
},
|
|
{
|
|
$set : {"casting" : [
|
|
{
|
|
"nom" : "Foster", "prenom" : "Jodie"
|
|
},
|
|
{
|
|
"nom" : "Hopkins", "prenom" : "Anthony"
|
|
}
|
|
]}
|
|
}
|
|
)
|
|
db.films.updateOne(
|
|
{
|
|
"titre" : "Forrest Gump"
|
|
},
|
|
{
|
|
$set : {"casting" : [
|
|
{
|
|
"nom" : "Hanks", "prenom" : "Tom"
|
|
},
|
|
{
|
|
"nom" : "Wright", "prenom" : "Robin"
|
|
},
|
|
{
|
|
"nom" : "Sinise", "prenom" : "Gary"
|
|
}
|
|
]}
|
|
}
|
|
)
|
|
|
|
db.films.find({"casting" : {"nom" : "Hanks", "prenom" : "Tom"}})
|
|
|
|
db.films.insertMany([
|
|
{
|
|
"titre" : "La filmade",
|
|
"annee" : 2025,
|
|
"realisation" : {"nom" : "Nddope", "prenom" : "sEpon"},
|
|
"casting" : {"nom" : "Elodie", "prenom" : "sdq"}
|
|
},
|
|
{
|
|
"titre" : "Dune",
|
|
"annee" : 2024,
|
|
"realisation" : {"nom" : "Duné", "prenom" : "Dunard"},
|
|
"casting" : {"nom" : "ds", "prenom" : "sqdfdq"}
|
|
},
|
|
{
|
|
"titre" : "Il était une fois la vie",
|
|
"annee" : 1995,
|
|
"realisation" : {"nom" : "jsp", "prenom" : "toujourspas"},
|
|
"casting" : {"nom" : "Le grand", "prenom" : "barbue"}
|
|
},
|
|
{
|
|
"titre" : "La monique",
|
|
"annee" : 1995,
|
|
"realisation" : {"nom" : "Monique", "prenom" : "Monique"},
|
|
"casting" : {"nom" : "Michelle", "prenom" : "Jean"}
|
|
},
|
|
{
|
|
"titre" : "La liaison",
|
|
"annee" : 2000,
|
|
"realisation" : {"nom" : "Henri", "prenom" : "Assi"},
|
|
"casting" : {"nom" : "Henri", "prenom" : "Debout"}
|
|
}
|
|
])
|
|
|
|
db.films.find({}, ["titre"]).limit(6)
|
|
|
|
db.films.deleteMany({"annee" : {$lte : 1995}})
|
|
|
|
db.films.drop()
|
|
|
|
|
|
mongoimport --host londres.uca.local --authenticationDatabase "admin" -u "anperederi" --db="dbanperederi" --collection ="films" films.json
|
|
|
|
db.films.find({"annee" : 2001}).sort({"titre" : -1}).limit(2) |