dataobject-parser
dataobject-parser copied to clipboard
untranspose method is removing properties containing MongoDb ObjectId
I think there is a bug where untranspose method is removing properties containing MongoDb ObjectId. I can demonstrate that with following TypeScript code:
import { ObjectId } from "mongodb";
const DataObjectParser = require("dataobject-parser");
const obj = {
orderId: new ObjectId(),
location: {
city: {
name: "House on cliff",
geo: '45, 23'
}
}
}
console.log(DataObjectParser.untranspose(obj));
Actual output of console.log is as follows:
{
'location.city.name': 'House on cliff',
'location.city.geo': '45, 23'
}
Expected output of console.log is as follows:
{
'orderId': ObjectId(...),
'location.city.name': 'House on cliff',
'location.city.geo': '45, 23'
}
A suggestion, I think this kind of transformation can be skipped for certain custom data-types for which we can pass additional functions which can check for those data types.
Sure PR is welcome
On Mon, Mar 13, 2023, 2:34 AM Jibran Shaikh @.***> wrote:
@henrytseng https://github.com/henrytseng are you active? Would you like a PR?
— Reply to this email directly, view it on GitHub https://github.com/henrytseng/dataobject-parser/issues/17#issuecomment-1465587270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEDYE4Q5G7GBP5UKNKIEMTW325XJANCNFSM6AAAAAAVU4WSLM . You are receiving this because you were mentioned.Message ID: @.***>