MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / server_info

Method server_info

pymongo/synchronous/mongo_client.py:2343–2357  ·  view source on GitHub ↗

Get information about the MongoDB server we're connected to. :param session: a :class:`~pymongo.client_session.ClientSession`. .. versionchanged:: 3.6 Added ``session`` parameter.

(self, session: Optional[client_session.ClientSession] = None)

Source from the content-addressed store, hash-verified

2341 return None
2342
2343 def server_info(self, session: Optional[client_session.ClientSession] = None) -> dict[str, Any]:
2344 """Get information about the MongoDB server we're connected to.
2345
2346 :param session: a
2347 :class:`~pymongo.client_session.ClientSession`.
2348
2349 .. versionchanged:: 3.6
2350 Added ``session`` parameter.
2351 """
2352 return cast( # type: ignore[redundant-cast]
2353 dict[str, Any],
2354 self.admin.command(
2355 "buildinfo", read_preference=ReadPreference.PRIMARY, session=session
2356 ),
2357 )
2358
2359 def _list_databases(
2360 self,

Calls 1

commandMethod · 0.45