lukejagodzinski / meteor-astronomy-validators

https://atmospherejs.com/jagi/astronomy-validators
MIT License
11 stars 13 forks source link

ID validator #32

Open ndarilek opened 8 years ago

ndarilek commented 8 years ago

It would be nice to have a validator that checks against the format for object IDs, since it's common enough to use them in relations. Looks like this is the regexp used by simple-schema:

/^[23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijkmnopqrstuvwxyz]{17}$/

For the moment I'm instantiating my own regexp validator and reusing that.

lukejagodzinski commented 8 years ago

Yes, good idea I will add it in the next version. However there is a problem with how mongo ID is treated. In fact, it should be a MongoID object not just a string. In some cases documents may come from the other database there documents are stored with real MongoID objects. However, if think it's a very rear situation and someone may just not omit validation of such ID.