{"id":13800662,"url":"https://github.com/denyncrawford/dndb","last_synced_at":"2025-09-06T04:36:28.698Z","repository":{"id":48195440,"uuid":"280949626","full_name":"denyncrawford/dndb","owner":"denyncrawford","description":"A Deno 🦕 persistent, embeddable and optimized NoSQL database for JS \u0026 TS","archived":false,"fork":false,"pushed_at":"2022-11-02T03:16:36.000Z","size":161,"stargazers_count":76,"open_issues_count":3,"forks_count":15,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-25T16:28:30.042Z","etag":null,"topics":["async","database","datastore","deno","javascript","json","mongodb","nosql","persistent-storage"],"latest_commit_sha":null,"homepage":"https://dndb.crawford.ml","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denyncrawford.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-19T21:00:21.000Z","updated_at":"2025-08-05T02:18:37.000Z","dependencies_parsed_at":"2023-01-21T10:33:51.222Z","dependency_job_id":null,"html_url":"https://github.com/denyncrawford/dndb","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/denyncrawford/dndb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdndb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdndb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdndb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdndb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denyncrawford","download_url":"https://codeload.github.com/denyncrawford/dndb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdndb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273858845,"owners_count":25180766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","database","datastore","deno","javascript","json","mongodb","nosql","persistent-storage"],"created_at":"2024-08-04T00:01:14.824Z","updated_at":"2025-09-06T04:36:28.658Z","avatar_url":"https://github.com/denyncrawford.png","language":"TypeScript","funding_links":["https://paypal.me/DENYNCRAWFORD?locale.x=en_US"],"categories":["TypeScript","Modules","nosql"],"sub_categories":["Database","Assistants"],"readme":"\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://dndb.crawford.ml\"\u003e\n    \u003cimg src=\"https://dndb.crawford.ml/_assets/dndblogo.c35b53e9.png\" alt=\"Deno Logo\" width=\"80\" height=\"80\"\u003e\n  \u003c/a\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\u003ca href=\"https://nest.land/package/dndb\"\u003e\u003cimg src=\"https://nest.land/badge.svg\" alt=\"nest badge\"\u003e\u003c/a\u003e \u003cimg src=\"https://hitcounter.pythonanywhere.com/count/tag.svg?url=https%3A%2F%2Fgithub.com%2Fdenyncrawford%2Fdndb\" alt=\"Hits\"\u003e \u003ca href=\"https://deno.land\"\u003e\u003cimg src=\"https://img.shields.io/badge/deno-v1.1.3-green.svg?style=flat-square\u0026amp;logo=deno\" alt=\"(Deno)\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/denyncrawford/crawford/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/denyncrawford/dndb?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAEFCu8CAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAHKADAAQAAAABAAAAHAAAAABHddaYAAAC5UlEQVRIDd2WPWtVQRCGby5pVASLiGghQSxyG8Ui2KWwCfkH9olY2JneQkiR0oCIxH/gB+qVFDYBIWBAbAIRSbCRpLXwIxLiPT7vnNm9e87ZxJtUwYH3zO47Mzv7Mbv3tlo5KYriGtgAJ81OY1ENdG/YI4boFEOI911BXgY/pdtwGuAtXpvmB1tAXHDnUolE5urkPOQo6MqA3pXWmJJL4Bb4rQ7yEYfxsjnIF29NJIoNC6e5fxOL/qN+9KCz7AaLpN8zI415N2i2EptpGrkRIjGeAuvR6IY1hSFLFUOug9Ms2M7ZxIUNytm1mnME186sdI2BOCwAyQMg54ugzSmKmwbPwSbolKH+hbAtQdsOoF+BsF3anUVwBdiOWRidFZDKTTrKEAJTm3GVrGkHzw/uPZbyx7DNNLfB7KGmRsCcr+/gjaiPSpAOTyX9qG4L/XBDdWXDDf1M+wtQ5fwCOtcb4Dto6VpLmzByB6gqdHbTItGSJdAGqibJQhmRfCF7IN4beSF2G9CqnGXQrxofXU+EykllNeoczRgYytDKMubDIRK0g5MF8rE69cGu0u9nlUcqaUZ41W0qK2nGcSzr4D2wV9U9wxp1rnpxn8agXAOHMQ9cy9kbHM7ngY4gFb03TxrO/yfBUifTtXt78jCrjY/jgEFnMn45LuNWUtknuu7NSm7D3QEn3HbatV1Q2jvgIRf1sfODKQaeymxZoMLlTqsq1LF+HvaTqQOzEzUCfni0/eNIA+DfuE3KEtbsegckGmMktTXacnBHPVe687ugkpT+axCkkhBSyRSjWI2xf1KMMVmYiQdWksK9BEFiQoiYLIlvJA3/zeTzCejP0RbB6YPbhZuB+0pR3KcdX0LaJtju0ZgBL8Bd+sbz2QIaU2OfBX3BaQLsgZysQtrk0M8Sh1A0w3DyyYnGnAiZ4gqZ/TvI2A8OGd1YIbF7+F3P+B6dYpYdsJNZgrjO0UdOIhmom0nwL0pnfnzkL1803jAoKhvyAAAAAElFTkSuQmCC\" alt=\"license\"\u003e\u003c/a\u003e\n\u003ca href=\"https://app.fossa.com/projects/git%2Bgithub.com%2Fdenyncrawford%2Fdndb?ref=badge_small\"\u003e\u003cimg src=\"https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdenyncrawford%2Fdndb.svg?type=small\" alt=\"FOSSA Status\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    A Deno 🦕 persistent, embeddable and optimized NoSQL database for JS \u0026 TS \u003c/a\u003e.\n    \u003cbr /\u003e\n    \u003ca href=\"https://dndb.crawford.ml/docs\"\u003e\u003cstrong\u003eDocumentation\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/denyncrawford/dndb/issues\"\u003eReport a Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/denyncrawford/dndb/issues\"\u003eRequest Feature\u003c/a\u003e\n    .\n    \u003ca href=\"https://github.com/denyncrawford\"\u003eSupport Us\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\u003cbr\u003e\n\n## About DnDB\n\nDnDB is a javascript persistent database written for Deno and available for\nTypescript.\n\nInspired by NeDB, DnDB is a robust but minimalist database engine written on JS\nthat uses/emulates the mongo query API to edit and find data, making it 100%\nexportable to a mongojs environment.\n\n\u003e _Notice_: This project is under development, so it is subject to future\n\u003e improvements and changes.\n\n## Why DnDB?\n\nDnDB is an incredibly fast and powerful data store. All methods are streamed and\nbuffered to optimize data reading/writing. DnDB is not only faster, but it\nconsumes less resources (RAM) since only a small portion of the data stream is\nstored in memory by the buffer, enabling optimal performance on large data\ncollections.\n\n## 🧪 Quick test\n\n[Run the demo](/demo/README.md) to test DnDB in a server environment. Also this\ndemo lives on [Codesandbox](https://codesandbox.io/s/6x0uw)\n\n## 📦 Importing\n\n**deno.land**\n\n```javascript\nimport Datastore from \"https://deno.land/x/dndb@0.3.3/mod.ts\";\n```\n\n**nest.land**\n\n```javascript\nimport Datastore from \"https://x.nest.land/dndb@0.3.3/mod.ts\";\n```\n\n## 📖 Usage\n\nDnDB works by instantiating collections stored in a specific file given by the\nuser in the instance configuration. By default the created instance exposes the\nnecessary methods to work the datastore.\n\nAll the api methods are asynchronous by default, so they return promises, but\nit's also possible to pass a callback to them to work in a traditional mongo\nway.\n\n- [Instantiating a collection](/#instatiating-a-collection)\n- [API](#inserting-documents)\n  - [Inserting documents](#%EF%B8%8F-inserting-documents)\n  - [Finding documents](#-finding-documents)\n  - [Updating documents](#%EF%B8%8F-updating-documents)\n  - [Removing documents](#-removing-documents)\n\n## ✔️ Instantiating the collection\n\n```javascript\nimport Datastore from \"https://deno.land/x/dndb@0.3.3/mod.ts\";\n\nconst db = new Datastore({ filename: \"./database.db\", autoload: true });\n```\n\nWhen you instantiate a collection you can pass it a config object with a couple\nof options:\n\n- `filename`: The filename is the absolute path to your target file. If no\n  filename is provided, DnDB will automatically create one in the current\n  working directory, and if a full path is not specified, it will resolve the\n  file name within the CWD.\n\n- `autoload`: The autoload option runs the `loadDatabase` method which creates\n  the persistent file the first time DnDB is running in your project, this is\n  optional, but if the loadDatabase method is not executed, the instance will\n  not work until the persistent file exists.\n\n- `bufSize`: The bufSize parameter rewrites the default size of the buffer. It\n  must be indicated in numbers and represents the amount of bytes to be\n  allocated. By default 4096 bytes.\n\n\u003e _Notice_: The configuration content is currently in alpha, more options will\n\u003e be available soon.\n\n## 🖋️ Inserting documents\n\nAll data types are allowed, but field names starting with '$' are reserved for\ndata querying.\n\nIf the document does not contain an _id field, DnDB will automatically generate\none for you (a RFC4122 UUID alphanumerical string). The _id of a document, once\nset, shouldn't be modified.\n\n```javascript\nlet obj = {\n  name: \"denyn\",\n  lastName: \"crawford\",\n};\n\nlet insertion = await db.insert(obj);\n\n// OR\n\ndb.insert(obj, (insertion) =\u003e {\n  // ...foo(insetion)\n});\n```\n\nTo insert documents DnDB exposes the method:\n\n- `insert`:\n\n- returns: Array/object with the inserted documents.\n\nThe insert method receives two arguments:\n\n- `data`: Json data to insert\n- `callback`(optional): The callback function to get the data inserted.\n\nYou can also insert several documents at the same time by wrapping them in an\narray.\n\n```javascript\nlet foo = \"foo\";\n\ndb.insert([{ name: \"denyn\" }, { name: foo }], (insertion) =\u003e {\n  // ...foo(insetion)\n});\n```\n\n## 🔍 Finding documents\n\nTo find documents DnDB exposes the methods:\n\n- `find`: Finds all the documents that match the query.\n\n  - returns: array of matching documents\n\n- `findOne`: Finds the first document that matches the query.\n\n  - returns: exact first matching object\n\nYou can select documents based on field equality or use comparison operators\n(`$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$nin`, `$neq`). You can also use logical\noperators `$or`, `$and`, `$not` and `$eq`. See below for the syntax.\n\nYou can use regular expressions in two ways: in basic querying in place of a\nstring, or with the $regex operator.\n\n_Example of document querying:_\n\n\u003e _Notice_: See all rules and operators list\n\u003e [here](https://www.npmjs.com/package/mingo)\n\n```javascript\ndb.find({ name: \"Denyn\" }, {}, (docs) =\u003e {\n  console.log(docs);\n});\n\n// or\n\nlet docs = await db.find({ name: \"Denyn\" });\n\n// Finding unique document\n\nlet docs = await db.findOne({ username: \"denyncrawford\" });\n\n// Deep querying syntax:\n\nlet docs = await db.find({ fullName: { lastName: \"Crawford\" } });\n```\n\nYou can also use dot notation to find documents by deep querying.\n\n```javascript\nlet docs = await db.find({ \"fullName.lastName\": \"Crawford\" });\n\n// Using dot notation to find inside arrays:\n\nlet docs = await db.find({ \"list.games.0\": \"Doom\" });\n```\n\n\u003e If you want to know how to advance query documents please\n\u003e [read this](https://github.com/louischatriot/nedb/#basic-querying)\n\n### Projections\n\nYou can give `find` and `findOne` an optional second argument, projections. The\nsyntax is the same as MongoDB: `{ a: 1, b: 1 }` to return only the a and b\nfields, `{ a: 0, b: 0 }` to omit these two fields. You cannot use both modes at\nthe time, except for _id which is by default always returned and which you can\nchoose to omit. You can project on nested documents.\n\n\u003e _Notice_: See all rules and operators list\n\u003e [here](https://www.npmjs.com/package/mingo)\n\n```javascript\ndb.find({ planet: \"Mars\" }, { planet: 1, system: 1 }, function (docs) {\n  // docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }]\n});\n```\n\n## 🖌️ Updating documents\n\nTo update documents DnDB exposes the method:\n\n- `update`\n\n  - returns: array with the new updated collection\n\n- `updateOne`\n\n  - returns: object with the new updated document.\n\nThe update method follows the same query rules as in `find` and `findOne` at\nfirst argument to get the update target document and as a second agument it\nreceives the aggregation operators that modifies the matching fileds values ​​by\nfollowing the aggregation rules.\n\n\u003e _Notice_: See all rules and operators list\n\u003e [here](https://www.npmjs.com/package/mingo)\n\n```javascript\ndb.update({ name: \"denyn\" }, { $set: { pet: \"Boots\" } }, (update) =\u003e {\n  // ...foo(update)\n});\n\n// OR\n\nlet update = await db.update({ name: \"denyn\" }, { $set: { pet: \"Boots\" } });\n```\n\n## ❌ Removing documents\n\nTo remove documents DnDB exposes the method:\n\n- `remove`\n\n  - returns: array with the new removed collection\n\n- `removeOne`\n\n  - returns: object with the new removed document\n\nThe remove method follows the same query rules as in `find` and `findOne` at\nfirst argument, it will remove all the documents that matches the query.\n\n```javascript\ndb.remove({ _id: \"id2\" }, function (newDoc) {\n  // ...foo(newDoc)\n});\n\n//OR\n\nconst { remove } = db;\n\nawait remove({ _id: \"id2\" });\n```\n\n\u003e _Notice_: If you want to unset a value from the document you must use update\n\u003e with the $unset operator. See all rules and operators list\n\u003e [here](https://www.npmjs.com/package/mingo)\n\n# 📝 Roadmap\n\n- Standard methods\n- Database from datastores factory\n- Read and write streams and buffer\n- Global Queue executor\n- Event hooks on all the API usage\n- Count method\n- Improve documentation\n- Prevent updating immutable data\n- Error handlers.\n- SORT, SKIP, and LIMIT modifier methods support.\n\n# 📌 This module is right now on Beta, but the main API is pretty usable for production.\n\nSince it is a standard, the API will not be subject to drastic changes, but its\ninternal working will.\n\n# 👊 Support this project by donating on:\n\n- [Paypal](https://paypal.me/DENYNCRAWFORD?locale.x=en_US).\n- BTC address: 1AwAW9gj7zsHWjoawm1yFntjE69uvEjJTv\n- USDT adress (BSC) 0x9c83792244a8ee2e5b4c595b001ad8d7173e98bf\n- USDT adress (ERC20) 0x9c83792244a8ee2e5b4c595b001ad8d7173e98bf\n\n# 📜 MIT License\n\nCopyright (c) Crawford.\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdenyncrawford%2Fdndb.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdenyncrawford%2Fdndb?ref=badge_large)\n\n[Full license](/LICENSE.md)\n\n# Scripts\n\n| Type   | Command                                                                             |\n| ------ | ----------------------------------------------------------------------------------- |\n| Format | `deno fmt`                                                                          |\n| Lint   | `deno lint --unstable --ignore=test,demo`                                           |\n| Test   | `deno test --unstable --allow-read=. --allow-write=db.db,db.db.updated`             |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenyncrawford%2Fdndb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenyncrawford%2Fdndb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenyncrawford%2Fdndb/lists"}