MongoDB C++ Driver  mongocxx-3.7.0
pipeline.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 <cstdint>
18 #include <memory>
19 #include <string>
20 
21 #include <bsoncxx/array/view.hpp>
22 #include <bsoncxx/array/view_or_value.hpp>
23 #include <bsoncxx/document/view.hpp>
24 #include <bsoncxx/document/view_or_value.hpp>
25 
26 #include <mongocxx/config/prelude.hpp>
27 
28 namespace mongocxx {
29 MONGOCXX_INLINE_NAMESPACE_BEGIN
30 
31 class client;
32 class collection;
33 class database;
34 
38 class MONGOCXX_API pipeline {
39  public:
45  pipeline();
46 
50  pipeline(pipeline&&) noexcept;
51 
55  pipeline& operator=(pipeline&&) noexcept;
56 
60  ~pipeline();
61 
76  pipeline& add_fields(bsoncxx::document::view_or_value fields_to_add);
77 
92  pipeline& bucket(bsoncxx::document::view_or_value bucket_args);
93 
109  pipeline& bucket_auto(bsoncxx::document::view_or_value bucket_auto_args);
110 
124  pipeline& coll_stats(
126 
139  pipeline& count(std::string field);
140 
156  pipeline& current_op(bsoncxx::document::view_or_value current_op_args);
157 
172  pipeline& facet(bsoncxx::document::view_or_value facet_args);
173 
189  pipeline& append_stage(bsoncxx::document::view_or_value stage);
190 
206  pipeline& append_stages(bsoncxx::array::view_or_value stages);
207 
221  pipeline& geo_near(bsoncxx::document::view_or_value geo_near_args);
222 
236  pipeline& graph_lookup(bsoncxx::document::view_or_value graph_lookup_args);
237 
256  pipeline& group(bsoncxx::document::view_or_value group_args);
257 
267  pipeline& index_stats();
268 
281  pipeline& limit(std::int32_t limit);
282 
296  pipeline& list_local_sessions(bsoncxx::document::view_or_value list_local_sessions_args);
297 
310  pipeline& list_sessions(bsoncxx::document::view_or_value list_sessions_args);
311 
326  pipeline& lookup(bsoncxx::document::view_or_value lookup_args);
327 
342 
356  pipeline& merge(bsoncxx::document::view_or_value merge_args);
357 
372  pipeline& out(std::string collection_name);
373 
386  pipeline& project(bsoncxx::document::view_or_value projection);
387 
401  pipeline& redact(bsoncxx::document::view_or_value restrictions);
402 
416  pipeline& replace_root(bsoncxx::document::view_or_value replace_root_args);
417 
431  pipeline& sample(std::int32_t size);
432 
446  pipeline& skip(std::int32_t docs_to_skip);
447 
461 
479  pipeline& sort_by_count(bsoncxx::document::view_or_value field_expression);
480 
499  pipeline& sort_by_count(std::string field_expression);
500 
519  pipeline& unwind(bsoncxx::document::view_or_value unwind_args);
520 
539  pipeline& unwind(std::string field_name);
540 
544  bsoncxx::array::view view_array() const;
545 
546  private:
547  friend class client;
548  friend class collection;
549  friend class database;
550 
551  class MONGOCXX_PRIVATE impl;
552  std::unique_ptr<impl> _impl;
553 };
554 
555 MONGOCXX_INLINE_NAMESPACE_END
556 } // namespace mongocxx
557 
558 #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 >
bsoncxx::array::view
A read-only, non-owning view of a BSON document.
Definition: view.hpp:40
mongocxx::client
Class representing a client connection to MongoDB.
Definition: client.hpp:58
mongocxx::pipeline
Class representing a MongoDB aggregation pipeline.
Definition: pipeline.hpp:38
mongocxx::database
Class representing a MongoDB database.
Definition: database.hpp:43
mongocxx::collection
Class representing server side document groupings within a MongoDB database.
Definition: collection.hpp:83
bsoncxx::document::view
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33