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