2

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.

rajashekar
  • 609
  • 5
  • 19

0 Answers0