-
Type:
New Feature
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Query
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When we use $lookup in aggregate query of MongoDB we use this format
{
$lookup:
{
from: "users",
localField: "userId",
foreignField: "_id",
as: "user"
}
}
where user return as an array of object and then some time we need to use $arrayElemAt in $project stage to return as a single object. like
{
$project:
{
user:
{
$arrayElemAt: [ "$user", 0 ]
}
}
}
so my request is can create option to return user as a single object instead of array from $lookup stage ?
- duplicates
-
SERVER-22384 Add $lookUpOne to retrieve single Object on result
-
- Open
-