Skip to content

Tag: aggregation-framework

MongoDB Extract document

I have this Json: I would like to filter exclusive for paymentType.type equals “PILOT” and limits equals type equals “COMBAT_HOURS”. This is the result I would like to receive. How to extract the document to reach this result? Answer Query map paymentTypes if paymentType= PILOT, filter the limits to keep only the combat hours else null (we don’t want that

MongoDB Aggregation Pipeline – Count no of records that are matching a complex criteria – (Couldn’t find PersistentEntity for type java.lang.Object!)

I have documents with dynamic fields and I would need to find a count of matching records for a given complex query criteria Example Entity Example Data: Expected Query Criteria: Building such complex Criteria using $match would be too much of implementation, so I was trying to use SPEL evolution through $project like below: However, the above logic failing due