Replies: 2 comments
-
Passing id in your data object on create should be all you need to do. Can you share your id field config and your code calling create? |
Beta Was this translation helpful? Give feedback.
0 replies
-
As I couldn't make it work, I never made a commit with that code and ended up using mongo-seeding. I'm kinda rushing something right now, but I'll make a repo to try to reproduce it in a few days, because I'm interested in making a plugin for Payload that does this in a db agnostic way |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to make a script that seeds a few collections. So far I was able to make it work for collections that don't have relationships with other collections, but when I tried to reference some upload that belongs to another collection, I realized that the ID saved on the seed was different to the one in the upload when I ran the script to recreate all the data on the db.
Naturally, I tried passing the ID to the
data
object when creating the documents, but payload ignored it. After that, I tried enabling custom IDs in the collection but it still didn't work. I also tried runningpayload.update
right afterpayload.create
but that didn't work either. My last experiment was with anafterOperation
hook, but it also failed.For the record I'm using MongoDB, and I was able to do this on the past (using Payload 1.8.3). Maybe after so many versions it's no longer possible? I found #6884 but I thought that maybe it's an issue exclusive to Postgres.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions