4

DocumentDB is not supporting the "$lookup" operator, Any other Alternative of $lookup(MongoDB) in DocumentDB.

Here is the list of DocumentDB supported operator. https://docs.aws.amazon.com/documentdb/latest/developerguide/mongo-apis-aggregation-pipeline.html

Migrated a Nodejs application from MongoDB to DocumentDB, data is migrated successfully but got this error while running the application.

{ MongoError: Aggregation stage not supported: '$lookup'
at Connection.<anonymous> (/.../node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:443:61)
at emitTwo (events.js:126:13)
at Connection.emit (events.js:214:7)
at processMessage (/.../node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:364:10)
at TLSSocket.<anonymous> (/.../node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:533:15)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at TLSSocket.Readable.push (_stream_readable.js:208:10)
at TLSWrap.onread (net.js:607:20)
ok: 0,
errmsg: 'Aggregation stage not supported: \'$lookup\'',
code: 304,
name: 'MongoError',
[Symbol(mongoErrorContextSymbol)]: {} }
Stennie
  • 63,885
  • 14
  • 149
  • 175

1 Answers1

2

[Updated 10/16] Amazon DocumentDB how supports $lookup: https://aws.amazon.com/about-aws/whats-new/2019/10/amazon-documentdb-add-additional-aggregation-pipeline-capabilities/

You can find the most up-to-date list of supported API/stages/operators here:https://docs.aws.amazon.com/documentdb/latest/developerguide/mongo-apis.html

Also, please check the following for recent launches: https://aws.amazon.com/documentdb/resources/

Joseph Idziorek
  • 4,853
  • 6
  • 23
  • 37
  • Is there any alternative of $lookup? which is supported by DocumentDB. – Bhanwarlal Chaudhary May 14 '19 at 04:09
  • @BhanwarChaudhary, typically, joins are a result of normalizing data (similar to the relational model) and the $lookup operator enables you to join two collections. Alternatives include denormalizing the data model or, depending on the size/performance constraints, performing the join in the application tier. I know you'd rather prefer $lookup and we greatly appreciate the feedback. – Joseph Idziorek May 14 '19 at 18:37
  • 3
    Thanks, but application build and running I have to migrate it to the DocumentDB, I can't change the code or query, so I am gonna use MongoDB Atlas instead of DocumentDB. – Bhanwarlal Chaudhary May 15 '19 at 02:01