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