Skip to content
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

this.$__path is not a function for stringify #8955

Closed
WangHansen opened this issue May 8, 2020 · 2 comments
Closed

this.$__path is not a function for stringify #8955

WangHansen opened this issue May 8, 2020 · 2 comments
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@WangHansen
Copy link

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
this.$__path is not a function

If the current behavior is a bug, please provide the steps to reproduce.

see davidmarkclements/fast-safe-stringify#43

What is the expected behavior?
No error

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node: 12.13.1
Mongoose: 5.9.12
mongoDB: 3.6.12

@AbdelrahmanHafez
Copy link
Collaborator

AbdelrahmanHafez commented May 12, 2020

I took a look at this yesterday, and decirc function modifies the document by adding a key '[Circular]'
It would be nice if you provide a script that reproduces the issue with the minimal effects that fast-safe-stringify has on the document in order to avoid diving into fast-safe-stringify internals.

@AbdelrahmanHafez AbdelrahmanHafez added the needs repro script Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue label May 12, 2020
@vkarpov15 vkarpov15 added this to the 5.9.16 milestone May 22, 2020
@vkarpov15
Copy link
Collaborator

vkarpov15 commented May 23, 2020

I'd advise against using fast-safe-stringify because, as @AbdelrahmanHafez noted, it mutates the object you pass in.

const stringify = require('fast-safe-stringify');

const obj = {};
obj.obj = obj;

console.log(typeof obj.obj); // 'object'

stringify(obj);

console.log(typeof obj.obj); // 'string'

That being said, we'll work around this issue by using symbols for the offending property scope that fast-safe-stringify overwrites.

@vkarpov15 vkarpov15 added enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature and removed needs repro script Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue labels May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

No branches or pull requests

3 participants