DirtyDB -CRUD operations (coffeescript)

The following code performs basic CRUD operations in dirtyDB using coffeescript.

db.coffee

@db = require('dirty')('/tmp/test.dirty')

@db.on 'load', =>
   @entries = {}
   value = {eyes: 'blue'}
   @db.set "karthick",value
   @db.set "raju",value  
   #@entries[key]=value
   @db.forEach (key,value)  =>  
      console.log 'Found key: %s, val: %j', key, value
      @entries[key]=value
   key = "karthick"  
       
   console.log 'record get->',@db.get(key)  
   
   console.log 'remove record->',@db.rm(key)        
   

Execution command:

coffee db.coffee

Note: You should have installed node.js and related modules like (coffeescript,dirty) in your system before executing the above code.

Technology: 

Search