MongoDB C++ Driver  mongocxx-3.9.0
All Classes Namespaces Functions Typedefs Enumerations Enumerator Friends Pages
aggregate.hpp
1 // Copyright 2014 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 #include <cstdint>
19 
20 #include <bsoncxx/builder/basic/document.hpp>
21 #include <bsoncxx/document/view_or_value.hpp>
22 #include <bsoncxx/stdx/optional.hpp>
23 #include <bsoncxx/types/bson_value/view_or_value.hpp>
24 #include <mongocxx/hint.hpp>
25 #include <mongocxx/read_concern.hpp>
26 #include <mongocxx/read_preference.hpp>
27 #include <mongocxx/stdx.hpp>
28 #include <mongocxx/write_concern.hpp>
29 
30 #include <mongocxx/config/prelude.hpp>
31 
32 namespace mongocxx {
33 inline namespace v_noabi {
34 namespace options {
35 
39 class MONGOCXX_API aggregate {
40  public:
54  aggregate& allow_disk_use(bool allow_disk_use);
55 
63  const stdx::optional<bool>& allow_disk_use() const;
64 
77  aggregate& batch_size(std::int32_t batch_size);
78 
86  const stdx::optional<std::int32_t>& batch_size() const;
87 
100  aggregate& collation(bsoncxx::document::view_or_value collation);
101 
110  const stdx::optional<bsoncxx::document::view_or_value>& collation() const;
111 
124  aggregate& let(bsoncxx::document::view_or_value let);
125 
134  const stdx::optional<bsoncxx::document::view_or_value>& let() const;
135 
148  aggregate& max_time(std::chrono::milliseconds max_time);
149 
158  const stdx::optional<std::chrono::milliseconds>& max_time() const;
159 
172 
180  const stdx::optional<class read_preference>& read_preference() const;
181 
191  aggregate& bypass_document_validation(bool bypass_document_validation);
192 
200  const stdx::optional<bool>& bypass_document_validation() const;
201 
217  aggregate& hint(class hint index_hint);
218 
226  const stdx::optional<class hint>& hint() const;
227 
243 
253  const stdx::optional<class write_concern>& write_concern() const;
254 
268 
278  const stdx::optional<class read_concern>& read_concern() const;
279 
293 
303  const stdx::optional<bsoncxx::types::bson_value::view_or_value>& comment() const;
304 
305  private:
306  friend class ::mongocxx::database;
307  friend class ::mongocxx::collection;
308 
309  void append(bsoncxx::builder::basic::document& builder) const;
310 
311  stdx::optional<bool> _allow_disk_use;
312  stdx::optional<std::int32_t> _batch_size;
313  stdx::optional<bsoncxx::document::view_or_value> _collation;
314  stdx::optional<bsoncxx::document::view_or_value> _let;
315  stdx::optional<std::chrono::milliseconds> _max_time;
316  stdx::optional<class read_preference> _read_preference;
317  stdx::optional<bool> _bypass_document_validation;
318  stdx::optional<class hint> _hint;
319  stdx::optional<class write_concern> _write_concern;
320  stdx::optional<class read_concern> _read_concern;
321  stdx::optional<bsoncxx::types::bson_value::view_or_value> _comment;
322 };
323 
324 } // namespace options
325 } // namespace v_noabi
326 } // namespace mongocxx
327 
328 #include <mongocxx/config/postlude.hpp>
A traditional builder-style interface for constructing a BSON document.
Definition: document.hpp:37
Class representing a view-or-value variant type.
Definition: view_or_value.hpp:29
Class representing a hint to be passed to a database operation.
Definition: hint.hpp:31
Class representing the optional arguments to a MongoDB aggregation operation.
Definition: aggregate.hpp:39
const stdx::optional< bool > & bypass_document_validation() const
The current bypass_document_validation setting.
aggregate & allow_disk_use(bool allow_disk_use)
Enables writing to temporary files.
aggregate & read_preference(class read_preference rp)
Sets the read_preference for this operation.
const stdx::optional< class read_concern > & read_concern() const
Gets the current read concern.
const stdx::optional< bsoncxx::document::view_or_value > & collation() const
Retrieves the current collation for this operation.
const stdx::optional< bsoncxx::document::view_or_value > & let() const
Retrieves the current variable mapping for this operation.
const stdx::optional< std::chrono::milliseconds > & max_time() const
The current max_time setting.
const stdx::optional< class hint > & hint() const
Gets the current hint.
aggregate & batch_size(std::int32_t batch_size)
Sets the number of documents to return per batch.
aggregate & collation(bsoncxx::document::view_or_value collation)
Sets the collation for this operation.
aggregate & max_time(std::chrono::milliseconds max_time)
Sets the maximum amount of time for this operation to run server-side in milliseconds.
aggregate & comment(bsoncxx::types::bson_value::view_or_value comment)
Sets the comment to use for this operation.
aggregate & hint(class hint index_hint)
Sets the index to use for this operation.
aggregate & write_concern(class write_concern write_concern)
Sets the write concern to use for this operation.
const stdx::optional< std::int32_t > & batch_size() const
The current batch size setting.
const stdx::optional< class write_concern > & write_concern() const
Gets the current write concern.
aggregate & let(bsoncxx::document::view_or_value let)
Sets the variable mapping for this operation.
aggregate & bypass_document_validation(bool bypass_document_validation)
Sets whether the $out stage should bypass document validation.
aggregate & read_concern(class read_concern read_concern)
Sets the read concern to use for this operation.
const stdx::optional< bsoncxx::types::bson_value::view_or_value > & comment() const
Gets the current comment.
const stdx::optional< bool > & allow_disk_use() const
Retrieves the current allow_disk_use setting.
const stdx::optional< class read_preference > & read_preference() const
The current read_preference for this operation.
A class to represent the read concern.
Definition: read_concern.hpp:57
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:67
Class representing the server-side requirement for reporting the success of a write operation.
Definition: write_concern.hpp:59
The top-level namespace for mongocxx library entities.
Definition: bulk_write.hpp:24