I am defining a collection like this:
VotesList = new Mongo.Collection('votes');
In the ‘is.client’, I add an initial record, like this:
VotesList.insert({ user: Meteor.userId(), flavour: 'blank', timestamp: '100'});
I have an event which adds a record:
VotesList.insert({ user: Meteor.userId(), flavour: FlavoursList.findOne(selectedFlavour, {fields: {name: 1}}).name, timestamp: now});
Then, I have a console.log, with the following:
console.log("just added: "+VotesList.findOne({user: Meteor.userId()}, {sort: {timestamp: -1}}).timestamp);
No matter what happens, it comes back with “100”, the initial timestamp value
When I use the “VotesList.find().fetch();” and look at the latest record (the one just added), it has a timestamp which is correct, like this:
_id: "BJtjkjDsMTydSARs8"
flavour: "chocolate"
timestamp: 1449199251006
user: "CiPFseWm8StWqtuh8"
Why am I always getting ‘100’ in my timestamp, and not the value from the record?