1data:
2  - { _id: 1, x: 11 }
3
4collection_name: &collection_name "test"
5database_name: &database_name "command-monitoring-tests"
6
7tests:
8  -
9    description: "A successful command"
10    operation:
11      name: "count"
12      arguments:
13        filter: { _id: 1 }
14    expectations:
15      -
16        command_started_event:
17          command:
18            count: *collection_name
19            query: { _id: 1 }
20          command_name: "count"
21          database_name: *database_name
22      -
23        command_succeeded_event:
24          reply: { ok: 1.0, n: 1 }
25          command_name: "count"
26  -
27    description: "A failed command event"
28    operation:
29      name: "count"
30      arguments:
31        filter: { $or: true }
32    expectations:
33      -
34        command_started_event:
35          command:
36            count: *collection_name
37            query: { $or: true }
38          command_name: "count"
39          database_name: *database_name
40      -
41        command_failed_event:
42          command_name: "count"
43  -
44    description: "A successful command with a non-primary read preference"
45    operation:
46      name: "count"
47      arguments:
48        filter: { _id: 1 }
49      read_preference: { mode: "primaryPreferred" }
50    expectations:
51      -
52        command_started_event:
53          command:
54            count: *collection_name
55            query: { _id: 1 }
56          command_name: "count"
57          database_name: *database_name
58      -
59        command_succeeded_event:
60          reply: { ok: 1.0, n: 1 }
61          command_name: "count"
62