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