Closed as not planned
Description
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