A unique name for the database.
The folder path for where the database and its collections will be stored.
An array of collections, where each item in this array is an object containing the name of the collection and the model or document that the collection will use.
A list of meta-objects defining categories of documents in the database.
A collection is an object containing a collection name, document type, plus other properties to help access that data. This means that multiple collections could use the same document type while still keeping database records in separate collections in the database.
The set of document types used in this database.
This is calculated based on the collections that the database is configured to use, since multiple collections could use the same document type.
The set of embedded-document types used in this database.
This is calculated based on the collections that the database is configured to use, since multiple collections could use the same embedded-document type.
The name of the database.
The database's folder path, where it stores all collections.
Query a collection and receive a number representing the count of documents matching that query.
The name of the collection that you wish search through.
The NeDB query used to find the specific document within the collection.
Integer number of documents within the specified collection that match the query.
Add a new collection to an existing database.
Configure an enforced constraint on a collection.
See the @seald/nedb documentation for more info about NeDB indexes.
A string of the collection name to target within the database.
An object per the @seald/nedb documentation to configure the index that is to be created.
Promise.
Create multiple document instances from a provided array of object data, insert each document instance into the database, and return the array of document instances.
Create a document instance from a provided object of data, insert the new document instance into the database, and return the new document instance.
Delete collections by model. Can delete multiple collections that use the same model.
You can also specify whether or not the data within the collection should be deleted, just as a sanity-check. This is enabled by default.
The model to search for.
Optional
deleteData: boolean = trueWhether or not data within the collection should be deleted. Defaults to true.
The number of collections with a matching name that were deleted.
Delete collections by name. Can delete multiple collections that use the same name.
You can also specify whether or not the data within the collection should be deleted, just as a sanity-check. This is enabled by default.
The name of the collections to search for.
Optional
deleteData: boolean = trueWhether or not data within the collection should be deleted. Defaults to true.
The number of collections with a matching name that were deleted.
Find and delete multiple documents from a specified collection.
The name of the collection that you wish to search through and modify.
The NeDB query used to find the specific documents within the collection.
Options to pass to the query system in NeDB. For this particular method, multi
is always set to true
.
Number of removed documents.
Find and delete one document from a specified collection.
The name of the collection that you wish to search through and modify.
The NeDB query used to find the specific document within the collection.
Options to pass to the query system in NeDB. For this particular method, multi
is always set to false
.
Number of removed documents.
Search a database for one or more matched documents and modify them, returning the modified documents as an array of document instances.
If no documents match the given query, this function will return an empty array.
The name of the database collection to query.
The query to run to find the relevant document.
The data to apply to the found document.
Optional
options: updateManyOptionsOptional. The options that can be used in this operation.
Search a database for one or more matched documents and modify them, returning the modified documents as an array of plain objects.
If no documents match the given query, this function will return an empty array.
The name of the database collection to query.
The query to run to find the relevant document.
The data to apply to the found document.
Optional
options: updateManyOptionsOptional. The options that can be used in this operation.
Search a database for a singular matched document and modify it, returning the modified document as a document instance.
The name of the database collection to query.
The query to run to find the relevant document.
The data to apply to the found document.
Optional
options: updateOptionsOptional. The options that can be used in this operation.
Search a database for a singular matched document and modify it, returning the modified document as a plain object.
The name of the database collection to query.
The query to run to find the relevant document.
The data to apply to the found document.
Optional
options: updateOptionsOptional. The options that can be used in this operation.
Query a collection and return an array of document instances matching that query.
This method is NOT compatible with NeDB projections.
Even if nothing matches the given query, an array is returned.
The name of the collection that you wish to search through.
The NeDB query used to find the specific document within the collection. Read more about NeDB queries here: https://github.com/seald/nedb?tab=readme-ov-file#finding-documents
Optional
options: findManyDocumentsOptionsOptional. Configuration for this database operation.
An instance of the collection's model.
Query a collection and return an array of objects matching that query, where each object is a document's data.
This method is compatible with NeDB projections, allowing you to trim the returned data. Read more in the NeDB documentation.
Even if nothing matches the given query, an array is returned.
The name of the collection that you wish to search through.
The NeDB query used to find the specific document within the collection. Read more about NeDB queries here: https://github.com/seald/nedb?tab=readme-ov-file#finding-documents
Optional
options: findManyObjectsOptionsOptional. Configuration for this database operation.
An instance of the collection's model.
Query a collection and receive the first document matching that query, returned as a document instance.
This method is NOT compatible with NeDB projections, and thus returns an instance of the document used by the specified collection.
The name of the collection that you wish to search through.
The NeDB query used to find the specific document within the collection. Read more about NeDB queries here: https://github.com/seald/nedb?tab=readme-ov-file#finding-documents
An instance of the collection's model.
Query a collection and receive the first document matching that query, returned as a plain object.
This method is compatible with NeDB projections, allowing you to trim the returned data. Read more in the NeDB documentation.
The name of the collection that you wish to search through.
The NeDB query used to find the specific document within the collection. Read more about NeDB queries here: https://github.com/seald/nedb?tab=readme-ov-file#finding-documents
Optional
options: findOneObjectOptionsOptional. Configuration for this database operation.
An instance of the collection's model.
Retrieve the collection meta object stored on the NeDB client instance matching a given collection name.
A string of the collection name to target within the database.
An object containing helper properties to perform collection-related operations.
Insert an array of objects of data into the database, following a document schema, and return the saved array of objects of data.
The name of the collection to insert the data into.
The data to be inserted.
The data saved in the database, as an object.
Insert an object of data into the database, following a document schema, and return the saved object of data.
The name of the collection to insert the data into.
The data to be inserted.
The data saved in the database, as an object.
Remove a collection's index from an array of given field names.
A string of the collection name to target within the database.
An array containing one or more fields on the collection that you'd like to remove the index from.
Promise.
Creates an instance of NedbClient.