/** * Mongo Query: * 1. {term1,term2..} object keys, values => and * 2. $and[term1,term2..] * 3. $or[term1,term2..] * * term: * a. field: "value" * b. field: {$elementMatch: * c. field: {: value} * * 4. $elemMatch * { "_id": 1, "results": [ { "product": "abc", "score": 10 }, { "product": "xyz", "score": 5 } ] }, { "_id": 2, "results": [ { "product": "abc", "score": 8 }, { "product": "xyz", "score": 7 } ] }, { "_id": 3, "results": [ { "product": "abc", "score": 7 }, { "product": "xyz", "score": 8 } ] }, { "_id": 4, "results": [ { "product": "abc", "score": 7 }, { "product": "def", "score": 8 } ] }, { "_id": 5, "results": { "product": "xyz", "score": 7 } } ] ) db.survey.find( { results: { $elemMatch: { product: "xyz", score: { $gte: 8 } } } } ) * 5. operators: $gt,$gte,$lt,$lte field:{} */ interface MQuery { [key: string]: any; } interface MProjection { [key: string]: 0 | 1 | MProjection; } declare class MongoLikeQuery { static filterObjectsAndChildren(array: any[], query: MQuery, childName: string): any[]; static filterObjects(array: any[], query: MQuery): any[]; static projectObjects(array: any[], projection: MProjection): any[]; } export { MongoLikeQuery };