@@ -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
@@ -947,6 +948,8 @@ <T> T findAndModify(Query query, UpdateDefinition update, FindAndModifyOptions o
947
948
* fields specification. Must not be {@literal null}.
948
949
* @param replacement the replacement document. Must not be {@literal null}.
949
950
* @return the converted object that was updated or {@literal null}, if not found.
951
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
952
+ * {@link #getCollectionName(Class) derived} from the given replacement value.
950
953
* @since 2.1
951
954
*/
952
955
@ Nullable
@@ -988,6 +991,8 @@ default <T> T findAndReplace(Query query, T replacement, String collectionName)
988
991
* @return the converted object that was updated or {@literal null}, if not found. Depending on the value of
989
992
* {@link FindAndReplaceOptions#isReturnNew()} this will either be the object as it was before the update or
990
993
* as it is after the update.
994
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
995
+ * {@link #getCollectionName(Class) derived} from the given replacement value.
991
996
* @since 2.1
992
997
*/
993
998
@ Nullable
@@ -1061,6 +1066,8 @@ default <T> T findAndReplace(Query query, T replacement, FindAndReplaceOptions o
1061
1066
* @return the converted object that was updated or {@literal null}, if not found. Depending on the value of
1062
1067
* {@link FindAndReplaceOptions#isReturnNew()} this will either be the object as it was before the update or
1063
1068
* as it is after the update.
1069
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1070
+ * {@link #getCollectionName(Class) derived} from the given replacement value.
1064
1071
* @since 2.1
1065
1072
*/
1066
1073
@ Nullable
@@ -1144,6 +1151,8 @@ <S, T> T findAndReplace(Query query, S replacement, FindAndReplaceOptions option
1144
1151
* {@literal null}.
1145
1152
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
1146
1153
* @return the count of matching documents.
1154
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1155
+ * {@link #getCollectionName(Class) derived} from the given type.
1147
1156
* @see #exactCount(Query, Class)
1148
1157
* @see #estimatedCount(Class)
1149
1158
*/
@@ -1199,6 +1208,8 @@ <S, T> T findAndReplace(Query query, S replacement, FindAndReplaceOptions option
1199
1208
*
1200
1209
* @param entityClass must not be {@literal null}.
1201
1210
* @return the estimated number of documents.
1211
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1212
+ * {@link #getCollectionName(Class) derived} from the given type.
1202
1213
* @since 3.1
1203
1214
*/
1204
1215
default long estimatedCount (Class <?> entityClass ) {
@@ -1235,6 +1246,8 @@ default long estimatedCount(Class<?> entityClass) {
1235
1246
* {@literal null}.
1236
1247
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
1237
1248
* @return the count of matching documents.
1249
+ * @throws org.springframework.data.mapping.MappingException if the collection name cannot be
1250
+ * {@link #getCollectionName(Class) derived} from the given type.
1238
1251
* @since 3.4
1239
1252
*/
1240
1253
default long exactCount (Query query , Class <?> entityClass ) {
@@ -1302,6 +1315,8 @@ default long exactCount(Query query, String collectionName) {
1302
1315
* @param objectToSave the object to store in the collection. Must not be {@literal null}.
1303
1316
* @return the inserted object.
1304
1317
* @throws IllegalArgumentException in case the {@code objectToSave} is collection-like.
1318
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1319
+ * {@link #getCollectionName(Class) derived} from the given object type.
1305
1320
*/
1306
1321
<T > T insert (T objectToSave );
1307
1322
@@ -1326,6 +1341,8 @@ default long exactCount(Query query, String collectionName) {
1326
1341
* @param batchToSave the batch of objects to save. Must not be {@literal null}.
1327
1342
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
1328
1343
* @return the inserted objects that.
1344
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1345
+ * {@link #getCollectionName(Class) derived} from the given type.
1329
1346
*/
1330
1347
<T > Collection <T > insert (Collection <? extends T > batchToSave , Class <?> entityClass );
1331
1348
@@ -1344,6 +1361,8 @@ default long exactCount(Query query, String collectionName) {
1344
1361
*
1345
1362
* @param objectsToSave the list of objects to save. Must not be {@literal null}.
1346
1363
* @return the inserted objects.
1364
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1365
+ * {@link #getCollectionName(Class) derived} for the given objects.
1347
1366
*/
1348
1367
<T > Collection <T > insertAll (Collection <? extends T > objectsToSave );
1349
1368
@@ -1362,6 +1381,8 @@ default long exactCount(Query query, String collectionName) {
1362
1381
* @param objectToSave the object to store in the collection. Must not be {@literal null}.
1363
1382
* @return the saved object.
1364
1383
* @throws IllegalArgumentException in case the {@code objectToSave} is collection-like.
1384
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1385
+ * {@link #getCollectionName(Class) derived} from the given object type.
1365
1386
*/
1366
1387
<T > T save (T objectToSave );
1367
1388
@@ -1396,9 +1417,11 @@ default long exactCount(Query query, String collectionName) {
1396
1417
* the existing object. Must not be {@literal null}.
1397
1418
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
1398
1419
* @return the {@link UpdateResult} which lets you access the results of the previous write.
1399
- * @since 3.0
1400
1420
* @see Update
1401
1421
* @see AggregationUpdate
1422
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1423
+ * {@link #getCollectionName(Class) derived} from the given type.
1424
+ * @since 3.0
1402
1425
*/
1403
1426
UpdateResult upsert (Query query , UpdateDefinition update , Class <?> entityClass );
1404
1427
@@ -1450,9 +1473,11 @@ default long exactCount(Query query, String collectionName) {
1450
1473
* the existing. Must not be {@literal null}.
1451
1474
* @param entityClass class that determines the collection to use.
1452
1475
* @return the {@link UpdateResult} which lets you access the results of the previous write.
1453
- * @since 3.0
1454
1476
* @see Update
1455
1477
* @see AggregationUpdate
1478
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1479
+ * {@link #getCollectionName(Class) derived} from the given type.
1480
+ * @since 3.0
1456
1481
*/
1457
1482
UpdateResult updateFirst (Query query , UpdateDefinition update , Class <?> entityClass );
1458
1483
@@ -1504,9 +1529,11 @@ default long exactCount(Query query, String collectionName) {
1504
1529
* the existing. Must not be {@literal null}.
1505
1530
* @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
1506
1531
* @return the {@link UpdateResult} which lets you access the results of the previous write.
1507
- * @since 3.0
1532
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1533
+ * {@link #getCollectionName(Class) derived} from the given type.
1508
1534
* @see Update
1509
1535
* @see AggregationUpdate
1536
+ * @since 3.0
1510
1537
*/
1511
1538
UpdateResult updateMulti (Query query , UpdateDefinition update , Class <?> entityClass );
1512
1539
@@ -1554,6 +1581,8 @@ default long exactCount(Query query, String collectionName) {
1554
1581
*
1555
1582
* @param object must not be {@literal null}.
1556
1583
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
1584
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1585
+ * {@link #getCollectionName(Class) derived} from the given object type.
1557
1586
*/
1558
1587
DeleteResult remove (Object object );
1559
1588
@@ -1577,6 +1606,8 @@ default long exactCount(Query query, String collectionName) {
1577
1606
* @param entityClass class that determines the collection to use.
1578
1607
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
1579
1608
* @throws IllegalArgumentException when {@literal query} or {@literal entityClass} is {@literal null}.
1609
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1610
+ * {@link #getCollectionName(Class) derived} from the given type.
1580
1611
*/
1581
1612
DeleteResult remove (Query query , Class <?> entityClass );
1582
1613
@@ -1624,6 +1655,8 @@ default long exactCount(Query query, String collectionName) {
1624
1655
* @param query the query document that specifies the criteria used to find and remove documents.
1625
1656
* @param entityClass class of the pojo to be operated on.
1626
1657
* @return the {@link List} converted objects deleted by this operation.
1658
+ * @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
1659
+ * {@link #getCollectionName(Class) derived} from the given type.
1627
1660
* @since 1.5
1628
1661
*/
1629
1662
<T > List <T > findAllAndRemove (Query query , Class <T > entityClass );
0 commit comments