Creating MongoDB views in DocumentDB

0

Hello, During migration of MongoDB databases (v5.0.19) to DocumentDB (with engine 5.0.0), we've encountered an issue when creating a MongoDB View in DocumentDB.

We've created a DocumentDB database and have imported our existing MongoDB collections using mongorestore command. Then we tried to create Views using following query in mongosh console:

db.createCollection("aViewName",{viewOn:"sourceColectionName", pipeline:[...some pipeline...]})

but we got an error:

MongoServerError: Field 'viewOn' is currently not supported

There is another way to create a view with db.createView(), but according to DocumentDB, it's not supported. https://docs.aws.amazon.com/documentdb/latest/developerguide/mongo-apis.html

Is there a way to create MongoDB Views in DocumentDB?

Thank you in advance!

asked 9 months ago757 views
1 Answer
1
Accepted Answer

Hi there.

Please note creating views is not yet supported in Amazon DocumentDB. The 'viewOn' is a field used when calling the createView() command, which is therefore not supported by DocumentDB.

At present, there is an existing feature request for the support for views in Amazon DocumentDB. However, I do not have an ETA on when it would be rolled out. You can keep an eye on the below links where we announce updates and new feature releases.

[+] Databases blogs: https://aws.amazon.com/blogs/database/

[+] What's new with Documentdb: https://docs.aws.amazon.com/documentdb/latest/developerguide/release-notes.html

AWS
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions