...
1description: "createSearchIndex"
2schemaVersion: "1.4"
3createEntities:
4 - client:
5 id: &client0 client0
6 useMultipleMongoses: false
7 observeEvents:
8 - commandStartedEvent
9 - database:
10 id: &database0 database0
11 client: *client0
12 databaseName: *database0
13 - collection:
14 id: &collection0 collection0
15 database: *database0
16 collectionName: *collection0
17
18runOnRequirements:
19 - minServerVersion: "7.0.0"
20 topologies: [ replicaset, load-balanced, sharded ]
21 serverless: forbid
22
23tests:
24 - description: "no name provided for an index definition"
25 operations:
26 - name: createSearchIndex
27 object: *collection0
28 arguments:
29 model: { definition: &definition { mappings: { dynamic: true } } }
30 expectError:
31 # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
32 # that the driver constructs and sends the correct command.
33 # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
34 isError: true
35 errorContains: Atlas
36 expectEvents:
37 - client: *client0
38 events:
39 - commandStartedEvent:
40 command:
41 createSearchIndexes: *collection0
42 indexes: [ { definition: *definition } ]
43 $db: *database0
44
45 - description: "name provided for an index definition"
46 operations:
47 - name: createSearchIndex
48 object: *collection0
49 arguments:
50 model: { definition: &definition { mappings: { dynamic: true } } , name: 'test index' }
51 expectError:
52 # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
53 # that the driver constructs and sends the correct command.
54 # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
55 isError: true
56 errorContains: Atlas
57 expectEvents:
58 - client: *client0
59 events:
60 - commandStartedEvent:
61 command:
62 createSearchIndexes: *collection0
63 indexes: [ { definition: *definition, name: 'test index' } ]
64 $db: *database0
View as plain text