Created
April 22, 2014 16:32
-
-
Save jchris/11185782 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var coax = require("coax"), | |
server = coax("https://localhost:59840/"), | |
database = server("tmp-test"); | |
database.put(function(err, ok){ | |
console.log("create db", err, ok) | |
var ddocID = "_design/foo" | |
database(ddocID, function(err, ddoc){ | |
if (err) { | |
ddoc = {} | |
} | |
ddoc.views = { | |
myView : { | |
map : function(doc) { | |
emit(doc.mykey) | |
} | |
} | |
} | |
database.put(ddocID, ddoc, function(err, ok) { | |
console.log("ddoc save", err, ok) | |
var views = database("_view"); | |
views.get(["myView",{include_docs : true}], function(err, data){ | |
console.log("view",err,data.rows) | |
}) | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment