             dbHelpers.db.query 'folder/all', params, callback
 
         get: (key, callback) ->
-            params =
-                include_docs: true
-                key: key
-            db.query 'folder/byFullPath', params, (err, docs) ->
-                if err
-                    callback err
-                else if docs.rows.length is 0
-                    callback()
-                else
-                    callback null,  docs.rows[0].value
+            getByKey 'folder/byFullPath', key, callback
 
         upsert: (newDoc, callback) ->
             key = "#{newDoc.path}/#{newDoc.name}"

db.setMaxListeners 100

fs.ensureDirSync config.dir


module.exports = dbHelpers =

                params = {}
            dbHelpers.db.query 'file/all', params, callback
        get: (key, callback) ->
            getByKey 'file/byFullPath', key, callback

    folders:
        rows: []
