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: Write new information to a collection. Perform insert or update.
  
  .. seealso:: :meth:`orion.core.io.database.Database.write` for argument documentation.
docstr_tok: ["Write","new","information","to","a","collection",".","Perform","insert","or","update",".","..","seealso",":",":",":","meth",":","`","orion.core.io.database.Database.write","`","for","argument","documentation","."]
code: def write(self, collection_name, data, query=None):
      """Write new information to a collection. Perform insert or update.
  
      .. seealso:: :meth:`orion.core.io.database.Database.write` for argument documentation.
  
      """
      dbcollection = self._db[collection_name]
  
      if query is None:
          # We can assume that we do not want to update.
          # So we do insert_many instead.
          if type(data) not in (list, tuple):
              data = [data]
  
          result = dbcollection.insert_many(documents=data)
          return len(result.inserted_ids)
  
      update_data = {"$set": data}
  
      result = dbcollection.update_many(
          filter=query, update=update_data, upsert=False
      )
      return result.modified_count
  
imports: import functools
  import pymongo
  from orion.core.io.database import Database, DatabaseError, DatabaseTimeout, DuplicateKeyError
label_desc: Use image node_id 13 for calling the MongoDB obj's underlying member method code with example usage: obj.write(collection_name, data, query) and returns: result, len