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 <chrono>
18
19#include <bsoncxx/stdx/optional.hpp>
20#include <mongocxx/write_concern.hpp>
21
22#include <mongocxx/config/prelude.hpp>
23
24namespace mongocxx {
25MONGOCXX_INLINE_NAMESPACE_BEGIN
26namespace options {
27
31class MONGOCXX_API index_view {
32 public:
33 index_view();
34
48 index_view& max_time(std::chrono::milliseconds max_time);
49
59 const bsoncxx::stdx::optional<std::chrono::milliseconds>& max_time() const;
60
75
85 const bsoncxx::stdx::optional<mongocxx::write_concern>& write_concern() const;
86
104 index_view& commit_quorum(std::int32_t commit_quorum);
105
123 index_view& commit_quorum(std::string commit_quorum);
124
136 const stdx::optional<bsoncxx::document::value> commit_quorum() const;
137
138 private:
139 bsoncxx::stdx::optional<std::chrono::milliseconds> _max_time;
140 bsoncxx::stdx::optional<mongocxx::write_concern> _write_concern;
141 bsoncxx::stdx::optional<bsoncxx::document::value> _commit_quorum;
142};
143
144} // namespace options
145MONGOCXX_INLINE_NAMESPACE_END
146} // namespace mongocxx
147
148#include <mongocxx/config/postlude.hpp>
Class representing optional arguments to IndexView operations.
Definition index_view.hpp:31
const bsoncxx::stdx::optional< mongocxx::write_concern > & write_concern() const
Gets the current write concern.
index_view & commit_quorum(std::int32_t commit_quorum)
Sets the commit quorum for this operation.
index_view & write_concern(mongocxx::write_concern write_concern)
Sets the write concern for this operation.
const stdx::optional< bsoncxx::document::value > commit_quorum() const
Gets the current commitQuorum setting.
const bsoncxx::stdx::optional< std::chrono::milliseconds > & max_time() const
The current max_time setting.
index_view & max_time(std::chrono::milliseconds max_time)
Sets the maximum amount of time for this operation to run (server-side) in milliseconds.
index_view & commit_quorum(std::string commit_quorum)
Sets the commit quorum for this operation.
Class representing the server-side requirement for reporting the success of a write operation.
Definition write_concern.hpp:56
Top level namespace for the MongoDB C++ driver.
Definition bulk_write.hpp:24