@@ 555-557 (lines=3) @@ | ||
552 | ||
553 | // Starting with MongoDB 3.2, this command returns code 20 when a collection is already sharded. |
|
554 | // For older MongoDB versions, check the error message |
|
555 | if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 20) || $result['errmsg'] == 'already sharded') { |
|
556 | return; |
|
557 | } |
|
558 | ||
559 | throw MongoDBException::failedToEnsureDocumentSharding($documentName, $result['errmsg']); |
|
560 | } |
|
@@ 577-579 (lines=3) @@ | ||
574 | ||
575 | // Error code is only available with MongoDB 3.2. MongoDB 3.0 only returns a message |
|
576 | // Thus, check code if it exists and fall back on error message |
|
577 | if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 23) || $result['errmsg'] == 'already enabled') { |
|
578 | return; |
|
579 | } |
|
580 | ||
581 | throw MongoDBException::failedToEnableSharding($dbName, $result['errmsg']); |
|
582 | } |