Skip to content

Commit

Permalink
chore: merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikrut committed Sep 28, 2021
2 parents 1597055 + e0020bf commit b4334b2
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 225 deletions.
23 changes: 1 addition & 22 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,8 @@

### Features

* adjusts empty group population to be virtual only ([8a890fd](https://github.com/payloadcms/payload/commit/8a890fdc15b646c24963a1ef7584237b1d3c5783))
* defaults empty group fields to empty object ([8a890fd](https://github.com/payloadcms/payload/commit/8a890fdc15b646c24963a1ef7584237b1d3c5783))
* allows local update api to replace existing files with newly uploaded ones ([dbbff4c](https://github.com/payloadcms/payload/commit/dbbff4cfa41aa20077e47c8c7b87d4d00683c571))
* defaults empty group fields to empty object ([39a8e2c](https://github.com/payloadcms/payload/commit/39a8e2c20fa7e999c89c1ab09e886d874dbfda25))
* defaults empty group fields to empty object ([e39ece4](https://github.com/payloadcms/payload/commit/e39ece4823c9104bd698642e42fd9d1eab67e7b3))
* exposes Pill component for re-use ([7e8df10](https://github.com/payloadcms/payload/commit/7e8df100bbf86798de292466afd4c00c455ecb35))
* performance improvement while saving large docs ([901ad49](https://github.com/payloadcms/payload/commit/901ad498b47bcb8ae995ade18f2fc08cd33f0645))

## [0.10.4-beta.0](https://github.com/payloadcms/payload/compare/v0.10.0...v0.10.4-beta.0) (2021-09-22)


### Bug Fixes

* array objects now properly save IDs ([2b8f925](https://github.com/payloadcms/payload/commit/2b8f925e81c58f6aa010bf13a318236f211ea091))
* date field error message position ([03c0435](https://github.com/payloadcms/payload/commit/03c0435e3b3ecdfa0713e3e5026b80f8985ca290))
* properly types optional req in local findByID ([02e7fe3](https://github.com/payloadcms/payload/commit/02e7fe3f1f3763f32f100cf2e5a8596aa16f3bd9))


### Features

* adjusts empty group population to be virtual only ([8a890fd](https://github.com/payloadcms/payload/commit/8a890fdc15b646c24963a1ef7584237b1d3c5783))
* allows local update api to replace existing files with newly uploaded ones ([dbbff4c](https://github.com/payloadcms/payload/commit/dbbff4cfa41aa20077e47c8c7b87d4d00683c571))
* defaults empty group fields to empty object ([39a8e2c](https://github.com/payloadcms/payload/commit/39a8e2c20fa7e999c89c1ab09e886d874dbfda25))
* defaults empty group fields to empty object ([e39ece4](https://github.com/payloadcms/payload/commit/e39ece4823c9104bd698642e42fd9d1eab67e7b3))
* exposes Pill component for re-use ([7e8df10](https://github.com/payloadcms/payload/commit/7e8df100bbf86798de292466afd4c00c455ecb35))
* performance improvement while saving large docs ([901ad49](https://github.com/payloadcms/payload/commit/901ad498b47bcb8ae995ade18f2fc08cd33f0645))

Expand Down
8 changes: 7 additions & 1 deletion src/collections/operations/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import executeAccess from '../../auth/executeAccess';
import sanitizeInternalFields from '../../utilities/sanitizeInternalFields';
import { Collection, PaginatedDocs } from '../config/types';
import { hasWhereAccessResult } from '../../auth/types';
import flattenWhereConstraints from '../../utilities/flattenWhereConstraints';

export type Arguments = {
collection: Collection
Expand Down Expand Up @@ -55,6 +56,7 @@ async function find(incomingArgs: Arguments): Promise<PaginatedDocs> {
// /////////////////////////////////////

const queryToBuild: { where?: Where} = {};
let useEstimatedCount = false;

if (where) {
let and = [];
Expand All @@ -68,6 +70,10 @@ async function find(incomingArgs: Arguments): Promise<PaginatedDocs> {
...and,
],
};

const constraints = flattenWhereConstraints(queryToBuild);

useEstimatedCount = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'));
}

if (!overrideAccess) {
Expand Down Expand Up @@ -110,7 +116,7 @@ async function find(incomingArgs: Arguments): Promise<PaginatedDocs> {
sort,
lean: true,
leanWithId: true,
useEstimatedCount: true,
useEstimatedCount,
};

const paginatedDocs = await Model.paginate(query, optionsToExecute);
Expand Down
Loading

0 comments on commit b4334b2

Please sign in to comment.