Commit Graph

4605 Commits

Author SHA1 Message Date
Emily Stark
44d399456e Clean up some comments and names for upsert. 2013-10-02 10:51:14 -07:00
Emily Stark
47b6af30a5 Factor out the bindEnvironment part of writeCallback.
Get rid of numberAffectedCallback; instead, choose the right return value at
every place where we were using numberAffectedCallback and then pass through
bindEnvironmentForWrite. This cleans up a couple places where we were going
through numberAffectedCallback to wrap a result in an object, and then sometimes
getting the numberAffected out of that object and just returning that. Also
ensures that all callbacks for write get passed through Meteor.bindEnvironment
with the same onException function.
2013-10-02 10:31:30 -07:00
Emily Stark
f9fda934ec Add some comments to minimongo upsert code 2013-10-01 22:16:32 -07:00
Emily Stark
6ae90f4d67 Rename onInsert to isInsert 2013-10-01 19:02:05 -07:00
Emily Stark
cfd5861c8d Make update() the canonical form for upserts on the wire.
update(..., { upsert: true }) returns the number of affected docs, and
update(..., { upsert: true, _returnObject: true }) returns the whole object that
is used by upsert(). Also includes a rename of returnObject -> _returnObject.
2013-10-01 18:26:41 -07:00
Emily Stark
1002650fcd Update Collection comments to reflect new return values. 2013-10-01 11:48:45 -07:00
Emily Stark
dc8e948cb1 Test and fixes for returning upsert results immediately inside stubs.
Added a test for upsert return values. Factored out some more upsert test
helpers.

Could still use a test for update/remove return values inside a method stub.
2013-10-01 11:39:46 -07:00
Emily Stark
bad2102c06 Return results from collection methods on livedata connection.
This allows us to immediately return local collection return values inside
stubs.
2013-10-01 10:12:02 -07:00
Emily Stark
f397295b8a Suppress invalid modifier log message in upsert test 2013-09-30 15:47:40 -07:00
David Greenspan
e1dd2b40f8 return un-mongo-converted insertedId
… instead of converting to mongo form and back
2013-09-30 15:41:47 -07:00
Emily Stark
ea63ea560f Merge branch 'devel' into mongo-upsert 2013-09-30 15:07:09 -07:00
Emily Stark
1bbb34e602 Take the async out of tests that don't need it 2013-09-30 11:21:11 -07:00
Emily Stark
dd44f6b165 Fix compareResults everywhere and factor it out. 2013-09-30 11:06:16 -07:00
Emily Stark
7cba2923f5 Add a test for update/remove return values over the network. 2013-09-28 23:14:37 -07:00
Emily Stark
f7d33c734d Plumb mutation method return values through to callbacks.
Also:
* Fix some bugs: compareResults wasn't working so well; insertedId return values
  weren't being passed through replaceTypes; a few places where options objects
  weren't being treated as optional.
* Duplicate upsert tests for async upserts (with some changes to account for the
  fact that updates and removes can only be by id). Maybe this can be cleaned up
  to be less duplicate-y.
* Still need tests for async update/remove return values.
2013-09-28 23:03:47 -07:00
Emily Stark
ab59ae2bcb Add browser-policy to History.md 2013-09-28 18:53:40 -07:00
Emily Stark
3590eb1345 Merge branch 'security-headers' into devel 2013-09-28 18:45:23 -07:00
Emily Stark
9d1e3dbd56 Enable CSP differently for tests.
Avoids sending header and using meteor_runtime_config.js on tests. Also tweak
wording on browser-policy docs.
2013-09-28 18:44:31 -07:00
Emily Stark
a102872a96 Rework browser-policy to make API more intuitive.
- Remove starter-browser-policy and replace it with
  BrowserPolicy.enableContentSecurityPolicy(), which gives you the starter
  policy and allows you to use the other BrowserPolicy functions to configure
  it. This is motivated by the fact that the API isn't very intuitive without a
  well-defined starting policy. ex: if the package starts off without a policy,
  and then the user calls allowAllContentSameOrigin(), that will result in
  turning off inline scripts, which is probably not what they wanted.
- AllContent functions do more of what you'd expect now;
  i.e. BrowserPolicy.disallowAllContent() actually disallows all content,
  instead of setting default-src to 'none', which will allow other types of
  content that have previously had srcs set for them.
