Skip to content

Commit

Permalink
fix view
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictarr committed Feb 13, 2013
1 parent ba25ad4 commit 4c5ec38
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/client-opener.js
Expand Up @@ -54,6 +54,7 @@ module.exports = function () {

opener.view = function () {
var args = [].slice.call(arguments)
return mx.createStream(args)
}

//create stream...
Expand Down
7 changes: 5 additions & 2 deletions lib/db-opener.js
Expand Up @@ -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)
}
Expand All @@ -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 () {
Expand Down
1 change: 1 addition & 0 deletions lib/map.js
Expand Up @@ -13,6 +13,7 @@ module.exports = function (db) {

mapReduce(db)

db.scuttlebutt.addView =
db.scuttlebutt.addMapReduce = function (opts) {

opts = merge({
Expand Down
2 changes: 1 addition & 1 deletion lib/stream.js
Expand Up @@ -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)
}
Expand Down

0 comments on commit 4c5ec38

Please sign in to comment.