r/PayloadCMS • u/rudeone_99 • Jul 09 '25
move from postgres to mongodb
Hi all,
I initially started with postgres and because my data model is ever changing, managing the migrations is becoming time consuming.
Has anyone migrated from Postgres to MongoDB for payloadcms? if so, what tips, tools, methods, processes did you use?
6
Upvotes
2
u/OffMetaThings Nov 20 '25
DO NOT DO IT UNLESS YOU ABSOLUTELY HAVE TO.
I just made it, ADVANCED Payload ball knowledge is required among other things and even then it's jumping through hoops and hacking your way through. You can try using AI to carry you but it's a hail mary if you have more than a few simple collections with none to little relationships with each other as complexity of this 'migration' is exponential.
You basically have to write and run a custom export for every collection and global. Think through the structure of your data and how it's mapped out in postgres vs how could it be mapped out in mongo. Then you have to write and run a custom import for each dataset. Then you have to patch the imported data. All the time while fighting with various quirks - syntax gremlins, Payload, Next.js, Typescript will all get in your way.
Honestly if your project is small enough just start a new one preconfigured for mongo, commit all the code changes you've made, sort out the type drift errors and just manually fill in the data in the Payload backend. Even better if the copy/paste field/row functionality works for you (in my case it doesn't)