This commit is contained in:
Christopher Jeffrey 2012-05-17 12:12:06 -05:00
Родитель 72e2c454d9
Коммит ca37830c7f
1 изменённых файлов: 3 добавлений и 24 удалений

Просмотреть файл

@ -172,17 +172,10 @@ MongoDB.prototype.query = function (options, callback) {
var self = this,
options = this.normalizeQuery(options),
query = {},
opt = {},
query,
opt,
fields;
// if (options.fields) {
// fields = {};
// options.fields.forEach(function (key) {
// fields[key] = 1;
// });
// }
query = {
timestamp: {
$gte: options.from,
@ -191,21 +184,12 @@ MongoDB.prototype.query = function (options, callback) {
};
opt = {
// .skip(options.start)
skip: options.start,
// .limit(options.rows)
limit: options.rows,
// .sort({timestamp: -1})
sort: { timestamp: options.order === 'desc' ? -1 : 1 }
};
// if (fields) {
// // col.find({}, {field: 1}, {})
// opt.fields = fields;
// }
if (options.fields) {
// col.find({}, {field: 1}, {})
opt.fields = options.fields;
}
@ -250,10 +234,6 @@ MongoDB.prototype.stream = function (options, stream) {
start = null;
}
if (start == null) {
; // get collection size
}
var opt = {
skip: start || 0,
tailable: true
@ -270,6 +250,7 @@ MongoDB.prototype.stream = function (options, stream) {
// next();
// });
// TODO: implement start
// if (start == null) {
// col.count({}, function (err, count) {
// opt.skip = count;
@ -277,7 +258,6 @@ MongoDB.prototype.stream = function (options, stream) {
// });
// }
// .sort({ $natural: 1 })
var cursor = col.find({}, opt);
// tail cursor
@ -299,7 +279,6 @@ MongoDB.prototype.stream = function (options, stream) {
// hack because isCapped doesn't work
if (err.message === 'tailable cursor requested on non capped collection') {
//if (~(err.message + '').indexOf('non capped collection')) {
tail.destroy();
self.streamPoll(options, stream);
return;