Skip to content

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

License

Notifications You must be signed in to change notification settings

coreorm/s3-nosql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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) => {...})

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •