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
However, JSON.stringify ignores fields with values of undefined, which aren't valid in strict JSON. For example, JSON.stringify({foo: undefined}) produces {}.
This does not match the behavior of sharedb-mongo, which passes values of undefined down to the Mongo driver. Both the official mongodb driver and mingo handle values of undefined by converting them to null.
Potential fixes
Either switch parseQuery to do a proper structured deep clone, or just do a shallow clone if that's sufficient.
The text was updated successfully, but these errors were encountered:
A query of
{foo: undefined}
produces different results in sharedb-mongo and sharedb-mingo-memory:foo
unset orfoo: null
.foo
condition were not present. Any other query conditions are still applied.Cause
parseQuery
usesJSON.stringify
->JSON.parse
to do a deep clone of the query:https://github.com/share/sharedb-mingo-memory/blob/v1.1.0/index.js#L88
However,
JSON.stringify
ignores fields with values ofundefined
, which aren't valid in strict JSON. For example,JSON.stringify({foo: undefined})
produces{}
.This does not match the behavior of sharedb-mongo, which passes values of
undefined
down to the Mongo driver. Both the official mongodb driver and mingo handle values ofundefined
by converting them tonull
.Potential fixes
Either switch
parseQuery
to do a proper structured deep clone, or just do a shallow clone if that's sufficient.The text was updated successfully, but these errors were encountered: