MongoDB C++ Driver mongocxx-3.0.3
Loading...
Searching...
No Matches
insert_many_builder.hpp
1// Copyright 2015 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 <bsoncxx/stdx/optional.hpp>
18#include <bsoncxx/builder/basic/array.hpp>
19#include <mongocxx/bulk_write.hpp>
20#include <mongocxx/options/insert.hpp>
21#include <mongocxx/result/insert_many.hpp>
22#include <mongocxx/stdx.hpp>
23
24#include <mongocxx/config/prelude.hpp>
25
26namespace mongocxx {
27MONGOCXX_INLINE_NAMESPACE_BEGIN
28
34class MONGOCXX_API insert_many_builder {
35 public:
42 explicit insert_many_builder(const options::insert& options);
43
53
60 stdx::optional<result::insert_many> insert(collection* col) const;
61
62 private:
63 bulk_write _writes;
65};
66
67MONGOCXX_INLINE_NAMESPACE_END
68} // namespace mongocxx
69
70#include <mongocxx/config/postlude.hpp>
A traditional builder-style interface for constructing a BSON array.
Definition array.hpp:35
A read-only, non-owning view of a BSON document.
Definition view.hpp:33
Class representing a batch of write operations that can be sent to the server as a group.
Definition bulk_write.hpp:41
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:74
Class to build an insert_many bulk write operation.
Definition insert_many_builder.hpp:34
void operator()(const bsoncxx::document::view &doc)
Appends a single insert to insert_many bulk write operation.
insert_many_builder(const options::insert &options)
Initializes a new builder for an insert_many bulk write operation.
stdx::optional< result::insert_many > insert(collection *col) const
Executes the underlying insert_many bulk operation.
Class representing the optional arguments to a MongoDB insert operation.
Definition insert.hpp:31