Commit Graph

56 Commits

Author SHA1 Message Date
Raymond Feng 454fd0f1b2 Fix value equality test to avoid toString
- The where statement can be something like {toString: 'not a function'}
- Avoid object string comparison

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
2020-10-30 09:15:39 -07:00
Diana Lau 251ced811b
Update copyright year and CODEOWNERS (#1818)
* chore: update CODEOWNERS

* chore: update copyright years
2020-01-21 13:12:14 -05:00
Dimitris Halatsis ab11205fa0 fix #1781 (#1782) 2019-10-21 12:55:14 -04:00
Miroslav Bajtoš caf9d09274
Test "near" queries executed in memory
Rework setup of the Operation Hooks test suite for memory connector
so that the "unoptimized" variant disables not only atomic CRUD
operations, but also geo queries.

This way we can test both "near" querying implementations:
 - When the connectors supports "near" queries natively.
 - When "near" queries are executed at LoopBack side in-memory.
2019-05-14 09:14:10 +02:00
Agnes Lin de4718d5b8 chore: update copyrights years (#1737) 2019-05-08 11:45:37 -04:00
Miroslav Bajtoš 9e0f624ad5
manually fix remaining problems 2018-12-07 16:46:15 +01:00
Miroslav Bajtoš 422ec9ad4f
autofix eslint errors 2018-12-07 16:46:15 +01:00
Miroslav Bajtoš d2ee73b9d3
Update eslint + config to latest 2018-06-12 09:13:32 +02:00
Raymond Feng 1f995ec674 Use dataSource.connect to avoid duplicate connects 2017-04-04 10:19:58 -07:00
Raymond Feng 0a408476ec Fix in-mem connector file operation racing condition 2017-04-04 08:25:15 -07:00
jannyHou 8b1100e3ed Add test case for all connectors 2017-02-14 14:01:44 -05:00
Loay 9541bb5f15 Add proper statusCode for duplicate 2017-02-08 23:52:14 -05:00
Siddhi Pai 3baa61590e Fix block padding
* Remove test/.eslintrc
* run eslint . --fix
2016-12-13 16:05:50 -08:00
Amir Jafarian fec7742a69 Add 'isNewInstance' for updateAttributes
* Add 'isNewInstance' to loaded hook for updateAttributes
2016-09-19 16:56:15 -04: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
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š c7f34c3452 eslint config 2.0 + remove extra empty lines
Upgrade eslint-config-loopback to ^2.0.0.

Remove extra empty lines to make `npm run lint` pass again.
2016-04-19 16:11:43 +02:00
Raymond Feng e321bafdf9 Fix style errors 2016-04-05 16:11:25 -07:00
Raymond Feng b7543e9402 Merge pull request #860 from horiaradu/master
fix nin support for in memory datasource
2016-04-05 15:42:07 -07:00
Miroslav Bajtoš 27c6279d6c fix remaining eslint issues 2016-04-05 15:25:34 +02:00
Miroslav Bajtoš 39e04a1756 eslint --fix 2016-04-05 15:25:34 +02:00
Ryan Graham c467b43c38 Insert copyright headers 2016-04-04 18:14:03 -07:00
Amir Jafarian 5b6bffb5b3 Fix Mongo compatibility issue
*Fix Mongo compatibility issue for replaceOrCreate
2016-03-29 14:42:13 -04:00
Horia Radu a3ae44aca0 fix nin support for in memory datasource 2016-02-27 10:27:09 +02:00
Amir Jafarian ba7161b39e Implement `findOrCreate` for memory connector 2016-01-16 18:46:53 -05:00
Michael Diguet d8678a1f03 Correction of a regression introduced by commit 632898b: when querying an empty array ([]) with a 'neq' filter, there were no matching. 2015-11-23 17:09:24 +01:00
Laurent Villeneuve cb78c8ef96 Add direct copmarison value for array matching 2015-08-27 23:56:49 -04:00
Laurent Villeneuve 632898b022 Add support for matching array values à la mongo. 2015-08-27 23:32:53 -04:00
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
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
Simon Ho b8f1598723 Add support for regex operator 2015-07-27 15:11:53 -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
Raymond Feng eb20eebe95 Fix the regression for date conversion 2015-07-03 09:29:26 -07:00
Raymond Feng 4206088fbc Fix the regexp value for like/nlike 2015-07-02 23:22:36 -07:00
Pradnya Baviskar e7430184a9 Promisify 'autoupdate' 2015-06-23 18:02:08 +05:30
Pradnya Baviskar f4f13a6626 Promisify 'automigrate' 2015-06-16 12:58:21 +05:30
Raymond Feng 506223885d Mix in observer apis to the connector 2015-05-20 15:02:44 -07:00
Raymond Feng 5ef444e45d Conditionally pass options to connector CRUD methods 2015-05-13 09:36:45 -07:00
Raymond Feng 137d096cfb Allow nesting properties to be queried for memory connector
See https://github.com/strongloop/loopback/issues/517
2015-03-27 16:05:12 -07:00
Daniel B. Vasquez 3de94cb9bd add tests for between in memory connector 2015-03-16 18:26:33 +01:00
Clark Wang 0bef56efc0 support optimized findOrCreate
Signed-off-by: Clark Wang <clark.wangs@gmail.com>

remove undefined for creating data in findOrCreate

Signed-off-by: Clark Wang <clark.wangs@gmail.com>

getLastGeneratedUid instead of force an id

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-02-07 10:23:04 +08:00
Raymond Feng 4afb2385a9 Fix id type issue for update
https://github.com/strongloop/loopback/issues/1058
2015-02-02 08:44:36 -08:00
Miroslav Bajtoš 1fd6eff10f Intent-based hooks for persistence
This patch introduces a new API for "intent-based" hooks. These hooks
are not tied to a particular method (e.g. "find" or "update"). Instead,
they are triggered from all methods that execute a particular "intent".

The consumer API is very simple, there is a new method
Model.observe(name, observer), where the observer is function
observer(context, callback).

Observers are inherited by child models and it is possible to register
multiple observers for the same hook.

List of hooks:

 - query
 - before save
 - after save
 - after delete
2015-01-29 08:43:52 +01:00
Raymond Feng 8dfe877639 Remove console.log 2015-01-14 11:51:47 -08:00
Christian Vette 99acd364d2 added test for sorting undefined values 2015-01-05 21:56:17 +01:00
Raymond Feng 455743167a Fix the automigrate issue
See https://github.com/strongloop/loopback-example-relations-basic/issues/6
2014-10-16 12:04:16 -07:00
Fabien Franzen 8352ed3afc Implemented collection setting for Memory connector 2014-10-09 18:13:57 +02:00
Raymond Feng 6020436063 Added a test case for neq 2014-09-02 08:36:37 -07:00