Details
-
New Feature
-
Resolution: Duplicate
-
Major - P3
-
None
-
None
-
None
-
Query
Description
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 ?
Attachments
Issue Links
- duplicates
-
SERVER-22384 Add $lookUpOne to retrieve single Object on result
-
- Open
-