patch_database

monkey patch mongomock.database

mongomock_mate.patch_database.dump_db(self, file, pretty=False, overwrite=False, verbose=True)

Dump mongomock.database.Database to a local file. Only support *.json or *.gz (compressed json file)

Parameters:
  • file – file path.
  • pretty – bool, toggle on jsonize into pretty format.
  • overwrite – bool, allow overwrite to existing file.
  • verbose – bool, toggle on log.
mongomock_mate.patch_database.load_db(self, file, check_dbname=True, verbose=True)

Load mongomock.database.Database from a local file.

Parameters:
  • file – file path.
  • check_dbname – bool, if True, the dbname has to be matched.
  • verbose – bool, toggle on log.