I'm trying to upgrade my legacy application from Java driver 2.10.1 into 3.0.0
So the insert method is changed into insertOne. but DBCollection.insert()
returned the result, where I can check the getError()
. But MongoCollection.insertOne()
does not return a value.
How to check an error of operation?
You have to catch:
more info here: http://api.mongodb.org/java/current/com/mongodb/client/MongoCollection.html#insertOne-TDocument-
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With