Commit Graph

1251 Commits

Author SHA1 Message Date
Wilson Júnior c26b857a87 UpdateAttributes: Raises an error if database fails
Signed-off-by: Wilson Júnior <wilsonpjunior@gmail.com>
2015-11-17 17:10:11 -02:00
Clark Wang b1b36ed44e fix typo 2015-11-04 14:58:28 +08:00
Clark Wang b993fb9466 fix global leak that mocha complains
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-11-04 14:19:47 +08:00
Raymond Feng d0072b68a1 Merge pull request #739 from mdartic/master
Fix filtering relations of a model with an order specified
2015-10-28 08:38:03 -07:00
Federico Rampazzo 2de499ccb0 Added missing callback when a model is not found 2015-10-28 09:15:32 +00:00
mdartic 7c22db6ea7 Filtering relations of a model with an order specified 2015-10-16 18:21:04 +02:00
Ryan Schumacher 94c3f9a432 Ability to define normalization of undefined query
Add datasource and model setting `normalizeUndefinedInQuery`
to determine how it will handle undefined values. Options:

- nullify : converts undefined to null
- throw : throw an error on undefined value
- ignore : strip the key where undefined value is found

The default operation is to strip the key.
2015-10-07 09:26:09 -07:00
James Cooke 6dac956cf8 findByIds would fail when an array of 0 length was passed as its first argument 2015-09-23 16:27:41 +01:00
Raymond Feng 207edd5eec Merge pull request #687 from sklyukin/master
primaryKey to hasOne relation
2015-09-08 09:20:42 -07:00
Rand McKinney 0e2d2c162e Update validations.js
Fix small mistake in doc comment.
2015-09-04 16:31:54 -07:00
Bram Borggreve fb11c78be0 Add support for using UUID V4 as defaultFn 2015-09-02 16:39:00 +02:00
sklyukin d0f9b760f5 primaryKey for hasMany and belongsTo relations 2015-09-01 19:03:02 +05:00
sklyukin 483cd873e7 primaryKey to hasOne relation 2015-09-01 01:31:28 +05:00
Raymond Feng febfe2362a Merge pull request #699 from satyadeepk/master
Fixed ReferencesMany .findById to check the given id in the modelInstance[fk]
2015-08-31 10:08:38 -07:00
Laurent Villeneuve 632898b022 Add support for matching array values à la mongo. 2015-08-27 23:32:53 -04:00
Simon Ho 57a9c40e16 Fix primary key checks 2015-08-27 13:59:43 -07:00
Simon Ho cd71a37bfa Relax id requirement for basic query operations 2015-08-20 02:57:53 -07:00
Satyadeep ad83c82ebc Fixed ReferencesMany .findById to check the given id in the ids array of the model instance 2015-08-19 22:34:16 +05:30
Laurent Villeneuve 0381f6d7e7 Support embedded query in memory connector. Fix memory connector bug
Adds support for the ability to query embedsMany models from the parent.

Fix a memory connector bug that could occur when having an "or" or "and"
clause combined with another property. In that case, the and would revert
true for 'Paul McCartney'

