Skip to content
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

Added mongodb as custom state storage #162

Closed
wants to merge 2 commits into from

Conversation

krishna-atkalikar
Copy link
Contributor

No description provided.

@krishna-atkalikar krishna-atkalikar changed the title Added custom state store for mongodb Added mongodb as custom state storage Aug 6, 2019
Copy link
Collaborator

@wesleytodd wesleytodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @krishna-atkalikar, thanks for the new example! I think it is a great idea to have a mongo example, I just have a few comments on the specific implementation details.

examples/custom-state-storage/mongo-state-storage.js Outdated Show resolved Hide resolved
examples/custom-state-storage/mongo-state-storage.js Outdated Show resolved Hide resolved
examples/custom-state-storage/mongo-state-storage.js Outdated Show resolved Hide resolved
examples/custom-state-storage/mongo-state-storage.js Outdated Show resolved Hide resolved
}
}

module.exports = MongoDbStore;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with the pg example, this should not be exported but used to run migrations. See: https://github.com/tj/node-migrate/blob/master/examples/custom-state-storage/custom-state-storage.js#L51-L66

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I use migrate.load() and pass custom state store it still fails with TypeError: Store is not a constructor but it works fine with module.exports = MongoDbStore;.

@wesleytodd
Copy link
Collaborator

Thanks for making those updates. I didn't notice this before, but can you make it follow the style enforced by the linter? Once it follows that, I will probably let it sit here for a bit to see if anyone with more mongo experience has opinions.

@qqilihq
Copy link

qqilihq commented Sep 11, 2019

FYI: We've built something similar. It's available here and via NPM @nodepit/migrate-state-store-mongodb:

https://github.com/NodePit/node-migrate-state-store-mongodb

Feedback and contributions welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants