MongoDB C++ Driver 4.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
index_view.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 <string>
18#include <vector>
19
22
25
27#include <mongocxx/cursor.hpp>
30
32
33namespace mongocxx {
34namespace v_noabi {
35
42class index_view {
43 public:
44 MONGOCXX_ABI_EXPORT_CDECL() index_view(index_view&&) noexcept;
45 MONGOCXX_ABI_EXPORT_CDECL(index_view&) operator=(index_view&&) noexcept;
46
47 MONGOCXX_ABI_EXPORT_CDECL() ~index_view();
48
49 index_view(index_view const&) = delete;
50 MONGOCXX_ABI_EXPORT_CDECL(index_view&) operator=(index_view const&) = delete;
51
56
64
89 bsoncxx::v_noabi::document::view_or_value const& keys,
90 bsoncxx::v_noabi::document::view_or_value const& index_options = {},
92
119 client_session const& session,
120 bsoncxx::v_noabi::document::view_or_value const& keys,
121 bsoncxx::v_noabi::document::view_or_value const& index_options = {},
123
144 create_one(index_model const& index, options::index_view const& options = options::index_view{});
145
169 client_session const& session,
170 index_model const& index,
171 options::index_view const& options = options::index_view{});
172
193 create_many(std::vector<index_model> const& indexes, options::index_view const& options = options::index_view{});
194
218 client_session const& session,
219 std::vector<index_model> const& indexes,
220 options::index_view const& options = options::index_view{});
221
240 drop_one(bsoncxx::v_noabi::stdx::string_view name, options::index_view const& options = options::index_view{});
241
263 client_session const& session,
264 bsoncxx::v_noabi::stdx::string_view name,
265 options::index_view const& options = options::index_view{});
266
293 bsoncxx::v_noabi::document::view_or_value const& keys,
294 bsoncxx::v_noabi::document::view_or_value const& index_options = {},
296
325 client_session const& session,
326 bsoncxx::v_noabi::document::view_or_value const& keys,
327 bsoncxx::v_noabi::document::view_or_value const& index_options = {},
329
351 drop_one(index_model const& index, options::index_view const& options = options::index_view{});
352
377 client_session const& session,
378 index_model const& index,
379 options::index_view const& options = options::index_view{});
380
395 drop_all(options::index_view const& options = options::index_view{});
396
413 drop_all(client_session const& session, options::index_view const& options = options::index_view{});
414
415 private:
416 friend ::mongocxx::v_noabi::collection;
417 class impl;
418
419 index_view(void* coll, void* client);
420
421 impl& _get_impl();
422
423 private:
424 std::unique_ptr<impl> _impl;
425};
426
427} // namespace v_noabi
428} // namespace mongocxx
429
431
A polyfill for std::optional<T>.
Definition optional.hpp:800
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:39
Supports MongoDB client session operations.
Definition client_session.hpp:50
A client connection to a MongoDB server.
Definition client.hpp:61
A cursor over the documents returned by a query to a MongoDB server.
Definition cursor.hpp:42
Used by mongocxx::v_noabi::index_view.
Definition index_model.hpp:32
A MongoDB index.
Definition index_view.hpp:42
cursor list()
Returns a cursor over all the indexes.
void drop_one(bsoncxx::v_noabi::stdx::string_view name, options::index_view const &options=options::index_view{})
Drops a single index by name.
void drop_all(options::index_view const &options=options::index_view{})
Drops all indexes in the collection.
cursor list(client_session const &session)
Returns a cursor over all the indexes.
bsoncxx::v_noabi::document::value create_many(std::vector< index_model > const &indexes, options::index_view const &options=options::index_view{})
Adds a container of indexes to the collection.
bsoncxx::v_noabi::stdx::optional< std::string > create_one(bsoncxx::v_noabi::document::view_or_value const &keys, bsoncxx::v_noabi::document::view_or_value const &index_options={}, options::index_view const &options=options::index_view{})
Creates an index. A convenience method that calls create_many.
Used by MongoDB index view operations.
Definition index_view.hpp:35
Provides mongocxx::v_noabi::client_session.
Declares mongocxx::v_noabi::collection.
Provides mongocxx::v_noabi::cursor.
Provides bsoncxx::v_noabi::document::value.
Provides mongocxx::v_noabi::index_model.
Declares mongocxx::v_noabi::index_view.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities representing options to use with various commands.
Declares entities whose ABI stability is NOT guaranteed.
The top-level namespace within which all mongocxx library entities are declared.
Provides mongocxx::v_noabi::options::index_view.
Provides std::optional-related polyfills for library API usage.