- Add some tests
2013-09-28 18:44:04 -07:00
Emily Stark
e6300461b1 Reorganize browser-policy docs a bit.
Addressing Nick's suggestions. Haven't decided yet about combining
browser-policy and starter-browser-policy docs.
2013-09-28 18:44:04 -07:00
Emily Stark
4893fe048c Package for security-related http headers. 2013-09-28 18:44:04 -07:00
David Greenspan
6329cedc51 upsert method -- let upsert go over the network
Only works in insecure mode.  (Not supported by allow/deny.)
2013-09-27 19:41:24 -07:00
David Greenspan
22d3a56b81 remove duplicate function 2013-09-27 19:13:42 -07:00
David Greenspan
2724bd0d84 upsert bugfixes and tests
* mongo_driver native upsert returns insertedId
* minimongo doesn't use query _id on upsert/replace
* minimongo supports insertedId option
* tests for all this
2013-09-27 19:10:09 -07:00
David Greenspan
3e87c8f9d5 finish optimistic retry code detect collision 2013-09-27 18:54:50 -07:00
Emily Stark
6494ec563f Put .upsert() on LocalCollection and mongo driver.
This way LocalCollection and Meteor.Collection have the same API.
2013-09-27 18:50:39 -07:00
David Glasser
e6023214d8 Merge branch 'pr-63' into devel 2013-09-27 19:01:03 -05:00
David Glasser
b86ba7e3da History.md update for forEach/map arguments. 2013-09-27 19:00:49 -05:00
David Glasser
7f490a4081 Docs for ES5-style iteration. 2013-09-27 19:00:22 -05:00
David Glasser
3e1afb7850 Tests for extra forEach/map arguments. 2013-09-27 19:00:22 -05:00
David Glasser
d4d7ebb783 Implements ES5-style callbacks for cursor forEach and map.
Fixes #63.

Based on iwoj's PR.

Needs tests and docs.
2013-09-27 19:00:22 -05:00
Emily Stark
2b4d4974fa Update minimongo tests to new api.
All tests pass now, but we've got the unfortunate situation that the
LocalCollection return values don't match the Meteor.Collection return values,
which is problematic because the minimongo tests use LocalCollection
directly. Hmm.
2013-09-27 16:07:55 -07:00
Emily Stark
e56428dceb Make sure we provide the right return value for callbacks also.
Also, don't mutate `name` to "update" from "upsert"; the function closes over it
so all subsequent calls will start with name "update".
2013-09-27 16:06:28 -07:00
David Greenspan
2b082db1a8 adjust tests for API 2013-09-27 15:10:34 -07:00
Emily Stark
bc3ea63752 Make sure our mutated options object makes into the actual collection method 2013-09-27 15:10:18 -07:00
Nick Martin
3177d9ad41 Use http_proxy environment variable so meteor update and deploy work behind an http proxy. 2013-09-27 15:06:43 -07:00
Emily Stark
ff143f94b7 Account for undefined options 2013-09-27 14:58:59 -07:00
Emily Stark
db03f574a3 Implement Collection.upsert().
Basically the same code as Collection.update(... { upsert: true }) except that
it returns an object with numberAffected and insertedId keys. remove() is back
to returning just the number affected, not an object, so that both update() and
remove() match the mongo api.

Untested.
2013-09-27 14:46:10 -07:00
Nick Martin
1582372d5c Merge branch 'pr-1253' into devel 2013-09-27 14:39:00 -07:00
Nick Martin
eda50d2d1e add history.md note 2013-09-27 14:38:47 -07:00
Nick Martin
400778a559 Cleanup. Whitespace, comments, style, unused variables. 2013-09-27 14:36:26 -07:00
Robert Lowe
9e0897aecd Adds documentation for config arg of OAuth1Binding's constructor
Context: https://github.com/meteor/meteor/pull/1253#commitcomment-3980200
2013-09-27 14:36:26 -07:00
Robert Lowe
7bf11e35a6 Adds oauth1 improves to support requestTokenSecrets & dynamic urls.
Atmosphere package: https://github.com/RobertLowe/meteor-accounts-trello

Fixes #1167
Closes #1227
2013-09-27 14:36:26 -07:00
David Greenspan
d8d9206f4b $setOnInsert in minimongo 2013-09-27 13:53:09 -07:00
David Greenspan
e1aa2450e9 don't swallow exceptions on LocalCollection write
We provide an error-logging callback for async writes without a callback.  However, writes to LocalCollections are not necessarily async, so we shouldn't provide a callback.
2013-09-27 13:38:50 -07:00
David Greenspan
1dd83b1d2c run minimongo upsert tests on client (has errors) 2013-09-27 13:18:09 -07:00
David Greenspan
3f6c14aedf fix tests 2013-09-27 12:37:22 -07:00
Slava Kim
c6b8c651a4 Merge branch 'pr-1332' into devel 2013-09-26 14:51:23 -07:00
Slava Kim
d855e58f92 Implement Accounts.config({ restrictCreationByEmail: 'mit.edu' })
- Check email for users created with password or any social account's email
- Throw an error with explanation on bad email domain.
- Set `hd` param for Google Accounts authentication url
- Docs description
- Touch History.md

- Possibly should add it into QA process?
2013-09-26 14:50:55 -07:00
Emily Stark
58ad24d932 Run upsert tests for minimongo collections 2013-09-26 14:48:53 -07:00