...
1description: "estimatedDocumentCount-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 edc-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: "estimatedDocumentCount with document comment"
28 runOnRequirements:
29 # https://jira.mongodb.org/browse/SERVER-63315
30 # Server supports count with comment of any type for comment starting from 4.4.14.
31 - minServerVersion: "4.4.14"
32 operations:
33 - name: estimatedDocumentCount
34 object: *collection0
35 arguments:
36 comment: &documentComment { key: "value"}
37 expectResult: 3
38 expectEvents:
39 - client: *client0
40 events:
41 - commandStartedEvent:
42 command:
43 count: *collection0Name
44 comment: *documentComment
45 commandName: count
46 databaseName: *database0Name
47
48 - description: "estimatedDocumentCount with string comment"
49 runOnRequirements:
50 - minServerVersion: "4.4.0"
51 operations:
52 - name: estimatedDocumentCount
53 object: *collection0
54 arguments:
55 comment: &stringComment "comment"
56 expectResult: 3
57 expectEvents:
58 - client: *client0
59 events:
60 - commandStartedEvent:
61 command:
62 count: *collection0Name
63 comment: *stringComment
64 commandName: count
65 databaseName: *database0Name
66
67 - description: "estimatedDocumentCount with document comment - pre 4.4.14, server error"
68 runOnRequirements:
69 - minServerVersion: "3.6.0"
70 maxServerVersion: "4.4.13"
71 # Server does not raise an error if topology is sharded.
72 # https://jira.mongodb.org/browse/SERVER-65954
73 topologies: [ single, replicaset ]
74 operations:
75 - name: estimatedDocumentCount
76 object: *collection0
77 arguments:
78 # Even though according to the docs count command does not support any
79 # comment for server version less than 4.4, no error is raised by such
80 # servers. Therefore, we have only one test with a document comment
81 # to test server errors.
82 # https://jira.mongodb.org/browse/SERVER-63315
83 # Server supports count with comment of any type for comment starting from 4.4.14.
84 comment: *documentComment
85 expectError:
86 isClientError: false
87 expectEvents:
88 - client: *client0
89 events:
90 - commandStartedEvent:
91 command:
92 count: *collection0Name
93 comment: *documentComment
94 commandName: count
95 databaseName: *database0Name
View as plain text