@@ -76,6 +76,19 @@ public Mono<T> findById(Mono<ID> mono) {
76
76
id -> mongoOperations .findById (id , entityInformation .getJavaType (), entityInformation .getCollectionName ()));
77
77
}
78
78
79
+ /*
80
+ * (non-Javadoc)
81
+ * @see org.springframework.data.repository.query.ReactiveQueryByExampleExecutor#findOne(org.springframework.data.domain.Example)
82
+ */
83
+ @ Override
84
+ public <S extends T > Mono <S > findOne (Example <S > example ) {
85
+
86
+ Assert .notNull (example , "Sample must not be null!" );
87
+
88
+ Query q = new Query (new Criteria ().alike (example ));
89
+ return mongoOperations .findOne (q , example .getProbeType (), entityInformation .getCollectionName ());
90
+ }
91
+
79
92
/*
80
93
* (non-Javadoc)
81
94
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#existsById(java.lang.Object)
@@ -103,6 +116,23 @@ public Mono<Boolean> existsById(Mono<ID> mono) {
103
116
104
117
}
105
118
119
+ /*
120
+ * (non-Javadoc)
121
+ * @see org.springframework.data.repository.query.ReactiveQueryByExampleExecutor#exists(org.springframework.data.domain.Example)
122
+ */
123
+ @ Override
124
+ public <S extends T > Mono <Boolean > exists (Example <S > example ) {
125
+
126
+ Assert .notNull (example , "Sample must not be null!" );
127
+
128
+ Query q = new Query (new Criteria ().alike (example ));
129
+ return mongoOperations .exists (q , example .getProbeType (), entityInformation .getCollectionName ());
130
+ }
131
+
132
+ /*
133
+ * (non-Javadoc)
134
+ * @see org.springframework.data.repository.reactive.ReactiveSortingRepository#findAll()
135
+ */
106
136
@ Override
107
137
public Flux <T > findAll () {
108
138
return findAll (new Query ());
@@ -170,10 +200,24 @@ public <S extends T> Flux<S> findAll(Example<S> example) {
170
200
* (non-Javadoc)
171
201
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#count()
172
202
*/
203
+ @ Override
173
204
public Mono <Long > count () {
174
205
return mongoOperations .count (new Query (), entityInformation .getCollectionName ());
175
206
}
176
207
208
+ /*
209
+ * (non-Javadoc)
210
+ * @see org.springframework.data.repository.query.ReactiveQueryByExampleExecutor#count(org.springframework.data.domain.Example)
211
+ */
212
+ @ Override
213
+ public <S extends T > Mono <Long > count (Example <S > example ) {
214
+
215
+ Assert .notNull (example , "Sample must not be null!" );
216
+
217
+ Query q = new Query (new Criteria ().alike (example ));
218
+ return mongoOperations .count (q , example .getProbeType (), entityInformation .getCollectionName ());
219
+ }
220
+
177
221
/*
178
222
* (non-Javadoc)
179
223
* @see org.springframework.data.mongodb.repository.ReactiveMongoRepository#insert(java.lang.Object)
@@ -315,34 +359,11 @@ public Mono<Void> deleteAll(Publisher<? extends T> entityStream) {
315
359
* (non-Javadoc)
316
360
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#deleteAll()
317
361
*/
362
+ @ Override
318
363
public Mono <Void > deleteAll () {
319
364
return mongoOperations .remove (new Query (), entityInformation .getCollectionName ()).then (Mono .empty ());
320
365
}
321
366
322
- public <S extends T > Mono <Boolean > exists (Example <S > example ) {
323
-
324
- Assert .notNull (example , "Sample must not be null!" );
325
-
326
- Query q = new Query (new Criteria ().alike (example ));
327
- return mongoOperations .exists (q , example .getProbeType (), entityInformation .getCollectionName ());
328
- }
329
-
330
- public <S extends T > Mono <S > findOne (Example <S > example ) {
331
-
332
- Assert .notNull (example , "Sample must not be null!" );
333
-
334
- Query q = new Query (new Criteria ().alike (example ));
335
- return mongoOperations .findOne (q , example .getProbeType (), entityInformation .getCollectionName ());
336
- }
337
-
338
- public <S extends T > Mono <Long > count (Example <S > example ) {
339
-
340
- Assert .notNull (example , "Sample must not be null!" );
341
-
342
- Query q = new Query (new Criteria ().alike (example ));
343
- return mongoOperations .count (q , example .getProbeType (), entityInformation .getCollectionName ());
344
- }
345
-
346
367
private Query getIdQuery (Object id ) {
347
368
return new Query (getIdCriteria (id ));
348
369
}
0 commit comments