MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
index.hpp
Go to the documentation of this file.
1// Copyright 2009-present 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 <chrono>
18#include <memory>
19
22
28
29#include <mongocxx/stdx.hpp>
30
32
34
35namespace mongocxx {
36namespace v_noabi {
37namespace options {
38
45class index {
46 public:
47 BSONCXX_PUSH_WARNINGS();
48 BSONCXX_DISABLE_WARNING(MSVC(4251));
49 BSONCXX_DISABLE_WARNING(MSVC(4275));
50
55 public:
56 virtual ~base_storage_options();
57
59 base_storage_options& operator=(base_storage_options&&) = default;
61 base_storage_options& operator=(const base_storage_options&) = default;
62
63 base_storage_options() = default;
64
65 private:
66 friend ::mongocxx::v_noabi::options::index;
67
68 virtual int type() const = 0;
69 };
70
75 public:
77
81 wiredtiger_storage_options& operator=(const wiredtiger_storage_options&) = default;
82
84
92
99
100 private:
101 friend ::mongocxx::v_noabi::collection;
102
103 MONGOCXX_ABI_NO_EXPORT int type() const override;
104
106 };
107
108 BSONCXX_POP_WARNINGS();
109
111
127
133 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bool>&) background() const;
134
150
156 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bool>&) unique() const;
157
173
179 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bool>&) hidden() const;
180
192
198 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::string::view_or_value>&)
199 name() const;
200
215
225 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::document::view>&)
226 collation() const;
227
243
249 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bool>&) sparse() const;
250
263 storage_options(std::unique_ptr<base_storage_options> storage_options);
264
273 storage_options(std::unique_ptr<wiredtiger_storage_options> storage_options);
274
289 MONGOCXX_ABI_EXPORT_CDECL(index&) expire_after(std::chrono::seconds seconds);
290
296 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::chrono::seconds>&) expire_after() const;
297
309
315 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::int32_t>&) version() const;
316
329
335 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::document::view>&)
336 weights() const;
337
351
357 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::string::view_or_value>&)
359
373
379 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::string::view_or_value>&)
381
394
400 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::document::view>&)
402
414
420 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::uint8_t>&) twod_sphere_version() const;
421
433
439 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::uint8_t>&) twod_bits_precision() const;
440
452
458 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<double>&) twod_location_min() const;
459
471
477 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<double>&) twod_location_max() const;
478
499 MONGOCXX_ABI_EXPORT_CDECL(index&) haystack_bucket_size_deprecated(double haystack_bucket_size);
500
509 MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<double>&)
511 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<double>&)
512 haystack_bucket_size_deprecated() const;
513
522 MONGOCXX_ABI_EXPORT_CDECL() operator bsoncxx::v_noabi::document::view_or_value();
523
524 private:
525 friend ::mongocxx::v_noabi::collection;
526
527 stdx::optional<bool> _background;
528 stdx::optional<bool> _unique;
529 stdx::optional<bool> _hidden;
530 stdx::optional<bsoncxx::v_noabi::string::view_or_value> _name;
531 stdx::optional<bsoncxx::v_noabi::document::view> _collation;
532 stdx::optional<bool> _sparse;
533 std::unique_ptr<base_storage_options> _storage_options;
534 stdx::optional<std::chrono::seconds> _expire_after;
535 stdx::optional<std::int32_t> _version;
536 stdx::optional<bsoncxx::v_noabi::document::view> _weights;
537 stdx::optional<bsoncxx::v_noabi::string::view_or_value> _default_language;
538 stdx::optional<bsoncxx::v_noabi::string::view_or_value> _language_override;
539 stdx::optional<bsoncxx::v_noabi::document::view> _partial_filter_expression;
540 stdx::optional<std::uint8_t> _twod_sphere_version;
541 stdx::optional<std::uint8_t> _twod_bits_precision;
542 stdx::optional<double> _twod_location_min;
543 stdx::optional<double> _twod_location_max;
544 stdx::optional<double> _haystack_bucket_size;
545
546 //
547 // Return the current storage_options setting.
548 //
549 const std::unique_ptr<base_storage_options>& storage_options() const;
550};
551
552} // namespace options
553} // namespace v_noabi
554} // namespace mongocxx
555
556#include <bsoncxx/config/postlude.hpp>
557
559
The bsoncxx macro guard prelude header.
A polyfill for std::optional<T>.
Definition optional.hpp:874
Class representing a view-or-value variant type for strings.
Definition view_or_value.hpp:41
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:87
Base class representing the optional storage engine options for indexes.
Definition index.hpp:54
Class representing the optional WiredTiger storage engine options for indexes.
Definition index.hpp:74
void config_string(bsoncxx::v_noabi::string::view_or_value config_string)
Set the WiredTiger configuration string.
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & config_string() const
The current config_string setting.
Class representing the optional arguments to a MongoDB create index operation.
Definition index.hpp:45
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & language_override() const
The current name of the field that contains the override language for text indexes.
const stdx::optional< bool > & unique() const
The current unique setting.
const stdx::optional< double > & twod_location_max() const
The current upper inclusive boundary for the longitude and latitude values.
const stdx::optional< std::int32_t > & version() const
The current index version.
const stdx::optional< bsoncxx::v_noabi::document::view > & collation() const
Retrieves the current collation for this index.
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & name() const
The current name setting.
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & default_language() const
The current default_language setting.
const stdx::optional< bool > & hidden() const
The current hidden setting.
const stdx::optional< std::uint8_t > & twod_sphere_version() const
The current twod_sphere_version setting.
const stdx::optional< std::uint8_t > & twod_bits_precision() const
The current precision of the stored geohash value of the location data.
const stdx::optional< double > & twod_location_min() const
The current lower inclusive boundary for the longitude and latitude values.
const stdx::optional< bool > & sparse() const
The current sparse setting.
const stdx::optional< bool > & background() const
The current background setting.
MONGOCXX_DEPRECATED const stdx::optional< double > & haystack_bucket_size() const
The current haystack_bucket_size setting.
const stdx::optional< std::chrono::seconds > & expire_after() const
The current expire_after setting.
const stdx::optional< bsoncxx::v_noabi::document::view > & partial_filter_expression() const
The current partial_filter_expression setting.
operator bsoncxx::v_noabi::document::view_or_value()
Conversion operator that provides a view of the options in document form.
const stdx::optional< bsoncxx::v_noabi::document::view > & weights() const
The current weights setting.
Declares mongocxx::v_noabi::collection.
Provides bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view.
Provides bsoncxx::v_noabi::document::view_or_value.
#define MONGOCXX_DEPRECATED
Declares the associated entity as deprecated.
Definition fwd.hpp:258
#define MONGOCXX_ABI_NO_EXPORT
Excludes the associated entity from being part of the ABI.
Definition fwd.hpp:206
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition fwd.hpp:222
#define MONGOCXX_ABI_EXPORT
Exports the associated entity as part of the ABI.
Definition fwd.hpp:198
Declares mongocxx::v_noabi::options::index.
The mongocxx macro guard postlude header.
The mongocxx macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
The top-level namespace within which all mongocxx library entities are declared.
The top-level namespace reserved for the C++ standard library.
Provides std::optional-related polyfills for library API usage.
Redeclares bsoncxx::v_noabi::stdx in mongocxx::v_noabi::stdx for internal use.
Provides bsoncxx::v_noabi::string::view_or_value.