Commit Graph

842 Commits

Author SHA1 Message Date
Simon Ho 06d4b90071 Add code review fixups 2016-09-22 16:15:32 -07:00
Tim De Pauw 5636c15903 More descriptive name for model with shortid 2016-09-22 16:07:34 -07:00
Tim De Pauw 419a464d06 Polish PR 2016-09-22 16:07:34 -07:00
Tim De Pauw be1d71f626 Support {defaultFn: 'shortid'} 2016-09-22 16:07:34 -07:00
Amirali Jafarian 66f27b9b83 Merge pull request #1094 from strongloop/newInstance_loade_updateAttributes
Add 'isNewInstance' for updateAttributes
2016-09-21 09:23:57 -04:00
Amir Jafarian fec7742a69 Add 'isNewInstance' for updateAttributes
* Add 'isNewInstance' to loaded hook for updateAttributes
2016-09-19 16:56:15 -04:00
David Cheung 805db78e19 Strict mode now always return validationError
- Deprecation of strict:validate and strict:throw
- When strict mode is enabled, it will now always
return validation error (previous strict:validate)
2016-09-19 10:27:24 -04:00
Loay 32a6b68f1d Skip test temporarily 2016-09-09 14:48:41 -04:00
Simon Ho 11ce971ad0 Fix BSON Object ID errors for CI 2016-09-08 13:16:55 -07:00
Miroslav Bajtoš a438c72cc5 Add missing "done" arg in test/kvao/ttl.suite 2016-09-08 10:22:27 +02:00
pponugo a39c0236bb Support nested queries for arrays
Enhance the built-in memory connector to correctly support nested
queries for arrays in addition to objects.

E.g. if "friends" is an array of objects containing "name", then
{ where: { "friends.name": "Jane" } } should match records containing
a friend called "Jane".
2016-09-07 13:33:57 +02:00
Simon Ho 095745c93b Refactor TTL tests for KV memory connector
Reduce the complixity in the TTL test suite for the kv-memory connector
to get CI to pass.
2016-09-04 12:27:33 -07:00
Simon Ho f102f6302b Merge pull request #1075 from strongloop/forwardport/test-fix-for-expire
Fix test case for expire
2016-09-02 16:03:54 -07:00
Amirali Jafarian d888d758c0 Merge pull request #1073 from strongloop/fix_upsertWithWhere_failures
Fix failures of upsertWithWhere
2016-09-02 17:01:43 -04:00
Simon Ho b884138923 Fix test case for expire
Forwardport of #1074. #1072 was missing Promise.resolve before using
delay(20) and causing Travis to fail on 2.x. This PR makes the test code
consistent on both master and 2.x.
2016-09-02 13:59:44 -07:00
Amir Jafarian 581b8c61bf Fix failures of upsertWithWhere
Forwardport of #1052
2016-09-02 15:46:36 -04:00
Simon Ho 96cd8ff56b Remove expired item before executing expire
The expire feature is falsely returning 204 instead of 404 because it is
not removing expired items before execution.
2016-09-01 21:18:40 -07:00
Miroslav Bajtoš 6d3ea21c16 test/memory: remove dummy findOrCreate impl
Let the operation-hook tests use the real implementation,
now that we have it in place.
2016-08-26 09:46:59 +02:00
Amir Jafarian aec678d252 Fix manually 2016-08-22 19:20:12 -04:00
Amir Jafarian aa6d28268b Auto-update by eslint --fix 2016-08-22 15:12:25 -04:00
Miroslav Bajtoš 3b653a192b kvao: implement key filter 2016-08-18 09:59:56 +02:00
Miroslav Bajtoš 01ce7df60f kvao: add iterateKeys() and keys()
Add a core implementation of KVAO.iterateKeys() which returns an
AsyncIterator, inspired by
 - https://github.com/tc39/proposal-async-iteration
 - https://www.npmjs.com/package/async-iterators

This way we can safely iterate even large sets of data.

