2.0.19 • Published 1 year ago
w3db-v2 v2.0.19
W3DB-V2 - DECENTRALIZED DATABASE
W3DB-V2 is a decentralised database uses IPFS for managing data
Usage
go to w3db-v2 official page and create app for your project
install this package in your project directory
# Yarn
$ yarn add w3db-v2
OR
# npm
$ npm i w3db-v2
Creating W3DB-V2 Instance
const { W3dbV2 } = require("w3db-v2")
const config = {
address : // Your Wallet address
projectId : // Your ProjectId
secret: // Your project secret
mumbaiRPC : // Your polygon mumbai rpc url
}
const db = new W3dbV2(config);
ADDING NEW DOCUMENT
// adding new collection
const userCollection = db.collection("Users");
//
const doc = userCollection.add({ id: "1233434854323485",firstName: "JOHN", lastName: "DOE" });
GET ENTIRE COLLECTION
const docs = userCollection.get({ });
GET A PARTICULAR DOCUMENT
const docs = userCollection.get({ id: "1233434854323485" });
// will fetch list in which the "0x92810381801080313" will be in the 'likes' array
const docs = userCollection.get({ $includes: { likes : "0x92810381801080313" }});
UPDATING A PARTICULAR DOCUMENT
const isSuccess = userCollection.update({ id: "1233434854323485" },{ lastName: "WICK" });
DELETING A PARTICULAR DOCUMENT
const deletedId = userCollection.deleteOne({ id: "1233434854323485" });
DELETING A COLLECTION
const isSuccess = userCollection.deleteAll()
GET IPFS
// returns hash of ipfs
const hash = await db.getIPFS()
// returns gateway url of IPFS
const gateway = await db.getIPFS(true)
2.0.19
1 year ago
2.0.18
1 year ago
2.0.17
1 year ago
2.0.16
1 year ago
2.0.15
1 year ago
2.0.14
1 year ago
2.0.13
1 year ago
2.0.12
1 year ago
2.0.11
1 year ago
2.0.10
1 year ago
2.0.9
1 year ago
2.0.8
1 year ago
2.0.7
1 year ago
2.0.6
1 year ago
2.0.5
1 year ago
2.0.4
1 year ago
2.0.3
1 year ago
2.0.2
1 year ago
2.0.1
1 year ago
2.0.0
1 year ago