Sha256: 7bc5e3ff41a4c37cd50d0d7bd8ace47b117a754d90fb9491b10bcc7272106dee

Contents?: true

Size: 1.3 KB

Versions: 10

Compression:

Stored size: 1.3 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, meta) {
  emit(meta.id, null);
}

// You can also check out following examples
//
// The simplest example of a map function:
//
//   function(doc, meta) {
//     emit(meta.id, doc);
//   }
//
// Slightly more complex example of a function that defines a view on values
// computed from customer documents:
//
//   function(doc, meta) {
//     if (doc.type == "customer") {
//       emit(meta.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, meta) {
//     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

10 entries across 10 versions & 3 rubygems

Version Path
couchbase-model-0.5.4 lib/rails/generators/couchbase/view/templates/map.js
jmoses-couchbase-model-0.5.3 lib/rails/generators/couchbase/view/templates/map.js
couchbase-jruby-model-0.1.3-java lib/rails/generators/couchbase/view/templates/map.js
couchbase-jruby-model-0.1.2-java lib/rails/generators/couchbase/view/templates/map.js
couchbase-jruby-model-0.1.1-java lib/rails/generators/couchbase/view/templates/map.js
couchbase-jruby-model-0.1.0-java lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.5.3 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.5.2 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.5.1 lib/rails/generators/couchbase/view/templates/map.js
couchbase-model-0.5.0 lib/rails/generators/couchbase/view/templates/map.js