getMore requires the same API params as the cursor-creating command (
SERVER-56550), but the shell helpers for cursor-creating commands like db.collection.aggregate() don't implement this, so if you do:
... if there's more than one batch, the shell calls getMore without the API params and the server returns APIMismatchError.
I think this behavior's appropriate. It's consistent with drivers. We don't expect users to pass API params directly into commands or helper methods when they use drivers. The expected way to use API params with drivers is by passing them to MongoClient(), and the expected way with the shell is to pass --apiVersion 1 on the command line. Those ways work correctly with getMore.
However, this leaves a booby trap for tests: if the results for aggregate, etc, fit in the first batch, then the JS above will succeed. Once the test is deployed, something might change to cause the JS above to execute getMore and fail.
I propose that cursor-creating shell helper methods ban API parameters. Tests can use runCommand if they know what they're doing.