MongoDB C++ Driver mongocxx-3.10.1
Loading...
Searching...
No Matches
insert_one.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 <mongocxx/result/insert_one-fwd.hpp>
18
19#include <bsoncxx/array/value.hpp>
20#include <bsoncxx/types.hpp>
21#include <bsoncxx/types/bson_value/view.hpp>
22#include <mongocxx/result/bulk_write.hpp>
23
24#include <mongocxx/config/prelude.hpp>
25
26namespace mongocxx {
27namespace v_noabi {
28namespace result {
29
32 public:
33 // This constructor is public for testing purposes only
35
41 const result::bulk_write& result() const;
42
49
50 private:
51 result::bulk_write _result;
52
53 // Array with a single element, containing the value of the _id field for the inserted document.
54 bsoncxx::v_noabi::array::value _inserted_id_owned;
55
56 // Points into _inserted_id_owned.
58
59 friend MONGOCXX_API bool MONGOCXX_CALL operator==(const insert_one&, const insert_one&);
60 friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const insert_one&, const insert_one&);
61};
62
63} // namespace result
64} // namespace v_noabi
65} // namespace mongocxx
66
67#include <mongocxx/config/postlude.hpp>
A read-only BSON array that owns its underlying buffer.
Definition value.hpp:36
A view-only variant that can contain any BSON type.
Definition view.hpp:41
Class representing the result of a MongoDB bulk write operation.
Definition bulk_write.hpp:36
Class representing the result of a MongoDB insert operation.
Definition insert_one.hpp:31
const bsoncxx::v_noabi::types::bson_value::view & inserted_id() const
Gets the _id of the inserted document.
const result::bulk_write & result() const
Returns the bulk write result for this insert operation.
The top-level namespace for mongocxx library entities.
Definition bulk_write-fwd.hpp:19