I've a C++ function which saves a document to MongoDB using C++ driver. It takes connection reference as argument:
http://pastebin.com/jwRDhNWQ
When I restart MongoDB, I can see that new connection is being made. However, conn.isFailed() remains true.
This maybe happening due to the fact that when I reconnect, I am using conn
and not &conn
When I do use &conn
as in &conn.connect("localhost");
, I get error message-
error: lvalue required as unary ‘&’ operand
How do I fix this? i.e. modify the underlying connection so that conn.isFailed() becomes false when a new connection has been established?