-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueries.txt
37 lines (25 loc) · 1.05 KB
/
queries.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//MGDB1
db.delegates.find()*
* every find() could be followed with .pretty() so that the search results will be displayed more readable.
//MGDB2
db.delegates.count()
//MGDB3
db.conferences.find({},{_id:1})
//MGDB4
db.conferences.find({co_located_with:"ICSE'41"})
//MGDB5
db.conferences.find({"duration.end" : {$gt: "2019-04-15"}})
//MGDB6
db.delegates.find({},{name:1,country:1,_id=0})
//MGDB7
db.conferences.find( {tracks : {$exists:true}, $where:'this.tracks.length>1'})
//MGDB8
db.conferences.find({name: {$regex: 'ICSE'}}, {edition: true, _id:false})
//MGDB9
db.delegates.update({name : "Sonia Haiduc"}, {$set : { "country" : "Australia"}})
//MGDB10
db.delegates.update({name: "Michael Whalen"},{$set: {"attends": [{"conference":"ICSE'41","registered":"2019-02-01"}]}})
//MGDB11
db.delegates.count({country: {$regex : 'USA'}})
//MGDB12
db.conferences.aggregate([{$lookup: {from: "delegates",localField: "general_chair", foreignField: "name", as: "conferences"}}, {$match: {"conferences.country" :{$regex: 'USA'}}}, {$project: { "name": true, _id:false}}])