Commit Graph

91 Commits

Author SHA1 Message Date
Rahul Lanjewar
0db3a6ff27 fix: Parse.Query.containedIn and matchesQuery do not work with nested objects (#9738) 2025-05-03 12:52:31 +02:00
Mohammad Ali
5f66c6a075 fix: Parse.Query.distinct fails due to invalid aggregate stage 'hint' (#9295) 2024-10-22 20:51:58 +02:00
Manuel
9552a4cbee ci: Fix test exclusion list in combination with other exclusions (#9277) 2024-08-13 22:13:19 +02:00
Manuel
901cff5edd test: Add test IDs (#9205) 2024-07-18 15:41:04 +02:00
vzukanov
0388956808 feat: add option to change the default value of the Parse.Query.limit() constraint (#8152) 2022-09-30 00:38:57 +02:00
dblythy
3b775a1fb8 fix: sorting by non-existing value throws INVALID_SERVER_ERROR on Postgres (#8157) 2022-09-17 20:41:45 +02:00
Manuel Trezza
1593575a87 build: release 2022-03-18 15:17:12 +01:00
Corey
16b1b2a197 feat: support relativeTime query constraint on Postgres (#7747) 2022-01-02 01:10:54 +01:00
Antonio Davi Macedo Coelho de Castro
308668c894 Merge pull request from GHSA-xqp8-w826-hh6x
* Added a test case that triggers the query parameter crash

* rest.js: validate the explain parameter to keep the nodejs driver from throwing an uncatchable exception and crashing the server (see https://jira.mongodb.org/browse/NODE-3463)
RestQuery.js: Check whether explain mode is enabled not by "!== true", but by the "!" operator. explain can have string values.
Added tests that validate correct behaviour on different explain values

* Refactor the new tests

* Simplify the new tests
Also do a sanity check on the explain results

* Test refactor

* Exclude queryPlannerExtended as it is not supported by the testing environment
  Simplifies the tests

* Restrict the changes to mongodb
  Moved the verification of the explain value from rest.js to MongoStorageAdapter.js
  Also restricted the relevant unit tests to mongodb

* Added changelog entry

* reformat changelog entry

* Update CHANGELOG.md

Co-authored-by: Kartal Kaan Bozdoğan <kartalkaanbozdogan@gmail.com>
Co-authored-by: Manuel <5673677+mtrezza@users.noreply.github.com>
2021-09-02 12:46:48 +02:00
Corey
6d13aeae2c Fix select exclude queries (#7242)
* fix keys and excludeKeys to work with JSON array strings

* make excludeKeys test more robust

* add changelog

* add select([]) functionality to fix)

* update changelog

* update keys

* add exclude test

* add select REST test and exclude JS SDK test

* add more tests

* add additional exclude test

* improved select test for testing JSON string array in REST

* improved exclude test for testing JSON string array in REST

* check for parse keys

* make include look like keys and excludeKeys

* nit

* Exclude nexted child fields

* add updates and show failing testcases

* working

* add more tests

* even more test cases

* use await for added tests

* lint

* Add suggestions
2021-06-03 14:54:44 -05:00
Diamond Lewis
9563793303 Allow single server instance in test suite (#7262)
* initial pass

* reconfigureServer when needed

* finish postgres tests

* mongo tests

* more tests

* clean up

* re-add skipped test

* Fix transaction tests

* handle batch

* AuthenticationAdapter fix

* More reconfiguration

* clean up

* properly terminate cli servers

* handle Parse.Push

* Flaky PushController

* ensure reconfigureServer when changed

* fix postgres tests

* remove console.log

* LiveQuery spec remove duplicates and listeners
2021-03-13 09:05:22 -06:00
Diamond Lewis
39fa17f914 Postgres: Properly initialize database on startup and debugger (#7255)
* PG: Properly initialize database

* fix flaky tests

* flaky test

* correct test

* no idea

* clean up debugger
2021-03-10 11:31:35 -08:00
dblythy
e53b6c2f87 run prettier (#7172) 2021-02-12 10:18:49 +01:00
Manuel
b59517fd68 Add tests against multiple MongoDB versions (#7161)
* added tests environment with mongodb 4.4.3

* added CI test for mongodb 4.4.3

* added CI tests for MongoDB versions 4.0, 4.2

* improved flaky test (seems to max out the limit of simultaneous connections)

* added spec helpers to run tests only for specific MongoDB version

* addedn npm scripts to run tests against relevant mongodb versions

* added spec helper function to exclude specific mongodb version

* added test for changed aggregate query planner results

* fixed regex test with incorrect regex syntax

* fixed test where query has select no keys (empty array)

* added changelog entry and ordered list

* fixed test that tried to simultaneously delete and build index on same collection

* added MongoDB compatibility table to readme

* updated default local tests to use MongoDB 4.4.3

* added MongoDB badges for new versions to README

* fixed typo in readme

* added new test helper filter to contribution guide

* fixed incorrect storage engine for mongodb 4.4

* changed CI to test MongoDB 3.6. with mmapv1 storage engine and standalone

* improved CI test description

* added CI self check for new MongoDB versions

* fixed CI

* removed CI

* added CI

* added throwing error if any of the checks failed

* added github action connector

* improved error message

* improved error messages

* improved error message

* updated CI environment to MongoDB 3.6.22

* improved error messages

* update CI env name

* updated CI env name

* improved error message

* removed patch versions from CI env description

* improved status message

* removed version range from core lib

* added explicit mongodb version to redis test and node 12 test

* bumped Node 12 test to 12.20.1 (version currently recommended by AWS Elastic Beanstalk)
2021-02-07 23:16:46 +01:00
Diamond Lewis
ca1b78220f Prevent invalid column names (className and length) (#7053)
* Prevent invalid column names

* remove className as invalid

* remove className from beforeSave hook response

* improve tests
2020-12-09 12:19:15 -06:00
Corey
568c285369 Fix includeAll for querying a Pointer and Pointer array (#7002)
* initial test

* Add failing testcase

* fix includeAll by considering array
2020-11-11 10:57:41 -06:00
Diamond Lewis
e6ac3b6932 fix(prettier): Properly handle lint-stage files (#6970)
Now handles top level files and recursive files in folders.

Set max line length to be 100
2020-10-25 15:06:58 -05:00
Manuel
2b7223355e fix explain on user class (#6650)
* added test case and fixed bug

* enabled test case only for mongodb
2020-04-28 11:45:01 -07:00
Old Grandpa
292bdb713a Allow protectedFields for Authenticated users and Public. Fix userField with keys/excludedKeys (#6415)
* fix error message and test it

* protected fields fixes

* clean

* remove duplicate test, add some comments

* no need for 'requiresAuthentication'
2020-02-19 01:34:08 -08:00
Diamond Lewis
1a7f64d8d9 Fix: Undefined dot notation in matchKeyInQuery (#5917)
* Fix: Undefined dot notation in matchKeyInQuery

* fix test

* fix postgres test

* improve tests

* FINAL test
2019-08-13 21:34:46 -07:00
Douglas Muraoka
ef14ca530d GraphQL Object constraints (#5715)
* GraphQL Object constraints

Implements the GraphQL Object constraints, which allows us to filter queries results using the `$eq`, `$lt`, `$gt`, `$in`, and other Parse supported constraints.
Example:
```
query objects {
  findMyClass(where: {
    objField: {
      _eq: {
        key: 'foo.bar',
        value: 'hello'
      },
      _gt: {
        key: 'foo.number',
        value: 10
      },
      _lt: {
        key: 'anotherNumber',
        value: 5
      }
    }
  }) {
    results {
      objectId
    }
  }
}
```
In the example above, we have the `findMyClass` query (automatically generated for the `MyClass` class), and a field named `objField` whose type is Object. The object below represents a valid `objField` value and would satisfy all constraints:
```
{
  "foo": {
    "bar": "hello",
    "number": 11
  },
  "anotherNumber": 4
}
```
The Object constraint is applied only when using Parse class object type queries. When using "generic" queries such as `get` and `find`, this type of constraint is not available.

* Objects constraints not working on Postgres

Fixes the $eq, $ne, $gt, and $lt constraints when applied on an Object type field.

* Fix object constraint field name

* Fix Postgres constraints indexes

* fix: Object type composed constraints not working

* fix: Rename key and value fields

* refactor: Object constraints for generic queries

* fix: Object constraints not working on Postgres
2019-08-02 12:18:07 -07:00
Diamond Lewis
95208e96e0 Postgres: Safely escape strings in nested objects (#5855)
* Postgres: Safely handle string in nested objects

* fix failing tests
2019-07-28 23:54:13 -05:00
Raschid J.F. Rafeally
9816285205 Added rest option: excludeKeys (#5737)
* Added restOption: excludeKeys

* improve tests
2019-07-10 15:01:21 -05:00
Jeff Gu Kang
ad7fc48c97 Postgres: Regex support foreign characters (#5598)
* Fix issue #5293

* Fix issue #5293

* add test

* Revert "add test"

This reverts commit 38b32a627a9d2c9a9b852b48194f173d8b7254f3.

* fix conflicts

* use native package
2019-06-24 16:13:34 -05:00
Diamond Lewis
005fd78275 PG: Fix updating mixed array (#5552)
* PG: Fix updating mixed array

* Revert "PG: Fix updating mixed array"

This reverts commit 5a441413c083747d9e51767be7b2e9298bd4f8ba.

* simple fix
2019-05-02 12:44:17 -05:00
Diamond Lewis
ab32dbc9a2 PG: Fix containedIn query on empty array (#5254)
* PG: Fix containedIn query on empty array

* improve logic
2018-12-19 17:57:55 -06:00
Diamond Lewis
631b1684e2 PG: Updating mixed array test (#5252)
* PG: Updating mixed array test

Currently we can save a mixed array but not update

* build array instead of casting

* fix test

* add recursion
2018-12-18 17:38:05 -06:00
Diamond Lewis
7b3da8b744 PG: Fix updating numeric array (#5251)
* PG: Fix updating numeric array

* lint
2018-12-18 12:11:24 -06:00
Diamond Lewis
d478e001b5 PG: Support multiple global config (#5242)
* PG: Support Multiple Configs

* rename test

* refactor
2018-12-14 17:39:07 -06:00
Florent Vilmart
045d941aef Remove request and request-promise from dev dependencies (#5077)
* removes from emailverificationtoken spec

* updates winston

* Updates ValidationAndPasswordsReset

* Use local request in schemas

* Removes request in rest.spec

* Removes request from PushRouter0

* removes request from public API

* removes request from index.spec

* Removes request form parse.push spec

* removes request from ParseInstallation spec

* Removes from ParseHooks

* removes request from ParseGlobalConfig.spec

* Removes request from ParseAPI.spec.js

* removes request from LogsRouter

* removes in features

* Filters undefined headers instead of crashing

* Removes request from ParseUser spec

* Removes usage of request in ParseFile.spec.js

* Removes request from AuthAdapters.js

* removes request-promise from ParseGeoPoint.spec

* Removes request-promise from ParseQuery spec

* remove request-promise from UserPII

* removes request-promise from EnableExpressErrorHandler

* Updates RevocableSessionUpgrade spec

* Update RestQuery

* Removes read preferenceOptionM

* ensure we forward auth from URL

* use request in CloudCode.spec.js

* Removes request-promise from JobSchedule.spec

* Removes rp from VerifyUserPassword.spec.js

* Removes rp from PasswordPolicy spec

* Removes rp from ParsePolygon spec

* Removes rp from fullTextSearch spec

* Removes rp from PArseQuery.Aggregate

* Ensure we properly forward errors

* Removes request and request-promise
2018-09-24 17:07:51 -04:00
Florent Vilmart
576779b69b Updates JS SDK to 2.1.0 (#5043) 2018-09-08 20:05:32 -04:00
Florent Vilmart
d83a0b6808 Use Prettier JS (#5017)
* Adds prettier

* Run lint before tests
2018-09-01 13:58:06 -04:00
Diamond Lewis
f1b008388c Support include('*') Query (#4947) 2018-08-10 12:51:32 -05:00
Florent Vilmart
ff25ae254d Update parse SDK to 2.0.0 (#4925)
* WIP: Integrate JS SDK v2

- Removes backbone style callbacks
- Use Promise instead of Parse.Promise

* Fixes ParseObject and ParseRelation

* Updates Parse.Query with promises

* Alls tests should pass

* Ensure a fresh user is used for each test

* Use REST implementation to avoid side effects for username/email duplicates

* Uses js sdk v2
2018-08-05 13:58:07 -04:00
Diamond Lewis
0e93306867 nit 2018-06-16 10:16:54 -07:00
Diamond Lewis
00252cbeff add includeAll option 2018-06-16 10:16:54 -07:00
Manuel
1e29d0299b add support for geoWithin.centerSphere queries via withJSON (#4825)
* add support for geoWithin.centerSphere queries via withJSON

* added test for passing array of lat, lng instead of Parse.GeoPoint

* added postgres support

* added more tests

* improved tests and validation

* added more tests
2018-06-12 12:41:02 -04:00
Arthur Cinader
e06471603f Don't error when attempting to sort on an object field (#4806)
* add failing test to demonstrate that you can't sort on a
field in an object.

* Only validate the base of the field name.

* fix test name

* Only test sort for mongo.

* pg order by nested object

* level 2 test

* Factor out operation to get a field's base name.  Add comment.

* tweak comment wording so it wont make my grammar teacher angry.
2018-06-07 18:47:18 -04:00
Jérémy Piednoel
77ed10f57b Adding $nor operator support (#4768)
* adding nor to specialQuerykeys

* adding nor suport

* adding test

* CRLF

* adding postgres NOR

* adding nor validation

* adding NOR test

* adding test amd fixing NOR cases

* revert the nor logic
2018-05-18 14:26:33 -05:00
Jérémy Piednoel
c0f86ae1d1 Adding Mongodb element to add arrayMatches the #4762 (#4766)
* Adding elemMatch and nor

* lint

* adding test

* adding edge test

* postgres support

* clean up

* empty test
2018-05-18 08:35:50 -05:00
Eduard Bosch Bertran
c0e3672e32 New query condition support to match all strings that starts with some other given strings (#3864)
* feat: Convert $regex value to RegExp object

* feat: Add lib folder

* Revert "feat: Add lib folder"

This reverts commit c9dfbcbf699ff220baeb2df5586a944d19808e5e.

* feat: Add $regex test in $all array

* test: Test regex with $all only in MongoDB

* Revert "test: Test regex with $all only in MongoDB"

This reverts commit d7194c7869dee98d924fbc2502593a198385dba1.

* feat: Add tests for containsAllStartingWith

* feat: Add postgres support

Thanks to @dplewis

* feat: Check that all values in $all must be regex or none

* test: Check that $all vaules must be regex or none

* feat: Update tests to use only REST API

* refactor: Move $all regex check to adapter

* feat: Check for valid $all values in progres

* refactor: Update function name

* fix:  Postgres $all values regex checking

* fix: Check starts with as string

* fix: Define contains all regex sql function

* fix: Wrong value check

* fix: Check valid data

* fix: Check regex when there is only one value

* fix: Constains all starting with string returns empty with bad params

* fix: Pass correct regex value

* feat: Add missing tests

* feat: Add missing tests

* feat: Add more tests

* fix: Unify MongoDB and PostgreSQL functionality

* fix: Lint checks

* fix: Test broken

$regex in $all list must be { $regex: "string" }

* test for empty $all
2018-05-15 20:42:32 -05:00
Diamond Lewis
710848938f PG: Fixes issues comparing to zero or false (#4667)
* initial test

* more test

* clean up

* added correct errors

* test fix

* $eq null test

* type check
2018-03-24 17:45:34 -05:00
Florent Vilmart
b754d51e8e chore(package): update jasmine to version 3.0.0 (#4553)
* chore(package): update jasmine to version 3.0.0

Closes #4547

* Fixes failing tests for jasmine 3.0

Starting 3.0, done(something) will fail

* Update tests so they dont leverage var, but let and const

With jasmine 3.0, the randomization engine was making the test fails because of the scope of `var`

* Remove randomizer

* Use same adapter for PG tests, drop table to ensure the tests dont side effect
2018-02-17 09:55:30 -05:00
Arthur Cinader
ca542c3750 Fix test name to match what's tested 2017-11-30 12:40:39 -08:00
Arthur Cinader
1876d3f3fd Add doesNotMatchKeyInQuery case... 2017-11-30 12:40:39 -08:00
Henrik Malmberg
4ceff38811 added test for dot-notation in matchesKeyInQuery 2017-11-30 12:40:39 -08:00
Benjamin Wilson Friedman
46af1b6955 Adds Relative Time options now,weeks & years (#4304)
* Adds 'now' as an option in relative time

* reenables no-console in previous spot

* Adds weeks,months,years and abbreviations

* modified tests to address coverage

* month be gone!
2017-11-01 13:31:08 -07:00
marvelm
6f1fe89948 Relative time queries (#4289)
* Add relative time queries

* Encode successful result

* Add integration test

* Add more error cases

* Remove unnecessary new Date

* Error when time has both 'in' and 'ago'

* naturalTimeToDate -> relativeTimeToDate

* Add $relativeTime operator

* Throw error if $relativeTime is invalid

* Add integration test for invalid relative time

* Exclude $exists query

* Only run integration tests on MongoDB

* Add it_only_db test helper
bd2ea87c1d/CONTRIBUTING.md (L23)

* Handle where val might be null or undefined

* Add integration test for multiple results

* Lowercase text before processing

* Always past if not future

* Precompute seconds multiplication

* Add shorthand for interval
hr, hrs
min, mins
sec, secs

* Throw error if $relativeTime is used with $exists, $ne, and $eq

* Improve coverage for relativeTimeToDate

* Add test for erroring on floating point units

* Remove unnecessary dropDatabase function

* Unit test $ne, $exists, $eq

* Verify field type

* Fix unit test for $exists
Unnest query object
2017-10-26 16:23:27 -04:00
Florent Vilmart
e4eeadd4c6 Bumps parse sdk 1.10.1 (#4274)
* Fail test case for Issue#3999

* no message

* Bumps Parse to 1.10.1

Updates Polygon test suite to leverage latest version
2017-10-21 16:03:24 -04:00
Florent Vilmart
7fac070435 Allow queries with String array for pointers containedIn (#4188)
* Adds basic failing test

* Adds ability to use [objectId] for $in/$nin pointers

* makes sure to use a set field

* Makes sure field is defined
2017-10-03 13:50:39 -04:00