In general, please do not re-open old threads, especially if they are only tangentially related to your question.
If I understand correctly, you want to know two things:
- How to issue a serverStatus command with the mongocxx driver.
- Whether the .ok part of the shell expression db.serverStatus().ok is evaluated at the server, or in the shell.
For the first question, I recommend looking at the '
connect' example for the C++ driver, which shows how to run the isMaster command. It should be easy to replace the command name with
serverStatus. You can obtain the value of the
ok field from the command result with
result['ok'], using the variable names as they are in the example.
For the second question, the extraction of the 'ok' field is done client side (i.e. in the shell).
Thanks,
Andrew