Commit Graph

4546 Commits

Author SHA1 Message Date
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
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
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
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
Emily Stark
58ad24d932 Run upsert tests for minimongo collections 2013-09-26 14:48:53 -07:00
Emily Stark
1964d2e88e Support in minimongo 2013-09-26 14:48:13 -07:00
Emily Stark
0286395700 Actually implement minimongo upsert.
Got a little over-confident there...
2013-09-26 14:22:23 -07:00
Emily Stark
86565853b1 Implement upsert in minimongo.
i.e. delete the code where we throw an exception if you try to upsert.
2013-09-25 18:19:59 -07:00
Emily Stark
399028eb53 Don't allow clients to call update methods as upserts.
Add test for it. This is a way to avoid the complexity of allow/deny rules for
upserts; for now, if you want to do an upsert, do it in a method.
2013-09-25 18:13:46 -07:00
Emily Stark
18050d9471 Return { numberAffected: x } from updates and removes. 2013-09-25 15:44:12 -07:00
Emily Stark
d5680c6a37 Merge branch 'jacott-return-counts-for-update-remove' into mongo-upsert
Conflicts:
	packages/mongo-livedata/collection.js
2013-09-25 15:34:46 -07:00
Emily Stark
6d72ae761e Merge branch 'return-counts-for-update-remove' of github.com:jacott/meteor into jacott-return-counts-for-update-remove
Conflicts:
	packages/minimongo/minimongo.js
	packages/mongo-livedata/mongo_driver.js
2013-09-25 15:33:04 -07:00
David Greenspan
0e988fcf5a strategy comment 2013-09-24 19:13:01 -07:00
David Greenspan
220676600e upsert supports modify and multi
doesn't actually retry 3 times yet (needs to determine when to)
2013-09-24 19:06:27 -07:00
David Greenspan
41247305db version 0 of optimistic upsert simulation 2013-09-24 17:59:59 -07:00
Emily Stark
99b9ec2da5 Return values of server update/remove queries to user.
Thanks to @jacott. Minimongo implementations to come.
2013-09-24 17:10:29 -07:00
Slava Kim
9368852bdc Improve error message
Glasser's comments
2013-09-24 16:31:44 -07:00
Slava Kim
1eca8f4a55 Merge branch 'mongod-exit-message' into devel 2013-09-24 15:20:47 -07:00
Slava Kim
63589300fe On MongoDB failures print 20 lines of stderr and print a special error if mongod failed to start due to incompatible version of glibc.
Catch stderr before 'exit' signal

Try to give a good error message on outdated glibc/libstdc++.

Simplify error reporting to two lines.

Print only last 20 lines of stderr.

Slightly better error message.
2013-09-24 15:20:08 -07:00
Naomi Seyfer
33153624f6 Fix bug with empty-string _id not giving you any results ever 2013-09-24 12:00:26 -07:00
Avital Oliver
bd73b31255 Update History.md for fixing #722 2013-09-24 10:48:55 -07:00
Nick Martin
d1be6dde35 Merge branch 'mongo-new-devbundle' into devel 2013-09-23 23:00:18 -07:00
Nick Martin
6452c8b173 update history. 2013-09-23 22:50:43 -07:00
Nick Martin
ca080b1477 bump mongo and dev bundle version. release/mongo-new-devbundle-1 2013-09-23 20:53:09 -07:00
Avital Oliver
7e8c2f9405 Better error when passing string to {{#each}}
Fixes #722
2013-09-23 17:49:59 -07:00
Naomi Seyfer
4f4e5342eb Remove code to keep around sessions after they are disconnected.
We will deal with reconnects with session resumption someday, but it will not be
using this dead code which has bitrotted in our repository for months on end.
It was never fully implemented, and what we had was a sketch that causes bugs
(and extra cpu usage).
2013-09-23 17:30:34 -07:00
Naomi Seyfer
35e8a04834 Stop offending the message. Dont alias in_queue to out_queue 2013-09-23 15:53:47 -07:00
Maxhodges
8afa4f2c9e typo. "with" repeated twice. 2013-09-23 10:49:53 -07:00
David Glasser
d5ce2502f6 Improve error messages if unipackage load fails.
This mostly affects Meteor core development (since for now, unipackage.load is
only used inside the meteor tools itself and only to load core packages, which
should be properly compiled in any Meteor release).
2013-09-19 13:54:33 -07:00
Slava Kim
9e2d6ed769 Merge branch 'minimongo-fields' into devel
Now supporting fields filtering in subarrays.

Example:

  C.insert({ foo: [ { bar: 1, qux: -1 }, [ { bar: 2, qux: -2 } ] ] });

  C.findOne({}, { 'foo.bar': 1, _id: 0 });

  < { foo: [ { bar: 1 }, [ { bar: 2 } ] ] }
2013-09-16 11:07:51 -07:00
Slava Kim
48eea25d27 Comments on keys sorting.
Suggested by Glasser.
2013-09-16 11:04:08 -07:00
Slava Kim
4345fdbd4b Always sort keys to simplify some cases.
And don't modify the argument.
2013-09-13 16:00:08 -07:00
Slava Kim
4ed373b2b4 Check the equality with _.isEqual
EJSON.stringify doesn't guarantee the order of keys.
2013-09-13 15:59:36 -07:00
Slava Kim
6c448a213f Another test 2013-09-13 15:41:53 -07:00
Slava Kim
2642280977 Put a.b.c and a.b validation into general case. 2013-09-13 01:51:25 -07:00
Slava Kim
eb5d426a7c Fix docs. $slice is not related to fields projection. 2013-09-13 01:51:25 -07:00
Slava Kim
a6643812a8 Same test but for blacklisting 2013-09-13 01:51:24 -07:00
Slava Kim
05a3a22a6b Fields with subsets passes the test. 2013-09-13 01:51:24 -07:00
Slava Kim
83136f64aa Add nested-nested test.
Taken from Glasser's old code-review.
2013-09-13 01:51:24 -07:00
Slava Kim
f6e307e644 Whitespace 2013-09-13 01:51:24 -07:00
Slava Kim
b24066d477 Improve documentation on fields.
- You can mix incl/excl as long as it is `_id`
- Note unsupported `$` and `$slice` operators of minimongo
- Give an advanced example with reference to mongodb docs.
2013-09-13 01:51:24 -07:00
Slava Kim
27fd0d5066 Support subsets fields filtering.
Rewrote the returned closure. Still don't support '$' and '$slice' operators.
2013-09-13 01:51:24 -07:00