MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / RangeOpts

Class RangeOpts

pymongo/encryption_options.py:271–310  ·  view source on GitHub ↗

Options to configure encrypted queries using the range algorithm.

Source from the content-addressed store, hash-verified

269
270
271class RangeOpts:
272 """Options to configure encrypted queries using the range algorithm."""
273
274 def __init__(
275 self,
276 sparsity: Optional[int] = None,
277 trim_factor: Optional[int] = None,
278 min: Optional[Any] = None,
279 max: Optional[Any] = None,
280 precision: Optional[int] = None,
281 ) -> None:
282 """Options to configure encrypted queries using the range algorithm.
283
284 :param sparsity: An integer.
285 :param trim_factor: An integer.
286 :param min: A BSON scalar value corresponding to the type being queried.
287 :param max: A BSON scalar value corresponding to the type being queried.
288 :param precision: An integer, may only be set for double or decimal128 types.
289
290 .. versionadded:: 4.4
291 """
292 self.min = min
293 self.max = max
294 self.sparsity = sparsity
295 self.trim_factor = trim_factor
296 self.precision = precision
297
298 @property
299 def document(self) -> dict[str, Any]:
300 doc = {}
301 for k, v in [
302 ("sparsity", int64.Int64(self.sparsity) if self.sparsity else None),
303 ("trimFactor", self.trim_factor),
304 ("precision", self.precision),
305 ("min", self.min),
306 ("max", self.max),
307 ]:
308 if v is not None:
309 doc[k] = v
310 return doc
311
312
313class TextOpts:

Callers 15

run_test_casesMethod · 0.90
test_double_precisionMethod · 0.90
test_datetimeMethod · 0.90
test_intMethod · 0.90
setUpMethod · 0.90
run_test_casesMethod · 0.90

Calls

no outgoing calls

Tested by 15

run_test_casesMethod · 0.72
test_double_precisionMethod · 0.72
test_datetimeMethod · 0.72
test_intMethod · 0.72
setUpMethod · 0.72
run_test_casesMethod · 0.72