sanitizes json before it comes out of global and collection find operations
This commit is contained in:
@@ -87,7 +87,8 @@ async function find(args) {
|
||||
result = {
|
||||
...result,
|
||||
docs: await Promise.all(result.docs.map(async (doc) => {
|
||||
let docRef = doc;
|
||||
let docRef = JSON.stringify(doc);
|
||||
docRef = JSON.parse(docRef);
|
||||
|
||||
if (docRef._id) delete docRef._id;
|
||||
if (typeof docRef.__v !== 'undefined') delete docRef.__v;
|
||||
|
||||
@@ -65,6 +65,9 @@ async function findOne(args) {
|
||||
// 6. Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
doc = JSON.stringify(doc);
|
||||
doc = JSON.parse(doc);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user