MongoDB C++ Driver  mongocxx-3.7.0
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 MONGOCXX_INLINE_NAMESPACE_BEGIN
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 
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 MONGOCXX_INLINE_NAMESPACE_END
326 } // namespace mongocxx
327 
328 #include <mongocxx/config/postlude.hpp>
mongocxx
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
bsoncxx::view_or_value< document::view, document::value >
mongocxx::options::aggregate
Class representing the optional arguments to a MongoDB aggregation operation.
Definition: aggregate.hpp:39
mongocxx::write_concern
Class representing the server-side requirement for reporting the success of a write operation.
Definition: write_concern.hpp:56
mongocxx::read_concern
A class to represent the read concern.
Definition: read_concern.hpp:54
mongocxx::read_preference
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:63
mongocxx::hint
Class representing a hint to be passed to a database operation.
Definition: hint.hpp:32
bsoncxx::builder::basic::document
A traditional builder-style interface for constructing a BSON document.
Definition: document.hpp:37