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: Delete from a collection document[s] which match the `query`.
  
  .. seealso:: :meth:`orion.core.io.database.Database.remove` for argument documentation.
docstr_tok: ["Delete","from","a","collection","document","[","s","]","which","match","the","`","query","`",".","..","seealso",":",":",":","meth",":","`","orion.core.io.database.Database.remove","`","for","argument","documentation","."]
code: def delete_many(self, query=None):
      """Delete from a collection document[s] which match the `query`.
  
      .. seealso:: :meth:`orion.core.io.database.Database.remove` for argument documentation.
  
      """
      deleted = 0
      retained_documents = []
      for document in self._documents:
          if not document.match(query):
              retained_documents.append(document.to_dict())
          else:
              deleted += 1
  
      # Reset indexes
      for name, (keys, _) in self._indexes.items():
          self._indexes[name] = (keys, set())
  
      self._documents = []
      self.insert_many(retained_documents)
  
      return deleted
  
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 13 for calling the EphemeralCollection obj's underlying member method code with example usage: obj.delete_many(query) and returns: deleted