Argument to localField must be a string (which is the name of the
field). So you will need to transform (via $project) the value you
need into a field and then use that field name in the $lookup.
Something like this:
[ {$project:{ appinfo_user_id: {$arrayElemAt: [ {$arrayElemAt :
["$appinfo.user_ids,0]}, 0]} }},
{$lookup:{ from:"users", localField:"appinfo_user_id", foreignField:
"_id", as:"userinfo"}} ] )
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user"
> group.
>
> For other MongoDB technical support options, see:
>
https://docs.mongodb.org/manual/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
https://groups.google.com/group/mongodb-user.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/mongodb-user/f5658b03-417b-41b6-b138-048ce499fc2a%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
Asya Kamsky
Lead Product Manager
MongoDB
Download MongoDB -
mongodb.org/downloads
Free MongoDB Monitoring -
cloud.mongodb.com
Free Online Education -
university.mongodb.com
Get Involved -
mongodb.org/community
We're Hiring! -
https://www.mongodb.com/careers