9 ) Display in a pretty format the names of drivers who performed no trips so far.
//Query to print all the name of employes who performed no trip so far
db.employee.find({"Trip": {$exists:true, $size:0}},{"name":1}).pretty()
10) Display in a pretty format names of drivers who started at least on trip in Wollongong.
db.employee.aggregate([
{$match: {'Trip.TripLEG.ciytname': 'Wollongong'}},
{$project: {
Trip: {$filter: {
input: '$Trip',
as: 'TripLEG',
cond: {$eq: ['$$TripLEG.ciytname', 'Wollongong']}
}},
_id: 0,
}}
])
Comments
Leave a comment