| 1 | { |
| 2 | "description": "createSearchIndexes", |
| 3 | "schemaVersion": "1.4", |
| 4 | "createEntities": [ |
| 5 | { |
| 6 | "client": { |
| 7 | "id": "client0", |
| 8 | "useMultipleMongoses": false, |
| 9 | "observeEvents": [ |
| 10 | "commandStartedEvent" |
| 11 | ] |
| 12 | } |
| 13 | }, |
| 14 | { |
| 15 | "database": { |
| 16 | "id": "database0", |
| 17 | "client": "client0", |
| 18 | "databaseName": "database0" |
| 19 | } |
| 20 | }, |
| 21 | { |
| 22 | "collection": { |
| 23 | "id": "collection0", |
| 24 | "database": "database0", |
| 25 | "collectionName": "collection0" |
| 26 | } |
| 27 | } |
| 28 | ], |
| 29 | "runOnRequirements": [ |
| 30 | { |
| 31 | "minServerVersion": "7.0.0", |
| 32 | "topologies": [ |
| 33 | "replicaset", |
| 34 | "load-balanced", |
| 35 | "sharded" |
| 36 | ], |
| 37 | "serverless": "forbid" |
| 38 | } |
| 39 | ], |
| 40 | "tests": [ |
| 41 | { |
| 42 | "description": "empty index definition array", |
| 43 | "operations": [ |
| 44 | { |
| 45 | "name": "createSearchIndexes", |
| 46 | "object": "collection0", |
| 47 | "arguments": { |
| 48 | "models": [] |
| 49 | }, |
| 50 | "expectError": { |
| 51 | "isError": true, |
| 52 | "errorContains": "Atlas" |
| 53 | } |
| 54 | } |
| 55 | ], |
| 56 | "expectEvents": [ |
| 57 | { |
| 58 | "client": "client0", |
| 59 | "events": [ |
| 60 | { |
| 61 | "commandStartedEvent": { |
| 62 | "command": { |
| 63 | "createSearchIndexes": "collection0", |
| 64 | "indexes": [], |
| 65 | "$db": "database0" |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | ] |
| 70 | } |
| 71 | ] |
| 72 | }, |
| 73 | { |
| 74 | "description": "no name provided for an index definition", |
| 75 | "operations": [ |
| 76 | { |
| 77 | "name": "createSearchIndexes", |
| 78 | "object": "collection0", |
| 79 | "arguments": { |
| 80 | "models": [ |
| 81 | { |
| 82 | "definition": { |
| 83 | "mappings": { |
| 84 | "dynamic": true |
| 85 | } |
| 86 | }, |
| 87 | "type": "search" |
| 88 | } |
| 89 | ] |
| 90 | }, |
| 91 | "expectError": { |
| 92 | "isError": true, |
| 93 | "errorContains": "Atlas" |
| 94 | } |
| 95 | } |
| 96 | ], |
| 97 | "expectEvents": [ |
| 98 | { |
| 99 | "client": "client0", |
| 100 | "events": [ |
| 101 | { |
| 102 | "commandStartedEvent": { |
| 103 | "command": { |
| 104 | "createSearchIndexes": "collection0", |
| 105 | "indexes": [ |
| 106 | { |
| 107 | "definition": { |
| 108 | "mappings": { |
| 109 | "dynamic": true |
| 110 | } |
| 111 | }, |
| 112 | "type": "search" |
| 113 | } |
| 114 | ], |
| 115 | "$db": "database0" |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | ] |
| 120 | } |
| 121 | ] |
| 122 | }, |
| 123 | { |
| 124 | "description": "name provided for an index definition", |
| 125 | "operations": [ |
| 126 | { |
| 127 | "name": "createSearchIndexes", |
| 128 | "object": "collection0", |
| 129 | "arguments": { |
| 130 | "models": [ |
| 131 | { |
| 132 | "definition": { |
| 133 | "mappings": { |
| 134 | "dynamic": true |
| 135 | } |
| 136 | }, |
| 137 | "name": "test index", |
| 138 | "type": "search" |
| 139 | } |
| 140 | ] |
| 141 | }, |
| 142 | "expectError": { |
| 143 | "isError": true, |
| 144 | "errorContains": "Atlas" |
| 145 | } |
| 146 | } |
| 147 | ], |
| 148 | "expectEvents": [ |
| 149 | { |
| 150 | "client": "client0", |
| 151 | "events": [ |
| 152 | { |
| 153 | "commandStartedEvent": { |
| 154 | "command": { |
| 155 | "createSearchIndexes": "collection0", |
| 156 | "indexes": [ |
| 157 | { |
| 158 | "definition": { |
| 159 | "mappings": { |
| 160 | "dynamic": true |
| 161 | } |
| 162 | }, |
| 163 | "name": "test index", |
| 164 | "type": "search" |
| 165 | } |
| 166 | ], |
| 167 | "$db": "database0" |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | ] |
| 172 | } |
| 173 | ] |
| 174 | }, |
| 175 | { |
| 176 | "description": "create a vector search index", |
| 177 | "operations": [ |
| 178 | { |
| 179 | "name": "createSearchIndexes", |
| 180 | "object": "collection0", |
| 181 | "arguments": { |
| 182 | "models": [ |
| 183 | { |
| 184 | "definition": { |
| 185 | "fields": [ |
| 186 | { |
| 187 | "type": "vector", |
| 188 | "path": "plot_embedding", |
| 189 | "numDimensions": 1536, |
| 190 | "similarity": "euclidean" |
| 191 | } |
| 192 | ] |
| 193 | }, |
| 194 | "name": "test index", |
| 195 | "type": "vectorSearch" |
| 196 | } |
| 197 | ] |
| 198 | }, |
| 199 | "expectError": { |
| 200 | "isError": true, |
| 201 | "errorContains": "Atlas" |
| 202 | } |
| 203 | } |
| 204 | ], |
| 205 | "expectEvents": [ |
| 206 | { |
| 207 | "client": "client0", |
| 208 | "events": [ |
| 209 | { |
| 210 | "commandStartedEvent": { |
| 211 | "command": { |
| 212 | "createSearchIndexes": "collection0", |
| 213 | "indexes": [ |
| 214 | { |
| 215 | "definition": { |
| 216 | "fields": [ |
| 217 | { |
| 218 | "type": "vector", |
| 219 | "path": "plot_embedding", |
| 220 | "numDimensions": 1536, |
| 221 | "similarity": "euclidean" |
| 222 | } |
| 223 | ] |
| 224 | }, |
| 225 | "name": "test index", |
| 226 | "type": "vectorSearch" |
| 227 | } |
| 228 | ], |
| 229 | "$db": "database0" |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | ] |
| 234 | } |
| 235 | ] |
| 236 | } |
| 237 | ] |
| 238 | } |