Skip to content

IndexInfo does not expose background option of the index #4760

Closed as not planned
@debugmaster

Description

@debugmaster

While working with MongoOperations and IndexOperations, and it hard to validate when an index has been created with background or not.

Mongo version: 7.0.12
SpringData MongoDB version: 4.2.4

Simple Java Code:

IndexDefinition definition = new Index()
        .on("field", Sort.Direction.ASC)
        .background();
mongoOperations.indexOps(IndexedClass.class).ensureIndex(indexDefinition);

mongoOperations.indexOps(IndexedClass.class).getIndexInfo();
// No way to validate whether background option exists on the index

Looking at Mongo, it seems to keep track of it:

db.getCollection('indexedClass').getIndexes()
[
  { v: 2, key: { _id: 1 }, name: '_id_' },
  { v: 2, key: { field: 1 }, name: 'field_1', background: true }
]

Please include background property to IndexInfo

Metadata

Metadata

Labels

status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions