iriscouch / follow

Very stable, very reliable, NodeJS CouchDB _changes follower

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Now way to get the whole doc

LeHibou opened this issue · comments

Hello,

I tried the following code :


var app = require('express')(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);

server.listen(8888);

var follow = require('follow');
follow({db:"http://localhost:5984/baseball/", include_docs:true}, function(error, change) {
if(!error) {
console.log("Got change number " + change.seq + ": ");
io.sockets.on('connection', function (socket) {

    socket.emit('news', change);

});
}
})


My doc is of the form :

{
"_id": "3a926675dbac89820e2f8b3746001003",
"_rev": "28-57309ea14f606e494dc94cd0816f8d99",
"re": "hgypmp",
"mim": "ghj"
}

How can I pass the value of re and mim to the browser ?
I saw that I can grab the key but no way I can get change.re or change.mim.

Any idea ?

Thanks !

Solved :

I had to iterate over change.doc in a loop and extract the part[i].

Many thanks !

LeHibou