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