972 Commits

Author SHA1 Message Date
matt debergalis
3f1ff26e43 Convert to new publish API. 2012-02-29 16:08:59 -08:00
matt debergalis
8a8e402510 autopublish in leaderboard 2012-02-29 16:08:59 -08:00
matt debergalis
c0b3df5a91 Sync Minimongo observe API to server.
Return old document in callbacks.  Add LiveResultsSet.collection to
match server.

Add observe() unit test suite.
2012-02-29 16:08:58 -08:00
matt debergalis
b35af422c6 Support field selection in server-side mongo.
Can now publish subsets of documents with something like this:

Meteor.publish('items', function (sub, params) {
  return Items.find({user_id: params.user_id},
                    {fields: {some_secret_field: 0}});
});

where items.some_secret_fields won't be included in the publish output.

(fields option is ignored by minimongo.)
2012-02-29 16:08:58 -08:00
matt debergalis
cb887f5a9b Rework livedata (DDP) subscriptions.
Publish now comes in three flavors:

* Bare metal API: Meteor.publish(name, func).

  Server will call func(sub, params) each time a client subscribes to
  "name" (with supplied "params"), or if "name" is null, each time a new
  client connects (autopublish).  "sub" is a Subscription object, which
  supplies sub.set(), sub.unset(), sub.satisfies(), and sub.flush()
  methods to emit DDP data messages.  func() should register a cleanup
  function with sub.onStop(), which will be called when client unsubs.

  To react to database changes, use Collection.observe().  Publish
  functions that are not database backed may use some other mechanism
  (setInterval?) to schedule calls to sub.set().

* publishCursor API:

  If func() *returns* a Cursor, server will automatically publish all
  results from that cursor as the collection with the same name as the
  cursor's underlying Mongo collection.  For example:

  Meteor.publish('top10', function (sub, params) {
    return Players.find({}, {sort: {score: -1}, limit: 10});
  });

  will define a 'top10' publish that is always the top 10 scoring
  players, published to the 'players' collection on each subscribing
  client.

* autopublish

  When the autopublish package is loaded, all Collections defined on the
  server will automatically be published, in their entirety, to each
  connected client.  Clients need not call Meteor.subscribe().  Calls to
  publish() will emit a warning message, since they are superflous.  To
  disable autopublish, run "meteor remove autopublish".
