Library: MongoDB
Package: MongoDB
Header: Poco/MongoDB/Connection.h
Represents a connection to a MongoDB server
Member Functions: address, connect, disconnect, sendRequest
typedef Poco::SharedPtr < Connection > Ptr;
Connection();
Default constructor. Use this when you want to connect later on.
Connection(
const std::string & hostAndPort
);
Constructor which connects to the given MongoDB host/port. The host and port must be separated with a colon.
Connection(
const Net::SocketAddress & addrs
);
Constructor which connects to the given MongoDB host/port.
Connection(
const std::string & host,
int port
);
Constructor which connects to the given MongoDB host/port.
virtual ~Connection();
Destructor
Net::SocketAddress address() const;
Returns the address of the MongoDB connection
void connect(
const std::string & hostAndPort
);
Connects to the given MongoDB server. The host and port must be separated with a colon.
void connect(
const std::string & host,
int port
);
Connects to the given MongoDB server.
void connect(
const Net::SocketAddress & addrs
);
Connects to the given MongoDB server.
void disconnect();
Disconnects from the MongoDB server
void sendRequest(
RequestMessage & request
);
Sends a request to the MongoDB server Only use this when the request hasn't a response.
void sendRequest(
RequestMessage & request,
ResponseMessage & response
);
Sends a request to the MongoDB server and receives the response. Use this when a response is expected: only a query or getmore request will return a response.