MongoDB C++ Driver  mongocxx-3.10.2
command_succeeded_event.hpp
1 // Copyright 2018-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 <memory>
18 
19 #include <mongocxx/events/command_succeeded_event-fwd.hpp>
20 
21 #include <bsoncxx/document/view.hpp>
22 #include <bsoncxx/oid.hpp>
23 #include <bsoncxx/stdx/optional.hpp>
24 
25 #include <mongocxx/config/prelude.hpp>
26 
27 namespace mongocxx {
28 namespace v_noabi {
29 namespace events {
30 
38  public:
39  MONGOCXX_PRIVATE explicit command_succeeded_event(const void* event);
40 
45 
52 
58  bsoncxx::v_noabi::stdx::string_view command_name() const;
59 
65  std::int64_t duration() const;
66 
72  std::int64_t request_id() const;
73 
79  std::int64_t operation_id() const;
80 
86  bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::oid> service_id() const;
87 
93  bsoncxx::v_noabi::stdx::string_view host() const;
94 
100  std::uint16_t port() const;
101 
102  private:
103  const void* _succeeded_event;
104 };
105 
106 } // namespace events
107 } // namespace v_noabi
108 } // namespace mongocxx
109 
110 #include <mongocxx/config/postlude.hpp>
A read-only, non-owning view of a BSON document.
Definition: view.hpp:35
An event notification sent when the driver successfully executes a MongoDB command.
Definition: command_succeeded_event.hpp:37
std::int64_t duration() const
Returns the duration of the successful operation.
std::int64_t request_id() const
Returns the request id.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::oid > service_id() const
Optionally returns the service id.
bsoncxx::v_noabi::stdx::string_view host() const
Returns the host name.
~command_succeeded_event()
Destroys a command_succeeded_event.
bsoncxx::v_noabi::document::view reply() const
Returns the server reply for the succeeded operation.
std::uint16_t port() const
Returns the port.
std::int64_t operation_id() const
Returns the operation id.
bsoncxx::v_noabi::stdx::string_view command_name() const
Returns the name of the command.
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19