|
@@ 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 |
|
throw MongoDBException::failedToEnsureDocumentSharding($documentName, $result['errmsg']); |
| 564 |
|
} |
| 565 |
|
} |
| 566 |
|
|
| 567 |
|
/** |
|
@@ 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 |
|
throw MongoDBException::failedToEnableSharding($dbName, $result['errmsg']); |
| 584 |
|
} |
| 585 |
|
} |
| 586 |
|
|
| 587 |
|
/** |