Closed Jehu closed 9 years ago
With this code i get an increment of 2 instead of 1
Streets.after.insert(function (userId, doc) { Territories.update({ _id: doc.territory_id }, { $inc: {streets_count: 1} }) });
... while the code below entered in browser console increments by 1 like expected:
Territories.update({_id: "kdo5aSa8XrsirK6Ar"}, { $inc: {streets_count: 1 } })
A console.log inside of after.insert() fires just one time by the way.
console.log
Here a list of installed packages:
aldeed:autoform 5.3.0 aldeed:simple-schema 1.3.3 fastclick 1.0.3 ground:db 0.3.9 iron:layout 1.0.8 iron:router 1.0.9 matb33:collection-hooks 0.7.13 meteor-platform 1.2.2
I've testet without ground:db too. Same results. What is going wrong here?
What happens when you put that hook in the server only?
@rclai if i restrict the hook to server or client only, $inc works as expected. Thank you.
With this code i get an increment of 2 instead of 1
... while the code below entered in browser console increments by 1 like expected:
A
console.log
inside of after.insert() fires just one time by the way.Here a list of installed packages:
I've testet without ground:db too. Same results. What is going wrong here?