Skip to content

v0.6.5

Compare
Choose a tag to compare
@sebelga sebelga released this 20 Oct 19:43
· 383 commits to master since this release

Added

New property on Schema declaration: required (#18)

If it set to true, the entityData value of the property can not be undefined, null or an empty string.

var schema = new Schema({
    name: {type:'string'},
    email: {validate: 'isEmail', required: true}
})
;

var entityData = {name: 'John'}; // won't validate
var entityData = {name: 'John', email: null}; // won't validate
var entityData = {name: 'John', email: ' '}; // won't validate

gstore.defaultValues helper

There is a new constant gstore.defaultValues.NOW that you can use in your Schema declaration as a default value for "datetime" properties. It will automatically return the current time of the request.

var gstore = require('gstore-node');
var Schema = gstore.Schema;

var blogPostSchema = new Schema({
    createdOn : {type:'datetime', default: gstore.defaultValues.NOW},
    ...
});