Package: saracendb
SaracenDB DocumentationIntroductionSaracenDB is a Python-based NoSQL database, offering a simple and flexible data storage solution. It uses BSON for data serialization and allows users to create, read, update, and delete data in an easy-to-use manner.Class Initializationdb=SaracenDB(filename:str,collection:str='default')filename: Name of the file that will store the database.collection: Name of the collection to use initially. If not provided, the default collection name will be 'default'.MethodsAddAdd a new entry to the current collection.db.add(entry:dict)entry: The data to be added to the collection, in dictionary form.FindFinds entries in the current collection that match a given key-value pair.db.find(key:str,value:str)key: The key to look for in the entries.value: The value to look for in the entries.GetGet an entry by its ID in the current collection.db.get(id:int)id: The ID of the entry.EditEdit a key-value pair in an entry in the current collection.db.edit(id:int,key:str,value)id: The ID of the entry.key: The key to edit.value: The new value.rm_itemDelete an entry from the current collection using its ID.db.rm_item(id:int)id: The ID of the entry.rm_keyDelete a key from an entry in the current collection.db.rm_key(key:str,id)key: The key to delete.id: The ID of the entry.rm_collDelete a collection.db.rm_coll(collection:str)collection: The name of the collection to delete.rm_key_for_allDelete a key from all entries in the current collection.db.rm_key_for_all(key:str)key: The key to delete.add_key_for_allAdd a key to all entries in the current collection.db.add_key_for_all(key:str,value='')key: The key to add.value: The initial value of the new key.add_collCreate a new collection.db.add_coll(collection:str)collection: The name of the new collection.use_collSwitch to another collection.db.use_coll(collection:str)collection: The name of the collection to switch to.pushSave changes to the database.db.push()compactRemove deleted entries from the database file to reduce file size.db.compact()to_jsonWrite the current collection to a JSON file.db.to_json(path:str)path: The path of the JSON file.to_yamlWrite the current collection to a YAML file.db.to_yaml(path:str)path: The path of the YAML file.db_to_jsonWrite the entire database to a JSON file.db.db_to_json(path:str)path: The path of the JSON file.db_to_yamlWrite the entire database to a YAML file.db.db_to_yaml(path:str)path: The path of the YAML file.json_to_dbCreate a new database from a JSON file.db.json_to_db(path:str)path: The path of the JSON file.yaml_to_dbCreate a new database from a YAML file.db.yaml_to_db(path:str)path: The path of the YAML file.import_json_to_collImport a JSON file to the current collection.db.import_json_to_coll(path:str)path: The path of the JSON file.import_yaml_to_collImport a YAML file to the current collection.db.import_yaml_to_coll(path:str)path: The path of the YAML file.reindexReindex the current collection.db.reindex()coll_listList all collections in the database.db.coll_list()get_collReturn the current collection.db.get_coll()set_collOverwrite the current collection.db.set_coll(coll:list)coll: The new collection data, in list form.get_full_dbReturn the full database.db.get_full_db()