-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRIVERS-2658 Add hint support for distinct.
- Loading branch information
1 parent
38cbbce
commit 69cfacb
Showing
3 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
description: "distinct-hint" | ||
|
||
schemaVersion: "1.0" | ||
runOnRequirements: | ||
# https://jira.mongodb.org/browse/SERVER-14227 | ||
# Server supports distinct with hint starting from 7.1.0. | ||
- minServerVersion: "7.1.0" | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
observeEvents: [ commandStartedEvent ] | ||
- database: | ||
id: &database0 database0 | ||
client: *client0 | ||
databaseName: &database0Name distinct-hint-tests | ||
- collection: | ||
id: &collection0 collection0 | ||
database: *database0 | ||
collectionName: &collection0Name coll0 | ||
|
||
initialData: | ||
- collectionName: *collection0Name | ||
databaseName: *database0Name | ||
documents: | ||
- { _id: 1, x: 11 } | ||
- { _id: 2, x: 22 } | ||
- { _id: 3, x: 33 } | ||
|
||
tests: | ||
- description: "distinct with hint string" | ||
operations: | ||
- name: distinct | ||
object: *collection0 | ||
arguments: | ||
fieldName: &fieldName x | ||
filter: &filter { _id: 1 } | ||
hint: _id_ | ||
expectResult: [ 11 ] | ||
expectEvents: | ||
- client: *client0 | ||
events: | ||
- commandStartedEvent: | ||
command: | ||
distinct: *collection0Name | ||
key: *fieldName | ||
query: *filter | ||
hint: _id_ | ||
commandName: distinct | ||
databaseName: *database0Name | ||
|
||
- description: "distinct with hint document" | ||
operations: | ||
- name: distinct | ||
object: *collection0 | ||
arguments: | ||
fieldName: *fieldName | ||
filter: *filter | ||
hint: | ||
_id: 1 | ||
expectResult: [ 11 ] | ||
expectEvents: | ||
- client: *client0 | ||
events: | ||
- commandStartedEvent: | ||
command: | ||
distinct: *collection0Name | ||
key: *fieldName | ||
query: *filter | ||
hint: | ||
_id: 1 | ||
commandName: distinct | ||
databaseName: *database0Name |