--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/F9DF41E5-0D53-4E4C-B509-9FA080C112A0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
db.mdbdays_attendeees.aggregate([
{ $lookup : {
"from" : "cloud_users",
on: { email : "$email" },
as: "cloud_user_doc"
}
},
{ $match : { "cloud_user_doc.active" : true } },
{ $unwind : "$cloud_user_doc.groups" },
{ $lookup : {
"from" : "cloud_hosts",
on: { group_id: "$cloud_user_doc.groups"},
as: "host"
}
},
{ $match : { last_ping : {$gte : new ISODate("2015-06-01Z00:00:00") } } },
{ $group : { _id : "$version", count : { $sum : 1}}}
])
// Eliot Horowitz's Keynote Example of $lookup
db.mdbdays_attendees.insert({ first : "Eliot", last : "horowitz", email : "redacted", zip : "10024", title : "CTO" })
db.cloud_days.insert({ first : "Eliot", last : "horowitz", email : "redacted",
groups : [ 12321, 51234 ]})
db.cloud_hosts.insert({ hostname: "foo.mongodb.com", group_id : 51234, last_ping : new ISODate("2015-06-02Z05:42:12"), version : "3.0.3"})
db.mdbdays_attendeees.aggregate([
{ $lookup : {
"from" : "cloud_users",
on: { email : "$email" },
as: "cloud_user_doc"
}
},
{ $match : { "cloud_user_doc.active" : true } },
{ $unwind : "$cloud_user_doc.groups" },
{ $lookup : {
"from" : "cloud_hosts",
on: { group_id: "$cloud_user_doc.groups"},
as: "host"
}
},
{ $match : { last_ping : {$gte : new ISODate("2015-06-01Z00:00:00") } } },
{ $group : { _id : "$version", count : { $sum : 1}}}
])
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/f74ce405-f7c6-4a4a-a9ad-c1682b5e8096%40googlegroups.com.