Also add KVAO.keys(), a sugar API converting the result of iterateKeys()
into a single array.
2016-08-18 09:59:56 +02:00
Sonali Samantaray 37541dd178 upsertWithWhere feature support in juggler DAO 2016-08-16 18:06:01 +05:30
Simon Ho e1a649ed58 Rename get test suite to match other test suites 2016-08-15 11:13:07 -07:00
Simon Ho 1c20cc83aa Add TTL for KeyValue related features 2016-08-11 17:12:36 -07:00
Miroslav Bajtoš b01df10eae Merge pull request #1039 from strongloop/fix/kv-memory-reference-error
kv-memory: fix crash in regular cleanup
2016-08-10 14:18:11 +02:00
Janny c4b2921977 Merge pull request #982 from strongloop/fix/auto-increment-db
forceId=true with auto-increment db
2016-08-09 10:02:36 -04:00
Miroslav Bajtoš 4978cd8089 kv-memory: fix crash in regular cleanup
Fix bug in "_setupRegularCleanup()" where the interval callback
was trying to access an object that has been garbage-collected
in the meantime.
2016-08-09 15:35:23 +02:00
Miroslav Bajtoš baec1b5b77 test/relation: add missing error handlers 2016-08-08 16:26:26 -04:00
jannyHou 8935b978f3 forceId=true with auto-increment db 2016-08-08 16:26:26 -04:00
Miroslav Bajtoš 9ced20fdcc kvao: return 404 when expiring unknown key 2016-08-08 17:22:33 +02:00
Miroslav Bajtoš f15b4e2c86 Implement KeyValue API and memory connector
Models attached to a KeyValue connector get the following *static*
methods:

    Color.set(key, value);
    Color.set(key, value, ttl);
    Color.set(key, value, { ttl: ttl });

    Color.get(key);

    Color.expire(key, ttl);
2016-08-08 10:15:34 +02:00
Richard Pringle 0b62dd94ea Disallow bulk updateOrCreate. 2016-08-05 11:54:06 +02:00
Supasate Choochaisri f967773b2a Fix test case typo
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-07-24 19:38:37 +07:00
Supasate Choochaisri 94c5c18541 Add test to catch invalid date property
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-07-14 17:27:02 +07:00
Miroslav Bajtoš 699e0587d1 Ensure stable order of items in DAO.find()
When post-processing result of find operation, use "async.map"
instead of "async.each + array.push" to ensure the order of items
is preserved.
2016-07-13 14:55:49 +02:00
Amir Jafarian 9f0c10fdff Add test for updateOrCreate
* Add test for updateOrCreate when id is not autogenerated Id
2016-07-07 12:55:22 -04:00
RobinBiondi fbe58f7cf8 give options to validators #984 2016-06-24 14:44:43 -07:00
gunjpan 8117b0403f Throw Error for property names with dots
Result of Compat Flags Clenup.
Throws an error for property names with dots, instead
of a deprecation warning.
2016-06-09 17:50:59 -04:00
Amir Jafarian 7a8803cb38 Give warning if PK is changed in hooks
* Give warning if PK is changed in `before save` and `loaded`
 operation hooks for replaceById
2016-06-08 11:56:19 -04:00
Candy 3daca1e960 Remove model events 2016-06-08 10:27:05 -04:00
Dimitris Halatsis ea2266e453 Persist changes on parent for embedsOne
Allow direct save of changes on embedded model to be persisted on
parent document.

    Person.embedsOne(Address);
    Person.findById(someId)
      .then(function(p){
        var address = p.addressItem();
        address.street = 'new street'
        // This will now persist changes on parent document
        return address.save();
      })

[forward-port of #949]
2016-06-07 17:24:59 +02:00
Amir Jafarian 8f2077e344 Fix 2016-06-03 18:00:21 -04:00
Amir Jafarian cae44f0458 Fix error message
*Fix error message when PK is changed in `replaceById`
2016-06-01 16:16:35 -04:00
Dimitris Halatsis b7ba73f1b1 ModelBuilder: add new setting strictEmbeddedModels
The setting controls the strict mode used for embedded property types,
for example the type of "address" property in this model definition:

    modelBuilder.define('TestEmbedded', {
      name: 'string',
      address: {
        street: 'string',
      },
    });
2016-06-01 13:12:50 +02:00
Miroslav Bajtoš 6ec66a7e4a Merge pull request #950 from strongloop/add_test_description
Add test's description
2016-06-01 09:57:53 +02:00
Alex Pitigoi 423db34bf3 fix error handling when applying undefined mixins 2016-05-31 12:24:04 -04:00
Amir Jafarian 2b6ced06a1 Add test's description 2016-05-31 11:13:28 -04:00
Amir Jafarian d9a3f6226a Fix incompatibility between different connectors
* Fix incompatibility for replace methods between different connectors.
2016-05-27 13:45:24 -04:00
Alex Pitigoi 0e89a9c837 fix avoid duplicate record on scope with promise 2016-05-19 15:47:31 -04:00