Features
Last updated
Was this helpful?
Last updated
Was this helpful?
The options for Dreamy-db.
new Dreamy( options = { } )
Parameters
options
: | DreamyOptions
uri
: The connection URI of the database.
namespace
:
The namespace of the database.
The storage adapter or backend to use.
store
: *
The options for Dreamy.
A data serialization function.
A data deserialization function.
The name of the collection. Only works for MongoDB.
The name of the table. Only works for SQL databases.
The maximum size of the keys of elements.
Namespaces isolate elements within the database to avoid key collisions, separate elements by prefixing the keys, and allow clearance of only one namespace while utilizing the same database.
You can optionally utilize third-party storage adapters or build your own. Dreamy-db will integrate the third-party storage adapter and handle complex data types internally.
Dreamy-db handles all the JSON data types including Buffer using its data serialization methods that encode Buffer data as a base64-encoded string, and decode JSON objects which contain buffer-like data, either as arrays of strings or numbers, into Buffer instances to ensure consistency across various backends.
Optionally, pass your own data serialization methods to support extra data types.
Using custom serializers means you lose any guarantee of data consistency.
adapter
:
serialize
:
deserialize
:
collection
:
table
:
keySize
:
For example, is an unrelated and independent module that has an API similar to that of Dreamy-db.
Dreamy-db is designed to be easily embeddable inside modules. It is recommended to set a for the module.