Hi
If I have an object like this
and then I try to do something like thisCode:@Document public class User { @Id private String id; }
it does not work, because QueryDsl creates a query with 'id' instead of '_id'. Is this working as intended and there is no other way than renaming the id property to _id (private String _id)? Or is there a way to tell QueryDsl that the fieldname is _id on the database?Code:User user = repository.findOne(QUser.user.id.eq("4e721fba6733246393b1095e"));
With the spring-data-document Query this works fine. The library knows that it has to rename the field to _id for the query.
mongoTemplate.find(Query.query(Criteria.where("id" ).is("4e721fba6733246393b1095e")), User.class);
Ralph


Reply With Quote
