Hi
I’ve started using schema for the first time and i’m writing a chat app in which i want the latest message to be displayed ontop, alas i need to sort the collection.
Template.messages.created = function () {
this.autorun(function () {
Meteor.subscribe('messages');
}.bind(this));
};
Template.messages.helpers({
messages: Messages.find({}, {sort: {date_created: -1}})
});
Messages.attachSchema(new SimpleSchema({ //take this from docs.
text: {
type: String,
label: "Medelande",
max: 200
}
//Date should go here
}));
If i add a date field in the schema, it ends up displaying a input. How should i approach this?