[英]MongoDB create compund index text and NumberLong with spring-boot annotation
請看這個 mongodb 索引:
{
"v" : 2,
"key" : {
"_fts" : "text",
"_ftsx" : 1,
"time_in_millisecond" : -1.0
},
"name" : "field_1_text_time_in_millisecond_-1",
"weights" : {
"field_1" : 1
},
"default_language" : "none",
"language_override" : "dummy",
"textIndexVersion" : 3
},
我想使用 spring-boot 注釋創建它,有人對此有什么建議嗎?
試試這個:
@Document(collection = "your_collection")
@CompoundIndex(name = "field_1_text_time_in_millisecond_-1", def = "{'_fts' : 'text', '_ftsx': 1, 'time_in_millisecond': -1}")
public class SomeClass {...}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.