-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run seeds programatically #8
Comments
Hi @JohannesMerz, thank you for opening this issue. You should be able to do something very similar to what you did. The Notice, i am working on a refactoring, i will continue to use observable but the inner |
Hi @JohannesMerz, |
oh i guess this can be closed. I didn't quite get what you suggested above. A section in the readme of what can be done programmatically and not through the cli would be really helpful. |
@JohannesMerz I shared with you the code that uses the You can write something like: import { seed } from 'mongoose-data-seed';
seed().subscribe({
next: ({ name, results }) => console.log(name, results),
error: ({ name, error }) => console.log(name, error),
complete: () => console.log('Completed!'),
}); You can also pass const selectedSeeders = ['Users', 'Posts'];
seed(selectedSeeders).subscribe({ ... }); Let me know if I can do more to help! I will update the docs soon. |
Ahh, nice! Thanks for the quick response. That clears everything up. |
Hi @JohannesMerz i tried running seed() in in my express app but i'm getting this error:
I've googed it and it seems to be some sort of cyclic reference according to this: https://stackoverflow.com/questions/37312197/node-js-v6-2-0-class-extends-is-not-a-function-error/37312355#37312355 But i'm not sure how the cyclic reference is occurring, would you know how this is happening?
This is the code from where i want to programatically seed the db
|
is it possible to run the commands programmatically? On a quick glance it seems that run is only exposed through the binary.
Something like:
The text was updated successfully, but these errors were encountered: