### Get Database List Example Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Retrieves a list of all database names stored for the current application context. The callback function receives an array of strings. ```javascript idbAdapter.getDatabaseList(function(result) { // result is array of string names for that appcontext ("finance") result.forEach(function(str) { console.log(str); }); }); ``` -------------------------------- ### Install LokiDB with npm Source: https://lokijs-forge.github.io/LokiDB/api/index.html Use this command to install the LokiDB package via npm. Ensure you have Node.js and npm installed. ```bash npm install @lokidb/loki ``` -------------------------------- ### Load Database Example Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Loads a serialized database from the catalog. This method is asynchronous and returns a Promise that resolves with the database object. ```javascript var idbAdapter = new LokiIndexedAdapter("finance"); var db = new loki("test", { adapter: idbAdapter }); db.base(function(result) { console.log("done"); }); ``` -------------------------------- ### Save Database Example Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Saves a serialized database to the catalog. This method is asynchronous and returns a Promise. ```javascript let idbAdapter = new LokiIndexedAdapter("finance"); let db = new loki("test", { adapter: idbAdapter }); let coll = db.addCollection("testColl"); coll.insert({test: "val"}); db.saveDatabase(); // could pass callback if needed for async complete ``` -------------------------------- ### Chained Query Example Source: https://lokijs-forge.github.io/LokiDB/api/classes/resultset.html Demonstrates a typical chain of query operations on a collection, including find and where, before retrieving the data. ```javascript mycollection.chain() .find({ 'doors' : 4 }) .where(function(obj) { return obj.name === 'Toyota' }) .data(); ``` -------------------------------- ### Delete Database Example Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Deletes a serialized database from the catalog. This method is asynchronous and returns a Promise. ```javascript idbAdapter.deleteDatabase("test", function() { // database deleted }); ``` -------------------------------- ### slice_from Method Source: https://lokijs-forge.github.io/LokiDB/api/classes/snowballprogram.html Sets the starting point for a slice operation. ```APIDOC ## slice_from ### Description Sets the starting point for a slice operation based on a given string. ### Method slice_from(s: string): void ### Parameters #### Path Parameters - **s** (string) - Required - The string to use as the starting point for the slice. #### Returns void ``` -------------------------------- ### Compound Sort Example Source: https://lokijs-forge.github.io/LokiDB/api/classes/resultset.html Shows how to sort a ResultSet by multiple properties, optionally specifying descending order for specific properties. ```javascript rs.compoundsort(['age', 'name']); ``` ```javascript rs.compoundsort(['age', ['name', true]); ``` -------------------------------- ### get Source: https://lokijs-forge.github.io/LokiDB/api/classes/collection.html Retrieves a document by its ID. This method is faster than others due to its optimized searching algorithm. ```APIDOC ## get ### Description Retrieves a document by its ID. This method is faster than others due to its optimized searching algorithm. ### Method get ### Parameters #### Query Parameters - **id** (number) - Required - $loki id of the document to retrieve - **returnPosition** (boolean) - Optional - If true, returns an array containing the document and its position ### Returns Doc | [Doc, number] - The document if found, null if not, or an array if 'returnPosition' was specified. ``` -------------------------------- ### get Source: https://lokijs-forge.github.io/LokiDB/api/classes/collection.html Retrieves a document from the collection by its Loki ID. ```APIDOC ## get get(id: number): T | undefined ### Description Retrieves a document from the collection by its Loki ID. ### Parameters #### Parameters - **id** (number) - Required - The Loki ID of the document to retrieve. #### Returns T | undefined - The document with the specified ID, or undefined if not found. ``` -------------------------------- ### constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/partitioningadapter.html Initializes a new instance of the PartitioningAdapter. ```APIDOC ## constructor ### Description Initializes a new instance of the PartitioningAdapter. ### Parameters #### adapter: StorageAdapter Reference to a 'non-reference' mode loki adapter instance. #### __namedParameters: object = {} Optional named parameters. #### Returns PartitioningAdapter ``` -------------------------------- ### constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/avltreeindex.html Initializes the AvlTreeIndex with a property name and a comparer function. ```APIDOC ## constructor ### Description Initializes index with property name and a comparer function. ### Parameters - **name**: string - **comparator**: ILokiComparer ### Returns AvlTreeIndex ``` -------------------------------- ### Instantiate and Use DynamicView Source: https://lokijs-forge.github.io/LokiDB/api/classes/dynamicview.html Demonstrates how to instantiate a dynamic view, apply find and where filters, and retrieve the results. This is useful for creating specific, up-to-date subsets of collection data. ```javascript let mydv = mycollection.addDynamicView('test'); mdv.applyFind({ 'doors' : 4 }); mdv.applyWhere(function(obj) { return obj.name === 'Toyota'; }); let results = mydv.data(); ``` -------------------------------- ### get Method Source: https://lokijs-forge.github.io/LokiDB/api/classes/uniqueindex.html Retrieves the Loki ID associated with a given unique value. ```APIDOC ## get get(value: any): number ### Description Returns the $loki id of an unique value. #### Parameters * ##### value: any the value to retrieve a loki id match for #### Returns number ``` -------------------------------- ### Create Collection with AVL Ranged Index Source: https://lokijs-forge.github.io/LokiDB/ranged_indexes Demonstrates how to create a collection and apply an AVL ranged index to a specific property. ```javascript const db = new Loki("idxtest"); // create a "users" collection, applying an avl index to the "name" property of its documents const items = db.addCollection("users", { rangedIndexes: { name: { indexTypeName: "avl", comparatorName: "js" } } }); ``` -------------------------------- ### register Source: https://lokijs-forge.github.io/LokiDB/api/classes/partitioningadapter.html Registers the partitioning adapter as a plugin. ```APIDOC ## register ### Description Registers the partitioning adapter as plugin. ### Returns void ``` -------------------------------- ### Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokiabstractoperatorpackage.html Initializes a new instance of the LokiAbstractOperatorPackage class. ```APIDOC ## constructor ### Description Initializes a new instance of the LokiAbstractOperatorPackage class. ### Returns LokiAbstractOperatorPackage ``` -------------------------------- ### Get Full-Text Search Scoring Source: https://lokijs-forge.github.io/LokiDB/api/classes/dynamicview.html Retrieves the scoring results from the last full-text search operation performed on the DynamicView. ```javascript const scores = dv.getScoring(); ``` -------------------------------- ### Get scoring from full-text search Source: https://lokijs-forge.github.io/LokiDB/api/classes/resultset.html Retrieve the scoring results from the last full-text search operation performed on the ResultSet. ```typescript getScoring(): Scorer.ScoreResult[] ``` -------------------------------- ### register Source: https://lokijs-forge.github.io/LokiDB/api/classes/localstorage.html Registers the local storage adapter as a plugin. ```APIDOC ## register ### Description Registers the local storage as a plugin. ### Method `register(): void` ### Returns * **void** ``` -------------------------------- ### Collection Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/collection.html Initializes a new Collection instance. It is typically created using `Loki#addCollection`. ```APIDOC ## constructor new Collection(name: string, options?: Options): Collection ### Description Initializes a new Collection instance. It is typically created using `Loki#addCollection`. ### Parameters #### Parameters - **name** (string) - Required - The name of the collection. - **options** (Options) - Optional - Options to configure the collection. #### Returns Collection - A reference to the newly created Collection instance. ``` -------------------------------- ### Get Data from DynamicView Source: https://lokijs-forge.github.io/LokiDB/api/classes/dynamicview.html Resolves any pending filtering and sorting, then returns the documents as an array. Optional parameters can be passed for non-persistent ResultSets. ```javascript const documents = dv.data(); ``` -------------------------------- ### Loki Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/loki.html Constructs the main database class. You can specify a filename for persistence and options for configuration. ```APIDOC ## constructor new Loki(filename?: string, options?: Options): Loki ### Description Constructs the main database class. ### Parameters - **filename** (string) - Optional - The name of the file to be saved to. Defaults to "loki.db". - **options** (Options) - Optional - Configuration options for the Loki instance. ### Returns - **Loki** - An instance of the Loki database. ``` -------------------------------- ### startTransaction Source: https://lokijs-forge.github.io/LokiDB/api/classes/collection.html Initiates a transaction, allowing for atomic operations on the collection. ```APIDOC ## startTransaction ### Description start the transation. ### Method ``` startTransaction(): void ``` ### Returns void ``` -------------------------------- ### Skip documents with offset Source: https://lokijs-forge.github.io/LokiDB/api/classes/resultset.html Use `offset` to skip a specified number of documents from the beginning of the ResultSet. This returns a copy of the ResultSet containing documents starting from the specified position. ```typescript offset(pos: number): this ``` -------------------------------- ### register Source: https://lokijs-forge.github.io/LokiDB/api/classes/fsstorage.html Registers the fs storage as a plugin. ```APIDOC ## register ### Description Registers the fs storage as a plugin. ### Method `register(): void` ### Returns void ``` -------------------------------- ### Entry Interface Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/entry.html This snippet details the structure of the Entry interface, including its properties: app, key, and size. ```APIDOC ## Interface Entry ### Hierarchy * Entry ## Properties ### app app: string ### key key: string ### size size: number ``` -------------------------------- ### loadDatabase Source: https://lokijs-forge.github.io/LokiDB/api/classes/loki.html Loads the entire database from storage. ```APIDOC ## loadDatabase loadDatabase(options?: LoadDatabaseOptions): Promise ### Description Loads the entire database from storage. ### Parameters - **options** (LoadDatabaseOptions) - Optional - Options for loading the database. ### Returns - **Promise** - A Promise that resolves when the database is loaded. ``` -------------------------------- ### copy Source: https://lokijs-forge.github.io/LokiDB/api/classes/loki.html Creates a shallow copy of the current Loki database instance. ```APIDOC ## copy copy(options?: CopyOptions): Loki ### Description Copies 'this' database into a new Loki instance. Object references are shared to make lightweight. ### Parameters - **options** (CopyOptions) - Optional - Options for the copy operation. ### Returns - **Loki** - A new Loki instance that is a copy of the original. ``` -------------------------------- ### MemoryStorage Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/memorystorage.html Initializes a new instance of MemoryStorage with optional configuration options. ```APIDOC ## new MemoryStorage(options?: Options) ### Description Initializes a new instance of the MemoryStorage class. ### Parameters #### Optional options: Options Memory storage options. ### Returns MemoryStorage A new instance of MemoryStorage. ``` -------------------------------- ### startTransaction Source: https://lokijs-forge.github.io/LokiDB/api/classes/dynamicview.html Marks the beginning of a transaction. ```APIDOC ## startTransaction ### Description Marks the beginning of a transaction. ### Method startTransaction ### Returns this DynamicView object, for further chain ops. ``` -------------------------------- ### IndexedStorage Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Initializes a new instance of the IndexedStorage class. An optional appname can be provided to specify the application context. ```APIDOC ## constructor IndexedStorage ### Description Initializes a new instance of the IndexedStorage class. ### Parameters * **appname** (string) - Optional - The name of the application context. Defaults to "loki". ### Returns IndexedStorage ``` -------------------------------- ### backup Source: https://lokijs-forge.github.io/LokiDB/api/classes/avltreeindex.html Creates a backup of the current index state. ```APIDOC ## backup ### Description Creates a backup of the current index state. ### Returns AvlTreeIndex ``` -------------------------------- ### loadDatabase Source: https://lokijs-forge.github.io/LokiDB/api/classes/partitioningadapter.html Loads a database that was partitioned into several key/value saves. ```APIDOC ## loadDatabase ### Description Loads a database which was partitioned into several key/value saves. (Loki persistence adapter interface function) ### Parameters #### dbname: string Name of the database (filename/keyname). ### Returns Promise A Promise that resolves after the database was loaded ``` -------------------------------- ### initializePersistence Source: https://lokijs-forge.github.io/LokiDB/api/classes/loki.html Configures options related to database persistence. This method initializes persistence settings and can optionally autoload the database if enabled. ```APIDOC ## initializePersistence ### Description Configures options related to database persistence. ### Parameters * `options` (PersistenceOptions) - Optional: Default value is {} ### Returns Promise: a Promise that resolves after initialization and (if enabled) autoloading the database ``` -------------------------------- ### MemoryStorage Options Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/memorystorage.options.html Configuration options for the MemoryStorage. ```APIDOC ## Interface Options ### Hierarchy * Options ## Properties ### Optional asyncResponses `asyncResponses`: boolean - Determines if asynchronous responses are enabled for MemoryStorage operations. ### Optional asyncTimeout `asyncTimeout`: number - Specifies the timeout duration in milliseconds for asynchronous operations in MemoryStorage. ``` -------------------------------- ### loadDatabase Source: https://lokijs-forge.github.io/LokiDB/api/classes/localstorage.html Loads database data from local storage. ```APIDOC ## loadDatabase ### Description Loads data from local storage. ### Method `loadDatabase(dbname: string): Promise` ### Parameters #### Path Parameters * **dbname** (string) - Required - The name of the database to load. ### Returns * **Promise** - A Promise that resolves after the database has been loaded. ``` -------------------------------- ### loadDatabase Source: https://lokijs-forge.github.io/LokiDB/api/classes/loki.html Handles manually loading the database from an adapter storage. This method uses Loki configuration options or environment detection to determine the persistence method and drains the save queue first. ```APIDOC ## loadDatabase ### Description Handles manually loading from an adapter storage (such as fs-storage). This method utilizes loki configuration options (if provided) to determine which persistence method to use, or environment detection (if configuration was not provided). To avoid contention with any throttledSaves, we will drain the save queue first. If you are configured with autosave, you do not need to call this method yourself. ### Parameters * `options` (LoadDatabaseOptions) - Optional: Default value is {} ### Returns Promise: a Promise that resolves after the database is loaded ``` -------------------------------- ### FullTextSearch Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/fulltextsearch.html Initializes the full-text search for the given fields. ```APIDOC ## constructor ### Description Initialize the full-text search for the given fields. ### Parameters - **fieldOptions** (FieldOptions[]) - Optional - The field options. Defaults to [] - **id** (string) - Optional - The ID for the search instance. ### Returns FullTextSearch ``` -------------------------------- ### register Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Registers the indexed storage as a plugin. ```APIDOC ## register ### Description Registers the indexed storage as plugin. ### Returns void ``` -------------------------------- ### loadDatabase Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/storageadapter.html Loads a database from storage. This method is required for all storage adapters. ```APIDOC ## loadDatabase ### Description Loads a database from storage. ### Method `loadDatabase(dbname: string): Promise` ### Parameters #### Path Parameters - **dbname** (string) - Required - The name of the database to load. ### Returns - Promise - The loaded database object. ``` -------------------------------- ### ComparatorOperatorPackage Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/comparatoroperatorpackage.html Initializes a new instance of the ComparatorOperatorPackage class with a specified comparator. ```APIDOC ## new ComparatorOperatorPackage(comparator: ILokiComparer) ### Description Initializes a new instance of the ComparatorOperatorPackage class. ### Parameters #### comparator: ILokiComparer - The comparer function to use for operations. ``` -------------------------------- ### initializePersistence Source: https://lokijs-forge.github.io/LokiDB/api/classes/loki.html Initializes the persistence layer for the database. ```APIDOC ## initializePersistence initializePersistence(options: PersistenceOptions): Promise ### Description Initializes the persistence layer for the database. ### Parameters - **options** (PersistenceOptions) - Required - Options for initializing persistence. ### Returns - **Promise** - A Promise that resolves when persistence is initialized. ``` -------------------------------- ### Options Interface Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/dynamicview.options.html The Options interface defines the configuration properties available for DynamicView. ```APIDOC ## Interface Options ### Hierarchy * Options ## Properties ### Optional minRebuildInterval minRebuildInterval: number ### Optional persistent persistent: boolean ### Optional sortPriority sortPriority: SortPriority ``` -------------------------------- ### loadDatabase Source: https://lokijs-forge.github.io/LokiDB/api/classes/fsstorage.html Loads data from a file. Throws an error if the file does not exist. ```APIDOC ## loadDatabase ### Description Loads data from a file. Throws an error if the file does not exist. ### Method `loadDatabase(dbname: string): Promise` ### Parameters #### Path Parameters * **dbname** (string) - Required - The filename of the database to load. ### Returns Promise - A Promise that resolves after the database was loaded. ``` -------------------------------- ### $nkeyin Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokiabstractoperatorpackage.html Checks if a key does not exist within an object. ```APIDOC ## $nkeyin ### Description Checks if a key does not exist within an object. ### Parameters - **a**: string - **b**: object ### Returns boolean ``` -------------------------------- ### on Source: https://lokijs-forge.github.io/LokiDB/api/classes/dynamicview.html Adds a listener to the queue of callbacks associated to an event. Returns the index of the callback. ```APIDOC ## on ### Description Adds a listener to the queue of callbacks associated to an event. ### Method on ### Parameters #### Path Parameters * **eventName** ( string | string[] ) - Required - the name(s) of the event(s) to listen to * **listener** ( Function ) - Required - callback function of listener to attach ### Returns Function - the index of the callback in the array of listeners for a particular event ``` -------------------------------- ### Implement and Register a Custom Ranged Index Source: https://lokijs-forge.github.io/LokiDB/ranged_indexes Shows how to define a custom RangedIndex implementation, create a factory for it, and register it with LokiDB for use in collections. ```typescript // define index implementation class customRangedIndex implements IRangedIndex { public name: string; public comparator: ILokiComparer; constructor(name: string, comparator: ILokiComparer) { this.name = name; this.comparator = comparator; } insert(id: number, val: T) { if (!id || !val) throw new Error(""); return; } update(id: number, val: T) { if (!id || val === null) throw new Error(""); return; } remove(id: number) { if (!id) throw new Error(""); return; } restore(tree: any) { if (!tree) throw new Error(""); return; } backup() { return this; } rangeRequest(range?: IRangedIndexRequest) { if (range === null) { // return everything return []; } return []; } validateIndex() { return true; } } // ranged index implementations need factory function let myCustomIndexFactory = (name: string, cmp: ILokiComparer) => { return new customRangedIndex(name, cmp); }; // register ranged index factory function with loki constructor let db = new Loki("test.db", { rangedIndexFactoryMap: { "MyCustomRangedIndex": myCustomIndexFactory } }); // utilize your registered ranged index within a collection let items = db.addCollection("users", { rangedIndexes: { "name": { indexTypeName: "MyCustomRangedIndex", comparatorName: "js" } } }); ``` -------------------------------- ### loadDatabase Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Retrieves a serialized database string from the catalog. ```APIDOC ## loadDatabase ### Description Retrieves a serialized db string from the catalog. ### Method GET ### Endpoint /indexedDB/{dbname} ### Parameters #### Path Parameters * **dbname** (string) - Required - The name of the database to retrieve. ### Returns Promise - A Promise that resolves after the database was loaded. ### Request Example ```javascript // LOAD var idbAdapter = new LokiIndexedAdapter("finance"); var db = new loki("test", { adapter: idbAdapter }); db.base(function(result) { console.log("done"); }); ``` ``` -------------------------------- ### SnowballProgram Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/snowballprogram.html Initializes a new instance of the SnowballProgram class. ```APIDOC ## constructor ### Description Initializes a new SnowballProgram instance. ### Method constructor() ### Returns SnowballProgram - A new instance of SnowballProgram. ``` -------------------------------- ### loadDatabase Source: https://lokijs-forge.github.io/LokiDB/api/classes/memorystorage.html Loads a serialized database from the in-memory store. ```APIDOC ## loadDatabase(dbname: string): Promise ### Description Loads a serialized database from its in-memory store. (Loki persistence adapter interface function) ### Parameters #### dbname: string Name of the database (filename/keyname). ### Returns Promise A Promise that resolves after the database was loaded. ``` -------------------------------- ### getCatalogSummary Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Retrieves a summary of all keys in the catalog along with their sizes. ```APIDOC ## getCatalogSummary ### Description Allows retrieval of list of all keys in catalog along with size. ### Parameters #### Callback * **callback** (function) - Optional - A callback function that accepts the result array. * **entry** (Entry[]) - An array of catalog entries. ### Returns void ``` -------------------------------- ### on Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokieventemitter.html Adds a listener function to be executed when the specified event is emitted. ```APIDOC ## on(eventName: string | string[], listener: Function): Function ### Description Adds a listener to the queue of callbacks associated to an event. ### Parameters * **eventName**: string | string[] - The name(s) of the event(s) to listen to. * **listener**: Function - The callback function of the listener to attach. ### Returns Function - The index of the callback in the array of listeners for a particular event. ``` -------------------------------- ### LokiOperatorPackage Methods Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokioperatorpackage.html This section details the various methods available in the LokiOperatorPackage class for performing comparisons and operations. ```APIDOC ## $and ### Description Performs a logical AND operation between two values. ### Method $and(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The first value to compare. #### b - Type: any - Description: The second value to compare. ### Returns - Type: boolean - Description: True if both values satisfy the condition, false otherwise. ``` ```APIDOC ## $between ### Description Checks if a value falls within a specified range. ### Method $between(a: any, range: [any, any]): boolean ### Parameters #### a - Type: any - Description: The value to check. #### range - Type: [any, any] - Description: An array representing the range [min, max]. ### Returns - Type: boolean - Description: True if the value is within the range, false otherwise. ``` ```APIDOC ## $contains ### Description Checks if a value contains another value. ### Method $contains(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value to check within. #### b - Type: any - Description: The value to search for. ### Returns - Type: boolean - Description: True if 'a' contains 'b', false otherwise. ``` ```APIDOC ## $containsAny ### Description Checks if a value contains any of the values in a collection. ### Method $containsAny(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value to check within. #### b - Type: any - Description: A collection of values to search for. ### Returns - Type: boolean - Description: True if 'a' contains any of the values in 'b', false otherwise. ``` ```APIDOC ## $containsNone ### Description Checks if a value contains none of the values in a collection. ### Method $containsNone(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value to check within. #### b - Type: any - Description: A collection of values to search for. ### Returns - Type: boolean - Description: True if 'a' contains none of the values in 'b', false otherwise. ``` ```APIDOC ## $definedin ### Description Checks if a property is defined within an object. ### Method $definedin(a: string, b: object): boolean ### Parameters #### a - Type: string - Description: The name of the property to check. #### b - Type: object - Description: The object to check within. ### Returns - Type: boolean - Description: True if the property is defined in the object, false otherwise. ``` ```APIDOC ## $eq ### Description Checks for equality between two values. ### Method $eq(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The first value to compare. #### b - Type: any - Description: The second value to compare. ### Returns - Type: boolean - Description: True if the values are equal, false otherwise. ``` ```APIDOC ## $finite ### Description Checks if a number is finite. ### Method $finite(a: number, b: boolean): boolean ### Parameters #### a - Type: number - Description: The number to check. #### b - Type: boolean - Description: This parameter seems unused based on the description, but is part of the signature. ### Returns - Type: boolean - Description: True if the number is finite, false otherwise. ``` ```APIDOC ## $gt ### Description Checks if the first value is greater than the second value. ### Method $gt(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The first value. #### b - Type: any - Description: The second value. ### Returns - Type: boolean - Description: True if 'a' is greater than 'b', false otherwise. ``` ```APIDOC ## $gte ### Description Checks if the first value is greater than or equal to the second value. ### Method $gte(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The first value. #### b - Type: any - Description: The second value. ### Returns - Type: boolean - Description: True if 'a' is greater than or equal to 'b', false otherwise. ``` ```APIDOC ## $in ### Description Checks if a value is present in a collection. ### Method $in(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value to check. #### b - Type: any - Description: The collection to search within. ### Returns - Type: boolean - Description: True if 'a' is in 'b', false otherwise. ``` ```APIDOC ## $keyin ### Description Checks if a key exists in an object. ### Method $keyin(a: string, b: object): boolean ### Parameters #### a - Type: string - Description: The key to check for. #### b - Type: object - Description: The object to check within. ### Returns - Type: boolean - Description: True if the key exists in the object, false otherwise. ``` ```APIDOC ## $len ### Description Checks the length of a value (e.g., string, array). ### Method $len(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value whose length is to be checked. #### b - Type: any - Description: The expected length. ### Returns - Type: boolean - Description: True if the length of 'a' matches 'b', false otherwise. ``` ```APIDOC ## $lt ### Description Checks if the first value is less than the second value. ### Method $lt(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The first value. #### b - Type: any - Description: The second value. ### Returns - Type: boolean - Description: True if 'a' is less than 'b', false otherwise. ``` ```APIDOC ## $lte ### Description Checks if the first value is less than or equal to the second value. ### Method $lte(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The first value. #### b - Type: any - Description: The second value. ### Returns - Type: boolean - Description: True if 'a' is less than or equal to 'b', false otherwise. ``` ```APIDOC ## $ne ### Description Checks for inequality between two values. ### Method $ne(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The first value to compare. #### b - Type: any - Description: The second value to compare. ### Returns - Type: boolean - Description: True if the values are not equal, false otherwise. ``` ```APIDOC ## $nin ### Description Checks if a value is not present in a collection. ### Method $nin(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value to check. #### b - Type: any - Description: The collection to search within. ### Returns - Type: boolean - Description: True if 'a' is not in 'b', false otherwise. ``` ```APIDOC ## $nkeyin ### Description Checks if a key does not exist in an object. ### Method $nkeyin(a: string, b: object): boolean ### Parameters #### a - Type: string - Description: The key to check for. #### b - Type: object - Description: The object to check within. ### Returns - Type: boolean - Description: True if the key does not exist in the object, false otherwise. ``` ```APIDOC ## $not ### Description Performs a logical NOT operation on a value. ### Method $not(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value to negate. #### b - Type: any - Description: This parameter seems unused based on the description, but is part of the signature. ### Returns - Type: boolean - Description: The negated value of 'a'. ``` ```APIDOC ## $or ### Description Performs a logical OR operation between two values. ### Method $or(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The first value to compare. #### b - Type: any - Description: The second value to compare. ### Returns - Type: boolean - Description: True if at least one of the values satisfies the condition, false otherwise. ``` ```APIDOC ## $regex ### Description Checks if a string matches a regular expression. ### Method $regex(a: string, b: RegExp): boolean ### Parameters #### a - Type: string - Description: The string to test. #### b - Type: RegExp - Description: The regular expression to match against. ### Returns - Type: boolean - Description: True if the string matches the regex, false otherwise. ``` ```APIDOC ## $size ### Description Checks the size of a value (e.g., array length, object key count). ### Method $size(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value whose size is to be checked. #### b - Type: any - Description: The expected size. ### Returns - Type: boolean - Description: True if the size of 'a' matches 'b', false otherwise. ``` ```APIDOC ## $type ### Description Checks the type of a value. ### Method $type(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value to check. #### b - Type: any - Description: The expected type (e.g., 'string', 'number', 'object'). ### Returns - Type: boolean - Description: True if the type of 'a' matches 'b', false otherwise. ``` ```APIDOC ## $undefinedin ### Description Checks if a property is undefined within an object. ### Method $undefinedin(a: string, b: object): boolean ### Parameters #### a - Type: string - Description: The name of the property to check. #### b - Type: object - Description: The object to check within. ### Returns - Type: boolean - Description: True if the property is undefined in the object, false otherwise. ``` ```APIDOC ## $where ### Description Performs a custom filtering operation based on a provided function. ### Method $where(a: any, b: any): boolean ### Parameters #### a - Type: any - Description: The value to test. #### b - Type: any - Description: A function or condition to apply for filtering. ### Returns - Type: boolean - Description: True if the value satisfies the condition, false otherwise. ``` -------------------------------- ### MatchQuery Properties Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/matchquery.html This section details the properties available for configuring a MatchQuery. These properties allow fine-grained control over how text is tokenized and searched. ```APIDOC ## Interface MatchQuery A query which tokenizes the given text into tokens and performs a sub query for each token. The results are combined using a boolean operator. ### Properties * **boost** (number) - Optional - Adjusts the relevance score of the query. * **extended** (boolean) - Optional - Enables extended matching features. * **field** (string) - Required - The field to perform the match query against. * **fuzziness** (0 | 1 | 2 | "AUTO") - Optional - Allows for fuzzy matching with a specified level of tolerance. * **minimum_should_match** (number | string) - Optional - Specifies the minimum number of 'should' clauses that must match. * **operator** ("and" | "or") - Optional - The boolean operator to combine query tokens (defaults to 'or'). * **prefix_length** (number) - Optional - The length of the prefix to be considered for matching. * **type** (string) - Required - Must be set to "match" for this query type. * **value** (string) - Required - The text value to search for. ``` -------------------------------- ### register Source: https://lokijs-forge.github.io/LokiDB/api/classes/fulltextsearch.html Registers the full-text search as a plugin. ```APIDOC ## register ### Description Registers the full-text search as plugin. ### Returns void ``` -------------------------------- ### serialize Source: https://lokijs-forge.github.io/LokiDB/api/classes/loki.html Serializes the database into a JSON string. ```APIDOC ## serialize serialize(options?: SerializeOptions): string ### Description Serializes the database into a JSON string. ### Parameters - **options** (SerializeOptions) - Optional - Options for serialization. ### Returns - **string** - The JSON string representation of the database. ``` -------------------------------- ### MemoryStorage.register Source: https://lokijs-forge.github.io/LokiDB/api/classes/memorystorage.html Registers the MemoryStorage as a plugin. ```APIDOC ## register(): void ### Description Registers the local storage as plugin. ### Returns void ``` -------------------------------- ### $eq Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokiabstractoperatorpackage.html Checks for equality between two values. ```APIDOC ## $eq ### Description Checks for equality between two values. ### Parameters - **a**: any - **b**: any ### Returns boolean ``` -------------------------------- ### Change Interface Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/collection.change.html Details about the properties of the Change interface. ```APIDOC ## Interface Change ### Hierarchy * Change ## Properties ### name name: string ### obj obj: any ### operation operation: string ``` -------------------------------- ### Functions Source: https://lokijs-forge.github.io/LokiDB/api/globals.html Documentation for utility functions available in the LokiDB library. ```APIDOC ## Functions ### CreateAbstractDateJavascriptComparator Creates a comparator that attempts to handle dates at the comparator level. Should work for dates in any of the object, string, and number formats. #### Type parameters * **T** #### Returns ILokiComparer - A Loki comparer function for dates. ### CreateAbstractJavascriptComparator Typescript-friendly factory for strongly typed 'abstract js' comparators. #### Type parameters * **T** #### Returns ILokiComparer - A Loki comparer function. ### CreateJavascriptComparator Typescript-friendly factory for strongly typed 'js' comparators. #### Type parameters * **T** #### Returns ILokiComparer - A Loki comparer function. ### CreateLokiComparator Typescript-friendly factory for strongly typed 'loki' comparators. #### Returns ILokiComparer - A Loki comparer function. ### analyze Analyzes a given string using the provided analyzer. #### Parameters * **analyzer**: Analyzer - The analyzer to use for tokenization. * **str**: string - The string to analyze. #### Returns string[] - An array of tokens. ### generateStopWordFilter Generates a stop word filter function. #### Parameters * **stopWords**: string[] - An array of stop words to filter out. #### Returns (Anonymous function) - A function that filters stop words. ### generateTrimmer Generates a trimmer function based on specified word characters. #### Parameters * **wordCharacters**: string - A string containing characters to be considered part of a word. #### Returns (Anonymous function) - A function that trims strings. ### lowercaseTokenFilter Converts a token to lowercase. #### Parameters * **token**: string - The token to convert. #### Returns string - The lowercased token. ### uppercaseTokenFilter Converts a token to uppercase. #### Parameters * **token**: string - The token to convert. #### Returns string - The uppercased token. ``` -------------------------------- ### $keyin Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokiabstractoperatorpackage.html Checks if a key exists within an object. ```APIDOC ## $keyin ### Description Checks if a key exists within an object. ### Parameters - **a**: string - **b**: object ### Returns boolean ``` -------------------------------- ### insert Source: https://lokijs-forge.github.io/LokiDB/api/classes/collection.html Adds one or more documents to the collection. Ensures documents have meta properties and clones them if necessary. ```APIDOC ## insert ### Description Adds one or more documents to the collection. Ensures documents have meta properties and clones them if necessary. ### Method insert ### Parameters #### Request Body - **doc** (TData | TData[]) - Required - The document or array of documents to be inserted ### Returns Doc | Doc[] - The inserted document or documents. ``` -------------------------------- ### exportDatabase Source: https://lokijs-forge.github.io/LokiDB/api/classes/partitioningadapter.html Saves a database by partitioning it into separate key/value saves. ```APIDOC ## exportDatabase ### Description Saves a database by partioning into separate key/value saves. (Loki 'reference mode' persistence adapter interface function) ### Parameters #### dbname: string Name of the database (filename/keyname). #### dbref: Loki Reference to database which we will partition and save. ### Returns Promise A Promise that resolves after the database was deleted ``` -------------------------------- ### mapReduce Source: https://lokijs-forge.github.io/LokiDB/api/classes/resultset.html Data transformation via user-supplied functions. ```APIDOC ## mapReduce ### Description data transformation via user supplied functions ### Type parameters #### U1 #### U2 ### Parameters #### mapFunction: function this function accepts a single document for you to transform and return * (item: Doc, index: number, array: Doc[]): U1 * Parameters: * item: Doc * index: number * array: Doc[] #### reduceFunction: function this function accepts many (array of map outputs) and returns single value * (array: U1[]): U2 * Parameters: * array: U1[] ### Returns U2 The output of your reduceFunction ``` -------------------------------- ### CheckIndexOptions Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/collection.checkindexoptions.html Options for checking an index. These are optional parameters that can be passed to the checkIndex method. ```APIDOC ## Interface CheckIndexOptions ### Properties #### Optional randomSampling `randomSampling`: boolean #### Optional randomSamplingFactor `randomSamplingFactor`: number #### Optional repair `repair`: boolean ``` -------------------------------- ### Among Constructor Source: https://lokijs-forge.github.io/LokiDB/api/classes/among.html Initializes a new instance of the Among class. ```APIDOC ## constructor new Among(s: string, substring_i: number, result: number, method?: any): Among ### Parameters - **s**: string - **substring_i**: number - **result**: number - **method** (optional): any ### Returns - Among ``` -------------------------------- ### insert Method Source: https://lokijs-forge.github.io/LokiDB/api/classes/snowballprogram.html Inserts a string into the current processing context. ```APIDOC ## insert ### Description Inserts a string into the current processing context, defined by bra and ket indices. ### Method insert(c_bra: number, c_ket: number, s: string): void ### Parameters #### Path Parameters - **c_bra** (number) - Required - The bra index for insertion. - **c_ket** (number) - Required - The ket index for insertion. - **s** (string) - Required - The string to insert. #### Returns void ``` -------------------------------- ### SimpleSortOptions Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/resultset.simplesortoptions.html Defines options for sorting query results. It allows specifying a descending order and a custom comparator function. ```APIDOC ## Interface SimpleSortOptions ### Description Options for sorting query results. Allows specifying a descending order and a custom comparator function. ### Properties #### desc (boolean) - Optional If true, the sort order is descending. #### sortComparator (string) - Optional A custom comparator function to use for sorting. This should be a string representation of the function. ``` -------------------------------- ### $lte Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokiabstractoperatorpackage.html Checks if the first value is less than or equal to the second value. ```APIDOC ## $lte ### Description Checks if the first value is less than or equal to the second value. ### Parameters - **a**: any - **b**: any ### Returns boolean ``` -------------------------------- ### serialize Source: https://lokijs-forge.github.io/LokiDB/api/classes/loki.html Serializes the entire database into a string format, which can later be loaded using the `loadJSON` method. Supports custom serialization options. ```APIDOC ## serialize ### Description Serialize database to a string which can be loaded via {@link Loki#loadJSON}. ### Parameters #### Query Parameters - **options** (SerializeOptions) - Optional - Default value: {} ### Returns - **string | string[]** - Stringified representation of the loki database. ``` -------------------------------- ### getDatabaseList Source: https://lokijs-forge.github.io/LokiDB/api/classes/indexedstorage.html Retrieves an array of database names for the current application context. ```APIDOC ## getDatabaseList ### Description Retrieves object array of catalog entries for current app. ### Parameters #### Callback * **callback** (function) - Required - A callback function that accepts an array of database names. * **names** (string[]) - An array of database names in the catalog for the current app. ### Returns void ### Request Example ```javascript idbAdapter.getDatabaseList(function(result) { // result is array of string names for that appcontext ("finance") result.forEach(function(str) { console.log(str); }); }); ``` ``` -------------------------------- ### applyFind Source: https://lokijs-forge.github.io/LokiDB/api/classes/dynamicview.html Applies a MongoDB-style query to filter the documents within the DynamicView. This is a convenient way to filter based on document properties. ```APIDOC ## applyFind ### Description Adds or updates a mongo-style query option in the DynamicView filter pipeline. ### Parameters * **query** (object) - Required - A mongo-style query object to apply to the pipeline. * **uid** (string | number) - Optional - The unique ID of this filter, to reference it in the future. Defaults to "". ### Returns * this - The current DynamicView object, enabling further chain operations. ``` -------------------------------- ### addListener Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokieventemitter.html Adds a listener function to be executed when the specified event is emitted. This is an alias for the 'on' method. ```APIDOC ## addListener(eventName: string | string[], listener: Function): Function ### Description Alias of EventEmitter.on(). Adds a listener to the queue of callbacks associated to an event. ### Parameters * **eventName**: string | string[] - The name(s) of the event(s) to listen to. * **listener**: Function - The callback function of the listener to attach. ### Returns Function - The index of the callback in the array of listeners for a particular event. ``` -------------------------------- ### deregister Source: https://lokijs-forge.github.io/LokiDB/api/classes/partitioningadapter.html Deregisters the partitioning storage as a plugin. ```APIDOC ## deregister ### Description Deregisters the partitioning storage as plugin. ### Returns void ``` -------------------------------- ### stage Source: https://lokijs-forge.github.io/LokiDB/api/classes/collection.html Creates a copy of an object and inserts it into a staging area within the collection. ```APIDOC ## stage ### Description (Staging API) create a copy of an object and insert it into a stage. ### Method ``` stage(stageName: string, obj: Doc): F ``` ### Type parameters #### F: TData ### Parameters #### stageName (string) - Required #### obj (Doc) - Required ### Returns F ``` -------------------------------- ### CopyOptions Interface Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/loki.copyoptions.html The CopyOptions interface defines optional parameters that can be passed when copying data. This allows for customization of the copying process. ```APIDOC ## Interface CopyOptions ### Hierarchy * CopyOptions ### Properties * removeNonSerializable ### Optional removeNonSerializable `removeNonSerializable`: boolean Controls whether non-serializable properties should be removed during the copy operation. If true, non-serializable properties will be excluded. If false or undefined, the behavior depends on the underlying serialization mechanism. ``` -------------------------------- ### ILokiOperatorPackageMap Interface Source: https://lokijs-forge.github.io/LokiDB/api/interfaces/ilokioperatorpackagemap.html This interface defines a structure for mapping string names to LokiOperatorPackage objects. It is indexable by a string name, returning a LokiOperatorPackage. ```APIDOC ## Interface ILokiOperatorPackageMap ### Description Hash interface for named LokiOperatorPackage registration. ### Indexable `[name: string]: LokiOperatorPackage` This indicates that the interface can be accessed using a string key, and the value associated with that key will be of type `LokiOperatorPackage`. ``` -------------------------------- ### $and Source: https://lokijs-forge.github.io/LokiDB/api/classes/lokiabstractoperatorpackage.html Performs a logical AND operation between two values. ```APIDOC ## $and ### Description Performs a logical AND operation between two values. ### Parameters - **a**: any - **b**: any ### Returns boolean ```