MongoDB C++ Driver  mongocxx-3.0.1
bulk_write.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 <map>
19 #include <vector>
20 
21 #include <bsoncxx/document/value.hpp>
22 #include <bsoncxx/document/view.hpp>
23 #include <bsoncxx/types.hpp>
24 
25 #include <mongocxx/config/prelude.hpp>
26 
27 namespace mongocxx {
28 MONGOCXX_INLINE_NAMESPACE_BEGIN
29 namespace result {
30 
34 class MONGOCXX_API bulk_write {
35  public:
36  using id_map = std::map<std::size_t, bsoncxx::document::element>;
37 
41  explicit bulk_write(bsoncxx::document::value raw_response);
42 
48  std::int32_t inserted_count() const;
49 
55  std::int32_t matched_count() const;
56 
62  std::int32_t modified_count() const;
63 
69  std::int32_t deleted_count() const;
70 
76  std::int32_t upserted_count() const;
77 
84  id_map upserted_ids() const;
85 
86  private:
87  MONGOCXX_PRIVATE bsoncxx::document::view view() const;
88 
89  bsoncxx::document::value _response;
90 };
91 
92 } // namespace result
93 MONGOCXX_INLINE_NAMESPACE_END
94 } // namespace mongocxx
95 
96 #include <mongocxx/config/postlude.hpp>
Definition: bulk_write.hpp:22
A read-only BSON document that owns its underlying buffer.
Definition: value.hpp:33
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33
Class representing the result of a MongoDB bulk write operation.
Definition: bulk_write.hpp:34