MongoDB C++ Driver  mongocxx-3.10.2
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 <mongocxx/collection-fwd.hpp>
21 #include <mongocxx/database-fwd.hpp>
22 #include <mongocxx/options/aggregate-fwd.hpp>
23 
24 #include <bsoncxx/builder/basic/document.hpp>
25 #include <bsoncxx/document/view_or_value.hpp>
26 #include <bsoncxx/stdx/optional.hpp>
27 #include <bsoncxx/types/bson_value/view_or_value.hpp>
28 #include <mongocxx/hint.hpp>
29 #include <mongocxx/read_concern.hpp>
30 #include <mongocxx/read_preference.hpp>
31 #include <mongocxx/stdx.hpp>
32 #include <mongocxx/write_concern.hpp>
33 
34 #include <mongocxx/config/prelude.hpp>
35 
36 namespace mongocxx {
37 namespace v_noabi {
38 namespace options {
39 
43 class aggregate {
44  public:
59 
67  const stdx::optional<bool>& allow_disk_use() const;
68 
82 
90  const stdx::optional<std::int32_t>& batch_size() const;
91 
105 
114  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& collation() const;
115 
129 
138  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& let() const;
139 
152  aggregate& max_time(std::chrono::milliseconds max_time);
153 
162  const stdx::optional<std::chrono::milliseconds>& max_time() const;
163 
176 
184  const stdx::optional<mongocxx::v_noabi::read_preference>& read_preference() const;
185 
196 
204  const stdx::optional<bool>& bypass_document_validation() const;
205 
222 
230  const stdx::optional<mongocxx::v_noabi::hint>& hint() const;
231 
247 
257  const stdx::optional<mongocxx::v_noabi::write_concern>& write_concern() const;
258 
272 
282  const stdx::optional<mongocxx::v_noabi::read_concern>& read_concern() const;
283 
297 
307  const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>& comment() const;
308 
309  private:
310  friend ::mongocxx::v_noabi::collection;
311  friend ::mongocxx::v_noabi::database;
312 
313  void append(bsoncxx::v_noabi::builder::basic::document& builder) const;
314 
315  stdx::optional<bool> _allow_disk_use;
316  stdx::optional<std::int32_t> _batch_size;
317  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
318  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _let;
319  stdx::optional<std::chrono::milliseconds> _max_time;
320  stdx::optional<mongocxx::v_noabi::read_preference> _read_preference;
321  stdx::optional<bool> _bypass_document_validation;
322  stdx::optional<mongocxx::v_noabi::hint> _hint;
323  stdx::optional<mongocxx::v_noabi::write_concern> _write_concern;
324  stdx::optional<mongocxx::v_noabi::read_concern> _read_concern;
325  stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _comment;
326 };
327 
328 } // namespace options
329 } // namespace v_noabi
330 } // namespace mongocxx
331 
332 #include <mongocxx/config/postlude.hpp>
A traditional builder-style interface for constructing a BSON document.
Definition: document.hpp:38
Class representing a hint to be passed to a database operation.
Definition: hint.hpp:34
Class representing the optional arguments to a MongoDB aggregation operation.
Definition: aggregate.hpp:43
const stdx::optional< bool > & bypass_document_validation() const
The current bypass_document_validation setting.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & collation() const
Retrieves the current collation for this operation.
aggregate & allow_disk_use(bool allow_disk_use)
Enables writing to temporary files.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & let() const
Retrieves the current variable mapping for this operation.
const stdx::optional< mongocxx::v_noabi::read_concern > & read_concern() const
Gets the current read concern.
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & comment() const
Gets the current comment.
aggregate & let(bsoncxx::v_noabi::document::view_or_value let)
Sets the variable mapping for this operation.
const stdx::optional< std::chrono::milliseconds > & max_time() const
The current max_time setting.
aggregate & comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment)
Sets the comment to use for this operation.
aggregate & batch_size(std::int32_t batch_size)
Sets the number of documents to return per batch.
const stdx::optional< mongocxx::v_noabi::write_concern > & write_concern() const
Gets the current write concern.
aggregate & collation(bsoncxx::v_noabi::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 & read_concern(mongocxx::v_noabi::read_concern read_concern)
Sets the read concern to use for this operation.
const stdx::optional< std::int32_t > & batch_size() const
The current batch size setting.
aggregate & bypass_document_validation(bool bypass_document_validation)
Sets whether the $out stage should bypass document validation.
aggregate & write_concern(mongocxx::v_noabi::write_concern write_concern)
Sets the write concern to use for this operation.
const stdx::optional< bool > & allow_disk_use() const
Retrieves the current allow_disk_use setting.
const stdx::optional< mongocxx::v_noabi::read_preference > & read_preference() const
The current read_preference for this operation.
aggregate & hint(mongocxx::v_noabi::hint index_hint)
Sets the index to use for this operation.
aggregate & read_preference(mongocxx::v_noabi::read_preference rp)
Sets the read_preference for this operation.
const stdx::optional< mongocxx::v_noabi::hint > & hint() const
Gets the current hint.
A class to represent the read concern.
Definition: read_concern.hpp:56
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:63
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