Skip to content

Instantly share code, notes, and snippets.

@alcaeus alcaeus/
Last active Oct 13, 2016

What would you like to do?
Invalid command cursor on listCollections with a sharded cluster in MongoDB 3.2

Install mongo-orchestration and start a sharded cluster:

mongo-orchestration -b -p 8889 --no-fork start
curl -XPUT http://localhost:8889/v1/sharded_clusters/myCluster --data @configurations/sharded_clusters/clean.json

Then, run the included PHP script:

$ php invalid-cursor-listCollections.php
PHP Fatal error:  Uncaught exception 'MongoCursorException' with message 'localhost:27017: the command cursor did not return a correctly structured response' in invalid-cursor-listCollections.php:7
Stack trace:
#0 invalid-cursor-listCollections.php(7): MongoDB->listCollections()
#1 {main}
  thrown in invalid-cursor-listCollections.php on line 7
$client = new MongoClient();
$db = $client->selectDb('invalid-cursor-test');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.