MongoDB C++ Driver mongocxx-3.10.1
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 <mongocxx/collection-fwd.hpp>
21#include <mongocxx/index_view-fwd.hpp>
22
23#include <bsoncxx/document/value.hpp>
24#include <bsoncxx/stdx/optional.hpp>
25#include <mongocxx/client_session.hpp>
26#include <mongocxx/cursor.hpp>
27#include <mongocxx/index_model.hpp>
28#include <mongocxx/options/index_view.hpp>
29
30#include <mongocxx/config/prelude.hpp>
31
32namespace mongocxx {
33namespace v_noabi {
34
39 public:
40 index_view(index_view&&) noexcept;
41 index_view& operator=(index_view&&) noexcept;
42
44
51
58 cursor list(const client_session& session);
59
63
87 stdx::optional<std::string> create_one(
89 const bsoncxx::v_noabi::document::view_or_value& index_options = {},
90 const options::index_view& options = options::index_view{});
91
115 stdx::optional<std::string> create_one(
116 const client_session& session,
118 const bsoncxx::v_noabi::document::view_or_value& index_options = {},
119 const options::index_view& options = options::index_view{});
120
124
145 stdx::optional<std::string> create_one(
146 const index_model& index, const options::index_view& options = options::index_view{});
147
168 stdx::optional<std::string> create_one(
169 const client_session& session,
170 const index_model& index,
171 const options::index_view& options = options::index_view{});
172
176
198 const std::vector<index_model>& indexes,
199 const options::index_view& options = options::index_view{});
200
222 const client_session& session,
223 const std::vector<index_model>& indexes,
224 const options::index_view& options = options::index_view{});
225
229
248 void drop_one(stdx::string_view name,
249 const options::index_view& options = options::index_view{});
250
269 void drop_one(const client_session& session,
270 stdx::string_view name,
271 const options::index_view& options = options::index_view{});
272
276
303 const bsoncxx::v_noabi::document::view_or_value& index_options = {},
304 const options::index_view& options = options::index_view{});
305
331 void drop_one(const client_session& session,
333 const bsoncxx::v_noabi::document::view_or_value& index_options = {},
334 const options::index_view& options = options::index_view{});
335
339
361 void drop_one(const index_model& index,
362 const options::index_view& options = options::index_view{});
363
385 void drop_one(const client_session& session,
386 const index_model& index,
387 const options::index_view& options = options::index_view{});
388
392
408
423 void drop_all(const client_session& session,
424 const options::index_view& options = options::index_view{});
425
429
430 private:
431 friend ::mongocxx::v_noabi::collection;
432 class MONGOCXX_PRIVATE impl;
433
434 MONGOCXX_PRIVATE index_view(void* coll, void* client);
435
436 MONGOCXX_PRIVATE impl& _get_impl();
437
438 private:
439 std::unique_ptr<impl> _impl;
440};
441
442} // namespace v_noabi
443} // namespace mongocxx
444
445#include <mongocxx/config/postlude.hpp>
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:38
Use a session for a sequence of operations, optionally with either causal consistency or snapshots.
Definition client_session.hpp:47
Class representing a client connection to MongoDB.
Definition client.hpp:61
Class representing a pointer to the result set of a query on a MongoDB server.
Definition cursor.hpp:42
Class representing an index on a MongoDB server.
Definition index_model.hpp:31
Class representing a MongoDB index view.
Definition index_view.hpp:38
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.
stdx::optional< std::string > create_one(const bsoncxx::v_noabi::document::view_or_value &keys, const bsoncxx::v_noabi::document::view_or_value &index_options={}, const options::index_view &options=options::index_view{})
Creates an index.
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.
void drop_one(const bsoncxx::v_noabi::document::view_or_value &keys, const bsoncxx::v_noabi::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_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.
bsoncxx::v_noabi::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.
stdx::optional< std::string > create_one(const client_session &session, const bsoncxx::v_noabi::document::view_or_value &keys, const bsoncxx::v_noabi::document::view_or_value &index_options={}, const options::index_view &options=options::index_view{})
Creates an index.
bsoncxx::v_noabi::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 index_model &index, const options::index_view &options=options::index_view{})
Creates an index.
void drop_one(const client_session &session, const bsoncxx::v_noabi::document::view_or_value &keys, const bsoncxx::v_noabi::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 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:33
The top-level namespace for mongocxx library entities.
Definition bulk_write-fwd.hpp:19