[SERVER-1142] Expose more methods to like getReplicationInfo to pymongo and other drivers Created: 23/May/10  Updated: 15/Nov/21  Resolved: 23/May/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Andreas Jung Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

"""
I know how to use db.command(cmd) for commands like 'dbstats' from
within Pymongo but how can I call e.g. printReplicationInfo()
or the underlying getReplicationInfo()
"""

"""

Those are not commands but queries on the oplog, so you'd have to
implement some of that logic manually (unless we decide to support
them w/in pymongo, but not sure if that makes sense).

To view the source of getReplicationInfo type:

db.getReplicationInfo

in the shell (note no parens). You should be able to translate this to
python code w/ pymongo pretty easily.
"""
"""
I think it does make sense. There is actually no clean way to extract
replication related information w/o reimplementing the wheel on the
Python level. The output of 'serverStatus' can be accessed as JSON
through a db.command() call and such function calls could be wrapped in
a similar way.
"""



 Comments   
Comment by Eliot Horowitz (Inactive) [ 23/May/10 ]

please see:
http://www.mongodb.org/display/DOCS/Replication#Replication-Fromtheshell

notably db._adminCommand(

{ serverStatus : 1 , repl : N }

)

Generated at Thu Feb 08 02:56:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.