0.1.2 • Published 4 years ago

jsonb-cli v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

jsonb-cli

command line interface for manipulating jsonb-db

Installation

npm install jsonb-cli -g

Usage

Navigate to project folder and provide the followings commands

Available commands

commanddescriptionexample
jsonblunch jsonb-cli> jsonb
helpprint jsonb-cli usage help> jsonb help
versionprint jsonb-cli version> jsonb version
connect --db=databasenameconnect jsonb-cli to db> jsonb connect --db=logs
dblist functions for connected db instancejsonb>db
collections()list avalaibale collections in connected db instancejsonb>db.collections()
createCollection("collectionName")create collectionjsonb>db.createCollection("customers")
updateCollection("oldCollectionName","newCollectionName")rename collectionjsonb>db.updateCollection("customers","sample")
dropCollection("collectionName")delete collectionjsonb>db.dropCollection("sample")
collection()list avalable functions for each collectionsjsonb>db.collection()
find(criteria)Find items in collection ,when criteria not provided all items are retrievedjsonb>db.collection("sample").find({"country":"TZ"})
skip(rows)Skip rows for a given outputjsonb>db.collection("sample").find({"country":"TZ"}).skip(1)
take(rows)limit number of output rowsjsonb>db.collection("sample").find({"country":"TZ"}).take(1)
count()count total number of rowsjsonb>db.collection("sample").find({"country":"TZ"}).count()
queryFormat output to readable jsonjsonb>db.collection("sample").find({"country":"TZ"}).query
pretty()Format output to nice look json formatjsonb>db.collection("sample").find({"country":"TZ"}).pretty()
table()Display results in tablejsonb>db.collection("sample").find({"country":"TZ"}).table()
insert(value)Insert one item(object) into a collectionjsonb>db.collection("sample").insert({"country":"UK"})
insertMany(values)Insert many items into a collectionjsonb>db.collection("sample").insertMany({"country":"UK"},{"country":"KE"},{"country":"UG"})
update(criteria,value)Update one items in a collection,where by criteria is searching object and value is the new item to be updatedjsonb>db.collection("sample").update({"country":"UK"},{"country":"TZ"})
remove(criterai)delete item from a collectionjsonb>db.collection("sample").remove({"country":"UK"})