3

I have a changefeed that works fine until I use the pluck() projection. If I use pluck, it doesn't pick up changes form inserts and deletes in my followers embedded collection.

 r.table('users')
    .getAll(name, {index: 'followers'})
    //.without('password', 'phone')
    .pluck('name', 'online') // using pluck doesn't pick up changes in insert/delete from followers
    .changes({includeInitial:true});

I could use the without command but that seems more error prone as I would have to keep updating that list anytime I added fields to the user object.

Updates to user's online property gets picked up in the changefeed in either scenario.

Why does pluck not show changes to the followers set/collection property?

MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460

2 Answers2

1

I'm not 100% sure, but I think this is because when you add the .pluck('name', 'online') to the end, and then you update the followers array, the changefeed logic applies the pluck and then compares the old value to the new value, and since neither of the plucked fields changed it decides that it's a "trivial" change and drops it. (In general ignoring trivial changes is what you want, since one of the main goals of .pluck.changes is to only be notified when the specified fields change.)

I think this probably isn't the desired behavior, though: it's probably more useful to only drop trivial changes if they don't cause the row to enter or exit the subscribed range. I opened https://github.com/rethinkdb/rethinkdb/issues/5205 to track that change.

mlucy
  • 5,249
  • 1
  • 17
  • 21
0

This isn't supported right now. Check this ticket and this.

  • Those issues refer to getting changes on transformations of *point* changefeeds, like `.get.pluck.changes`, which is unsupported. `.get_all.pluck.changes` should be supported, since the `get_all` makes it a range changefeed. – mlucy Dec 13 '15 at 09:56