Permalink
Browse files

fix view

  • Loading branch information...
1 parent ba25ad4 commit 4c5ec38953ef3474577411cbce6376f6cd1140de @dominictarr committed Feb 13, 2013
Showing with 8 additions and 3 deletions.
  1. +1 −0 lib/client-opener.js
  2. +5 −2 lib/db-opener.js
  3. +1 −0 lib/map.js
  4. +1 −1 lib/stream.js
View
@@ -54,6 +54,7 @@ module.exports = function () {
opener.view = function () {
var args = [].slice.call(arguments)
+ return mx.createStream(args)
}
//create stream...
View
@@ -113,7 +113,10 @@ module.exports = function (db) {
//reduce the 10 most recently modified documents.
opener.view.apply(null, stream.meta)
.pipe(through(function (data) {
- this.queue(JSON.parse(data.value))
+ this.queue({
+ key: data.key.toString(),
+ value: data.value.toString()
+ })
}))
.pipe(stream)
}
@@ -128,7 +131,7 @@ module.exports = function (db) {
opener.view = function () {
var args = [].slice.call(arguments)
- return db.scuttlebutt.view.apply(null, args)
+ return db.mapReduce.view.apply(db.mapReduce, args)
}
db.on('close', function () {
View
@@ -13,6 +13,7 @@ module.exports = function (db) {
mapReduce(db)
+ db.scuttlebutt.addView =
db.scuttlebutt.addMapReduce = function (opts) {
opts = merge({
View
@@ -22,7 +22,7 @@ module.exports = function (opener) {
//reduce the 10 most recently modified documents.
opener.view.apply(null, stream.meta)
.pipe(through(function (data) {
- this.queue(JSON.parse(data.value))
+ this.queue(data)
}))
.pipe(stream)
}

0 comments on commit 4c5ec38

Please sign in to comment.