sql >> Base de Datos >  >> NoSQL >> MongoDB

Agregación de base de datos Mongo de datos de primavera

Resolví el problema, debería haber aplicado $match antes y después de $unwind:

Aggregation.match(Criteria.where("alertsources.date_creation").regex(".*"+date+".*")),
                Aggregation.match(Criteria.where("descA").is(alertName)),

                //regex(".*"+date+".*")
                Aggregation.unwind("alertsources"),
                Aggregation.unwind("descA"),
                Aggregation.match(Criteria.where("alertsources.date_creation").regex(".*"+date+".*")),
                Aggregation.group().count().as("count")

Todo el crédito es para @Neil Lunn , después de investigar, encontré su respuesta original. sobre el asunto.