MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
insert_one.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 <mongocxx/model/insert_one-fwd.hpp> // IWYU pragma: export
18
19//
20
22
23#include <mongocxx/v1/bulk_write.hpp> // IWYU pragma: export
24
25#include <utility>
26
30
32
33namespace mongocxx {
34namespace v_noabi {
35namespace model {
36
41 public:
45 /* explicit(false) */ insert_one(v1::bulk_write::insert_one op)
46 : _document{bsoncxx::v_noabi::from_v1(std::move(op.value))} {}
47
51 explicit operator v1::bulk_write::insert_one() const {
53 }
54
62
69 return _document;
70 }
71
72 private:
74};
75
76} // namespace model
77} // namespace v_noabi
78} // namespace mongocxx
79
80namespace mongocxx {
81namespace v_noabi {
82
87 return {std::move(v)};
88}
89
96
97} // namespace v_noabi
98} // namespace mongocxx
99
101
A BSON document.
Definition value.hpp:46
insert_one(v1::bulk_write::insert_one op)
Construct with the mongocxx::v1 equivalent.
Definition insert_one.hpp:45
A single "Insert One" write operation.
Definition bulk_write.hpp:173
A MongoDB insert operation that creates a single document.
Definition insert_one.hpp:40
insert_one(bsoncxx::v_noabi::document::view_or_value document)
Constructs an insert operation that will create a single document.
Definition insert_one.hpp:61
bsoncxx::v_noabi::document::view_or_value const & document() const
Gets the document to be inserted.
Definition insert_one.hpp:68
insert_one(v1::bulk_write::insert_one op)
Construct with the mongocxx::v1 equivalent.
Definition insert_one.hpp:45
Provides bsoncxx::v_noabi::document::view_or_value.
Declares mongocxx::v_noabi::model::insert_one.
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
v_noabi::view_or_value< v_noabi::document::view, v_noabi::document::value > view_or_value
Equivalent to v_noabi::view_or_value<v_noabi::document::view, v_noabi::document::value>.
Definition view_or_value.hpp:30
v1::element::view to_v1(v_noabi::array::element const &v)
Convert to the bsoncxx::v1 equivalent of v.
Definition element.hpp:132
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities representing bulk write operations.
Declares entities whose ABI stability is NOT guaranteed.
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Provides entities related to write operations.
Provides bsoncxx::v1::document::value.
Provides bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view.