MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
pipeline.hpp
Go to the documentation of this file.
1// Copyright 2009-present 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
25
30
32
33namespace mongocxx {
34namespace v_noabi {
35
39class pipeline {
40 public:
48
53
58
63
64 pipeline(const pipeline&) = delete;
65 MONGOCXX_ABI_EXPORT_CDECL(pipeline&) operator=(const pipeline&) = delete;
66
83 add_fields(bsoncxx::v_noabi::document::view_or_value fields_to_add);
84
101 bucket(bsoncxx::v_noabi::document::view_or_value bucket_args);
102
120 bucket_auto(bsoncxx::v_noabi::document::view_or_value bucket_auto_args);
121
137 coll_stats(bsoncxx::v_noabi::document::view_or_value coll_stats_args =
138 bsoncxx::v_noabi::document::view{});
139
154
172 current_op(bsoncxx::v_noabi::document::view_or_value current_op_args);
173
190 facet(bsoncxx::v_noabi::document::view_or_value facet_args);
191
208 append_stage(bsoncxx::v_noabi::document::view_or_value stage);
209
226 append_stages(bsoncxx::v_noabi::array::view_or_value stages);
227
243 geo_near(bsoncxx::v_noabi::document::view_or_value geo_near_args);
244
260 graph_lookup(bsoncxx::v_noabi::document::view_or_value graph_lookup_args);
261
282 group(bsoncxx::v_noabi::document::view_or_value group_args);
283
295
310
326 list_local_sessions(bsoncxx::v_noabi::document::view_or_value list_local_sessions_args);
327
342 list_sessions(bsoncxx::v_noabi::document::view_or_value list_sessions_args);
343
360 lookup(bsoncxx::v_noabi::document::view_or_value lookup_args);
361
376 MONGOCXX_ABI_EXPORT_CDECL(pipeline&) match(bsoncxx::v_noabi::document::view_or_value filter);
377
393 merge(bsoncxx::v_noabi::document::view_or_value merge_args);
394
410 MONGOCXX_ABI_EXPORT_CDECL(pipeline&) out(std::string collection_name);
411
426 project(bsoncxx::v_noabi::document::view_or_value projection);
427
443 redact(bsoncxx::v_noabi::document::view_or_value restrictions);
444
460 replace_root(bsoncxx::v_noabi::document::view_or_value replace_root_args);
461
477
492 MONGOCXX_ABI_EXPORT_CDECL(pipeline&) skip(std::int32_t docs_to_skip);
493
507 MONGOCXX_ABI_EXPORT_CDECL(pipeline&) sort(bsoncxx::v_noabi::document::view_or_value ordering);
508
528 sort_by_count(bsoncxx::v_noabi::document::view_or_value field_expression);
529
550
571 unwind(bsoncxx::v_noabi::document::view_or_value unwind_args);
572
593
597 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::array::view) view_array() const;
598
599 private:
600 friend ::mongocxx::v_noabi::client;
601 friend ::mongocxx::v_noabi::collection;
602 friend ::mongocxx::v_noabi::database;
603
604 class impl;
605 std::unique_ptr<impl> _impl;
606};
607
608} // namespace v_noabi
609} // namespace mongocxx
610
611#include <mongocxx/config/postlude.hpp>
612
Provides bsoncxx::v_noabi::array::view.
Provides bsoncxx::v_noabi::array::view_or_value.
Class representing a client connection to MongoDB.
Definition client.hpp:62
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:87
Class representing a MongoDB database.
Definition database.hpp:47
Class representing a MongoDB aggregation pipeline.
Definition pipeline.hpp:39
pipeline & geo_near(bsoncxx::v_noabi::document::view_or_value geo_near_args)
Outputs documents in order of nearest to farthest from a specified point.
pipeline & graph_lookup(bsoncxx::v_noabi::document::view_or_value graph_lookup_args)
Performs a recursive search on a collection.
pipeline & bucket(bsoncxx::v_noabi::document::view_or_value bucket_args)
Categorizes documents into groups, called buckets, based on a specified expression and bucket boundar...
pipeline & skip(std::int32_t docs_to_skip)
Skips over the specified number of documents that pass into the stage and passes the remaining docume...
pipeline & index_stats()
Returns statistics regarding the use of each index for the collection.
pipeline & lookup(bsoncxx::v_noabi::document::view_or_value lookup_args)
Performs a left outer join to an unsharded collection in the same database to filter in documents fro...
pipeline & count(std::string field)
Returns a document containing a count of the number of documents input to the stage.
pipeline & group(bsoncxx::v_noabi::document::view_or_value group_args)
Groups documents by some specified expression and outputs to the next stage a document for each disti...
pipeline & replace_root(bsoncxx::v_noabi::document::view_or_value replace_root_args)
Promotes a specified document to the top level and replaces all other fields.
pipeline & append_stage(bsoncxx::v_noabi::document::view_or_value stage)
Appends a stage to this pipeline object.
pipeline & add_fields(bsoncxx::v_noabi::document::view_or_value fields_to_add)
Adds new fields to documents.
pipeline & list_local_sessions(bsoncxx::v_noabi::document::view_or_value list_local_sessions_args)
Lists the sessions cached in memory by the mongod or mongos instance.
bsoncxx::v_noabi::array::view view_array() const
pipeline & current_op(bsoncxx::v_noabi::document::view_or_value current_op_args)
Returns a stream of documents containing information on active and/or dormant operations as well as i...
pipeline & coll_stats(bsoncxx::v_noabi::document::view_or_value coll_stats_args=bsoncxx::v_noabi::document::view{})
Returns statistics regarding a collection or view.
pipeline & unwind(bsoncxx::v_noabi::document::view_or_value unwind_args)
Deconstructs an array field from the input documents to output a document for each element....
pipeline & merge(bsoncxx::v_noabi::document::view_or_value merge_args)
Outputs the aggregation results to a collection.
pipeline & sort(bsoncxx::v_noabi::document::view_or_value ordering)
Sorts all input documents and returns them to the pipeline in sorted order.
pipeline & list_sessions(bsoncxx::v_noabi::document::view_or_value list_sessions_args)
Lists all sessions stored in the system.sessions collection in the config database....
pipeline & redact(bsoncxx::v_noabi::document::view_or_value restrictions)
Restricts the contents of the documents based on information stored in the documents themselves.
pipeline & project(bsoncxx::v_noabi::document::view_or_value projection)
Projects a subset of the fields in the documents to the next stage of the pipeline.
pipeline & out(std::string collection_name)
Takes documents returned by the aggregation pipeline and writes them to a specified collection....
pipeline & facet(bsoncxx::v_noabi::document::view_or_value facet_args)
Processes multiple aggregation pipelines within a single stage on the same set of input documents.
pipeline & match(bsoncxx::v_noabi::document::view_or_value filter)
Filters the documents. Only the documents that match the condition(s) specified by the filter will co...
pipeline & append_stages(bsoncxx::v_noabi::array::view_or_value stages)
Appends stages to this pipeline object from the given bson array.
pipeline & sort_by_count(bsoncxx::v_noabi::document::view_or_value field_expression)
Groups incoming documents based on the value of a specified expression, then computes the count of do...
pipeline & sample(std::int32_t size)
Randomly selects the specified number of documents that pass into the stage and passes the remaining ...
pipeline & bucket_auto(bsoncxx::v_noabi::document::view_or_value bucket_auto_args)
Categorizes documents into a specific number of groups, called buckets, based on a specified expressi...
pipeline & limit(std::int32_t limit)
Limits the number of documents passed to the next stage in the pipeline.
Declares mongocxx::v_noabi::client.
Declares mongocxx::v_noabi::collection.
Declares mongocxx::v_noabi::database.
Provides bsoncxx::v_noabi::document::view.
Provides bsoncxx::v_noabi::document::view_or_value.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition fwd.hpp:222
The mongocxx macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
The top-level namespace within which all mongocxx library entities are declared.
The top-level namespace reserved for the C++ standard library.
Declares mongocxx::v_noabi::pipeline.