Sign In Register

How can we help you today?

Start a new topic

SparkMongoCollectionReadWrite.remove always returns true

It looks like SparkMongoCollectionReadWrite.remove always returns true independent of whether a document was removed or not. I'm removing a document based on id: 

var success = tracksCollection.remove({"_id" : { "$oid" : trackId }});

It's of course possible to hack around this by first attempting to retrieve the document to see if it exists, but it would be easier to get accurate success status directly from remove return value.

Ok I see thanks for the info.

Hi Jussi

The boolean return is an indication of whether there is an error.

You could use findAndModify with remove=true and returnNew=false to have a document removed and also have it returned.

Hope thats useful


Login to post a comment