MongoDB C++ Driver  mongocxx-3.9.0
All Classes Namespaces Functions Typedefs 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 inline namespace v_noabi {
34 class MONGOCXX_API index_view {
35  public:
36  index_view(index_view&&) noexcept;
37  index_view& operator=(index_view&&) noexcept;
38 
39  ~index_view();
40 
47 
54  cursor list(const client_session& session);
55 
59 
83  stdx::optional<std::string> create_one(
84  const bsoncxx::document::view_or_value& keys,
85  const bsoncxx::document::view_or_value& index_options = {},
86  const options::index_view& options = options::index_view{});
87 
111  stdx::optional<std::string> create_one(
112  const client_session& session,
113  const bsoncxx::document::view_or_value& keys,
114  const bsoncxx::document::view_or_value& index_options = {},
115  const options::index_view& options = options::index_view{});
116 
120 
141  stdx::optional<std::string> create_one(
142  const index_model& index, const options::index_view& options = options::index_view{});
143 
164  stdx::optional<std::string> create_one(
165  const client_session& session,
166  const index_model& index,
167  const options::index_view& options = options::index_view{});
168 
172 
193  bsoncxx::document::value create_many(
194  const std::vector<index_model>& indexes,
195  const options::index_view& options = options::index_view{});
196 
217  bsoncxx::document::value create_many(
218  const client_session& session,
219  const std::vector<index_model>& indexes,
220  const options::index_view& options = options::index_view{});
221 
225 
244  void drop_one(stdx::string_view name,
245  const options::index_view& options = options::index_view{});
246 
265  void drop_one(const client_session& session,
266  stdx::string_view name,
267  const options::index_view& options = options::index_view{});
268 
272 
297  void drop_one(const bsoncxx::document::view_or_value& keys,
298  const bsoncxx::document::view_or_value& index_options = {},
299  const options::index_view& options = options::index_view{});
300 
325  void drop_one(const client_session& session,
326  const bsoncxx::document::view_or_value& keys,
327  const bsoncxx::document::view_or_value& index_options = {},
328  const options::index_view& options = options::index_view{});
329 
333 
354  void drop_one(const index_model& index,
355  const options::index_view& options = options::index_view{});
356 
377  void drop_one(const client_session& session,
378  const index_model& index,
379  const options::index_view& options = options::index_view{});
380 
384 
400 
415  void drop_all(const client_session& session,
416  const options::index_view& options = options::index_view{});
417 
421 
422  private:
423  friend class collection;
424  class MONGOCXX_PRIVATE impl;
425 
426  MONGOCXX_PRIVATE index_view(void* coll, void* client);
427 
428  MONGOCXX_PRIVATE impl& _get_impl();
429 
430  private:
431  std::unique_ptr<impl> _impl;
432 };
433 
434 } // namespace v_noabi
435 } // namespace mongocxx
436 
437 #include <mongocxx/config/postlude.hpp>
Use a session for a sequence of operations, optionally with either causal consistency or snapshots.
Definition: client_session.hpp:40
Class representing a client connection to MongoDB.
Definition: client.hpp:54
Class representing server side document groupings within a MongoDB database.
Definition: collection.hpp:85
Class representing a pointer to the result set of a query on a MongoDB server.
Definition: cursor.hpp:36
Class representing an index on a MongoDB server.
Definition: index_model.hpp:28
Class representing a MongoDB index view.
Definition: index_view.hpp:34
void drop_one(const client_session &session, const index_model &index, const options::index_view &options=options::index_view{})
Attempts to drop a single index from the collection given an index model.
cursor list()
Returns a cursor over all the indexes.
void drop_one(stdx::string_view name, const options::index_view &options=options::index_view{})
Drops a single index by name.
stdx::optional< std::string > create_one(const client_session &session, const index_model &index, const options::index_view &options=options::index_view{})
Creates an index.
void drop_all(const client_session &session, const options::index_view &options=options::index_view{})
Drops all indexes in the collection.
void drop_all(const options::index_view &options=options::index_view{})
Drops all indexes in the collection.
stdx::optional< std::string > create_one(const client_session &session, const bsoncxx::document::view_or_value &keys, const bsoncxx::document::view_or_value &index_options={}, const options::index_view &options=options::index_view{})
Creates an index.
void drop_one(const bsoncxx::document::view_or_value &keys, const bsoncxx::document::view_or_value &index_options={}, const options::index_view &options=options::index_view{})
Attempts to drop a single index from the collection given the keys and options.
void drop_one(const client_session &session, const bsoncxx::document::view_or_value &keys, const bsoncxx::document::view_or_value &index_options={}, const options::index_view &options=options::index_view{})
Attempts to drop a single index from the collection given the keys and options.
stdx::optional< std::string > create_one(const index_model &index, const options::index_view &options=options::index_view{})
Creates an index.
bsoncxx::document::value create_many(const client_session &session, const std::vector< index_model > &indexes, const options::index_view &options=options::index_view{})
Adds a container of indexes to the collection.
stdx::optional< std::string > create_one(const bsoncxx::document::view_or_value &keys, const bsoncxx::document::view_or_value &index_options={}, const options::index_view &options=options::index_view{})
Creates an index.
bsoncxx::document::value create_many(const std::vector< index_model > &indexes, const options::index_view &options=options::index_view{})
Adds a container of indexes to the collection.
void drop_one(const index_model &index, const options::index_view &options=options::index_view{})
Attempts to drop a single index from the collection given an index model.
cursor list(const client_session &session)
Returns a cursor over all the indexes.
void drop_one(const client_session &session, stdx::string_view name, const options::index_view &options=options::index_view{})
Drops a single index by name.
Class representing optional arguments to IndexView operations.
Definition: index_view.hpp:31
The top-level namespace for mongocxx library entities.
Definition: bulk_write.hpp:24