s3-nosql

1.2.1 • Public • Published

s3-nosql

use s3 as a nosql storage (with limited support of queries)

install

npm install s3-nosql

setup

Make sure you have the s3 bucket setup properly and all the credentials setup;

Usage

Let's say you want to connect to bucket 'my-db':

const database = require('../s3-nosql');
const myDb = new database('my-db');

And now, if you want to create a new table called 'new-table', simply do

const newTable = myDb.table('new-table');

save one item

save(<string: item id>, <data>, callback); 

e.g.

newTable.save('user1', {
    name: 'John Doe',
    address: 'Somewhere over the rainbow'
}, (err, data) => {...})

delete one item

delete(key, callback)

e.g.

newTable.delete('user', (err, data) => {...})

fetch one item by id

fetchOne(key, callback)

e.g.

newTable.fetchOne('user1', (err, data) => {...})

fetch many items by ids

This one loads multiple data in parallel

fetchAll(keys, callback)

e.g.

newTable.fetchAll(['user1', 'user2', 'user3'], (err, data) => {...})

find all under the table

Note: since this is a document store, it's not feasible to search by content, so it accepts only document name matching.

find(keyword, callback)

e.g.

newTable.find('u', (err, data) => {...})

find and load content to all the objects

This one works like find, but also loads the data to each object.

findWithContent(keyword, callback)

e.g.

newTable.findWithContent('u', (err, data) => {...})

Readme

Keywords

Package Sidebar

Install

npm i s3-nosql

Weekly Downloads

0

Version

1.2.1

License

MIT

Last publish

Collaborators

  • coreorm