Store the particular date in the mongodb database when there was no appointment on that day

Viewed 25

For example: If on 24th july there was 4 appointment in the record, on 25th july there was 3 appointment and these dates are stored in the database.But on 26th july there is 0 appointment in the hospital then how to save this date in the database as this particular entry is not storing in the database. Please help.

public Map<String, Object> getDetails(String hospitalId) {
Map<String, Object> appDetails = new HashMap<>();
try{
Criteria dateCriteria = getStartAndEndDate(-30, 0);
Criteria hospCriteria = Criteria.where("Hospital_clinic.id").is(hospitalId);
Criteria ipdCriteria = Criteria.where("AppointmentType").is("IPD").andOperator(Criteria.where("appointmentStatus").is("Active"));
Aggregation aggregation = newAggregation(Aggregation.match(dateCriteria),
Aggregation.match(hospCriteria),
Aggregation.match(ipdCriteria),
Aggregation.group("AppointmentDate").count().as("ipdCount"),
Aggregation.project().and("_id").as("AppointmentDate").and("ipdCount").as("ipdCount"));
0 Answers
Related