MongoDB C++ Driver  mongocxx-3.10.2
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 <mongocxx/options/index_view-fwd.hpp>
20 
21 #include <bsoncxx/stdx/optional.hpp>
22 #include <mongocxx/write_concern.hpp>
23 
24 #include <mongocxx/config/prelude.hpp>
25 
26 namespace mongocxx {
27 namespace v_noabi {
28 namespace options {
29 
33 class index_view {
34  public:
35  index_view();
36 
50  index_view& max_time(std::chrono::milliseconds max_time);
51 
61  const bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds>& max_time() const;
62 
77 
87  const bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::write_concern>& write_concern() const;
88 
107 
126 
138  const stdx::optional<bsoncxx::v_noabi::document::value> commit_quorum() const;
139 
140  private:
141  bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds> _max_time;
142  bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::write_concern> _write_concern;
143  bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value> _commit_quorum;
144 };
145 
146 } // namespace options
147 } // namespace v_noabi
148 } // namespace mongocxx
149 
150 #include <mongocxx/config/postlude.hpp>
Class representing optional arguments to IndexView operations.
Definition: index_view.hpp:33
const stdx::optional< bsoncxx::v_noabi::document::value > commit_quorum() const
Gets the current commitQuorum setting.
index_view & commit_quorum(std::int32_t commit_quorum)
Sets the commit quorum for this operation.
const bsoncxx::v_noabi::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.
const bsoncxx::v_noabi::stdx::optional< mongocxx::v_noabi::write_concern > & write_concern() const
Gets the current write concern.
index_view & write_concern(mongocxx::v_noabi::write_concern write_concern)
Sets the write concern for this operation.
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:58
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19