Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Nested key-value database for OrbitDB

License

NotificationsYou must be signed in to change notification settings

orbitdb/nested-db

Nested key-value database type for OrbitDB.

orbit-db-nested testscodecov

Installation

$ pnpm add @orbitdb/nested-db

Introduction

AsNested database is like aKeyValue database, but it can contain nested values that can be accessed as JSON.

Examples

A simple example withNested:

import{createOrbitDB,useDatabaseType}from"@orbitdb/core";import{Nested}from"@orbitdb/nested-db";// Register nested database type. IMPORTANT - must call before creating orbit instance !useDatabaseType(Nested);constorbitdb=awaitcreateOrbitDB({ ipfs})constdb=awaitorbitdb.open({type:"nested"});awaitdb.put("a",1);awaitdb.put("b/c",2);awaitdb.put(["b","d"],3)// Alternative syntaxconstall=awaitdb.all();// { a: 1, b: { c: 2, d: 3 }}awaitdb.get("b")// { c: 2, d: 3 }awaitdb.del("b");awaitdb.all();// { "a": 1 }

A more complex example with object types:

import{createOrbitDB,useDatabaseType}from"@orbitdb/core";import{Nested}from"@orbitdb/nested-db";// Register nested database type. IMPORTANT - must call before creating orbit instance !useDatabaseType(Nested);constorbit=awaitcreateOrbitDB({ ipfs})constdb=awaitorbitdb.open({type:"nested"});awaitdb.insert({a:{b:1},d:3});awaitdb.insert("a",{c:2});constall=awaitdb.all();// { a: { b: 1, c: 2}, d: 3}

About

Nested key-value database for OrbitDB

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2026 Movatter.jp