class_docstr: The MongoDatabaseAdapter is an interface that allows
  ChatterBot to store statements in a MongoDB database.
  
  :keyword database_uri: The URI of a remote instance of MongoDB.
                         This can be any valid
                         `MongoDB connection string <https://docs.mongodb.com/manual/reference/connection-string/>`_
  :type database_uri: str
  
  .. code-block:: python
  
     database_uri='mongodb://example.com:8100/'
class_docstr_tok: ["The","MongoDatabaseAdapter","is","an","interface","that","allows","ChatterBot","to","store","statements","in","a","MongoDB","database",".",":","keyword","database_uri",":","The","URI","of","a","remote","instance","of","MongoDB",".","This","can","be","any","valid","`","MongoDB","connection","string","<","https",":","\/\/docs.mongodb.com\/manual\/reference\/connection-string\/",">","`","_",":","type","database_uri",":","str","..","code-block",":",":","python","database_uri='mongodb",":","\/\/example.com:8100\/","'"]
code: def update(self, statement):
      data = statement.serialize()
      data.pop("id", None)
      data.pop("tags", None)
  
      data["search_text"] = self.tagger.get_text_index_string(
          data["text"]
      )
  
      if data.get("in_response_to"):
          data[
              "search_in_response_to"
          ] = self.tagger.get_text_index_string(data["in_response_to"])
  
      update_data = {"$set": data}
  
      if statement.tags:
          update_data["$addToSet"] = {"tags": {"$each": statement.tags}}
  
      search_parameters = {}
  
      if statement.id is not None:
          search_parameters["_id"] = statement.id
      else:
          search_parameters["text"] = statement.text
          search_parameters["conversation"] = statement.conversation
  
      update_operation = self.statements.update_one(
          search_parameters, update_data, upsert=True
      )
  
      if update_operation.acknowledged:
          statement.id = update_operation.upserted_id
  
      return statement
  
file_path: ChatterBot/chatterbot/storage/mongodb.py
imports: import re
  from chatterbot.storage import StorageAdapter
label_desc: Use image node_id 8 for calling the MongoDatabaseAdapter obj's underlying member method code with example usage: obj.update(statement) and returns: statement