@@ -79,6 +79,7 @@ public interface MongoOperations extends FluentMongoOperations {
79
79
*
80
80
* @param entityClass must not be {@literal null}.
81
81
* @return never {@literal null}.
82
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be derived from the type.
82
83
*/
83
84
String getCollectionName (Class <?> entityClass );
84
85
@@ -970,6 +971,8 @@ <T> T findAndModify(Query query, UpdateDefinition update, FindAndModifyOptions o
970
971
* fields specification. Must not be {@literal null}.
971
972
* @param replacement the replacement document. Must not be {@literal null}.
972
973
* @return the converted object that was updated or {@literal null}, if not found.
974
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
975
+ * {@link #getCollectionName(Class) derived} from the given replacement value.
973
976
* @since 2.1
974
977
*/
975
978
@ Nullable
@@ -1011,6 +1014,8 @@ default <T> T findAndReplace(Query query, T replacement, String collectionName)
1011
1014
* @return the converted object that was updated or {@literal null}, if not found. Depending on the value of
1012
1015
* {@link FindAndReplaceOptions#isReturnNew()} this will either be the object as it was before the update or
1013
1016
* as it is after the update.
1017
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1018
+ * {@link #getCollectionName(Class) derived} from the given replacement value.
1014
1019
* @since 2.1
1015
1020
*/
1016
1021
@ Nullable
@@ -1084,6 +1089,8 @@ default <T> T findAndReplace(Query query, T replacement, FindAndReplaceOptions o
1084
1089
* @return the converted object that was updated or {@literal null}, if not found. Depending on the value of
1085
1090
* {@link FindAndReplaceOptions#isReturnNew()} this will either be the object as it was before the update or
1086
1091
* as it is after the update.
1092
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1093
+ * {@link #getCollectionName(Class) derived} from the given replacement value.
1087
1094
* @since 2.1
1088
1095
*/
1089
1096
@ Nullable
@@ -1167,6 +1174,8 @@ <S, T> T findAndReplace(Query query, S replacement, FindAndReplaceOptions option
1167
1174
* {@literal null}.
1168
1175
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
1169
1176
* @return the count of matching documents.
1177
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1178
+ * {@link #getCollectionName(Class) derived} from the given type.
1170
1179
* @see #exactCount(Query, Class)
1171
1180
* @see #estimatedCount(Class)
1172
1181
*/
@@ -1222,6 +1231,8 @@ <S, T> T findAndReplace(Query query, S replacement, FindAndReplaceOptions option
1222
1231
*
1223
1232
* @param entityClass must not be {@literal null}.
1224
1233
* @return the estimated number of documents.
1234
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1235
+ * {@link #getCollectionName(Class) derived} from the given type.
1225
1236
* @since 3.1
1226
1237
*/
1227
1238
default long estimatedCount (Class <?> entityClass ) {
@@ -1258,6 +1269,8 @@ default long estimatedCount(Class<?> entityClass) {
1258
1269
* {@literal null}.
1259
1270
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
1260
1271
* @return the count of matching documents.
1272
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1273
+ * {@link #getCollectionName(Class) derived} from the given type.
1261
1274
* @since 3.4
1262
1275
*/
1263
1276
default long exactCount (Query query , Class <?> entityClass ) {
@@ -1325,6 +1338,8 @@ default long exactCount(Query query, String collectionName) {
1325
1338
* @param objectToSave the object to store in the collection. Must not be {@literal null}.
1326
1339
* @return the inserted object.
1327
1340
* @throws IllegalArgumentException in case the {@code objectToSave} is collection-like.
1341
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1342
+ * {@link #getCollectionName(Class) derived} from the given object type.
1328
1343
*/
1329
1344
<T > T insert (T objectToSave );
1330
1345
@@ -1349,6 +1364,8 @@ default long exactCount(Query query, String collectionName) {
1349
1364
* @param batchToSave the batch of objects to save. Must not be {@literal null}.
1350
1365
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
1351
1366
* @return the inserted objects that.
1367
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1368
+ * {@link #getCollectionName(Class) derived} from the given type.
1352
1369
*/
1353
1370
<T > Collection <T > insert (Collection <? extends T > batchToSave , Class <?> entityClass );
1354
1371
@@ -1367,6 +1384,8 @@ default long exactCount(Query query, String collectionName) {
1367
1384
*
1368
1385
* @param objectsToSave the list of objects to save. Must not be {@literal null}.
1369
1386
* @return the inserted objects.
1387
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1388
+ * {@link #getCollectionName(Class) derived} for the given objects.
1370
1389
*/
1371
1390
<T > Collection <T > insertAll (Collection <? extends T > objectsToSave );
1372
1391
@@ -1385,6 +1404,8 @@ default long exactCount(Query query, String collectionName) {
1385
1404
* @param objectToSave the object to store in the collection. Must not be {@literal null}.
1386
1405
* @return the saved object.
1387
1406
* @throws IllegalArgumentException in case the {@code objectToSave} is collection-like.
1407
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1408
+ * {@link #getCollectionName(Class) derived} from the given object type.
1388
1409
*/
1389
1410
<T > T save (T objectToSave );
1390
1411
@@ -1419,9 +1440,11 @@ default long exactCount(Query query, String collectionName) {
1419
1440
* the existing object. Must not be {@literal null}.
1420
1441
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
1421
1442
* @return the {@link UpdateResult} which lets you access the results of the previous write.
1422
- * @since 3.0
1423
1443
* @see Update
1424
1444
* @see AggregationUpdate
1445
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1446
+ * {@link #getCollectionName(Class) derived} from the given type.
1447
+ * @since 3.0
1425
1448
*/
1426
1449
UpdateResult upsert (Query query , UpdateDefinition update , Class <?> entityClass );
1427
1450
@@ -1473,9 +1496,11 @@ default long exactCount(Query query, String collectionName) {
1473
1496
* the existing. Must not be {@literal null}.
1474
1497
* @param entityClass class that determines the collection to use.
1475
1498
* @return the {@link UpdateResult} which lets you access the results of the previous write.
1476
- * @since 3.0
1477
1499
* @see Update
1478
1500
* @see AggregationUpdate
1501
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1502
+ * {@link #getCollectionName(Class) derived} from the given type.
1503
+ * @since 3.0
1479
1504
*/
1480
1505
UpdateResult updateFirst (Query query , UpdateDefinition update , Class <?> entityClass );
1481
1506
@@ -1527,9 +1552,11 @@ default long exactCount(Query query, String collectionName) {
1527
1552
* the existing. Must not be {@literal null}.
1528
1553
* @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
1529
1554
* @return the {@link UpdateResult} which lets you access the results of the previous write.
1530
- * @since 3.0
1555
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1556
+ * {@link #getCollectionName(Class) derived} from the given type.
1531
1557
* @see Update
1532
1558
* @see AggregationUpdate
1559
+ * @since 3.0
1533
1560
*/
1534
1561
UpdateResult updateMulti (Query query , UpdateDefinition update , Class <?> entityClass );
1535
1562
@@ -1577,6 +1604,8 @@ default long exactCount(Query query, String collectionName) {
1577
1604
*
1578
1605
* @param object must not be {@literal null}.
1579
1606
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
1607
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1608
+ * {@link #getCollectionName(Class) derived} from the given object type.
1580
1609
*/
1581
1610
DeleteResult remove (Object object );
1582
1611
@@ -1600,6 +1629,8 @@ default long exactCount(Query query, String collectionName) {
1600
1629
* @param entityClass class that determines the collection to use.
1601
1630
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
1602
1631
* @throws IllegalArgumentException when {@literal query} or {@literal entityClass} is {@literal null}.
1632
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1633
+ * {@link #getCollectionName(Class) derived} from the given type.
1603
1634
*/
1604
1635
DeleteResult remove (Query query , Class <?> entityClass );
1605
1636
@@ -1647,6 +1678,8 @@ default long exactCount(Query query, String collectionName) {
1647
1678
* @param query the query document that specifies the criteria used to find and remove documents.
1648
1679
* @param entityClass class of the pojo to be operated on.
1649
1680
* @return the {@link List} converted objects deleted by this operation.
1681
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1682
+ * {@link #getCollectionName(Class) derived} from the given type.
1650
1683
* @since 1.5
1651
1684
*/
1652
1685
<T > List <T > findAllAndRemove (Query query , Class <T > entityClass );
0 commit comments