MongodB remove not working as intended?


#1

In meteor mongo shell this works:

db.acs_tasks.remove({name:'seb123'})

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))

also

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?


#2

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


#3

Hi Kelly, it is all server side…


#4

Yeah, should work then unless no record matches.


#5

Within app seems to be working :

Removed number of jobs :  16

But UI still showing entries ?