確定的な回答を見つけることができず、誰かが私を助けてくれることを願っています。私は、Mongo内で "参照されている"オブジェクトに複合インデックスを作成したいと考えています。明らかにエラーが発生しています。これについては、コードスニペットの下で説明します。DBRefを使用したMongoDB/Morphia Compound Index
@Entity
public class Address {
public Address (String street, String City, String state, String zip) {
this.street = street;
this.city = city;
this.state = state;
this.zip = zip;
}
// Getters and Setters
@Id private ObjectId id;
private String street;
private String city;
private String state;
private String zip;
}
@Entity
@Indexes(@Index("location.city, name"))
public class Team {
public Team (String sport, String name, Address location) {
this.sport = sport;
this.name = name;
this.location = location;
}
// Getters and Setters
@Id private ObjectId id;
private String sport;
private String name;
@Reference private Address location;
@Reference private List<Player> players;
}
そして、私は取得していますエラーは、次のとおりです。スレッド「メイン」com.google.code.morphia.query.ValidationExceptionで
例外:ドット表記の過去の「場所」を使用することはできません検証中に「com.company.test.Team」で見つけることができませんでした - location.city
をだから私は、私の質問は推測:「住所」は「チーム」内の参照ですので、私はこのエラーを取得していますか私は何か他のものを逃している?
フィードバックありがとうございます。