class_docstr: Non permanent collection
  
  This collection is meant for debugging purposes within the EphemeralDB.
  
  .. seealso:: :class:`orion.core.io.database.ephemeraldb.EphemeralDB` for database object.
class_docstr_tok: ["Non","permanent","collection","This","collection","is","meant","for","debugging","purposes","within","the","EphemeralDB",".","..","seealso",":",":",":","class",":","`","orion.core.io.database.ephemeraldb.EphemeralDB","`","for","database","object","."]
docstr: Insert the document when query was not found.
  
  If update contains `$set`, then the new document is the combination of query and
  update['$set'], otherwise the new document is `update`.
docstr_tok: ["Insert","the","document","when","query","was","not","found",".","If","update","contains","`","$","set","`",",","then","the","new","document","is","the","combination","of","query","and","update","[","'","$","set","'","]",",","otherwise","the","new","document","is","`","update","`","."]
code: def _upsert(self, query, update):
      """Insert the document when query was not found.
  
      If update contains `$set`, then the new document is the combination of query and
      update['$set'], otherwise the new document is `update`.
      """
      if "$set" in update:
          new_document = copy.deepcopy(query)
          new_document.update(update["$set"])
      else:
          new_document = update
  
      self.insert_many([new_document])
  
imports: import copy
  from collections import defaultdict
  from orion.core.io.database import Database, DatabaseError, DuplicateKeyError
  from orion.core.utils.flatten import flatten, unflatten
label_desc: Use image node_id 11 for calling the EphemeralCollection obj's underlying member method code with example usage: obj._upsert(query, update) without return types