| 1 |
{ |
| 2 |
"description": "entity-commandCursor", |
| 3 |
"schemaVersion": "1.3", |
| 4 |
"createEntities": [ |
| 5 |
{ |
| 6 |
"client": { |
| 7 |
"id": "client", |
| 8 |
"useMultipleMongoses": false, |
| 9 |
"observeEvents": [ |
| 10 |
"commandStartedEvent" |
| 11 |
] |
| 12 |
} |
| 13 |
}, |
| 14 |
{ |
| 15 |
"database": { |
| 16 |
"id": "db", |
| 17 |
"client": "client", |
| 18 |
"databaseName": "db" |
| 19 |
} |
| 20 |
}, |
| 21 |
{ |
| 22 |
"collection": { |
| 23 |
"id": "collection", |
| 24 |
"database": "db", |
| 25 |
"collectionName": "collection" |
| 26 |
} |
| 27 |
} |
| 28 |
], |
| 29 |
"initialData": [ |
| 30 |
{ |
| 31 |
"collectionName": "collection", |
| 32 |
"databaseName": "db", |
| 33 |
"documents": [ |
| 34 |
{ |
| 35 |
"_id": 1, |
| 36 |
"x": 11 |
| 37 |
}, |
| 38 |
{ |
| 39 |
"_id": 2, |
| 40 |
"x": 22 |
| 41 |
}, |
| 42 |
{ |
| 43 |
"_id": 3, |
| 44 |
"x": 33 |
| 45 |
}, |
| 46 |
{ |
| 47 |
"_id": 4, |
| 48 |
"x": 44 |
| 49 |
}, |
| 50 |
{ |
| 51 |
"_id": 5, |
| 52 |
"x": 55 |
| 53 |
} |
| 54 |
] |
| 55 |
} |
| 56 |
], |
| 57 |
"tests": [ |
| 58 |
{ |
| 59 |
"description": "runCursorCommand creates and exhausts cursor by running getMores", |
| 60 |
"operations": [ |
| 61 |
{ |
| 62 |
"name": "runCursorCommand", |
| 63 |
"object": "db", |
| 64 |
"arguments": { |
| 65 |
"commandName": "find", |
| 66 |
"batchSize": 2, |
| 67 |
"command": { |
| 68 |
"find": "collection", |
| 69 |
"filter": {}, |
| 70 |
"batchSize": 2 |
| 71 |
} |
| 72 |
}, |
| 73 |
"expectResult": [ |
| 74 |
{ |
| 75 |
"_id": 1, |
| 76 |
"x": 11 |
| 77 |
}, |
| 78 |
{ |
| 79 |
"_id": 2, |
| 80 |
"x": 22 |
| 81 |
}, |
| 82 |
{ |
| 83 |
"_id": 3, |
| 84 |
"x": 33 |
| 85 |
}, |
| 86 |
{ |
| 87 |
"_id": 4, |
| 88 |
"x": 44 |
| 89 |
}, |
| 90 |
{ |
| 91 |
"_id": 5, |
| 92 |
"x": 55 |
| 93 |
} |
| 94 |
] |
| 95 |
} |
| 96 |
], |
| 97 |
"expectEvents": [ |
| 98 |
{ |
| 99 |
"client": "client", |
| 100 |
"events": [ |
| 101 |
{ |
| 102 |
"commandStartedEvent": { |
| 103 |
"command": { |
| 104 |
"find": "collection", |
| 105 |
"filter": {}, |
| 106 |
"batchSize": 2, |
| 107 |
"$db": "db", |
| 108 |
"lsid": { |
| 109 |
"$$exists": true |
| 110 |
} |
| 111 |
}, |
| 112 |
"commandName": "find" |
| 113 |
} |
| 114 |
}, |
| 115 |
{ |
| 116 |
"commandStartedEvent": { |
| 117 |
"command": { |
| 118 |
"getMore": { |
| 119 |
"$$type": [ |
| 120 |
"int", |
| 121 |
"long" |
| 122 |
] |
| 123 |
}, |
| 124 |
"collection": "collection", |
| 125 |
"$db": "db", |
| 126 |
"lsid": { |
| 127 |
"$$exists": true |
| 128 |
} |
| 129 |
}, |
| 130 |
"commandName": "getMore" |
| 131 |
} |
| 132 |
}, |
| 133 |
{ |
| 134 |
"commandStartedEvent": { |
| 135 |
"command": { |
| 136 |
"getMore": { |
| 137 |
"$$type": [ |
| 138 |
"int", |
| 139 |
"long" |
| 140 |
] |
| 141 |
}, |
| 142 |
"collection": "collection", |
| 143 |
"$db": "db", |
| 144 |
"lsid": { |
| 145 |
"$$exists": true |
| 146 |
} |
| 147 |
}, |
| 148 |
"commandName": "getMore" |
| 149 |
} |
| 150 |
} |
| 151 |
] |
| 152 |
} |
| 153 |
] |
| 154 |
}, |
| 155 |
{ |
| 156 |
"description": "createCommandCursor creates a cursor and stores it as an entity that can be iterated one document at a time", |
| 157 |
"operations": [ |
| 158 |
{ |
| 159 |
"name": "createCommandCursor", |
| 160 |
"object": "db", |
| 161 |
"arguments": { |
| 162 |
"commandName": "find", |
| 163 |
"batchSize": 2, |
| 164 |
"command": { |
| 165 |
"find": "collection", |
| 166 |
"filter": {}, |
| 167 |
"batchSize": 2 |
| 168 |
} |
| 169 |
}, |
| 170 |
"saveResultAsEntity": "myRunCommandCursor" |
| 171 |
}, |
| 172 |
{ |
| 173 |
"name": "iterateUntilDocumentOrError", |
| 174 |
"object": "myRunCommandCursor", |
| 175 |
"expectResult": { |
| 176 |
"_id": 1, |
| 177 |
"x": 11 |
| 178 |
} |
| 179 |
}, |
| 180 |
{ |
| 181 |
"name": "iterateUntilDocumentOrError", |
| 182 |
"object": "myRunCommandCursor", |
| 183 |
"expectResult": { |
| 184 |
"_id": 2, |
| 185 |
"x": 22 |
| 186 |
} |
| 187 |
}, |
| 188 |
{ |
| 189 |
"name": "iterateUntilDocumentOrError", |
| 190 |
"object": "myRunCommandCursor", |
| 191 |
"expectResult": { |
| 192 |
"_id": 3, |
| 193 |
"x": 33 |
| 194 |
} |
| 195 |
}, |
| 196 |
{ |
| 197 |
"name": "iterateUntilDocumentOrError", |
| 198 |
"object": "myRunCommandCursor", |
| 199 |
"expectResult": { |
| 200 |
"_id": 4, |
| 201 |
"x": 44 |
| 202 |
} |
| 203 |
}, |
| 204 |
{ |
| 205 |
"name": "iterateUntilDocumentOrError", |
| 206 |
"object": "myRunCommandCursor", |
| 207 |
"expectResult": { |
| 208 |
"_id": 5, |
| 209 |
"x": 55 |
| 210 |
} |
| 211 |
} |
| 212 |
] |
| 213 |
}, |
| 214 |
{ |
| 215 |
"description": "createCommandCursor's cursor can be closed and will perform a killCursors operation", |
| 216 |
"operations": [ |
| 217 |
{ |
| 218 |
"name": "createCommandCursor", |
| 219 |
"object": "db", |
| 220 |
"arguments": { |
| 221 |
"commandName": "find", |
| 222 |
"batchSize": 2, |
| 223 |
"command": { |
| 224 |
"find": "collection", |
| 225 |
"filter": {}, |
| 226 |
"batchSize": 2 |
| 227 |
} |
| 228 |
}, |
| 229 |
"saveResultAsEntity": "myRunCommandCursor" |
| 230 |
}, |
| 231 |
{ |
| 232 |
"name": "iterateUntilDocumentOrError", |
| 233 |
"object": "myRunCommandCursor", |
| 234 |
"expectResult": { |
| 235 |
"_id": 1, |
| 236 |
"x": 11 |
| 237 |
} |
| 238 |
}, |
| 239 |
{ |
| 240 |
"name": "close", |
| 241 |
"object": "myRunCommandCursor" |
| 242 |
} |
| 243 |
], |
| 244 |
"expectEvents": [ |
| 245 |
{ |
| 246 |
"client": "client", |
| 247 |
"events": [ |
| 248 |
{ |
| 249 |
"commandStartedEvent": { |
| 250 |
"command": { |
| 251 |
"find": "collection", |
| 252 |
"filter": {}, |
| 253 |
"batchSize": 2, |
| 254 |
"$db": "db", |
| 255 |
"lsid": { |
| 256 |
"$$exists": true |
| 257 |
} |
| 258 |
}, |
| 259 |
"commandName": "find" |
| 260 |
} |
| 261 |
}, |
| 262 |
{ |
| 263 |
"commandStartedEvent": { |
| 264 |
"command": { |
| 265 |
"killCursors": "collection", |
| 266 |
"cursors": { |
| 267 |
"$$type": "array" |
| 268 |
} |
| 269 |
}, |
| 270 |
"commandName": "killCursors" |
| 271 |
} |
| 272 |
} |
| 273 |
] |
| 274 |
} |
| 275 |
] |
| 276 |
} |
| 277 |
] |
| 278 |
} |