|
|
|
@ -17,6 +17,7 @@ package org.springframework.data.mongodb.core; |
|
|
|
|
|
|
|
|
|
|
|
import static org.springframework.data.mongodb.core.query.SerializationUtils.*; |
|
|
|
import static org.springframework.data.mongodb.core.query.SerializationUtils.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.mongodb.client.model.*; |
|
|
|
import reactor.core.publisher.Flux; |
|
|
|
import reactor.core.publisher.Flux; |
|
|
|
import reactor.core.publisher.Mono; |
|
|
|
import reactor.core.publisher.Mono; |
|
|
|
import reactor.util.function.Tuple2; |
|
|
|
import reactor.util.function.Tuple2; |
|
|
|
@ -116,16 +117,6 @@ import com.mongodb.CursorType; |
|
|
|
import com.mongodb.MongoException; |
|
|
|
import com.mongodb.MongoException; |
|
|
|
import com.mongodb.ReadPreference; |
|
|
|
import com.mongodb.ReadPreference; |
|
|
|
import com.mongodb.WriteConcern; |
|
|
|
import com.mongodb.WriteConcern; |
|
|
|
import com.mongodb.client.model.CountOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.CreateCollectionOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.DeleteOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.FindOneAndDeleteOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.FindOneAndReplaceOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.FindOneAndUpdateOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.ReplaceOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.ReturnDocument; |
|
|
|
|
|
|
|
import com.mongodb.client.model.UpdateOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.ValidationOptions; |
|
|
|
|
|
|
|
import com.mongodb.client.model.changestream.FullDocument; |
|
|
|
import com.mongodb.client.model.changestream.FullDocument; |
|
|
|
import com.mongodb.client.result.DeleteResult; |
|
|
|
import com.mongodb.client.result.DeleteResult; |
|
|
|
import com.mongodb.client.result.InsertOneResult; |
|
|
|
import com.mongodb.client.result.InsertOneResult; |
|
|
|
@ -1247,6 +1238,15 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* (non-Javadoc) |
|
|
|
|
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#estimatedCount(java.lang.String) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Mono<Long> estimatedCount(String collectionName) { |
|
|
|
|
|
|
|
return doEstimatedCount(collectionName, new EstimatedDocumentCountOptions()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Run the actual count operation against the collection with given name. |
|
|
|
* Run the actual count operation against the collection with given name. |
|
|
|
* |
|
|
|
* |
|
|
|
@ -1261,6 +1261,12 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
collection -> collection.countDocuments(CountQuery.of(filter).toQueryDocument(), options)); |
|
|
|
collection -> collection.countDocuments(CountQuery.of(filter).toQueryDocument(), options)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected Mono<Long> doEstimatedCount(String collectionName, EstimatedDocumentCountOptions options) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return createMono(collectionName, |
|
|
|
|
|
|
|
collection -> collection.estimatedDocumentCount(options)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(reactor.core.publisher.Mono) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(reactor.core.publisher.Mono) |
|
|
|
|