Closed as not planned
Description
here is my code:
@Test
void testCount() throws IOException {
Example<FileChange> example = Example.of(FileChange.builder().programmingLanguage("Python").build());
Query query = new Query(Criteria.byExample(example));
List<FileChange> bad = mongoTemplate.find(query, FileChange.class); // not working, return empty
Query query1 = new Query();
query1.addCriteria(Criteria.where("programming_language").is("Python"));
List<FileChange> good = mongoTemplate.find(query1, FileChange.class);
}
// relative object
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Document("file_change")
public class FileChange {
@Id
private ObjectId id;
@Field("file_change_id")
private String fileChangeId;
@Field("hash")
private String hash;
@Field("filename")
private String filename;
@Field("old_path")
private String oldPath;
@Field("new_path")
private String newPath;
@Field("change_type")
private String changeType;
@Field("diff")
private String diff;
@Field("num_lines_added")
private String numLinesAdded;
@Field("num_lines_deleted")
private String numLinesDeleted;
@Field("code_after")
private String codeAfter;
@Field("code_before")
private String codeBefore;
@Field("nloc")
private String nloc;
@Field("complexity")
private String complexity;
@Field("token_count")
private String tokenCount;
@Field("programming_language")
private String programmingLanguage;
}