2012-02-29 16:08:58 -08:00
David Greenspan
5aeff801c3 deepcopy consistently in minimongo callbacks (to not mask bugs) 2012-02-29 13:16:16 -08:00
Geoff Schmidt
980868bc1b Merge branch 'methods' 2012-02-29 04:38:40 -08:00
Geoff Schmidt
5cf9351ecd Test compound methods, including clients cheating 2012-02-29 04:36:51 -08:00
Geoff Schmidt
72e37d8748 Method invocation tests pass on server
(as well as client)
2012-02-29 02:04:33 -08:00
Geoff Schmidt
4f04e0fb6a don't offer to debug server tests on the client 2012-02-29 01:47:42 -08:00
Geoff Schmidt
16b2de8e8c show overall test status
(makes it easier to see if server tests haven't returned)
2012-02-29 01:08:22 -08:00
Geoff Schmidt
f41d692cf5 method invocation context object
(including support for async methods, server-side
method ordering, running simulated methods
correctly)
2012-02-29 00:42:38 -08:00
matt debergalis
c228996976 fix merge error 2012-02-23 15:05:17 -08:00
Geoff Schmidt
9d3b86fa44 Additional bindEnvironment testing 2012-02-23 14:46:42 -08:00
matt debergalis
09f210c9e4 simplify result_func handling for remote method callbacks. 2012-02-23 13:14:06 -08:00
Geoff Schmidt
97c3e50379 Support server-side tests. 2012-02-23 06:08:09 -08:00
Geoff Schmidt
3d8b3b6e1d Implement dynamic scoping, bindEnvironment
tests on client, not yet on server
2012-02-23 03:44:41 -08:00
Geoff Schmidt
58a2d65126 Provide package 'meteor' to create the Meteor global
Fold old package 'core' into it
2012-02-23 02:21:10 -08:00
Geoff Schmidt
72fda4871a Merge branch 'refs/heads/livedata-tests' 2012-02-23 02:05:06 -08:00
Geoff Schmidt
e8e2d956a2 Work around Uglify bug
(incorrect minification of 'debugger')
2012-02-23 01:00:25 -08:00
Geoff Schmidt
1c8e498e1e Use a fresh collection each time the test is run
(so it can be rerun)
2012-02-23 01:00:02 -08:00
David Greenspan
08c3d13465 prevent collection remove from triggering add 2012-02-21 15:25:34 -08:00
Geoff Schmidt
e0722bedf8 basic livedata method invocation tests 2012-02-21 01:40:15 -08:00
Geoff Schmidt
8cf92b18ef reinstate ability to open debugger on a test
(also, restore ability to catch exceptions in tests)
2012-02-20 23:58:59 -08:00
Geoff Schmidt
6acaeb0ee6 refactor tinytest for async 2012-02-20 22:12:31 -08:00
Geoff Schmidt
1d3154bd54 livedata fixes 2012-02-19 14:44:32 -08:00
David Greenspan
5385c4a358 missing underscore 2012-02-17 20:48:17 -08:00
Nick Martin
54ddf0c280 Merge branch 'livedata-connect' 2012-02-17 12:08:28 -08:00
Geoff Schmidt
bd1e4eb858 leaderboard-remote example 2012-02-17 01:58:15 -08:00
Geoff Schmidt
7a8e7f5ea3 data refactoring cleanups in some tests 2012-02-17 01:33:18 -08:00
Geoff Schmidt
c88dc05ff3 add "universal publishes" for smooth autopublish experience 2012-02-17 01:02:51 -08:00
Geoff Schmidt
3e47029a61 port skel, todos, leaderboard to new data API 2012-02-17 01:02:34 -08:00
Geoff Schmidt
6fa852fdb7 first implementation of autopublish 2012-02-17 01:02:28 -08:00
Geoff Schmidt
23f4bd6fc4 rename LivedataClient => LivedataConnection 2012-02-16 23:07:00 -08:00
Geoff Schmidt
03f332d584 let the livedata client exist on the server 2012-02-16 23:07:00 -08:00
Geoff Schmidt
5d069169a9 factor mongo-specific parts out of livedata 2012-02-16 23:07:00 -08:00
Geoff Schmidt
908bfa0ba2 factor out is_client/is_server 2012-02-16 22:41:16 -08:00
Geoff Schmidt
d3eec5b920 rename Server => LivedataClient. add Meteor.connect 2012-02-16 22:41:16 -08:00
Geoff Schmidt
f31226e388 rename minimongo Collection => LocalCollection 2012-02-16 22:41:16 -08:00
Nick Martin
4818cc0bca Merge branch 'refs/heads/empty-objects' 2012-02-16 18:45:15 -08:00
Nick Martin
abd2097f55 Fixup regression from unintentional package API change associate w/ underscore upgrade.
Also fixup underscore callsites that use _.indexOf on a string.
2012-02-16 18:36:56 -08:00
Nick Martin
1ce3f3b812 Add note in docs re empty objects. 2012-02-16 17:50:54 -08:00
Nick Martin
c309647c0c Warn on empty object insert. 2012-02-16 16:25:12 -08:00
Nick Martin
4e552ec514 Don't send empty objects to the client. 2012-02-16 16:24:58 -08:00
Nick Martin
70fdc5a0a2 Super basic livedata tests. Just enough to see that the code runs. 2012-02-16 15:24:36 -08:00
Nick Martin
5cd46e7f3e Super basic test for stream package. Not a lot of coverage, but enough to catch a recent regression in stream_client.js. 2012-02-16 15:13:00 -08:00
Nick Martin
eaaedd3b43 Bump file-descriptor ulimit as high as it will go on startup and remove previous workaround.
This reverts commit a7c11b167e. See https://app.asana.com/0/364581412985/472479912325
2012-02-15 23:36:17 -08:00
Nick Martin
7269e01ebd Rework mongod killing on startup. No more XXX MONGO DEAD errors.
Also, detect mongo dying in a loop. Just print a helpful message and exit.

Uses 'ps ax' to inspect the process table. A little hacky, but should be functional and portable.
2012-02-15 23:05:00 -08:00
Nick Martin
7b2f2f3683 Allow use of external mongo with MONGO_URL environment variable. 2012-02-15 17:38:13 -08:00
matt debergalis
47c7a23bf2 Refactor server's synchronous MongoDB driver.
Driver is now in the preferred ctor / prototype method style, supports
multiple instantiations, and fully wraps the bare metal async node
mongo driver.
2012-02-15 09:04:04 -08:00