MongoDB C++ Driver current
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 {
26MONGOCXX_INLINE_NAMESPACE_BEGIN
27
28namespace options {
29
42class MONGOCXX_API range {
43 public:
47
50 const stdx::optional<bsoncxx::types::bson_value::view_or_value>& min() const;
51
55
58 const stdx::optional<bsoncxx::types::bson_value::view_or_value>& max() const;
59
61 range& sparsity(std::int64_t value);
62
64 const stdx::optional<std::int64_t>& sparsity() const;
65
68 range& precision(std::int32_t value);
69
72 const stdx::optional<std::int32_t>& precision() const;
73
74 private:
75 stdx::optional<bsoncxx::types::bson_value::view_or_value> _min;
76 stdx::optional<bsoncxx::types::bson_value::view_or_value> _max;
77 stdx::optional<std::int64_t> _sparsity;
78 stdx::optional<std::int32_t> _precision;
79};
80
81} // namespace options
82
83MONGOCXX_INLINE_NAMESPACE_END
84} // namespace mongocxx
Class representing a view-or-value variant type.
Definition: view_or_value.hpp:30
RangeOpts specifies index options for a Queryable Encryption field supporting "rangePreview" queries.
Definition: range.hpp:42
const stdx::optional< std::int64_t > & sparsity() const
Gets RangeOpts.sparsity.
range & precision(std::int32_t value)
Sets RangeOpts.precision.
range & min(bsoncxx::types::bson_value::view_or_value value)
Sets 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.
const stdx::optional< bsoncxx::types::bson_value::view_or_value > & min() const
Gets RangeOpts.min.
const stdx::optional< std::int32_t > & precision() const
Gets RangeOpts.precision.
range & sparsity(std::int64_t value)
Sets RangeOpts.sparsity.
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24