MongoDB C++ Driver current
Loading...
Searching...
No Matches
range.hpp
1// Copyright 2023 MongoDB Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <cstdint>
18
19#include <bsoncxx/types.hpp>
20#include <bsoncxx/types/bson_value/view_or_value.hpp>
21#include <mongocxx/stdx.hpp>
22
23#include <mongocxx/config/prelude.hpp>
24
25namespace mongocxx {
26inline namespace v_noabi {
27namespace options {
28
41class MONGOCXX_API range {
42 public:
46
49 const stdx::optional<bsoncxx::types::bson_value::view_or_value>& min() const;
50
54
57 const stdx::optional<bsoncxx::types::bson_value::view_or_value>& max() const;
58
60 range& sparsity(std::int64_t value);
61
63 const stdx::optional<std::int64_t>& sparsity() const;
64
67 range& precision(std::int32_t value);
68
71 const stdx::optional<std::int32_t>& precision() const;
72
73 private:
74 stdx::optional<bsoncxx::types::bson_value::view_or_value> _min;
75 stdx::optional<bsoncxx::types::bson_value::view_or_value> _max;
76 stdx::optional<std::int64_t> _sparsity;
77 stdx::optional<std::int32_t> _precision;
78};
79
80} // namespace options
81
82} // namespace v_noabi
83} // namespace mongocxx
84
85// CXX-2770: missing include of postlude header.
86#if defined(MONGOCXX_TEST_MACRO_GUARDS_FIX_MISSING_POSTLUDE)
87#include <mongocxx/config/postlude.hpp>
88#endif
Class representing a view-or-value variant type.
Definition view_or_value.hpp:29
RangeOpts specifies index options for a Queryable Encryption field supporting "rangePreview" queries.
Definition range.hpp:41
range & sparsity(std::int64_t value)
Sets RangeOpts.sparsity.
const stdx::optional< std::int32_t > & precision() const
Gets RangeOpts.precision.
const stdx::optional< std::int64_t > & sparsity() const
Gets RangeOpts.sparsity.
range & min(bsoncxx::types::bson_value::view_or_value value)
Sets RangeOpts.min.
const stdx::optional< bsoncxx::types::bson_value::view_or_value > & min() const
Gets RangeOpts.min.
const stdx::optional< bsoncxx::types::bson_value::view_or_value > & max() const
Gets RangeOpts.max.
range & max(bsoncxx::types::bson_value::view_or_value value)
Sets RangeOpts.max.
range & precision(std::int32_t value)
Sets RangeOpts.precision.
The top-level namespace for mongocxx library entities.
Definition bulk_write.hpp:24