Details
-
Task
-
Resolution: Done
-
Major - P3
-
None
-
3.3.0
-
None
Description
The updateOne command below works with MongoDB Java driver 3.3.0 but does not work with MongoDB Async Java driver 3.3.0.
MongoAsync Driver does not work:
public void upsertForReal(MongoCollection<Document> mCollection, Document query, Document upsert) { |
mCollection.updateOne(query, upsert, new UpdateOptions().upsert(true), new SingleResultCallback<UpdateResult>() { |
@Override |
public void onResult(UpdateResult result, Throwable e) { |
if (e!=null) { |
log.error("Upsert failed", e); |
}
|
if (log.isDebugEnabled()) { |
log.debug("The upsert query "+query+" returned matchedCount="+result.getMatchedCount()+ " modifiedCount= "+result.getModifiedCount()); |
}
|
|
}
|
});
|
}
|
Mongo driver works:
public void upsertForReal(MongoCollection<Document> mCollection, Document query, Document upsert) { |
mCollection.updateOne(query, upsert, new UpdateOptions().upsert(true)); |
}
|
The MongoAsync driver does not report any issues. The document simply does not get inserted if the query document does not match.