Mongodb 3.0 java insertOne -
i'm trying upgrade legacy application java driver 2.10.1 3.0.0 insert method changed insertone. dbcollection.insert()
returned result, can check geterror()
. mongocollection.insertone()
not return value.
how check error of operation?
you have catch:
- mongowriteexception - if write failed due other failure specific insert command
- mongowriteconcernexception - if write failed due being unable fulfil write concern
- mongoexception - if write failed due other failure
more info here: http://api.mongodb.org/java/current/com/mongodb/client/mongocollection.html#insertone-tdocument-
Comments
Post a Comment