javaspringnosqlmapreduceektorp

Map Reduce Couch Db


I have a simple database with couch db. I have users have that fields:

String userName
String password
String mail
boolean admin

I keep my users at db. However I am so new to Couch DB and NoSql. How can I implement map reduce on it with an example (or does it do it internally and I don't need to do anything?)

I use Spring 3 and Ekorp for my application.


Solution

  • in couch, add a field in your documents called

    _type

    or

    type_

    The map function could be

    function(doc) {
     if(doc.type_=="user") { 
       emit(doc.name,doc._id);
     }
    }