Skip to content

9.19.1

Choose a tag to compare

@github-actions github-actions released this 29 Nov 01:49
· 318 commits to master since this release
a2fa7a0

A change stream can now keep teams apart on one MongoDB cursor, with notify_when on @team._id.

notify_when on any variable of the session (#835)

Since 9.16 a change stream under a permission with a readFilter must keep its clients apart by itself. One way is notify_when on a variable the server resolves: every client shares one cursor, and each receives the events of its own documents. Until this release only @user variables counted, so a stream that kept teams apart was refused with 403:

{
  "uri": "live",
  "stages": [ { "$match": { "operationType": { "$in": ["insert", "update", "replace"] } } } ],
  "notify_when": { "fullDocument::team": { "$var": "@team._id" } }
}

The other way, a $match on @team._id in the stages, opens one cursor per team.

Now a notify_when keeps clients apart when its variable is resolved from the session alone. A VarResolver declares this with scope():

Scope Variables Keeps clients apart
LISTING, a value of the session @user, @roles, @authenticated, and with restheart-accounts @team and @teams yes
CALL, a value of the request @qparams, @request, @filter no: the client chooses it, and the stream is refused

A plugin's variable counts when its resolver declares LISTING.

TeamVarResolver and TeamsVarResolver of restheart-accounts now declare LISTING: they read the account's membership and nothing of the request. An MCP listing therefore resolves a condition on @team or @teams for real, where before it left it undetermined.

The documentation is in Change streams.