db

Easy access to dynamo, ds, mongodb, redis

npm install db
7 downloads in the last week
61 downloads in the last month

This module sponsored by Sleepless Inc. (sleepless.com)

This will hopefully have a common interface for the "least common denominator" functions of each NoSQL db soon.

To support:

AWS DynamoDB
MongoDB
JSON
Filesystem

Interfaces

authenticate( user, pass, callback() )

create( data, callback( new_record_id ) )

read( criteria, callback( records_matched[] )  )

update( criteria, data, callback( num_updated ) )

delete( criteria, callback( num_deleted ) )


Example:

    db.authenticate( "joe", "foo", function( error, dbss ) {
        dbss.create( {name:"bob"}, function( error ) {
            dbss.read( { name: "b.*" }, function( error, records ) {
                records.forEach( function( rec ) {
                    print( rec.name )    // "barbara", "bob", "bosworth", etc.
                    if( rec.name == "bob" ) {
                        rec.name = "robert"
                        dbss.update( {id:rec.id}, rec, function( error ) {
                            dbss.delete( {id:rec.id}, function( error ) {
                                print( "robert rec deleted" )
                            })
                        })
                    }
                })
            })
        })
    })

API ListTables CreateTable DescribeTable UpdateTable DeleteTable PutItem GetItem UpdateItem BatchGetItem DeleteItem Query Scan

npm loves you