```
{name:'John Lennon',and: [{role:'lead'}, {vip:true}]}}
```
2015-08-18 15:56:36 -04:00
Laurent Villeneuve bdf703fb45 Use idEquals when comparing ids in relation definitions 2015-08-18 10:22:36 -04:00
Laurent Villeneuve 94ff275bbc Handle possible undefined id 2015-08-18 09:40:52 -04:00
Laurent Villeneuve 9363354e0f Fix id copmarison by using strings 2015-08-18 09:40:52 -04:00
Raymond Feng f5270c39c5 Refactor idEquals to utils 2015-08-17 12:49:38 -07:00
Simon Ho d14721656f Merge pull request #691 from strongloop/do-not-coerce-regexp-to-string
Do not coerce RegExp objects to strings
2015-08-14 09:14:05 -07:00
Simon Ho e7e074f97b Do not coerce RegExp objects to strings
Queries like `{where: {name: /John.*/i}}` should work. Notice there is no
`regexp` operator (ie. `{where: {name: {regexp: /John.*/i}}}`).
2015-08-13 16:16:48 -07:00
Fabien Franzen 2120e53f7f Indicate result of destroyById/protototype.destroy
Return `info.count` to the callback to indicate whether the model
instance was deleted or not. When Model's `settings.strictDelete`
is true, return 404 error when the model instance was not found.
2015-08-10 17:38:46 +02:00
Raymond Feng 62624203d1 Merge pull request #683 from thefinnomenon/master
Fixed typo & added the filter units
2015-08-06 08:50:21 -07:00
Chris Finn 42805fd326 Removed extra ")" 2015-08-05 15:39:33 -04:00
Raymond Feng 21c0067462 Report deferred exceptions via callback 2015-08-05 11:18:38 -07:00
Chris Finn f35bd39e60 Fixed typo & added the filter units
Fixed typo in nearby sort function & added the ability to specify units when filtering for nearby points.
2015-08-05 14:18:28 -04:00
Kenta Fried 90ee9a1af3 fixes issue 673: Include hasMany of relation does not return empty array 2015-07-31 14:47:22 -07:00
Simon Ho 4cd428a726 Fix regexp error for the memory connector
- Check for undefined/null values when accessing `regexp` key
2015-07-30 08:46:50 -07:00
Raymond Feng 4d7bfc94cd Fix error handling 2015-07-29 10:21:47 -07:00
Raymond Feng c45bde7ccf Merge pull request #647 from PradnyaBaviskar/issue-418-discover
Promisify all 'discover' methods
2015-07-29 07:43:39 -07:00
Raymond Feng ce57234d5e Merge branch 'issue656-findLoadedAsync' of https://github.com/PradnyaBaviskar/loopback-datasource-juggler into PradnyaBaviskar-issue656-findLoadedAsync 2015-07-29 07:33:21 -07:00
Simon Ho 68dc1d821f Remove try/catch from find function 2015-07-28 17:40:14 -07:00
Simon Ho b2b5a0d920 Merge pull request #665 from strongloop/add-regex-support
Add support for RegExp operator
2015-07-28 15:22:02 -07:00
Simon Ho b8f1598723 Add support for regex operator 2015-07-27 15:11:53 -07:00
Pradnya Baviskar de0ca3c61f Async 'loaded' hook for find 2015-07-27 18:58:29 +05:30
Pradnya Baviskar c63f3fb6cb Promisify all 'discover' methods 2015-07-24 12:07:22 +05:30
Raymond Feng b08b6dd954 Merge pull request #650 from PradnyaBaviskar/issue-649
Fix 'persist' hook for updateAttributes()
2015-07-23 08:27:07 -07:00
Pradnya Baviskar 8a20e07b3d Fix 'persist' hook for updateAttributes() 2015-07-23 15:25:50 +05:30
Fabien Franzen a94993c097 Don't enforce strictness if allowExtendedOperators: true (MongoDB) 2015-07-22 17:09:04 +02:00
Fabien Franzen c7caa0a7c1 Take strict: validate and throw settings into account 2015-07-21 13:33:42 +02:00
Fabien Franzen 8b06a9d39d Filter attributes when strict: true 2015-07-20 11:59:07 +02:00
Bryan Clark 342bc2f782 prevent upsert overwriting default values with applyDefaultValues option
Creates a new applyDefaultValues option on the Model constructor
defaulting to true, the current behaviour.

Updates the dao module to pass `{ applyDefaultValues: false }` to the
Model constructor during the updateOrCreate method when we assume an
update is happening.
2015-07-14 09:08:10 -07:00
Bryan Clark 1066313f3f use fromDb to deserialize data after save in Memory connector
Changes the after `save` callback in the memory connector to use the
`fromDb` method to deserialize the data passed back to upsert and
updateAttributes methods.
2015-07-14 09:08:09 -07:00
Fabien Franzen 6ce47f71b4 Correctly handle validatesUniquenessOf(idName) 2015-07-13 12:56:49 +02:00
Raymond Feng 5dc4042300 Fix object merge 2015-07-10 13:54:29 -07:00
Raymond Feng 6eb18cb2f6 Make sure base property definitions are cloned
Sub models sometimes need to customize the properties from the base model.
This change allows each sub model has its own copy of the base property
definition to avoid potential conflicts across multiple sub models of the
same base.
2015-07-10 10:03:51 -07:00