Skip to content

Instantly share code, notes, and snippets.

@Pushplaybang
Last active August 29, 2015 14:16
Show Gist options
  • Save Pushplaybang/c323be2062099c311613 to your computer and use it in GitHub Desktop.
Save Pushplaybang/c323be2062099c311613 to your computer and use it in GitHub Desktop.
Meteor Simple Schema - re-usable snippets
/* For Use with collection2 / simpleschema / autoform */
Schemas.UsefulFields = new SimpleSchema({
createdAt : {
type: Date,
autoValue: function() {
if (this.isInsert) {
return new Date;
} else if (this.isUpsert) {
return {$setOnInsert: new Date};
} else {
this.unset();
}
}
},
updatedAt : {
type: Date,
autoValue: function() {
if (this.isUpdate) {
return new Date();
}
},
denyInsert: true,
optional: true
},
basic : {
type: String,
optional : true,
label : "basic",
},
datefield : {
type : Date,
optional : true,
label : "datefiled",
autoform : {
type : "bootstrap-datepicker"
}
},
map : {
type: String,
optional: true,
label : "map",
autoform : {
type :"map",
afFieldInput : {
type : 'map',
geolocation : true,
searchBox : true,
autolocate : true,
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment