-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Given a Mongoose service configured for relationships with { ref: 'modelName' }, when subscribing via a .find() query that includes the special $populate parameter, and a patch update is received, the record is overwritten with the update (as opposed to merged) and the related (ref) record data is replaced with its ObjectId.
So while you may initially get this list in your .find({ $populate: 'post' }).subscribe(fn) handler:
[
{
comment: 'Feathers is so cool',
post: {
_id: '1afsd09fj2e92f09qjf09234f',
slug: 'cool-feathers-features'
}
}
]
A patch to one of the query results will become this:
[
{
comment: 'Feathers is so cool',
post: '1afsd09fj2e92f09qjf09234f'
}
]
That said, this problem can be addressed with .watch({ listStrategy: 'always' }).
Not sure if this case is expected based on this statement from the documentation:
smart(default) - Returns a stream that smartly emits updated list data based on the services real-time events. It does not re-query any new data (but does not cover some cases in which thealwaysstrategy can be used).