@@ 560-562 (lines=3) @@ | ||
557 | ||
558 | // Starting with MongoDB 3.2, this command returns code 20 when a collection is already sharded. |
|
559 | // For older MongoDB versions, check the error message |
|
560 | if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 20) || $result['errmsg'] == 'already sharded') { |
|
561 | return; |
|
562 | } |
|
563 | ||
564 | throw MongoDBException::failedToEnsureDocumentSharding($documentName, $result['errmsg']); |
|
565 | } |
|
@@ 582-584 (lines=3) @@ | ||
579 | ||
580 | // Error code is only available with MongoDB 3.2. MongoDB 3.0 only returns a message |
|
581 | // Thus, check code if it exists and fall back on error message |
|
582 | if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 23) || $result['errmsg'] == 'already enabled') { |
|
583 | return; |
|
584 | } |
|
585 | ||
586 | throw MongoDBException::failedToEnableSharding($dbName, $result['errmsg']); |
|
587 | } |