25
25
26
26
import org .bson .Document ;
27
27
import org .springframework .data .domain .KeysetScrollPosition ;
28
+ import org .springframework .data .domain .Sort ;
28
29
import org .springframework .data .domain .Window ;
29
30
import org .springframework .data .geo .GeoResults ;
30
31
import org .springframework .data .mongodb .core .BulkOperations .BulkMode ;
@@ -1604,8 +1605,9 @@ default long exactCount(Query query, String collectionName) {
1604
1605
* A potential {@link org.springframework.data.annotation.Version} property of the {@literal entityClass} will be
1605
1606
* auto-incremented if not explicitly specified in the update.
1606
1607
*
1607
- * @param query the query document that specifies the criteria used to select a document to be updated. Must not be
1608
- * {@literal null}.
1608
+ * @param query the query document that specifies the criteria used to select a document to be updated. The
1609
+ * {@link Query} may define a {@link Query#with(Sort) sort order} to influence which document to update when
1610
+ * potentially matching multiple candidates. Must not be {@literal null}.
1609
1611
* @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
1610
1612
* the existing. Must not be {@literal null}.
1611
1613
* @param entityClass class that determines the collection to use.
@@ -1623,12 +1625,11 @@ default long exactCount(Query query, String collectionName) {
1623
1625
* the provided updated document. <br />
1624
1626
* <strong>NOTE:</strong> Any additional support for field mapping, versions, etc. is not available due to the lack of
1625
1627
* domain type information. Use {@link #updateFirst(Query, UpdateDefinition, Class, String)} to get full type specific
1626
- * support. <br />
1627
- * <strong>NOTE:</strong> {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
1628
- * Use {@link #findAndModify(Query, UpdateDefinition, Class, String)} instead.
1628
+ * support.
1629
1629
*
1630
- * @param query the query document that specifies the criteria used to select a document to be updated. Must not be
1631
- * {@literal null}.
1630
+ * @param query the query document that specifies the criteria used to select a document to be updated. The
1631
+ * {@link Query} may define a {@link Query#with(Sort) sort order} to influence which document to update when
1632
+ * potentially matching multiple candidates. Must not be {@literal null}.
1632
1633
* @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
1633
1634
* the existing. Must not be {@literal null}.
1634
1635
* @param collectionName name of the collection to update the object in. Must not be {@literal null}.
@@ -1646,8 +1647,9 @@ default long exactCount(Query query, String collectionName) {
1646
1647
* A potential {@link org.springframework.data.annotation.Version} property of the {@literal entityClass} will be auto
1647
1648
* incremented if not explicitly specified in the update.
1648
1649
*
1649
- * @param query the query document that specifies the criteria used to select a document to be updated. Must not be
1650
- * {@literal null}.
1650
+ * @param query the query document that specifies the criteria used to select a document to be updated. The
1651
+ * {@link Query} may define a {@link Query#with(Sort) sort order} to influence which document to update when
1652
+ * potentially matching multiple candidates. Must not be {@literal null}.
1651
1653
* @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
1652
1654
* the existing. Must not be {@literal null}.
1653
1655
* @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
@@ -1833,7 +1835,8 @@ default long exactCount(Query query, String collectionName) {
1833
1835
*
1834
1836
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
1835
1837
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
1836
- * to use. Must not be {@literal null}.
1838
+ * to use. The {@link Query} may define a {@link Query#with(Sort) sort order} to influence which document to
1839
+ * replace when potentially matching multiple candidates. Must not be {@literal null}.
1837
1840
* @param replacement the replacement document. Must not be {@literal null}.
1838
1841
* @return the {@link UpdateResult} which lets you access the results of the previous replacement.
1839
1842
* @throws org.springframework.data.mapping.MappingException if the collection name cannot be
@@ -1850,7 +1853,8 @@ default <T> UpdateResult replace(Query query, T replacement) {
1850
1853
*
1851
1854
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
1852
1855
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
1853
- * to use. Must not be {@literal null}.
1856
+ * to use. The {@link Query} may define a {@link Query#with(Sort) sort order} to influence which document to
1857
+ * replace when potentially matching multiple candidates. Must not be {@literal null}.
1854
1858
* @param replacement the replacement document. Must not be {@literal null}.
1855
1859
* @param collectionName the collection to query. Must not be {@literal null}.
1856
1860
* @return the {@link UpdateResult} which lets you access the results of the previous replacement.
@@ -1866,7 +1870,8 @@ default <T> UpdateResult replace(Query query, T replacement, String collectionNa
1866
1870
*
1867
1871
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document.The query may
1868
1872
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
1869
- * to use. Must not be {@literal null}.
1873
+ * to use. The {@link Query} may define a {@link Query#with(Sort) sort order} to influence which document to
1874
+ * replace when potentially matching multiple candidates. Must not be {@literal null}.
1870
1875
* @param replacement the replacement document. Must not be {@literal null}.
1871
1876
* @param options the {@link ReplaceOptions} holding additional information. Must not be {@literal null}.
1872
1877
* @return the {@link UpdateResult} which lets you access the results of the previous replacement.
@@ -1884,7 +1889,8 @@ default <T> UpdateResult replace(Query query, T replacement, ReplaceOptions opti
1884
1889
*
1885
1890
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may *
1886
1891
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
1887
- * to use. Must not be {@literal null}.
1892
+ * to use. The {@link Query} may define a {@link Query#with(Sort) sort order} to influence which document to
1893
+ * replace when potentially matching multiple candidates. Must not be {@literal null}.
1888
1894
* @param replacement the replacement document. Must not be {@literal null}.
1889
1895
* @param options the {@link ReplaceOptions} holding additional information. Must not be {@literal null}.
1890
1896
* @return the {@link UpdateResult} which lets you access the results of the previous replacement.
0 commit comments