MongoDB C++ Driver  mongocxx-3.10.2
index_model.hpp
1 // Copyright 2017 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 <mongocxx/index_model-fwd.hpp>
18 
19 #include <bsoncxx/document/value.hpp>
20 #include <bsoncxx/document/view_or_value.hpp>
21 #include <mongocxx/options/index.hpp>
22 
23 #include <mongocxx/config/prelude.hpp>
24 
25 namespace mongocxx {
26 namespace v_noabi {
27 
31 class index_model {
32  public:
38 
39  index_model() = delete;
40 
44  index_model(index_model&&) noexcept;
45 
49  index_model& operator=(index_model&&) noexcept;
50 
55 
56  index_model& operator=(const index_model&) = delete;
57 
62 
66  bsoncxx::v_noabi::document::view keys() const;
67 
71  bsoncxx::v_noabi::document::view options() const;
72 
73  private:
74  bsoncxx::v_noabi::document::value _keys;
75  bsoncxx::v_noabi::document::value _options;
76 };
77 
78 } // namespace v_noabi
79 } // namespace mongocxx
80 
81 #include <mongocxx/config/postlude.hpp>
Class representing an index on a MongoDB server.
Definition: index_model.hpp:31
index_model(const bsoncxx::v_noabi::document::view_or_value &keys, const bsoncxx::v_noabi::document::view_or_value &options={})
Initializes a new index_model over a mongocxx::v_noabi::collection.
index_model(index_model &&) noexcept
Move constructs an index_model.
bsoncxx::v_noabi::document::view options() const
Retrieves options of an index_model.
bsoncxx::v_noabi::document::view keys() const
Retrieves keys of an index_model.
The top-level namespace for bsoncxx library entities.
Definition: element-fwd.hpp:19
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19