Meteor-Community-Packages / meteor-collection2

A Meteor package that extends Mongo.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating.
https://packosphere.com/aldeed/collection2
MIT License
1.02k stars 108 forks source link

integrate with mongo db 3.2 document validation #312

Open SierraGolf opened 8 years ago

SierraGolf commented 8 years ago

since mongo db 3.2 there is database level support for validations. is there anything on the roadmap towards integrating with that functionality?

I guess this could also be a good approach for solving #12.

mtchllbrrn commented 8 years ago

I'm also curious about this. +1

StorytellerCZ commented 2 years ago

So looking at the docs, I'm thinking that we have two options here. Either we provide a new way how to make collections which when provided schema will implement it to MongoDB as well, or while attaching schema we could add a new option that when true will add it to MongoDB. We can do both, but I think the second option is better as it follows the current workflow. Either way we will now have to look over the differences in schemas and how to bridge them. From my point of view enabling MongoDB validation the use case would be if you have other apps connecting to your DB and you want to enforce rules across the board. If you have just Meteor app then you won't need it (as it would be redundant to collection2 & simpl-schema), potentially we could utilize some functionality that is in MongoDB validation that is not in simpl-schema.