我将此文档映射为Java
@Document(collection = "videoInfo")
public class VideoInfo {
@Id
private String id;
private long idVideo;
@TextIndexed
private String name;
@TextIndexed
private String layers;
@TextIndexed
private String tags;
@TextIndexed
private String files;
@TextIndexed
private String category;
@TextIndexed
private String dataOut;
@TextIndexed
private String dataIn;
@TextIndexed
private String dataRegister;
@TextScore
private Float score;
public VideoInfo(long idVideo, String name) {
this.idVideo = idVideo;
this.name = name;
}
当我添加新字段并重新部署tomcat时 应用程序给我这个错误
无法使用键'{{name“:” text“,” layers“:” text“,” tags“:” text“,” files“:” text“, “ category”:“ text”,“ dataOut”:“ text”,“ dataIn”:“ text”,“ dataRegister”:“ text”}''和选项'{“ name”:“ VideoInfo_TextIndex”}''。索引已经定义为'{“ v”:1,“ key”:{“ _fts”:“ text”,“ _ftsx”:1},“ name”:“ VideoInfo_TextIndex”,“ ns”:“ playmanager.videoInfo”, “ weights”:{“ category”:1,“ dataIn”:1,“ dataOut”:1,“ files”:1,“ layers”:1,“ name”:1,“ tags”:1},“ default_language “:” english“,” language_override“:” language“,” textIndexVersion“:3}'。嵌套的异常是com.mongodb.CommandFailureException:{“ serverUsed”:“ 127.0.0.1:27017”,“ ok”:0.0,“ errmsg”:“具有名称的索引:VideoInfo_TextIndex已经存在不同的选项”,“ code”:85 }
当我搜索类的索引时,它向我显示了这一点;
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "playmanager.videoInfo"
},
{
"v" : 1,
"key" : {
"_fts" : "text",
"_ftsx" : 1
},
"name" : "VideoInfo_TextIndex",
"ns" : "playmanager.videoInfo",
"weights" : {
"category" : 1,
"dataIn" : 1,
"dataOut" : 1,
"files" : 1,
"layers" : 1,
"name" : 1,
"tags" : 1
},
"default_language" : "english",
"language_override" : "language",
"textIndexVersion" : 3
}
]
我不明白错误,为什么我不能添加新字段。
谢谢。