- Ideal for test, offline applications and Proof-of-Concept
- Manage data in memory
- Store and load data to/from a JSON file
- Uses Write-Ahead Logging (WAL) to increase performance
- Collection data is split into individual files.
- Configurable (see table below)ù
- Core operations:
- Create, update, upsert, delete records
insertOne
/insertMany
updateOne
upsert
deleteOne
/deleteMany
- Drop Collection
drop
- Count
count
- Retrieve configurable amount of random records (
sample()
)sample
- Snapshot and Clear data
getData
clear
- Support Typescript Types: Data (
Schema
) and Collections (string
)
- Create, update, upsert, delete records
- Support Saving BigInt in JSON file
- Added
_meta
object for each record (not fully implemented)- createdAt
- updatedAt
- Version (increase when update and upsert)
- Added simple indexing (by _id)
- Install deno: https://deno.com
deno add @studiowebux/petitedb
import { PetiteDB } from "@studiowebux/petitedb@^2.1.2";
Version 2.2.0+ has breaking changes.
Example:
see demo/
directory, there are many examples.
Clean Shutdown
const db = new PetiteDB(...);
await db.shutdown()
Options
Parameter | Description | Default |
---|---|---|
autoCommit | If true, the database will be commited automatically when maxWritesBeforeFlush is reached |
true |
walLogPath | WAL File name | db_name.wal.log |
maxWritesBeforeFlush | Number of entries to store in the WAL before saving on-disk | 100 |
memoryOnly | Ephemeral DB only | false |
verbose | Enables all log levels | false |
- Fork the project
- Create a Feature Branch
- Commit your changes
- Push your changes
- Create a PR
Working with your local branch
Branch Checkout:
git checkout -b <feature|fix|release|chore|hotfix>/prefix-name
Your branch name must starts with [feature|fix|release|chore|hotfix] and use a / before the name; Use hyphens as separator; The prefix correspond to your Kanban tool id (e.g. abc-123)
Keep your branch synced:
git fetch origin
git rebase origin/master
Commit your changes:
git add .
git commit -m "<feat|ci|test|docs|build|chore|style|refactor|perf|BREAKING CHANGE>: commit message"
Follow this convention commitlint for your commit message structure
Push your changes:
git push origin <feature|fix|release|chore|hotfix>/prefix-name
Examples:
git checkout -b release/v1.15.5
git checkout -b feature/abc-123-something-awesome
git checkout -b hotfix/abc-432-something-bad-to-fix
git commit -m "docs: added awesome documentation"
git commit -m "feat: added new feature"
git commit -m "test: added tests"
Distributed under the MIT License. See LICENSE for more information.
- Tommy Gingras @ tommy@studiowebux.com | Studio Webux