Skip to content

@PatrickHeneise /gist:2470976
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Create CouchBase view with node.js
var memcache = require('memcache');
var client = new memcache.Client()
client.host = 'localhost'
client.port = 11211;
client.on('error', function(e){
console.log("couchbase error");
console.log(e);
});
var users = {
"_id": "_design/dev_users",
"language": "javascript",
"views": {
"usernames": {
"map": "function (doc) {\n if(doc.jsonType == \"user\") {\n emit(doc.username, doc);\n }\n}"
},
"emails": {
"map": "function (doc) {\n if(doc.jsonType == \"user\") {\n emit(doc.email, doc);\n }\n}"
}
},
"spatial": {}
}
client.connect();
client.set('_design/dev_users', JSON.stringify(users), function(error, result) {
console.log(error, result);
client.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.