Started adding async calls for upgrading to Meteor 3.0. Numerous other fixes.
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
|
||||
Meteor.methods({
|
||||
// Cleans up all Date objects that don't have a time component. Removes any time component.
|
||||
"enhanceSalesDateFields": function() {
|
||||
let sales = Sales.find({}).fetch();
|
||||
"enhanceSalesDateFields": async function() {
|
||||
let sales = await Sales.find({}).fetchAsync();
|
||||
|
||||
for(let i = 0; i < sales.length; i++) {
|
||||
let dateString = sales[i].date.toString();
|
||||
@@ -25,7 +25,7 @@ Meteor.methods({
|
||||
}
|
||||
|
||||
// Save to the database.
|
||||
Sales.update(sales[i]._id, {$set: {"timestamp": timestamp.getTime(), weekOfYear}}, {bypassCollection2: true}, function(err, id) {
|
||||
await Sales.updateAsync(sales[i]._id, {$set: {"timestamp": timestamp.getTime(), weekOfYear}}, {bypassCollection2: true}, function(err, id) {
|
||||
if(err) console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user