MongoDB C++ Driver  mongocxx-3.3.2
All Classes Namespaces Functions Enumerations Enumerator Friends Pages
index_view.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 <string>
18 #include <vector>
19 
20 #include <bsoncxx/document/value.hpp>
21 #include <bsoncxx/stdx/optional.hpp>
22 #include <mongocxx/client_session.hpp>
23 #include <mongocxx/cursor.hpp>
24 #include <mongocxx/index_model.hpp>
25 #include <mongocxx/options/index_view.hpp>
26 
27 #include <mongocxx/config/prelude.hpp>
28 
29 namespace mongocxx {
30 MONGOCXX_INLINE_NAMESPACE_BEGIN
31 
32 class MONGOCXX_API index_view {
33  public:
34  index_view(index_view&&) noexcept;
35  index_view& operator=(index_view&&) noexcept;
36 
37  ~index_view();
38 
44  cursor list();
45 
52  cursor list(const client_session& session);
53 
57 
81  stdx::optional<std::string> create_one(
83  const bsoncxx::document::view_or_value& index_options = {},
84  const options::index_view& options = options::index_view{});
85 
109  stdx::optional<std::string> create_one(
110  const client_session& session,
112  const bsoncxx::document::view_or_value& index_options = {},
113  const options::index_view& options = options::index_view{});
114 
118 
139  stdx::optional<std::string> create_one(
140  const index_model& index, const options::index_view& options = options::index_view{});
141 
162  stdx::optional<std::string> create_one(
163  const client_session& session,
164  const index_model& index,
165  const options::index_view& options = options::index_view{});
166 
170 
191  bsoncxx::document::value create_many(
192  const std::vector<index_model>& indexes,
193  const options::index_view& options = options::index_view{});
194 
215  bsoncxx::document::value create_many(
216  const client_session& session,
217  const std::vector<index_model>& indexes,
218  const options::index_view& options = options::index_view{});
219 
223 
242  void drop_one(stdx::string_view name,
243  const options::index_view& options = options::index_view{});
244 
263  void drop_one(const client_session& session,
264  stdx::string_view name,
265  const options::index_view& options = options::index_view{});
266 
270 
295  void drop_one(const bsoncxx::document::view_or_value& keys,
296  const bsoncxx::document::view_or_value& index_options = {},
297  const options::index_view& options = options::index_view{});
298 
323  void drop_one(const client_session& session,
325  const bsoncxx::document::view_or_value& index_options = {},
326  const options::index_view& options = options::index_view{});
327 
331 
352  void drop_one(const index_model& index,
353  const options::index_view& options = options::index_view{});
354 
375  void drop_one(const client_session& session,
376  const index_model& index,
377  const options::index_view& options = options::index_view{});
378 
382 
397  void drop_all(const options::index_view& options = options::index_view{});
398 
413  void drop_all(const client_session& session,
414  const options::index_view& options = options::index_view{});
415 
419 
420  private:
421  friend class collection;
422  class MONGOCXX_PRIVATE impl;
423 
424  MONGOCXX_PRIVATE index_view(void* coll);
425 
426  MONGOCXX_PRIVATE impl& _get_impl();
427 
428  private:
429  std::unique_ptr<impl> _impl;
430 };
431 
432 MONGOCXX_INLINE_NAMESPACE_END
433 } // namespace mongocxx
434 
435 #include <mongocxx/config/postlude.hpp>
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
A read-only BSON document that owns its underlying buffer.
Definition: value.hpp:33
Class representing a pointer to the result set of a query on a MongoDB server.
Definition: cursor.hpp:36
Use a session for a sequence of operations, optionally with causal consistency.
Definition: client_session.hpp:38
Definition: index_view.hpp:32
Class representing optional arguments to IndexView operations.
Definition: index_view.hpp:31
Class representing an index on a MongoDB server.
Definition: index_model.hpp:29
Class representing server side document groupings within a MongoDB database.
Definition: collection.hpp:87