ie, they can use arbitrary selectors on the server and in client stubs, but not
in other client contexts. This is to prevent clients from executing arbitrary
selectors against the DB.
Because of this, the update and remove allow/deny callbacks can only ever get
one doc, so switch them from getting an array to just getting the doc (like
insert).
In minimongo, sometimes we precompute a list of queries that need recomputation,
and then recompute them. When this happens, we call callbacks that sometimes end
up stopping the query, which removes it from the list of queries on the collection.
Without checking for this case, it casued an exception.
Instead of checking $Uint8ArrayPolyfill directly, keep that as an internal
detail of ejson and use EJSON.isBinary.
Consistently avoid treating $Uint8ArrayPolyfill objects as arrays throughout the
selector compiler.
Specifically, we can now detect if a selector matches at most a fixed set of
IDs (instead of just "at most one ID"), both for queries and for writes. This
includes every write made from the client on a restricted collection!
Specifically, updates and removes that specify a specific _id, and all inserts,
should not require live queries that specify a specific different _id to poll.
This involves changing the InvalidationCrossbar matching semantics. I suspect
that a future version of the InvalidationCrossbar may want the old semantics, if
the notifications it is receiving are more oplog-driven than command-driven, but
this will work for now.
Also, make the O(1) optimization on minimongo remove("id") actually work.
Previously it was declawed by the fact that Meteor.Collection.remove normalizes
to {_id: "id"}.
This is a 0.5.5 regression (with the new selector compiler): the new compiler
handled selectors with "a.b.c" reasonably well if the "c" level contained an
array but not if the "a" or "b" levels did.
This also implements mostly-Mongo-compatible behavior for sorting when arrays
are involved; this is not an 0.5.5 regression, since the old compiler did not
get this right.
Patch by: Ted Blackman <ted.blackman@gmail.com>
(Ted fixed a bug on devel that was preventing these tests from passing. On the
ddp-pre1 branch, the bug was fixed in a different way, but the tests are still
useful.)
- Delete dead EJSON._each2.
- Make OrderedDict.remove throw if the key isn't in it.
- Make changed callbacks in two places throw if the document isn't in the
dictionary. (Other callbacks implicitly throw via OrderedDict.)
- Remove OrderedDict.pop (which didn't return the key) and push.
This check was explicitly in the old selector compiler but the rewrite dropped
it. The `new RegExp("foo", "garbage")` throws on most browsers but not on old
WebKit.
Removed spark dependency on minimongo by duplicating a very small amount of
code. There is an XXX to mark it.
OrderedDict can have a function as the first argument to its constructor; it
will use the function to transform whatever object is used as a key to strings.