我现有的@CompoundIndex 定义如下:
@CompoundIndex(name = "idx_test_search", unique = true,
def = "{type: 1, origin: 1, date: 1}")
现在我需要更改它以添加另一个字段,例如:
@CompoundIndex(name = "idx_test_search", unique = true,
def = "{type: 1, origin: 1, date: 1, travelers: 1}")
我希望它会像在应用程序启动时创建一样自动应用,但在 MongoDb 中它仍然是旧的。我可以用新名称创建一个不同的索引,但是我需要删除这个索引。我可以这样做@ChangeSet
吗?有任何想法吗?