Permalink
Browse files

[api] always delete _id for consistency.

  • Loading branch information...
chjj committed May 17, 2012
1 parent ca37830 commit ee96d20b677ef27b990b3366522f377dcf34771a
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/winston-mongodb.js
View
@@ -196,11 +196,9 @@ MongoDB.prototype.query = function (options, callback) {
this._db.collection(this.collection, function (err, col) {
col.find(query, opt).toArray(function (err, docs) {
if (err) return callback(err);
- if (options.fields) {
- docs.forEach(function (log) {
- delete log._id;
- });
- }
+ docs.forEach(function (log) {
+ delete log._id;
+ });
if (callback) callback(null, docs);
});
});
@@ -269,6 +267,7 @@ MongoDB.prototype.stream = function (options, stream) {
};
tail.on('data', function (doc) {
+ delete doc._id;
stream.emit('log', doc);
});
@@ -336,8 +335,9 @@ MongoDB.prototype.streamPoll = function (options, stream) {
if (!docs.length) return next();
- docs.forEach(function (log) {
- stream.emit('log', log);
+ docs.forEach(function (doc) {
+ delete doc._id;
+ stream.emit('log', doc);
});
last = new Date(docs.pop().timestamp);

0 comments on commit ee96d20

Please sign in to comment.