You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When bringing an array field that is undefined in the database, the dataMapper returns an exception claiming that value.map is not a function.
To Reproduce
Search for a document from the database that contains a field declared in the entity as an array and that is undefined in the collection.
Expected behavior
The expected behavior is that the field is returned as undefined, since it does not exist in the database.
Additional context
This problem happens because when parsing an array, it is only checked if it is equal to null, but there is a difference in MongoDB between null and undefined, if I save a field as null, the key exists in the document, but with a null value, but if the key does not exist in the document, when the datamapper tries to parse the value (which will be undefined), the check will only be made if value is equal to null, after that it tries to call value.map, being value undefined, an exception is generated.
The text was updated successfully, but these errors were encountered:
Describe the bug
When bringing an array field that is undefined in the database, the dataMapper returns an exception claiming that
value.map is not a function
.To Reproduce
Search for a document from the database that contains a field declared in the entity as an array and that is undefined in the collection.
Expected behavior
The expected behavior is that the field is returned as undefined, since it does not exist in the database.
Additional context
This problem happens because when parsing an array, it is only checked if it is equal to
null
, but there is a difference in MongoDB betweennull
andundefined
, if I save a field asnull
, the key exists in the document, but with a null value, but if the key does not exist in the document, when the datamapper tries to parse the value (which will beundefined
), the check will only be made if value is equal tonull,
after that it tries to callvalue.map
, being valueundefined
, an exception is generated.The text was updated successfully, but these errors were encountered: