Skip to content

Commit

Permalink
Fixed minor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Mircea Danila Dumitrescu committed May 12, 2014
1 parent b811491 commit 095be58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/cube/genericGetter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var myutils = require("./myutils.js"),
MAX_RETURNED_RECORDS = 10000;
function customQuery(collectionObj, filter, sort, limit, batchSize, streamified, documentHandler) {
// set MongoDB cursor options
var cursorOptions={},
var cursorOptions = {},
cursor,
stream;

Expand All @@ -28,7 +28,7 @@ function customQuery(collectionObj, filter, sort, limit, batchSize, streamified,
if (streamified) {
stream = cursor.sort({$natural: -1}).stream();
stream.on('data', function (document) {
documentHandler({id: document._id instanceof mongodb.ObjectID ? undefined : document._id, time: document.t, data: document.d});
documentHandler({id: document._id, time: document.t, data: (document.d === undefined ? document.key : document.d)});
});
}
else {
Expand All @@ -50,7 +50,7 @@ function customQuery(collectionObj, filter, sort, limit, batchSize, streamified,

// A null name indicates that there are no more results.
if (document) {
documentHandler({id: document._id instanceof mongodb.ObjectID ? undefined : document._id, time: document.t, data: document.d});
documentHandler({id: document._id, time: document.t, data: (document.d === undefined ? document.key : document.d)});
}
else {
documentHandler(null);
Expand Down

0 comments on commit 095be58

Please sign in to comment.