MongoDB C++ Driver mongocxx-3.7.0
Loading...
Searching...
No Matches
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
29namespace mongocxx {
30MONGOCXX_INLINE_NAMESPACE_BEGIN
31
35class MONGOCXX_API index_view {
36 public:
37 index_view(index_view&&) noexcept;
38 index_view& operator=(index_view&&) noexcept;
39
41
48
55 cursor list(const client_session& session);
56
60
84 stdx::optional<std::string> create_one(
86 const bsoncxx::document::view_or_value& index_options = {},
87 const options::index_view& options = options::index_view{});
88
112 stdx::optional<std::string> create_one(
113 const client_session& session,
115 const bsoncxx::document::view_or_value& index_options = {},
116 const options::index_view& options = options::index_view{});
117
121
142 stdx::optional<std::string> create_one(
143 const index_model& index, const options::index_view& options = options::index_view{});
144
165 stdx::optional<std::string> create_one(
166 const client_session& session,
167 const index_model& index,
168 const options::index_view& options = options::index_view{});
169
173
195 const std::vector<index_model>& indexes,
196 const options::index_view& options = options::index_view{});
197
219 const client_session& session,
220 const std::vector<index_model>& indexes,
221 const options::index_view& options = options::index_view{});
222
226
245 void drop_one(stdx::string_view name,
246 const options::index_view& options = options::index_view{});
247
266 void drop_one(const client_session& session,
267 stdx::string_view name,
268 const options::index_view& options = options::index_view{});
269
273
299 const bsoncxx::document::view_or_value& index_options = {},
300 const options::index_view& options = options::index_view{});
301
326 void drop_one(const client_session& session,
328 const bsoncxx::document::view_or_value& index_options = {},
329 const options::index_view& options = options::index_view{});
330
334
355 void drop_one(const index_model& index,
356 const options::index_view& options = options::index_view{});
357
378 void drop_one(const client_session& session,
379 const index_model& index,
380 const options::index_view& options = options::index_view{});
381
385
401
416 void drop_all(const client_session& session,
417 const options::index_view& options = options::index_view{});
418
422
423 private:
424 friend class collection;
425 class MONGOCXX_PRIVATE impl;
426
427 MONGOCXX_PRIVATE index_view(void* coll, void* client);
428
429 MONGOCXX_PRIVATE impl& _get_impl();
430
431 private:
432 std::unique_ptr<impl> _impl;
433};
434
435MONGOCXX_INLINE_NAMESPACE_END
436} // namespace mongocxx
437
438#include <mongocxx/config/postlude.hpp>
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:34
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:58
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:83
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:29
Class representing a MongoDB index view.
Definition index_view.hpp:35
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 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.
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.
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.
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.
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.
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(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 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.
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.
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.
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.
Class representing optional arguments to IndexView operations.
Definition index_view.hpp:31
Top level namespace for the MongoDB C++ driver.
Definition bulk_write.hpp:24