If use this custom query with all other needed implementations:
@EzyQuery("{$query: {?0:'?1'},{_id:1, ?2:1}")
StringValue getStringFieldByValue(String field, String value, String retValue);
for now i use this to test to get the datas available if the below Error not there:
@Data
@EzyCollection
public class StringValue {
@EzyId
Long id;
String username;
}
the call looks :
StringValue value = accountService.getStringFieldByValue("email", request.getEmail(), "username");
I get this error if i call the custom query somewere. I think the major error from the list are:
readStartArray can only be called when CurrentBSONType is ARRAY, not when CurrentBSONType is DOCUMENT.
The Query should normal do this db.account.FindOne({email:'[email protected]'}, {_id:0, username:1})
returns: [ { username: 'yourusername' } ]
this query should be universal to get a string back there are two problems if i write it back to the StringValue object, this need the id but i dont need and set it _id:0 and i dont now realy if String named username:
@Data
@EzyCollection
public class StringValue {
@EzyId
Long id;
String username;
}
is there a example to get out a value from the query lets say i turn this to a String instead a StringValue object
public StringValue getStringFieldByValue(String field, String value, String retValue) {
return accountRepo.getStringFieldByValue(field, value, retValue);
}
something like:
public String getStringFieldByValue(String field, String value, String retValue) {
String value = accountRepo.getStringFieldByValue(field, value, retValue);
// how to extract the value of retValue as string from the returned query if the above error not exist enymore;
// In this example yourusername value [ { username: 'yourusername' } ]
return value:
}