2.0.19 • Published 3 years 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-v2OR
# npm
$ npm i w3db-v2Creating 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
3 years ago
2.0.18
3 years ago
2.0.17
3 years ago
2.0.16
3 years ago
2.0.15
3 years ago
2.0.14
3 years ago
2.0.13
3 years ago
2.0.12
3 years ago
2.0.11
3 years ago
2.0.10
3 years ago
2.0.9
3 years ago
2.0.8
3 years ago
2.0.7
3 years ago
2.0.6
3 years ago
2.0.5
3 years ago
2.0.4
3 years ago
2.0.3
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago