File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -302,11 +302,12 @@ Remove All Orphaned Documents from a Shard
302
302
:dbcommand:`cleanupOrphaned` examines documents from a single
303
303
contiguous range of shard keys. To remove all orphaned documents from
304
304
the shard, you can run :dbcommand:`cleanupOrphaned` in a loop, using
305
- the returned ``stoppedAtKey`` as the next ``startingFromKey``, as in
306
- the following:
305
+ the returned ``stoppedAtKey`` as the next ``startingFromKey``, as shown in
306
+ the following example :
307
307
308
308
.. code-block:: javascript
309
309
310
+ var loopSleep = 100;
310
311
var nextKey = { };
311
312
var result;
312
313
@@ -319,6 +320,10 @@ the following:
319
320
printjson(result);
320
321
321
322
nextKey = result.stoppedAtKey;
323
+
324
+ if (loopSleep > 0) sleep(loopSleep);
322
325
}
323
326
327
+ print("Orphan cleanup complete.");
328
+
324
329
.. admin-only
You can’t perform that action at this time.
0 commit comments