MongoDB C++ Driver mongocxx-3.0.0
Loading...
Searching...
No Matches
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 <string>
19#include <memory>
20
21#include <bsoncxx/document/view.hpp>
22#include <bsoncxx/document/view_or_value.hpp>
23
24#include <mongocxx/config/prelude.hpp>
25
26namespace mongocxx {
27MONGOCXX_INLINE_NAMESPACE_BEGIN
28
29class collection;
30
34class MONGOCXX_API pipeline {
35 public:
42
46 pipeline(pipeline&&) noexcept;
47
51 pipeline& operator=(pipeline&&) noexcept;
52
57
71 pipeline& group(bsoncxx::document::view_or_value group);
72
80 pipeline& limit(std::int32_t limit);
81
90 pipeline& match(bsoncxx::document::view_or_value filter);
91
101 pipeline& out(std::string collection_name);
102
110 pipeline& project(bsoncxx::document::view_or_value projection);
111
120 pipeline& redact(bsoncxx::document::view_or_value restrictions);
121
130 pipeline& skip(std::int32_t skip);
131
139 pipeline& sort(bsoncxx::document::view_or_value ordering);
140
150 pipeline& unwind(std::string field_name);
151
155 bsoncxx::document::view view() const;
156
157 private:
158 friend class collection;
159
160 class MONGOCXX_PRIVATE impl;
161 std::unique_ptr<impl> _impl;
162};
163
164MONGOCXX_INLINE_NAMESPACE_END
165} // namespace mongocxx
166
167#include <mongocxx/config/postlude.hpp>
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:74
Class representing a MongoDB aggregation pipeline.
Definition pipeline.hpp:34
pipeline(pipeline &&) noexcept
Move constructs a pipeline.
pipeline()
Creates a new aggregation pipeline.