-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: ObjectId in meta transformed to empty object #258
Comments
I think this is caused by the fact that multiple conflicting versions of the The root cause of this seems to be that you are using v4.x.x of the |
Indeed by looking into my Anyway thanks for the explanation, it's good to at least understand what's going on |
An alternative would be that In theory this can lead to problems if someone decided to create their own class named "ObjectID" but I'm not sure if we need to care about that edge case in practice. The benefit of doing this would be that @yurijmikhalevich @DABH thoughts? |
until a better solution cames up I've fixed it like this: 1: Change this line 2: use 3: Add this script below to
|
I did not know of |
@curledUpSheep @SarkarKurdish I like this idea (testing the class name as a string). Obviously there are edge cases like you mention, but given the limited bandwidth we have for maintaining the project, this sounds like it would overall make things more robust (we don't have to worry when different |
(A related PR: #254) |
🔎 Search Terms
ObjectId,mongo
The problem
When using
winston-mongodb
and logging mongo documents, the_id
(and I think any property typedObjectId
) is transformed to{}
I encounter this when logging authenticated user through
express-winston
.I use mongodb driver version 4.3.0
What version of Winston presents the issue?
v5.1.1
What version of Node are you using?
v18.17.1
If this worked in a previous version of Winston, which was it?
No response
Minimum Working Example
No response
Additional information
While debugging the problem on my side, I figured that it is the helper
cloneMeta
that causes the issue : the testnode instanceof ObjectID
returnsfalse
whereas I guess it should returntrue
The text was updated successfully, but these errors were encountered: