Search code examples
mongodbwrite-error

MongoDB WriteError "code" : 9


I am trying to delete some records from MongoDB that have dirty values, but whenever I try to delete it, I am getting the writeError with code 9.

A sample of the dirty document is as follows:

{
    "_id" : "some_unique_id_abcd",
    "tmp" : "1415772407377",
    "hiv" : "0.0",
    "liv" : "0.0",
    "oindx" : "0.0"
}

The remove command executed is as follows:

db.myCollection.remove({"_id" : "some_unique_id_abcd"});

The following error is thrown

WriteResult({
    "writeError" : {
        "code" : 9,
        "errmsg" : "wrong type for 'delete' field, expected string, 
                    found delete: 0.0"
    }
})

Any idea what exactly this error is about or how to get around it?


Solution

  • This is what the error code means:

    error_code("FailedToParse", 9)