0
json照会メソッドを使用して検索しようとしています。たとえば、エンタープライズエンティティを「EnterpriseA」という名前で検索する必要があります。しかし、nameプロパティはコンテンツの一部であり、生のjsonです。実行することは可能ですか?これは私のエンティティであるMongoRepositoryでSpringデータを使用して生のjsonを照会する方法
"content": "{\"name\":\"EnterpriseA\",\"email\":\"[email protected]\",\"address\":[{\"id\":1,\"description\":\"some description...\"},{\"id\":2,\"description\":\"some description...\"}]}"
:
@Document(collection = "enterprise")
public class Enterprise {
@Id
private String id;
@Indexed(unique = true)
private String content;
@Indexed(unique = false)
private Long companyId;
//...
}
マイリポジトリ:
@Repository
public interface EnterpriseDao extends MongoRepository<Enterprise,
String> {
@Query("{ 'content' : ?0 }")
Enterprise findByName(String name);
}
私は私が何かを見つけるしたいと思います
内容は、次のような値をとることができます間違っている。