@@ 565-567 (lines=3) @@ | ||
562 | ||
563 | // Starting with MongoDB 3.2, this command returns code 20 when a collection is already sharded. |
|
564 | // For older MongoDB versions, check the error message |
|
565 | if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 20) || $result['errmsg'] == 'already sharded') { |
|
566 | return; |
|
567 | } |
|
568 | ||
569 | throw MongoDBException::failedToEnsureDocumentSharding($documentName, $result['errmsg']); |
|
570 | } |
|
@@ 587-589 (lines=3) @@ | ||
584 | ||
585 | // Error code is only available with MongoDB 3.2. MongoDB 3.0 only returns a message |
|
586 | // Thus, check code if it exists and fall back on error message |
|
587 | if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 23) || $result['errmsg'] == 'already enabled') { |
|
588 | return; |
|
589 | } |
|
590 | ||
591 | throw MongoDBException::failedToEnableSharding($dbName, $result['errmsg']); |
|
592 | } |