189 Commits

Author SHA1 Message Date
David Greenspan
df5d2800ae dep.depend() instead of Deps.depend(dep)
simpler than having Deps.depend and addDependent, reads fine
2013-03-21 14:09:40 -07:00
David Glasser
5a5204e3a4 Remove closures around package files. (hint: git blame -w)
The bundler now adds closures around client files and the server adds closures
around server files.
2013-03-19 15:13:53 -07:00
Nick Martin
00c3f48837 Fix annoying bug in opera where deleting from a doc as you iterate doesn't work right. 2013-03-14 15:04:35 -07:00
David Glasser
070d6f7ca9 collection.update() and .remove() may only use IDs as selectors when sending RPCs.
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).
2013-03-13 04:52:59 -07:00
David Glasser
322699e420 Test for e03d354. 2013-03-12 18:18:33 -07:00
Naomi Seyfer
e03d35460d Account for the case where a query might have been stopped before recompute
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.
2013-03-12 18:04:41 -07:00
Naomi Seyfer
67d8f829a2 Make transforms on collections always nonreactive 2013-03-12 13:36:45 -07:00
Nick Martin
abe3ee9cbe Merge remote-tracking branch 'origin/deps-radical' into devel 2013-03-12 10:39:03 -07:00
David Glasser
5f9eba5f79 Clean up selector.js old-browser workarounds.
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.
2013-03-11 21:09:59 -07:00
Naomi Seyfer
1653c091e7 Change the names from factory to transform 2013-03-11 15:49:17 -07:00
David Greenspan
96d05d741f Deps.Variable => Deps.Dependency 2013-03-11 12:37:25 -07:00
David Greenspan
a18a92e65f Deps.run => Deps.autorun 2013-03-11 12:17:39 -07:00
Naomi Seyfer
996fc144bf Basics of factories on collections 2013-03-08 16:33:12 -08:00
David Greenspan
334f172cac radical radical Deps (needs more tests & docs) 2013-03-07 17:44:21 -08:00
Naomi Seyfer
1307b8c4a9 a step toward factories on collections 2013-03-07 16:09:18 -08:00
David Greenspan
b38ec5513d more from glasser review 2013-03-06 19:14:01 -08:00
David Greenspan
20612a17f9 observe() has reactive stop in minimongo, tests 2013-03-06 12:03:45 -08:00
David Greenspan
ad12bc6576 minimongo Deps API fixes 2013-03-05 15:46:16 -08:00
David Greenspan
833769c97d Merge branch 'devel' into deps-radical 2013-03-05 13:48:23 -08:00
David Glasser
9154b5d3c4 C.find(q, {reactive: false}).observe() should only produce initial adds.
Fixes #771.
2013-03-04 22:19:11 -08:00
David Greenspan
975454d4e4 Merge branch 'devel' into deps-radical 2013-03-04 13:46:50 -08:00
David Greenspan
87964fe689 Deps: can only register callbacks on active computations 2013-03-01 18:20:06 -08:00
David Glasser
307172885a Updates to minimongo docs, since we've implemented some things now. 2013-02-28 13:19:58 -08:00
David Greenspan
30af8389fb comment 2013-02-25 18:25:18 -08:00
David Greenspan
f6aabffab3 port all packages to new Deps (tests pass) 2013-02-25 17:52:51 -08:00
Naomi Seyfer
404ec3c998 accidentally had left in a debugger call 2013-02-22 16:21:06 -08:00
Naomi Seyfer
a0c3ff709a Fixed {$type: 5} selectors on old browsers 2013-02-22 14:28:05 -08:00
Naomi Seyfer
a39401add1 fixed extra changed message for ordered too; history.md description 2013-02-22 13:14:21 -08:00
Naomi Seyfer
e4bd63b397 ObserveChanges stop sending empty changed() event in some cases 2013-02-22 13:02:50 -08:00
Naomi Seyfer
c911cd9ef4 Greenspan comments on ddp-pre1 diff 2013-02-20 14:52:28 -08:00
David Glasser
74921182b5 Reduce unnecessary Mongo polling in more cases.
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!
2013-02-15 18:23:17 -08:00
David Glasser
a8fb7b4316 Reduce unnecessary Mongo polling.
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"}.
2013-02-15 18:20:17 -08:00
Naomi Seyfer
039fdf3f5d Merge branch 'ddp-pre1' into devel 2013-02-14 19:11:37 -08:00
Naomi Seyfer
9f22ca14fd Merge branch 'devel' into ddp-pre1 2013-02-14 18:31:10 -08:00
David Glasser
18035641f5 Fix selectors matching against arrays containing subdocuments.
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.
2013-02-14 16:38:44 -08:00
David Glasser
8a69e74a5d Regexps that match "undefined" should not match nonexistent fields. 2013-02-13 19:04:50 -08:00
David Glasser
cc53ff3ac0 Implement $type and sorting for ObjectID, Date, and Binary. 2013-02-13 18:56:20 -08:00
David Glasser
e12c6fd89a Various tests for count() with sort/limit/skip.
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.)
2013-02-13 13:56:52 -08:00
David Glasser
516f4dfaf7 Move Meteor.uuid to past package. Add Random.hexString. 2013-02-13 00:42:05 -08:00
David Glasser
b3d1fe4112 move objectid generation back into objectid class 2013-02-13 00:10:26 -08:00
David Glasser
e95bcb870c Get rid of duplicate random code inside minimongo.
Temporarily move the objectid-specific function into random.js.
2013-02-12 23:49:43 -08:00
David Glasser
14c0228361 Include "before" argument in addedAt callback, as documented. 2013-02-12 17:40:03 -08:00
David Glasser
77ac416374 Some ddp-pre1 cleanup
- 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.
2013-02-12 17:18:09 -08:00
David Glasser
62bcab56d1 Merge branch 'devel' into ddp-pre1 2013-02-07 10:47:06 -08:00
Naomi Seyfer
747a6ce20c Following through on allowing you to mix callbacks styles within reason 2013-02-06 16:17:53 -08:00
David Glasser
d1de04dbea Explicitly make {$regexp: "foo", $options: "garbage"} throw.
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.
2013-02-06 14:25:22 -08:00
Naomi Seyfer
38db5ddc1d * remove spark dependency on minimongo * simpler to use orderedDict with obj k
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.
2013-02-06 14:23:47 -08:00
David Glasser
b8c4486653 Move EJSON.addType("oid") to the ObjectID class's declaration. 2013-02-05 16:36:40 -08:00
David Glasser
d62c8b53a4 Merge branch 'devel' into ddp-pre1
Conflicts:
	packages/livedata/livedata_connection_tests.js
          (needed to fix new test to work with new DDP messages)
2013-02-05 16:16:11 -08:00
Naomi Seyfer
2c9017f162 Remove suppression check from observe converters; rename them.
At Glasser's urging
2013-02-05 16:09:38 -08:00