Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update template for map function

Change-Id: I3058aaad878d9510cb2997037e62d226a48ccdb1
Reviewed-on: http://review.couchbase.org/21768
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
  • Loading branch information...
commit 232333033754f03afb8ae882c56e98dc936ee98c 1 parent a985996
@avsej authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/rails/generators/couchbase/view/templates/map.js
View
14 lib/rails/generators/couchbase/view/templates/map.js
@@ -5,24 +5,24 @@
// 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);
+function(doc, meta) {
+ emit(meta.id, null);
}
// You can also check out following examples
//
// The simplest example of a map function:
//
-// function(doc) {
-// emit(doc._id, doc);
+// 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) {
+// function(doc, meta) {
// if (doc.type == "customer") {
-// emit(doc._id, {last_name: doc.last_name, first_name: doc.first_name});
+// emit(meta.id, {last_name: doc.last_name, first_name: doc.first_name});
// }
// }
//
@@ -31,7 +31,7 @@ function(doc) {
// 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) {
+// 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});
Please sign in to comment.
Something went wrong with that request. Please try again.