Created
October 28, 2015 23:22
-
-
Save ran488/f2a2e4841b888c51f1f5 to your computer and use it in GitHub Desktop.
MongoDB Aggregation Framework - Various Example Queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://docs.mongodb.org/manual/reference/operator/aggregation/ | |
db.agencyProfiles.aggregate( [ | |
{ $match: {"_id":"Florida SUI Wage"} }, | |
{ $unwind: "$agencyErrors" }, | |
{ $project: {_id:0, agencyErrors: {errorDescription:1, cannedAction:{actionCodeDescription:1}}}} | |
] ) | |
db.outboundAcksInfo.aggregate( [ | |
{ $match: {"uniqueFilingIdentifier":"Minnesota SUI Wage", | |
"outBoundFileName": "009300161ta7" | |
} | |
}, | |
{ $unwind: "$ackIdLineInfo" }, | |
{ $project: {"_id": 0, ackIdLineInfo: {ackId: 1, startLineNumber:1, } } } | |
] ) | |
db.outboundAcksInfo.aggregate( [ | |
{ $match: {"uniqueFilingIdentifier":"Minnesota SUI Wage", | |
"outBoundFileName": "009300161ta7" | |
} | |
}, | |
{ $unwind: "$ackIdLineInfo" }, | |
{ $match: {"ackIdLineInfo.startLineNumber":2970} }, | |
{ $project: {"_id": 0, ackIdLineInfo: {ackId: 1, startLineNumber:1, } } } | |
] ) | |
db.outboundAcksInfo.aggregate( [ | |
{ $match: {"uniqueFilingIdentifier":"Minnesota SUI Wage", | |
"outBoundFileName": "009300161ta7" | |
} | |
}, | |
{ $unwind: "$ackIdLineInfo" }, | |
{ $match: { "ackIdLineInfo.startLineNumber": {$lte:3190}, | |
"ackIdLineInfo.endLineNumber": {$gte:3190} | |
} | |
}, | |
{ $project: {"_id": 0, ackIdLineInfo: {ackId: 1, startLineNumber:1, endLineNumber:1} } } | |
] ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment