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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -