class_docstr: Datasource for reading from and writing to MongoDB.
class_docstr_tok: ["Datasource","for","reading","from","and","writing","to","MongoDB","."]
code: def _get_or_create_client(self):
      import pymongo
  
      if self._client is None:
          self._client = pymongo.MongoClient(self._uri)
          _validate_database_collection_exist(
              self._client, self._database, self._collection
          )
          self._avg_obj_size = self._client[self._database].command(
              "collstats", self._collection
          )["avgObjSize"]
  
file_path: ray/python/ray/data/datasource/mongo_datasource.py
imports: import logging
  from typing import TYPE_CHECKING, Dict, List, Optional
  from ray.data.block import Block, BlockMetadata
  from ray.data.datasource.datasource import Datasource, ReadTask
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 4 for calling the MongoDatasource obj's underlying member method code with example usage: obj._get_or_create_client() without return types