nestjs-seeder
nestjs-seeder copied to clipboard
Async drop
when executing the seeder with the --refresh
flag, my drop function is async as it needs to use the await
keyword to delete items in the DB, however by the look of it the seed method doesn't wait for the drop method to finish its execution as i see errors from mongoDB complaining about duplicate keys MongoError: E11000 duplicate key error collection
.
Basically the old record was not dropped before the new write. and i can confirm that the record is properly deleted from the database which means that the drop method is being executed properly in the event loop just not being waited for by the seed method.
this also brings me back issue #18 that i raised some time ago and that is to have a command to only execute the drop function.