top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to check if a mongo client is still valid, i.e., it is still connected or active?

+1 vote
344 views
How to check if a mongo client is still valid, i.e., it is still connected or active?
posted Jun 17, 2017 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

Can we use mongo recommended snapshot i.e LVM snapshot across versions? i.e snapshot taken from v2.4.10 and restore it to v3.0.4.
We have tested the same and this works. Is this recommended by mongo?

0 votes

If you wanted to copy over the mongo database using mongos oplog, how would you do it? Suppose we start copying the database at time T and we finish the copying at time U. We have to read from the oplog from time T onward and apply oplog changes (which also may have been applied between time T and U). Do the oplog transactions have timestamps in them so we can discard records before time T? Are the operations idempotent if we apply them twice (because we are applying an operation already executed between time T and U)? Guess I am confused how to get the initial data before reading from the oplog to continue the real time updates.

0 votes

I have 3 node replicates and i am using all the host in my connection string.Once i execute my node.js script i want to see which particular host it got connected to.
I can fire the following command in mongo shell but same is not working in node.js script, mostly says like "function is not defined"

hostnamedb.hostInfo().system.hostnamers.status().members.find(r=>r.state===1).name
TypeError: db.hostInfo is not a function
ReferenceError: hostname is not defined

Can someone help me how i can find the connected mongo instance server name using the node.js script?

...