Meteor collection2 is allowing numbers as strings -


i starting new meteor project , using collection2 validation. have below schema defined. when insert document title: 4, expect fail since have specified string. not failing. suspect there fundamental aspect of meteor i'm not getting. fyi, if leave out title, expected errors.

my schema:

timestamps = new mongo.collection('timestamps');  var schemas = {};  schemas.timestamp = new simpleschema({   title: {     type: string,     label: "title",     max: 500,     optional: false   },   notes: {     type: string,     label: "notes",     max: 1000,     optional: true   } });  timestamps.attachschema(schemas.timestamp); 

the following code should fail error saying title needs string. however, not failing, , value being stored string "4".

creating timestamp:

timestamps.insert({title: 4, comments: "a comment"}); 

this how publishing , allowing timestamp inserts.

meteor.publish("timestamps", function() {     return timestamps.find(); });  timestamps.allow({     insert: function(timestamp) {         return true;     } }); 

have @ documentation:

https://github.com/aldeed/meteor-collection2#skip-conversion-of-values-to-match-what-schema-expects

collection2 has option (default true) try match data types


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -