MongodB remove not working as intended?


In meteor mongo shell this works:



WriteResult({ "nRemoved" : 1 })

But in Meteor app

 FutureTasks.upsert({userid: details.userid}, {$inc: {count: -1}}, {multi: true}))
     .then(txt => console.log('Test is :', txt))
     .then(()=> ACSTasks.remove({name: details.userid})) // where name:details.userid is also seb123
     .then(x => console.log('Removed number of jobs : ', x))

results in

Removed number of jobs :  0

Tried hardcoding into remove

.then(()=> ACSTasks.remove({name: 'seb123'})) 
.then(x => console.log('Removed number of jobs : ', x))


Removed number of jobs :  0

This ACSTasks.remove({name: details.userid})) is part of the chain above which takes no argument, so even though it is a chain that waits for other functionality to happen before it is executed should not have any affect on returning zero instead of expected result as in meteor mongo?


Only think I can think of is if you are trying this from the client… Otherwise this should work fine.


Hi Kelly, it is all server side…


Yeah, should work then unless no record matches.


Within app seems to be working :

Removed number of jobs :  16

But UI still showing entries ?