Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[api] always delete _id for consistency.

  • Loading branch information...
commit ee96d20b677ef27b990b3366522f377dcf34771a 1 parent ca37830
@chjj chjj authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/winston-mongodb.js
View
14 lib/winston-mongodb.js
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.