Closed elizeuangelo closed 3 years ago
I changed the function isObject to this and it solved the problem:
export function isObject(target: unknown): target is UnknownObject { return Object.prototype.toString.call(target) === '[object Object]'; }
I guess depending the origins of an object it might not have a .construct
.
Hi, thanks for the comment and work you've done, I will fix this until stable release.
Also, i would like to clarify that I abandoned this project for a short period, but I plan to release stable version as soon as I can. At the moment, AloeDB is not finished, it has many technical and architectural flaws, so please do not use this database in production until stable release!
Im getting passed on objects from an graphql server and the database is failing to insert them on the grounds of:
"Error inserting document: Document can only contain Strings, Numbers, Booleans, Nulls, Arrays and Objects"
When I rebuild the object from scratch, pretty much just copying every field into a new object, then it works.
Edit: After some digging things got just more complex. Im trying calling the function
isObject()
before inserting it into the database and it returns true, I logged the result when its inside theprepareObject()
function and the same object returns false...Honestly Its driving me nuts, makes no sense.