Open superKalo opened 6 years ago
Would this solution work:
Have the populateModels return a promise that resolves with an array of the models that are created.
You can then chain populateModels calls and pass the results of a previous populateModels call to a subsequent one.
I'm not really sure I understood your idea. How this will solve the issue that each time the seeder executes, documents get different Object ID?
Can you please share a code example?
@superKalo @seanemmer For exactly this reason I've created colonize
, it has been used in production for a while now: https://www.npmjs.com/package/colonize
Hi @superKalo @seanemmer @mikevercoelen , Seedgoose supports fully dynamic smart id references. And we don't need to write seeding scripts. Writing data files is enough.
@superKalo I would suggest using the hardcoded id for reference of on object.
I have a seeder that seeds my States:
After the States seeder is done, each document gets Object ID by Mongo.
Then, I have another seeder, Survey. I want to reference the Object ID of one of the states inside it:
Any ideas how to reference any State Object IDs in the Survey seeder?
I want to reference it somehow dynamic, because each time the States seeder executes, documents get different Object ID.