class_docstr: Wrap MongoDB with three primary methods `read`, `write`, `remove`.
  
  Attributes
  ----------
  host : str
     Hostname or MongoDB compliant full credentials+address+database
     specification.
  
  Information on MongoDB `connection string
  <https://docs.mongodb.com/manual/reference/connection-string/>`_.
  
  .. seealso:: :class:`orion.core.io.database.Database` for more on attributes.
docstr: Read a collection's document and update the found document.
  
  Returns the updated document, or None if nothing found.
  
  .. seealso:: :meth:`orion.core.io.database.Database.read_and_write` for
               argument documentation.
docstr_tok: ["Read","a","collection","'s","document","and","update","the","found","document",".","Returns","the","updated","document",",","or","None","if","nothing","found",".","..","seealso",":",":",":","meth",":","`","orion.core.io.database.Database.read_and_write","`","for","argument","documentation","."]
code: def read_and_write(
      self, collection_name, query, data, selection=None
  ):
      """Read a collection's document and update the found document.
  
      Returns the updated document, or None if nothing found.
  
      .. seealso:: :meth:`orion.core.io.database.Database.read_and_write` for
                   argument documentation.
  
      """
      dbcollection = self._db[collection_name]
  
      update_data = {"$set": data}
  
      dbdoc = dbcollection.find_one_and_update(
          query,
          update_data,
          projection=selection,
          return_document=pymongo.ReturnDocument.AFTER,
      )
  
      return dbdoc
  
imports: import functools
  import pymongo
  from orion.core.io.database import Database, DatabaseError, DatabaseTimeout, DuplicateKeyError
label_desc: Use image node_id 15 for calling the MongoDB obj's underlying member method code with example usage: obj.read_and_write(collection_name, query, data, selection) and returns: dbdoc