Hi Rose
Looking at the SalatDAO source, I noticed that you only check for an error by testing error.ok(). But Mongo will sometimes return ok() even though an error occurred.
For example, when trying to insert a document with an _id that already exists, the WriteResult.getLastError.ok() == true, but a new key "err" is added to the writeResult with the description of the error.
Just in case this is something you might find useful, I use the following to test for an error upon inserting:
val error = wr.getLastError
if (error != null && (!error.ok() || error.contains("err"))) {
None
}
else {
dbo.getAs[ObjectId]("_id")
}
Also, is there any reason why you used getLastCachedError instead of getLastError? The latter will get the cached error if it exists, but fetch the error if its not cached.
Cheers
Rand