I wrote a mongo query which worked fine in MongoDB but it is not working in AWS DocumentDB
Here is the query:
const collection = db.collection('items');
const query = [
{
$addFields: {
files: {
$map: {
input: "$files",
as: "id",
in: { $toObjectId: "$$id" }
}
}
}
},
{
$lookup: {
from: "subitems",
localField: "files",
foreignField: "_id",
as: "files"
}
}
];
collection.aggregate(query).toArray();
It is showing the results when executed in MongoDB, but facing the below error in AWS DocumentDB
"Aggregation project operator not supported: '$map'"
Any help will be appreciated.