Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Last active December 11, 2015 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvinmetcalf/4520785 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/4520785 to your computer and use it in GitHub Desktop.
add: (doc, cb = ()-> true) ->
unless "_id" of doc
@db.post doc, cb
else if "_id" of doc and doc._id.slice(0,8) != "_design/"
@db.put doc, cb
else if doc.length
@db.bulkDocs doc, cb
get: (id, cb = ()-> true) ->
@db.get id, cb
remove: (id, cb = ()-> true) ->
@get id, (err, doc) =>
@db.remove doc, cb unless err
cb("err") if err
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment