我有以下文档:
{
"_id" : ObjectId("5ccfe299902bb32f5a194ed7"),
"email" : "johndoe@gmail.com",
"name" : "john",
"businessName" : "Test",
"phone" : "123123",
"createdTime" : ISODate("2019-05-09T11:11:13.353Z"),
"updatedTime" : ISODate("2019-05-09T11:11:28.336Z")
}
因此,我使用以下方法查询存储库:
@RepositoryRestResource(collectionResourceRel = "users",path = "users")
public interface UserRepository extends MongoRepository<User, String> {
@Query("{ 'email' : ?0 }")
User findByEmail(String email);
}
但是,即使email参数正确,此方法也将返回null。任何想法将不胜感激。