@@ -303,37 +303,39 @@ To avoid problems, either drop or correct any misconfigured TTL indexes.
303
303
.. code-block:: javascript
304
304
305
305
function getNaNIndexes() {
306
- const nan_index = [];
307
-
308
- const dbs = db.adminCommand({ listDatabases: 1 }).databases;
309
-
310
- dbs.forEach((d) => {
311
- const listCollCursor = db
312
- .getSiblingDB(d.name)
313
- .runCommand({ listCollections: 1 }).cursor;
314
-
315
- const collDetails = {
316
- db: listCollCursor.ns.split(".$cmd")[0],
317
- colls: listCollCursor.firstBatch.map((c) => c.name),
318
- };
319
-
320
- collDetails.colls.forEach((c) =>
321
- db
322
- .getSiblingDB(collDetails.db)
323
- .getCollection(c)
324
- .getIndexes()
325
- .forEach((entry) => {
326
- if (Object.is(entry.expireAfterSeconds, NaN)) {
327
- nan_index.push({ ns: `${collDetails.db}.${c}`, index: entry });
328
- }
329
- })
330
- );
331
- });
332
-
333
- return nan_index;
306
+ const nan_index = [];
307
+
308
+ const dbs = db.adminCommand({ listDatabases: 1 }).databases;
309
+
310
+ dbs.forEach((d) => {
311
+ if (d.name != 'local') {
312
+ const listCollCursor = db
313
+ .getSiblingDB(d.name)
314
+ .runCommand({ listCollections: 1 }).cursor;
315
+
316
+ const collDetails = {
317
+ db: listCollCursor.ns.split(".$cmd")[0],
318
+ colls: listCollCursor.firstBatch.map((c) => c.name),
319
+ };
320
+
321
+ collDetails.colls.forEach((c) =>
322
+ db
323
+ .getSiblingDB(collDetails.db)
324
+ .getCollection(c)
325
+ .getIndexes()
326
+ .forEach((entry) => {
327
+ if (Object.is(entry.expireAfterSeconds, NaN)) {
328
+ nan_index.push({ ns: `${collDetails.db}.${c}`, index: entry });
329
+ }
330
+ })
331
+ );
332
+ }
333
+ });
334
+
335
+ return nan_index;
334
336
};
335
-
336
- getNaNIndexes();
337
+
338
+ getNaNIndexes();
337
339
338
340
.. step:: Correct misconfigured indexes.
339
341
@@ -343,4 +345,3 @@ To avoid problems, either drop or correct any misconfigured TTL indexes.
343
345
As an alternative, you can :dbcommand:`drop <dropIndexes>` any
344
346
misconfigured TTL indexes and recreate them later using the
345
347
:dbcommand:`createIndexes` command.
346
-
0 commit comments