@@ -49,6 +49,8 @@ class TypedCriteria(
49
49
50
50
/* *
51
51
* Creates a criterion using equality.
52
+ * @author Tjeu Kayim
53
+ * @since 2.2
52
54
* @see Criteria.isEqualTo
53
55
*/
54
56
infix fun <T > KProperty<T>.isEqualTo (value : T ) = TypedCriteria ({ isEqualTo(value) }, this )
@@ -57,6 +59,8 @@ infix fun <T> KProperty<T>.isEqualTo(value: T) = TypedCriteria({ isEqualTo(value
57
59
* Creates a criterion using the $ne operator.
58
60
*
59
61
* See [MongoDB Query operator: $ne](https://docs.mongodb.com/manual/reference/operator/query/ne/)
62
+ * @author Tjeu Kayim
63
+ * @since 2.2
60
64
* @see Criteria.ne
61
65
*/
62
66
infix fun <T > KProperty<T>.ne (value : T ) = TypedCriteria ({ ne(value) }, this )
@@ -65,6 +69,8 @@ infix fun <T> KProperty<T>.ne(value: T) = TypedCriteria({ ne(value) }, this)
65
69
* Creates a criterion using the $lt operator.
66
70
*
67
71
* See [MongoDB Query operator: $lt](https://docs.mongodb.com/manual/reference/operator/query/lt/)
72
+ * @author Tjeu Kayim
73
+ * @since 2.2
68
74
* @see Criteria.lt
69
75
*/
70
76
infix fun <T > KProperty<T>.lt (value : T ) = TypedCriteria ({ lt(value) }, this )
@@ -73,6 +79,8 @@ infix fun <T> KProperty<T>.lt(value: T) = TypedCriteria({ lt(value) }, this)
73
79
* Creates a criterion using the $lte operator.
74
80
*
75
81
* See [MongoDB Query operator: $lte](https://docs.mongodb.com/manual/reference/operator/query/lte/)
82
+ * @author Tjeu Kayim
83
+ * @since 2.2
76
84
* @see Criteria.lte
77
85
*/
78
86
infix fun <T > KProperty<T>.lte (value : T ) = TypedCriteria ({ lte(value) }, this )
@@ -81,6 +89,8 @@ infix fun <T> KProperty<T>.lte(value: T) = TypedCriteria({ lte(value) }, this)
81
89
* Creates a criterion using the $gt operator.
82
90
*
83
91
* See [MongoDB Query operator: $gt](https://docs.mongodb.com/manual/reference/operator/query/gt/)
92
+ * @author Tjeu Kayim
93
+ * @since 2.2
84
94
* @see Criteria.gt
85
95
*/
86
96
infix fun <T > KProperty<T>.gt (value : T ) = TypedCriteria ({ gt(value) }, this )
@@ -89,6 +99,8 @@ infix fun <T> KProperty<T>.gt(value: T) = TypedCriteria({ gt(value) }, this)
89
99
* Creates a criterion using the $gte operator.
90
100
*
91
101
* See [MongoDB Query operator: $gte](https://docs.mongodb.com/manual/reference/operator/query/gte/)
102
+ * @author Tjeu Kayim
103
+ * @since 2.2
92
104
* @see Criteria.gte
93
105
*/
94
106
infix fun <T > KProperty<T>.gte (value : T ) = TypedCriteria ({ gte(value) }, this )
@@ -97,6 +109,8 @@ infix fun <T> KProperty<T>.gte(value: T) = TypedCriteria({ gte(value) }, this)
97
109
* Creates a criterion using the $in operator.
98
110
*
99
111
* See [MongoDB Query operator: $in](https://docs.mongodb.com/manual/reference/operator/query/in/)
112
+ * @author Tjeu Kayim
113
+ * @since 2.2
100
114
* @see Criteria.inValues
101
115
*/
102
116
fun <T > KProperty<T>.inValues (vararg o : Any ) = TypedCriteria ({ `in `(* o) }, this )
@@ -105,6 +119,8 @@ fun <T> KProperty<T>.inValues(vararg o: Any) = TypedCriteria({ `in`(*o) }, this)
105
119
* Creates a criterion using the $in operator.
106
120
*
107
121
* See [MongoDB Query operator: $in](https://docs.mongodb.com/manual/reference/operator/query/in/)
122
+ * @author Tjeu Kayim
123
+ * @since 2.2
108
124
* @see Criteria.inValues
109
125
*/
110
126
infix fun <T > KProperty<T>.inValues (value : Collection <T >) = TypedCriteria ({ `in `(value) }, this )
@@ -113,6 +129,8 @@ infix fun <T> KProperty<T>.inValues(value: Collection<T>) = TypedCriteria({ `in`
113
129
* Creates a criterion using the $nin operator.
114
130
*
115
131
* See [MongoDB Query operator: $nin](https://docs.mongodb.com/manual/reference/operator/query/nin/)
132
+ * @author Tjeu Kayim
133
+ * @since 2.2
116
134
* @see Criteria.nin
117
135
*/
118
136
fun <T > KProperty<T>.nin (vararg o : Any ) = TypedCriteria ({ nin(* o) }, this )
@@ -121,6 +139,8 @@ fun <T> KProperty<T>.nin(vararg o: Any) = TypedCriteria({ nin(*o) }, this)
121
139
* Creates a criterion using the $nin operator.
122
140
*
123
141
* See [MongoDB Query operator: $nin](https://docs.mongodb.com/manual/reference/operator/query/nin/)
142
+ * @author Tjeu Kayim
143
+ * @since 2.2
124
144
* @see Criteria.nin
125
145
*/
126
146
infix fun <T > KProperty<T>.nin (value : Collection <T >) = TypedCriteria ({ nin(value) }, this )
@@ -129,6 +149,8 @@ infix fun <T> KProperty<T>.nin(value: Collection<T>) = TypedCriteria({ nin(value
129
149
* Creates a criterion using the $mod operator.
130
150
*
131
151
* See [MongoDB Query operator: $mod](https://docs.mongodb.com/manual/reference/operator/query/mod/)
152
+ * @author Tjeu Kayim
153
+ * @since 2.2
132
154
* @see Criteria.mod
133
155
*/
134
156
fun KProperty<Number>.mod (value : Number , remainder : Number ) = TypedCriteria ({ mod(value, remainder) }, this )
@@ -137,6 +159,8 @@ fun KProperty<Number>.mod(value: Number, remainder: Number) = TypedCriteria({ mo
137
159
* Creates a criterion using the $all operator.
138
160
*
139
161
* See [MongoDB Query operator: $all](https://docs.mongodb.com/manual/reference/operator/query/all/)
162
+ * @author Tjeu Kayim
163
+ * @since 2.2
140
164
* @see Criteria.all
141
165
*/
142
166
fun KProperty <* >.all (vararg o : Any ) = TypedCriteria ({ all(* o) }, this )
@@ -145,6 +169,8 @@ fun KProperty<*>.all(vararg o: Any) = TypedCriteria({ all(*o) }, this)
145
169
* Creates a criterion using the $all operator.
146
170
*
147
171
* See [MongoDB Query operator: $all](https://docs.mongodb.com/manual/reference/operator/query/all/)
172
+ * @author Tjeu Kayim
173
+ * @since 2.2
148
174
* @see Criteria.all
149
175
*/
150
176
infix fun KProperty <* >.all (value : Collection <* >) = TypedCriteria ({ all(value) }, this )
@@ -153,6 +179,8 @@ infix fun KProperty<*>.all(value: Collection<*>) = TypedCriteria({ all(value) },
153
179
* Creates a criterion using the $size operator.
154
180
*
155
181
* See [MongoDB Query operator: $size](https://docs.mongodb.com/manual/reference/operator/query/size/)
182
+ * @author Tjeu Kayim
183
+ * @since 2.2
156
184
* @see Criteria.size
157
185
*/
158
186
infix fun KProperty <* >.size (s : Int ) = TypedCriteria ({ size(s) }, this )
@@ -161,6 +189,8 @@ infix fun KProperty<*>.size(s: Int) = TypedCriteria({ size(s) }, this)
161
189
* Creates a criterion using the $exists operator.
162
190
*
163
191
* See [MongoDB Query operator: $exists](https://docs.mongodb.com/manual/reference/operator/query/exists/)
192
+ * @author Tjeu Kayim
193
+ * @since 2.2
164
194
* @see Criteria.exists
165
195
*/
166
196
infix fun KProperty <* >.exists (b : Boolean ) = TypedCriteria ({ exists(b) }, this )
@@ -169,6 +199,8 @@ infix fun KProperty<*>.exists(b: Boolean) = TypedCriteria({ exists(b) }, this)
169
199
* Creates a criterion using the $type operator.
170
200
*
171
201
* See [MongoDB Query operator: $type](https://docs.mongodb.com/manual/reference/operator/query/type/)
202
+ * @author Tjeu Kayim
203
+ * @since 2.2
172
204
* @see Criteria.type
173
205
*/
174
206
infix fun KProperty <* >.type (t : Int ) = TypedCriteria ({ type(t) }, this )
@@ -177,6 +209,8 @@ infix fun KProperty<*>.type(t: Int) = TypedCriteria({ type(t) }, this)
177
209
* Creates a criterion using the $type operator.
178
210
*
179
211
* See [MongoDB Query operator: $type](https://docs.mongodb.com/manual/reference/operator/query/type/)
212
+ * @author Tjeu Kayim
213
+ * @since 2.2
180
214
* @see Criteria.type
181
215
*/
182
216
infix fun KProperty <* >.type (t : Collection <JsonSchemaObject .Type >) = TypedCriteria ({ type(* t.toTypedArray()) }, this )
@@ -185,6 +219,8 @@ infix fun KProperty<*>.type(t: Collection<JsonSchemaObject.Type>) = TypedCriteri
185
219
* Creates a criterion using the $type operator.
186
220
*
187
221
* See [MongoDB Query operator: $type](https://docs.mongodb.com/manual/reference/operator/query/type/)
222
+ * @author Tjeu Kayim
223
+ * @since 2.2
188
224
* @see Criteria.type
189
225
*/
190
226
fun KProperty <* >.type (vararg t : JsonSchemaObject .Type ) = TypedCriteria ({ type(* t) }, this )
@@ -193,6 +229,8 @@ fun KProperty<*>.type(vararg t: JsonSchemaObject.Type) = TypedCriteria({ type(*t
193
229
* Creates a criterion using the $not meta operator which affects the clause directly following
194
230
*
195
231
* See [MongoDB Query operator: $not](https://docs.mongodb.com/manual/reference/operator/query/not/)
232
+ * @author Tjeu Kayim
233
+ * @since 2.2
196
234
* @see Criteria.not
197
235
*/
198
236
fun KProperty <* >.not () = TypedCriteria ({ not () }, this )
@@ -201,6 +239,8 @@ fun KProperty<*>.not() = TypedCriteria({ not() }, this)
201
239
* Creates a criterion using a $regex operator.
202
240
*
203
241
* See [MongoDB Query operator: $regex](https://docs.mongodb.com/manual/reference/operator/query/regex/)
242
+ * @author Tjeu Kayim
243
+ * @since 2.2
204
244
* @see Criteria.regex
205
245
*/
206
246
infix fun KProperty<String?>.regex (re : String ) = TypedCriteria ({ regex(re, null ) }, this )
@@ -209,24 +249,32 @@ infix fun KProperty<String?>.regex(re: String) = TypedCriteria({ regex(re, null)
209
249
* Creates a criterion using a $regex and $options operator.
210
250
*
211
251
* See [MongoDB Query operator: $regex](https://docs.mongodb.com/manual/reference/operator/query/regex/)
252
+ * @author Tjeu Kayim
253
+ * @since 2.2
212
254
* @see Criteria.regex
213
255
*/
214
256
fun KProperty<String?>.regex (re : String , options : String? ) = TypedCriteria ({ regex(re, options) }, this )
215
257
216
258
/* *
217
259
* Syntactical sugar for [isEqualTo] making obvious that we create a regex predicate.
260
+ * @author Tjeu Kayim
261
+ * @since 2.2
218
262
* @see Criteria.regex
219
263
*/
220
264
infix fun KProperty<String?>.regex (re : Regex ) = TypedCriteria ({ regex(re.toPattern()) }, this )
221
265
222
266
/* *
223
267
* Syntactical sugar for [isEqualTo] making obvious that we create a regex predicate.
268
+ * @author Tjeu Kayim
269
+ * @since 2.2
224
270
* @see Criteria.regex
225
271
*/
226
272
infix fun KProperty<String?>.regex (re : Pattern ) = TypedCriteria ({ regex(re) }, this )
227
273
228
274
/* *
229
275
* Syntactical sugar for [isEqualTo] making obvious that we create a regex predicate.
276
+ * @author Tjeu Kayim
277
+ * @since 2.2
230
278
* @see Criteria.regex
231
279
*/
232
280
infix fun KProperty<String?>.regex (re : BsonRegularExpression ) = TypedCriteria ({ regex(re) }, this )
@@ -240,6 +288,8 @@ infix fun KProperty<String?>.regex(re: BsonRegularExpression) = TypedCriteria({
240
288
*
241
289
* See [MongoDB Query operator:
242
290
* $centerSphere](https://docs.mongodb.com/manual/reference/operator/query/centerSphere/)
291
+ * @author Tjeu Kayim
292
+ * @since 2.2
243
293
* @see Criteria.withinSphere
244
294
*/
245
295
infix fun KProperty <GeoJson <* >>.withinSphere (circle : Circle ) = TypedCriteria ({ withinSphere(circle) }, this )
@@ -249,6 +299,8 @@ infix fun KProperty<GeoJson<*>>.withinSphere(circle: Circle) = TypedCriteria({ w
249
299
*
250
300
* See [MongoDB Query operator:
251
301
* $geoWithin](https://docs.mongodb.com/manual/reference/operator/query/geoWithin/)
302
+ * @author Tjeu Kayim
303
+ * @since 2.2
252
304
* @see Criteria.within
253
305
*/
254
306
infix fun KProperty <GeoJson <* >>.within (shape : Shape ) = TypedCriteria ({ within(shape) }, this )
@@ -257,6 +309,8 @@ infix fun KProperty<GeoJson<*>>.within(shape: Shape) = TypedCriteria({ within(sh
257
309
* Creates a geospatial criterion using a $near operation.
258
310
*
259
311
* See [MongoDB Query operator: $near](https://docs.mongodb.com/manual/reference/operator/query/near/)
312
+ * @author Tjeu Kayim
313
+ * @since 2.2
260
314
* @see Criteria.near
261
315
*/
262
316
infix fun KProperty <GeoJson <* >>.near (point : Point ) = TypedCriteria ({ near(point) }, this )
@@ -267,13 +321,17 @@ infix fun KProperty<GeoJson<*>>.near(point: Point) = TypedCriteria({ near(point)
267
321
*
268
322
* See [MongoDB Query operator:
269
323
* $nearSphere](https://docs.mongodb.com/manual/reference/operator/query/nearSphere/)
324
+ * @author Tjeu Kayim
325
+ * @since 2.2
270
326
* @see Criteria.nearSphere
271
327
*/
272
328
infix fun KProperty <GeoJson <* >>.nearSphere (point : Point ) = TypedCriteria ({ nearSphere(point) }, this )
273
329
274
330
/* *
275
331
* Creates criterion using `$geoIntersects` operator which matches intersections of the given `geoJson`
276
332
* structure and the documents one. Requires MongoDB 2.4 or better.
333
+ * @author Tjeu Kayim
334
+ * @since 2.2
277
335
* @see Criteria.intersects
278
336
*/
279
337
infix fun KProperty <GeoJson <* >>.intersects (geoJson : GeoJson <* >) = TypedCriteria ({ intersects(geoJson) }, this )
@@ -283,13 +341,17 @@ infix fun KProperty<GeoJson<*>>.intersects(geoJson: GeoJson<*>) = TypedCriteria(
283
341
*
284
342
* See [MongoDB Query operator:
285
343
* $maxDistance](https://docs.mongodb.com/manual/reference/operator/query/maxDistance/)
344
+ * @author Tjeu Kayim
345
+ * @since 2.2
286
346
* @see Criteria.maxDistance
287
347
*/
288
348
infix fun KProperty <GeoJson <* >>.maxDistance (d : Double ) = TypedCriteria ({ maxDistance(d) }, this )
289
349
290
350
/* *
291
351
* Creates a geospatial criterion using a $minDistance operation, for use with $near or
292
352
* $nearSphere.
353
+ * @author Tjeu Kayim
354
+ * @since 2.2
293
355
* @see Criteria.minDistance
294
356
*/
295
357
infix fun KProperty <GeoJson <* >>.minDistance (d : Double ) = TypedCriteria ({ minDistance(d) }, this )
@@ -299,6 +361,8 @@ infix fun KProperty<GeoJson<*>>.minDistance(d: Double) = TypedCriteria({ minDist
299
361
*
300
362
* See [MongoDB Query operator:
301
363
* $elemMatch](https://docs.mongodb.com/manual/reference/operator/query/elemMatch/)
364
+ * @author Tjeu Kayim
365
+ * @since 2.2
302
366
* @see Criteria.elemMatch
303
367
*/
304
368
infix fun KProperty <* >.elemMatch (c : Criteria ) = TypedCriteria ({ elemMatch(c) }, this )
@@ -308,12 +372,16 @@ infix fun KProperty<*>.elemMatch(c: Criteria) = TypedCriteria({ elemMatch(c) },
308
372
*
309
373
* See [MongoDB Query operator:
310
374
* $elemMatch](https://docs.mongodb.com/manual/reference/operator/query/elemMatch/)
375
+ * @author Tjeu Kayim
376
+ * @since 2.2
311
377
* @see Criteria.elemMatch
312
378
*/
313
379
infix fun KProperty <* >.elemMatch (c : TypedCriteria ) = TypedCriteria ({ elemMatch(typedCriteria(c)) }, this )
314
380
315
381
/* *
316
382
* Creates a criterion using the given object as a pattern.
383
+ * @author Tjeu Kayim
384
+ * @since 2.2
317
385
* @see Criteria.alike
318
386
*/
319
387
fun alike (sample : Example <* >) = TypedCriteria ({ alike(sample) })
@@ -324,6 +392,8 @@ fun alike(sample: Example<*>) = TypedCriteria({ alike(sample) })
324
392
*
325
393
* See [MongoDB Query operator:
326
394
* $jsonSchema](https://docs.mongodb.com/manual/reference/operator/query/jsonSchema/)
395
+ * @author Tjeu Kayim
396
+ * @since 2.2
327
397
* @see Criteria.andDocumentStructureMatches
328
398
*/
329
399
infix fun KProperty <* >.andDocumentStructureMatches (schema : MongoJsonSchema ) =
@@ -338,6 +408,8 @@ infix fun KProperty<*>.andDocumentStructureMatches(schema: MongoJsonSchema) =
338
408
* ```
339
409
* bits { allClear(123) }
340
410
* ```
411
+ * @author Tjeu Kayim
412
+ * @since 2.2
341
413
* @see Criteria.bits
342
414
*/
343
415
infix fun KProperty <* >.bits (bitwiseCriteria : Criteria .BitwiseCriteriaOperators .() -> Criteria ) =
@@ -347,6 +419,8 @@ infix fun KProperty<*>.bits(bitwiseCriteria: Criteria.BitwiseCriteriaOperators.(
347
419
* Creates an 'or' criteria using the $or operator for all of the provided criteria
348
420
*
349
421
* Note that mongodb doesn't support an $or operator to be wrapped in a $not operator.
422
+ * @author Tjeu Kayim
423
+ * @since 2.2
350
424
* @see Criteria.orOperator
351
425
*/
352
426
fun orOperator (vararg builders : TypedCriteria ) = addOperatorWithCriteria(builders, Criteria ::orOperator)
@@ -355,6 +429,8 @@ fun orOperator(vararg builders: TypedCriteria) = addOperatorWithCriteria(builder
355
429
* Creates a 'nor' criteria using the $nor operator for all of the provided criteria.
356
430
*
357
431
* Note that mongodb doesn't support an $nor operator to be wrapped in a $not operator.
432
+ * @author Tjeu Kayim
433
+ * @since 2.2
358
434
* @see Criteria.norOperator
359
435
*/
360
436
fun norOperator (vararg builders : TypedCriteria ) = addOperatorWithCriteria(builders, Criteria ::norOperator)
@@ -363,6 +439,8 @@ fun norOperator(vararg builders: TypedCriteria) = addOperatorWithCriteria(builde
363
439
* Creates an 'and' criteria using the $and operator for all of the provided criteria.
364
440
*
365
441
* Note that mongodb doesn't support an $and operator to be wrapped in a $not operator.
442
+ * @author Tjeu Kayim
443
+ * @since 2.2
366
444
* @see Criteria.andOperator
367
445
*/
368
446
fun andOperator (vararg builders : TypedCriteria ) = addOperatorWithCriteria(builders, Criteria ::andOperator)
0 commit comments