@@ 571-573 (lines=3) @@ | ||
568 | ||
569 | // Starting with MongoDB 3.2, this command returns code 20 when a collection is already sharded. |
|
570 | // For older MongoDB versions, check the error message |
|
571 | if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 20) || $result['errmsg'] == 'already sharded') { |
|
572 | return; |
|
573 | } |
|
574 | ||
575 | throw MongoDBException::failedToEnsureDocumentSharding($documentName, $result['errmsg']); |
|
576 | } |
|
@@ 593-595 (lines=3) @@ | ||
590 | ||
591 | // Error code is only available with MongoDB 3.2. MongoDB 3.0 only returns a message |
|
592 | // Thus, check code if it exists and fall back on error message |
|
593 | if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 23) || $result['errmsg'] == 'already enabled') { |
|
594 | return; |
|
595 | } |
|
596 | ||
597 | throw MongoDBException::failedToEnableSharding($dbName, $result['errmsg']); |
|
598 | } |