vertx-mongo-client
vertx-mongo-client copied to clipboard
Update fails to encode _id
updateCollectionWithOptions
uses encodeKeyWhenUseObjectId
that assumes that the _id is at the top level of the JsonObject, if an update is of the form:
{
$set:{
_id='an-id',
foo:'bar'
}
}
The _id is nested so it will fail to encode the _id and throw an exception.
It may seem odd to have _id in an update, but I have tested with the mongo command line client and it accepts _id in the update provided it does not change the value. If we dont encode it we would probably need to warn people that their code needs to filter out _id from any updates.