Skip to content

Commit 82ce607

Browse files
committed
JAVA-908: Added @throws annotations to DBCollection findAndModify helper methods
1 parent 89d7021 commit 82ce607

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

driver/src/main/com/mongodb/DBCollection.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,9 @@ public WriteResult update(final DBObject query, final DBObject update, final boo
466466
* @param bypassDocumentValidation whether to bypass document validation.
467467
* @param encoder the DBEncoder to use
468468
* @return the result of the operation
469-
* @throws MongoException
469+
* @throws com.mongodb.DuplicateKeyException if the write failed to a duplicate unique key
470+
* @throws com.mongodb.WriteConcernException if the write failed due some other failure specific to the update command
471+
* @throws MongoException if the operation failed for some other reason
470472
* @mongodb.driver.manual tutorial/modify-documents/ Modify
471473
* @since 2.14
472474
*/
@@ -1556,6 +1558,8 @@ public void setHintFields(final List<? extends DBObject> indexes) {
15561558
* @param sort determines which document the operation will modify if the query selects multiple documents
15571559
* @param update the modifications to apply
15581560
* @return pre-modification document
1561+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1562+
* @throws MongoException if the operation failed for some other reason
15591563
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
15601564
*/
15611565
public DBObject findAndModify(final DBObject query, final DBObject sort, final DBObject update) {
@@ -1569,6 +1573,8 @@ public DBObject findAndModify(final DBObject query, final DBObject sort, final D
15691573
* @param query specifies the selection criteria for the modification
15701574
* @param update the modifications to apply
15711575
* @return the document as it was before the modifications
1576+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1577+
* @throws MongoException if the operation failed for some other reason
15721578
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
15731579
*/
15741580
public DBObject findAndModify(final DBObject query, final DBObject update) {
@@ -1580,6 +1586,8 @@ public DBObject findAndModify(final DBObject query, final DBObject update) {
15801586
*
15811587
* @param query specifies the selection criteria for the modification
15821588
* @return the document as it was before the modifications
1589+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1590+
* @throws MongoException if the operation failed for some other reason
15831591
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
15841592
*/
15851593
public DBObject findAndRemove(final DBObject query) {
@@ -1599,6 +1607,8 @@ public DBObject findAndRemove(final DBObject query) {
15991607
* @param upsert when true, operation creates a new document if the query returns no documents
16001608
* @return the document as it was before the modifications, unless {@code returnNew} is true, in which case it returns the document
16011609
* after the changes were made
1610+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1611+
* @throws MongoException if the operation failed for some other reason
16021612
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
16031613
*/
16041614
public DBObject findAndModify(final DBObject query, final DBObject fields, final DBObject sort,
@@ -1621,7 +1631,8 @@ public DBObject findAndModify(final DBObject query, final DBObject fields, final
16211631
* @param writeConcern the write concern to apply to this operation
16221632
* @return the document as it was before the modifications, unless {@code returnNew} is true, in which case it returns the document
16231633
* after the changes were made
1624-
* @throws MongoException
1634+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1635+
* @throws MongoException if the operation failed for some other reason
16251636
* @since 2.14
16261637
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
16271638
*/
@@ -1647,6 +1658,8 @@ public DBObject findAndModify(final DBObject query, final DBObject fields, final
16471658
* @param maxTimeUnit the unit that maxTime is specified in
16481659
* @return the document as it was before the modifications, unless {@code returnNew} is true, in which case it returns the document
16491660
* after the changes were made
1661+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1662+
* @throws MongoException if the operation failed for some other reason
16501663
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
16511664
* @since 2.12.0
16521665
*/
@@ -1675,6 +1688,8 @@ public DBObject findAndModify(final DBObject query, final DBObject fields, final
16751688
* @param writeConcern the write concern to apply to this operation
16761689
* @return the document as it was before the modifications, unless {@code returnNew} is true, in which case it returns the document
16771690
* after the changes were made
1691+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1692+
* @throws MongoException if the operation failed for some other reason
16781693
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
16791694
* @since 2.14.0
16801695
*/
@@ -1703,6 +1718,8 @@ public DBObject findAndModify(final DBObject query, final DBObject fields, final
17031718
* @param maxTimeUnit the unit that maxTime is specified in
17041719
* @return the document as it was before the modifications, unless {@code returnNew} is true, in which case it returns the document
17051720
* after the changes were made
1721+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1722+
* @throws MongoException if the operation failed for some other reason
17061723
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
17071724
* @since 2.14.0
17081725
*/
@@ -1733,6 +1750,8 @@ public DBObject findAndModify(final DBObject query, final DBObject fields, final
17331750
* @param writeConcern the write concern to apply to this operation
17341751
* @return the document as it was before the modifications, unless {@code returnNew} is true, in which case it returns the document
17351752
* after the changes were made
1753+
* @throws WriteConcernException if the write failed due some other failure specific to the update command
1754+
* @throws MongoException if the operation failed for some other reason
17361755
* @mongodb.driver.manual reference/command/findAndModify/ Find and Modify
17371756
* @since 2.14.0
17381757
*/

0 commit comments

Comments
 (0)