...
1description: "distinct-comment"
2
3schemaVersion: "1.0"
4
5createEntities:
6 - client:
7 id: &client0 client0
8 observeEvents: [ commandStartedEvent ]
9 - database:
10 id: &database0 database0
11 client: *client0
12 databaseName: &database0Name distinct-comment-tests
13 - collection:
14 id: &collection0 collection0
15 database: *database0
16 collectionName: &collection0Name coll0
17
18initialData:
19 - collectionName: *collection0Name
20 databaseName: *database0Name
21 documents:
22 - { _id: 1, x: 11 }
23 - { _id: 2, x: 22 }
24 - { _id: 3, x: 33 }
25
26tests:
27 - description: "distinct with document comment"
28 runOnRequirements:
29 # https://jira.mongodb.org/browse/SERVER-44847
30 # Server supports distinct with comment of any type for comment starting from 4.4.14.
31 - minServerVersion: "4.4.14"
32 operations:
33 - name: distinct
34 object: *collection0
35 arguments:
36 fieldName: &fieldName x
37 filter: &filter {}
38 comment: &documentComment { key: "value"}
39 expectResult: [ 11, 22, 33 ]
40 expectEvents:
41 - client: *client0
42 events:
43 - commandStartedEvent:
44 command:
45 distinct: *collection0Name
46 key: *fieldName
47 query: *filter
48 comment: *documentComment
49 commandName: distinct
50 databaseName: *database0Name
51
52 - description: "distinct with string comment"
53 runOnRequirements:
54 - minServerVersion: "4.4.0"
55 operations:
56 - name: distinct
57 object: *collection0
58 arguments:
59 fieldName: *fieldName
60 filter: *filter
61 comment: &stringComment "comment"
62 expectResult: [ 11, 22, 33 ]
63 expectEvents:
64 - client: *client0
65 events:
66 - commandStartedEvent:
67 command:
68 distinct: *collection0Name
69 key: *fieldName
70 query: *filter
71 comment: *stringComment
72 commandName: distinct
73 databaseName: *database0Name
74
75 - description: "distinct with document comment - pre 4.4, server error"
76 runOnRequirements:
77 - minServerVersion: "3.6.0"
78 maxServerVersion: "4.4.13"
79 operations:
80 - name: distinct
81 object: *collection0
82 arguments:
83 fieldName: *fieldName
84 filter: *filter
85 comment: *documentComment
86 expectError:
87 isClientError: false
88 expectEvents:
89 - client: *client0
90 events:
91 - commandStartedEvent:
92 command:
93 distinct: *collection0Name
94 key: *fieldName
95 query: *filter
96 comment: *documentComment
97 commandName: distinct
98 databaseName: *database0Name
View as plain text