We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following of a $filter inside of a $map results an Use of undefined variable: item error.
Use of undefined variable: item
const result = aggregate( [ { facilities: [ { id: 123, name: 'abc corp' } ], existingFacilities: [ { id: 456, companyName: 'abc corp' } ] } ], [ { $project: { "facilities" : { "$map" : { "input" : "$facilities", "as" : "item", "in" : { "id" : "$$item.id", "match" : { "$arrayElemAt" : [ { "$filter" : { "input" : "$existingFacilities", "as" : "facility", "cond" : { "$and" : [ "$$facility.companyName", { "$eq" : ["$$facility.companyName", "$$item.name"] } ] } } }, 0 ] }, "companyName" : "$$item.name" } } } } } ] ); console.log(result[0]);
The expected result:
{ "facilities" : [ { "id" : 123, "match" : { "id" : 456.0, "companyName" : "abc corp" }, "companyName" : "abc corp" } ] }
The text was updated successfully, but these errors were encountered:
20e5b27
No branches or pull requests
The following of a $filter inside of a $map results an
Use of undefined variable: item
error.The expected result:
The text was updated successfully, but these errors were encountered: