rethinkdbdash
Advanced tools
Comparing version 1.16.0 to 1.16.1
@@ -268,13 +268,32 @@ var net = require('net'); | ||
cursor._push({done: false, response: response}); | ||
if (self.options[token].profile === true) { | ||
result = { | ||
profile: response.p, | ||
result: cursor | ||
if ((self.options[token].stream === true || self.r._options.stream === true)) { | ||
stream = new Stream(cursor); | ||
if (self.options[token].profile === true) { | ||
result = { | ||
profile: response.p, | ||
result: stream | ||
} | ||
//Next batches will still have a profile (even though it's the same). So it's safe to keep the options | ||
//self.options[token].profile = false; | ||
} | ||
//Next batches will still have a profile (even though it's the same). So it's safe to keep the options | ||
//self.options[token].profile = false; | ||
else { | ||
result = stream | ||
} | ||
} | ||
else { | ||
result = cursor | ||
// The default behavior is to create a cursor for feeds | ||
if (self.options[token].profile === true) { | ||
result = { | ||
profile: response.p, | ||
result: cursor | ||
} | ||
//Next batches will still have a profile (even though it's the same). So it's safe to keep the options | ||
//self.options[token].profile = false; | ||
} | ||
else { | ||
result = cursor | ||
} | ||
} | ||
@@ -281,0 +300,0 @@ currentResolve(result); |
{ | ||
"name": "rethinkdbdash", | ||
"version": "1.16.0", | ||
"version": "1.16.1", | ||
"description": "A Node.js driver for RethinkDB with promises and a connection pool", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -99,2 +99,47 @@ var config = require('./config.js'); | ||
It("changes() should return a stream", function* (done) { | ||
try { | ||
var data = [{}, {}, {}, {}]; | ||
stream = yield r.db(dbName).table(tableName).changes().run({stream: true}); | ||
assert(stream); | ||
assert(stream instanceof Readable); | ||
var count = 0; | ||
stream.on('data', function() { | ||
count++; | ||
if (count === data.length) { | ||
done(); | ||
stream.close(); | ||
} | ||
}); | ||
yield r.db(dbName).table(tableName).insert(data).run(); | ||
} | ||
catch(e) { | ||
done(e); | ||
} | ||
}) | ||
It("get().changes() should return a stream", function* (done) { | ||
try { | ||
stream = yield r.db(dbName).table(tableName).get(1).changes().run({stream: true}); | ||
assert(stream); | ||
assert(stream instanceof Readable); | ||
var count = 0; | ||
stream.on('data', function() { | ||
count++; | ||
if (count === 3) { | ||
done(); | ||
stream.close(); | ||
} | ||
}); | ||
yield r.db(dbName).table(tableName).insert({id: 1}).run(); | ||
yield r.db(dbName).table(tableName).get(1).update({update: 1}).run(); | ||
yield r.db(dbName).table(tableName).get(1).update({update: 2}).run(); | ||
} | ||
catch(e) { | ||
done(e); | ||
} | ||
}) | ||
It("`table` should return a stream - testing empty SUCCESS_COMPLETE", function* (done) { | ||
@@ -101,0 +146,0 @@ var i=0; |
561826
16619