You are on page 1of 2

Houssem Jabally 3BI A03

TD2_Mongo

mongoimport --host localhost:27017 –-jsonArray --db


TP4 --collection publis <c:\workspace\dblp.json

1) db.publis.find({"type" : "Book"});
2) db.publis.find({$or: [{"type" : "Book"},{"type" :
"Phd"}]});
3) db.publis.find({year : {$gte : 2011}});
4) db.publis.find({"type" : "Book", year : {$gte : 2014}});
5) db.publis.find({authors : "Toru Ishida"});
6) db.publis.distinct("publisher");
7) db.publis.distinct("authors");
8) db.publis.aggregate([{$match:{authors : "Toru
Ishida"}}, { $sort : { booktitle : 1, "pages.start" : 1 } }]);
9) db.publis.aggregate([{$match:{authors : "Toru
Ishida"}}, {$sort : { booktitle : 1, "pages.start" : 1 }},
{$project : {title : 1, pages : 1}}]);
Houssem Jabally 3BI A03

10) db.publis.aggregate([{$match:{authors : "Toru


Ishida"}}, {$group:{_id:null, total : { $sum : 1}}}]);

You might also like