db.people.aggregate([
{
$lookup : {
from :"companies",
localField:"company_id",
foreignField:"_id",
as : "companys"
}
},
{
$unwind : {
path : "$companys"
}
},
{
$project : {
first_name : 1,
last_name : 1,
job : 1,
company : "$companys.name",
sector : "$companys.sector",
_id : 0
}
},
{
$sort : {
job : 1,
sector : 1,
last_name : 1,
first_name : 1
}
},
{
$skip : 99
}
])
Last active
May 26, 2017 06:31
-
-
Save anandrajneesh/b1c5c07ad578d37a0582615daea54113 to your computer and use it in GitHub Desktop.
Mongo queries just for reference
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment