Native Document Validation - MongoDB 3.2 & Meteor

I was inspecting some of the features of MongoDB and stumbled upon:
https://docs.mongodb.com/v3.2/core/document-validation/

We could do something like:

const Coll = new Mongo.Collection('name', {
       validator: {} // 
})

DB level document integrity sounds very nice. And I believe it’s super easy to make a PR to Meteor for this.

Thoughts ?

1 Like

Looks very nice actually. I wonder what the best way would be to hook onto the validationAction.

If I understand correctly, if validationAction is warn, it only outputs a failure to the console. But actually being able to specify a warning/validation message/code to use as feedback client-side would be more useful.

Also interested in this, is there any progress on the topic?

I looked into this and I believe it’s not possible to determine the reason for a field failing validation. It will be great when it’s fully baked though.

1 Like