DEV Community

Amit Chambial
Amit Chambial

Posted on

How to perform migrations in Mongodb

Hey everyone

I am working on a side project where I am using mongodb nodejs nextjs.

I am performing some schema update and my code is breaking up as the objects created before schema update have not been updated or not have a particular field.
Can somebody provide me the best way to perform dB migrations in mongodb using javascript.

Top comments (1)

Collapse
 
pranupranav97 profile image
Pranu Pranav • Edited

Hi this is one of the required skillset, if you are a full stack developer or a developer working on a stack that contains mongodb. I choose migrate-mongo package, you can install it using npm via command npm i migrate-mongo. It is simple.
Perform the migrations in data access layer of your application.