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

Use Mongoose as the model layer + convert simpl-schema to mongoose #2479

Open
eric-burel opened this issue Dec 12, 2019 · 2 comments
Open

Use Mongoose as the model layer + convert simpl-schema to mongoose #2479

eric-burel opened this issue Dec 12, 2019 · 2 comments

Comments

@eric-burel
Copy link
Contributor

eric-burel commented Dec 12, 2019

That would be a big work but it would bring significant improvements:

  • compatibility with tooling meant for Mongoose schemas, eg Forest Admin. We we would probably need not only to generate the schema dynamically, but also to export it as a file (like we can do with the graphql schema)
  • onCreate, onUpdate etc., and maybe callbacks, could be moved from the controller layer (GraphQL) to the model layer (Mongo/Mongoose). This would make direct call to the database easier server side. Currently you need to use the mutator by hand, because it is in charge of running callbacks and all, and create the context manually, it feels messy.
  • demeteorization, we would be able to use a better maintained and more common API for collections

Maybe it would be possible to get help from the community on this, since a simpl-schema / mongoose converter could be interesting for others Meteor users too.

Note that similar pattern could make sense for SQL too, by converting the simple schema to Knex calls for example.

@gland2015
Copy link

I think it's good,simpl-schema hasn't been updated for a long time.

@eric-burel
Copy link
Contributor Author

It wouldn't replace simpl-schema though, because we need a schema system that is also available client side. I think more about a simpl-schema/mongoose converter. Also I think simpl-schema is rather stable, hence the lack of updates, it's not necessarily an issue.

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

No branches or pull requests

2 participants