Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
couch-view-by-keys
Advanced tools
A command line tool to query CouchDB views, focused on easing queries with complex JSON keys
A command line tool to query CouchDB views, focused on easing queries with complex JSON keys (which are a pain to do with curl
)
npm install -g couch-view-by-keys
url="http://username:password@localhost:5984/db-name/_design/design-doc-name/_view/view-name"
couch-view-by-keys "$url" keyA keyB keyC
couch-view-by-keys "$url" '["a", "complex", "key"]' '["another", "complex", "key"]'
# Or from a file with one key per line
cat keys | xargs couch-view-by-keys "$url"
Or to fetch many documents
url="http://username:password@localhost:5984/_all_docs"
couch-view-by-keys "$url" docIdA docIdB docIdC
# Or from a file with one doc id per line
cat ids | xargs couch-view-by-keys "$url"
couch-view-by-keys "$url"
couch-view-by-keys --docs "$url"
couch-view-by-keys --values "$url"
By default, view rows are returned with their document, but this can be disabled by setting include_docs=false
couch-view-by-keys "${url}?include_docs=false"
NB: reduce=false
is also set by default, as reduce=true
is incompatible with include_docs=true
couch-view-by-keys "${url}?limit=10"
couch-view-by-keys "${url}?skip=10"
That's the default output format
couch-view-by-keys "$url" keyA keyB keyC
set the indentation to 0 to drop newlines
couch-view-by-keys "$url" keyA keyB keyC --json 0
# Get all the rows as an array of object
couch-view-by-keys "$url" keyA keyB keyC --json
# Same, but with an indentation of 2
couch-view-by-keys "$url" keyA keyB keyC --json 2
# Same, but with an indentation of 4
couch-view-by-keys "$url" keyA keyB keyC --json 4
Some times you might need to use variable interpolation, which, in bash, requires to use double quotes. Unfortunately, JSON keys being expected to be valid JSON, they also require doubles quotes. You would thus normally endup with some horrible escaping of the kind:
couch-view-by-keys "$url" "[\"$1\",\"a\"]" "[\"$2\",\"b\"]" "[\"$3\",\"c\"]"
Horrified by so much anticipated pain, you might just stop there, give up on computing and start drinking. But fear no more! You can just use single quotes instead:
# works with simple arrays
couch-view-by-keys "$url" "['$1','a']" "['$2','b']" "['$3','c']"
# and simple objects
couch-view-by-keys "$url" "{ 'a': '$1'}"
# TODO: make it work for nested objects/arrays if you have the need
FAQs
A command line tool to query CouchDB views, focused on easing queries with complex JSON keys
The npm package couch-view-by-keys receives a total of 0 weekly downloads. As such, couch-view-by-keys popularity was classified as not popular.
We found that couch-view-by-keys demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.