BREAKING CHANGE: Fields in the internal scope of Parse Server (prefixed with underscore `_`) are only returned using the new `maintenanceKey`; previously the `masterKey` allowed reading of internal fields; see [access scopes](https://github.com/parse-community/parse-server#access-scopes) for a comparison of the keys' access permissions (#8212)
* Optimize redundant logic used in queries
* Added CHANGELOG
* Fixed comments and code style after recommendations.
* Fixed code style after recommendation.
* Improved explanation in comments
* Added tests to for logic optimizations
* Added two test cases more and some comments
* Added extra test cases and fixed issue found with them.
* Removed empty lines as requested.
Co-authored-by: Pedro Diaz <p.diaz@wemersive.com>
* Optimize CLP pointer query
* remove console log
* Update changelog
* Fix flow type checker issues
* Remove unused properties
* Fix typo, add one more test case for coverage
* Add support for CLP entry of type Object
Co-authored-by: Musa Yassin-Fort <musa.yassin@bureapr.com>
Co-authored-by: Diamond Lewis <findlewis@gmail.com>
* Apply linter changes on files I'm about to update
My actual changes were quite difficult to find when buried in this sea
of style changes, which were getting automatically applied during a
pre-commit hook. Here I just run the hooks against the files I'm going
to be touching in the following commit, so that a reviewer can ignore
these automatically generated diffs and just view the meaningful commit.
* perf: Allow covering relation queries with minimal index
When finding objects through a relation, we're sending Mongo queries
that look like this:
```
db.getCollection('_Join:foo:bar').find({ relatedId: { $in: [...] } });
```
From the result of that query, we're only reading the `owningId` field,
so we can start by adding it as a projection:
```
db.getCollection('_Join:foo:bar')
.find({ relatedId: { $in: [...] } })
.project({ owningId: 1 });
```
This seems like the perfect example of a query that could be satisfied
with an index scan: we are querying on one field, and only need one
field from the matching document.
For example, this can allow users to speed up the fetching of user roles
in authentication, because they query a `roles` relation on the `_Role`
collection. To add a covering index on that, you could now add an index
like the following:
```
db.getCollection('_Join:roles:_Role').createIndex(
{ relatedId: 1, owningId: 1 },
{ background: true }
);
```
One caveat there is that the index I propose above doesn't include the
`_id` column. For the query in question, we don't actually care about
the ID of the row in the join table, just the `owningId` field, so we
can avoid some overhead of putting the `_id` column into the index if we
can also drop it from the projection. This requires adding a small
special case to the MongoStorageAdapter, because the `_id` field is
special: you have to opt-out of using it by projecting `{ _id: 0 }`.
* Set min mongodb to 3.6 in prep for parse-server 4.0
fixes: 6444
* don't use anonymous functions when we can just
pass the function.
Also remove the boolean argument in tests that no longer exists.
* generate the correct lock file. ooops.
* Always delete data after each, even for mongo.
* Add failing simple case test
* run all tests
* 1. when validating username be case insensitive
2. add _auth_data_anonymous to specialQueryKeys...whatever that is!
* More case sensitivity
1. also make email validation case insensitive
2. update comments to reflect what this change does
* wordsmithery and grammar
* first pass at a preformant case insensitive query. mongo only so far.
* change name of parameter from insensitive to
caseInsensitive
* Postgres support
* properly handle auth data null
* wip
* use 'caseInsensitive' instead of 'insensitive' in all places.
* update commenet to reclect current plan
* skip the mystery test for now
* create case insensitive indecies for
mongo to support case insensitive
checks for email and username
* remove unneeded specialKey
* pull collation out to a function.
* not sure what i planned
to do with this test.
removing.
* remove typo
* remove another unused flag
* maintain order
* maintain order of params
* boil the ocean on param sequence
i like having explain last cause it seems
like something you would
change/remove after getting what you want
from the explain?
* add test to verify creation
and use of caseInsensitive index
* add no op func to prostgress
* get collation object from mongocollection
make flow lint happy by declaring things Object.
* fix typo
* add changelog
* kick travis
* properly reference static method
* add a test to confirm that anonymous users with
unique username that do collide when compared
insensitively can still be created.
* minot doc nits
* add a few tests to make sure our spy is working as expected
wordsmith the changelog
Co-authored-by: Diamond Lewis <findlewis@gmail.com>
* added hint to aggregate
* added support for hint in query
* added else clause to aggregate
* fixed tests
* updated tests
* Add tests and clean up
* Add support for explain
Co-authored-by: Diamond Lewis <findlewis@gmail.com>
* moved whitelisting of own user to remove conflict with custom classes and * permission
* added new pointer-perm regex to permissions
* added pointer-permissions support
* added tests
* fixed typo
* fixed typo 2
* added tests using find operation
* renamed protectedFields pointerPerm to userField
* decoupled readUserFields from CLP and removed readUser from protectedFields before querying
* updated tests
* added array support for pointer permissions
* added tests for array support for pointer permissions
* Postgres fix
* simplify PG, no idea why this works
* Batch transaction boilerplate
* Refactoring transaction boilerplate
* Independent sessions test
* Transactions - partial
* Missing only one test
* All tests passing for mongo db
* Tests on Travis
* Transactions on postgres
* Fix travis to restart mongodb
* Remove mongodb service and keep only mongodb runner
* MongoDB service back
* Initialize replicaset
* Remove mongodb runner again
* Again only with mongodb-runner and removing cache
* Trying with pretest and posttest
* WiredTiger
* Pretest and posttest again
* Removing inexistent scripts
* wiredTiger
* One more attempt
* Trying another way to run mongodb-runner
* Fixing tests
* Include batch transaction on direct access
* Add tests to direct access
* Changed count to be approximate. Should help with postgres slowness
* refactored last commit to only fall back to estimate if no complex query
* handlign variables correctly
* Trying again because it was casting to lowercase table names which doesnt work for us/
* syntax error
* Adding quotations to pg query
* hopefully final pg fix
* Postgres will now use an approximate count unless there is a more complex query specified
* handling edge case
* Fix for count being very slow on large Parse Classes' collections in Postgres. Replicating fix for Mongo in issue 5264
* Fixed silly spelling error resulting from copying over notes
* Lint fixes
* limiting results to 1 on approximation
* suppress test that we can no longer run for postgres
* removed tests from Postgres that no longer apply
* made changes requested by dplewis
* fixed count errors
* updated package.json
* removed test exclude for pg
* removed object types from method
* test disabled for postgres
* returned type
* add estimate count test
* fix mongo test
* Auth module refactoring in order to be reusable
* Ensure cache controller is properly forwarded from helpers
* Nits
* Adds support for static validation
* Adds support for CLP in Live query (no support for roles yet)
* Adds e2e test to validate liveQuery hooks is properly called
* Adds tests over LiveQueryController to ensure data is correctly transmitted
* nits
* Fixes for flow types
* Removes usage of Parse.Promise
* Use the Auth module for authentication and caches
* Cleaner implementation of getting auth
* Adds authCache that stores auth promises
* Proper testing of the caching
* nits