🤖 Merge PR #45874 Add support to sample aggregate operator in Parse.Query by @vegidio

Co-authored-by: Vinicius Egidio <me@vinicius.io>
This commit is contained in:
Vinícius Egidio 2020-07-11 05:04:31 +02:00 committed by GitHub
parent cb5e017ba6
commit 58f07c94a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View File

@ -732,6 +732,8 @@ namespace Parse {
skip?: number;
// Sort documentation https://docs.mongodb.com/v3.2/reference/operator/aggregation/sort/#pipe._S_sort
sort?: { [key: string]: 1 | -1 };
// Sample documentation: https://docs.mongodb.com/v3.2/reference/operator/aggregation/sample/
sample?: { size: number };
}
// According to https://parseplatform.org/Parse-SDK-JS/api/2.1.0/Parse.Query.html#fullText

View File

@ -160,6 +160,11 @@ function test_query() {
objectId: '$name',
},
});
query.aggregate({
sample: {
size: 1
},
});
// Find objects with distinct key
query.distinct('name');

View File

@ -704,6 +704,8 @@ namespace Parse {
skip?: number;
// Sort documentation https://docs.mongodb.com/v3.2/reference/operator/aggregation/sort/#pipe._S_sort
sort?: { [key: string]: 1 | -1 };
// Sample documentation: https://docs.mongodb.com/v3.2/reference/operator/aggregation/sample/
sample?: { size: number };
}
// According to https://parseplatform.org/Parse-SDK-JS/api/2.1.0/Parse.Query.html#fullText

View File

@ -668,13 +668,15 @@ declare namespace Parse {
// According to http://docs.parseplatform.org/rest/guide/#aggregate-queries
interface AggregationOptions {
group?: { objectId?: string, [key:string]: any };
match?: {[key: string]: any};
project?: {[key: string]: any};
group?: { objectId?: string, [key: string]: any };
match?: { [key: string]: any };
project?: { [key: string]: any };
limit?: number;
skip?: number;
// Sort documentation https://docs.mongodb.com/v3.2/reference/operator/aggregation/sort/#pipe._S_sort
sort?: {[key: string]: 1|-1};
sort?: { [key: string]: 1 | -1 };
// Sample documentation: https://docs.mongodb.com/v3.2/reference/operator/aggregation/sample/
sample?: { size: number };
}
// According to https://parseplatform.org/Parse-SDK-JS/api/2.1.0/Parse.Query.html#fullText