From 095be58680d13579e8904c3665343d526d04fab4 Mon Sep 17 00:00:00 2001 From: Mircea Danila Dumitrescu Date: Mon, 12 May 2014 19:17:49 +0100 Subject: [PATCH] Fixed minor issue --- lib/cube/genericGetter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cube/genericGetter.js b/lib/cube/genericGetter.js index 8b15b3b..d9bf122 100644 --- a/lib/cube/genericGetter.js +++ b/lib/cube/genericGetter.js @@ -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; @@ -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 { @@ -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);