Sha256: 5800edc68929e0035591a91f03bebecc9d60f316494596ffb0a57820bb78c73e

Contents?: true

Size: 1.28 KB

Versions: 8

Compression:

Stored size: 1.28 KB

Contents

// The map function is the most critical part of any view as it provides the
// logical mapping between the input fields of the individual objects stored
// within Couchbase to the information output when the view is accessed.
//
// Read more about how to write map functions at:
// http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writing-map.html

function(doc) {
  emit(doc._id, null);
}

// You can also check out following examples
//
// The simplest example of a map function:
//
//   function(doc) {
//     emit(doc._id, doc);
//   }
//
// Slightly more complex example of a function that defines a view on values
// computed from customer documents:
//
//   function(doc) {
//     if (doc.type == "customer") {
//       emit(doc._id, {last_name: doc.last_name, first_name: doc.first_name});
//     }
//   }
//
// To be able to filter or sort the view by some document property, you
// would use that property for the key. For example, the following view
// would allow you to lookup customer documents by the last_name or
// first_name fields (your keys could be compound, e.g. arrays):
//
//   function(doc) {
//     if (doc.type == "customer") {
//       emit(doc.last_name, {first_name: doc.first_name});
//       emit(doc.first_name, {last_name: doc.last_name});
//     }
//   }
//

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
couchbase-model-0.4.4 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.4.3 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.4.1 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.4.0 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.3.1 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.3.0 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.2.0 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.1.0 lib/rails/generators/couchbase/view/templates/map.js