I am querying a document from Mongo DB using Mongoose:
const dbObj = await User.findOne({ "_id": id});
From there, I am attempting to turn that object into a string:
const dbObjStr = JSON.stringify(dbObj);
The problem: JSON.stringify isn't properly converting the object to a string, the outcome looks like this:
{"accreditedStatus":3,"count":39}
How can I get it to convert to an actual string? Like this:
"{\"accreditedStatus\":3,\"count\":39}"
Environment: Node.js v10.16.0, NPM 6.10.0, Mongo DB 4.0.10, Mongoose ^5.3.7