MongoDB C++ Driver  mongocxx-3.7.0
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 
38  // This constructor is public for testing purposes only
39  explicit bulk_write(bsoncxx::document::value raw_response);
40 
46  std::int32_t inserted_count() const;
47 
53  std::int32_t matched_count() const;
54 
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  friend MONGOCXX_API bool MONGOCXX_CALL operator==(const bulk_write&, const bulk_write&);
92  friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const bulk_write&, const bulk_write&);
93 };
94 
95 } // namespace result
96 MONGOCXX_INLINE_NAMESPACE_END
97 } // namespace mongocxx
98 
99 #include <mongocxx/config/postlude.hpp>
mongocxx
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
mongocxx::result::bulk_write
Class representing the result of a MongoDB bulk write operation.
Definition: bulk_write.hpp:34
bsoncxx::document::value
A read-only BSON document that owns its underlying buffer.
Definition: value.hpp:34
bsoncxx::document::view
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33