MongoDB C++ Driver mongocxx-3.0.3
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
94 pipeline& lookup(bsoncxx::document::view_or_value lookup);
95
104 pipeline& match(bsoncxx::document::view_or_value filter);
105
115 pipeline& out(std::string collection_name);
116
124 pipeline& project(bsoncxx::document::view_or_value projection);
125
134 pipeline& redact(bsoncxx::document::view_or_value restrictions);
135
144 pipeline& sample(std::int32_t size);
145
154 pipeline& skip(std::int32_t skip);
155
163 pipeline& sort(bsoncxx::document::view_or_value ordering);
164
174 pipeline& unwind(std::string field_name);
175
179 bsoncxx::document::view view() const;
180
181 private:
182 friend class collection;
183
184 class MONGOCXX_PRIVATE impl;
185 std::unique_ptr<impl> _impl;
186};
187
188MONGOCXX_INLINE_NAMESPACE_END
189} // namespace mongocxx
190
191#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.