Horje
sort in mongoose aggregate lookup Code Example
sort in mongoose aggregate lookup
db.getCollection('user').aggregate([
    {$lookup: {from: "post", localField: "_id", foreignField: "userId", as: "post"}},
    {$unwind: { path: "$post", preserveNullAndEmptyArrays: true }},
    {$sort: {"post.createdAt": -1}},
    {$group: {"_id": "$_id", "name": {$first: "$name"}, "post": {$first: "$post"}},
    {$project: {"_id": 1, "name": 1, "post": 1}}
])




Whatever

Related
combine .proto in android studio project Code Example combine .proto in android studio project Code Example
Drupal 8 reset update hook drush Code Example Drupal 8 reset update hook drush Code Example
quotes for teacher appreciation Code Example quotes for teacher appreciation Code Example
open cmd here shortcut Code Example open cmd here shortcut Code Example
salt is a lack of which mineral Code Example salt is a lack of which mineral Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7