Thanks So very much for acknowledging the concern.
The POJO class is something like below ::
package org.mongo;
//imports
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Student {
public Student() {
}
@BsonProperty("_id")
@JsonProperty("_id")
private ObjectId _id;
private String name;
private int age;
private int courseCount;
private String email;
private boolean isVerified;
private ArrayList<String> hobbies;
private ContactDetails contactDetails;
private ArrayList<Marks> marks;
// Getters and Setters
// toString() method
}
Basically this error is occurring when the BSON is deserialized to Java Object. _id field is mapped to null. Rest all other fields are mapped properly.
Please let me know how to solve this problem.