Skip to content

Instantly share code, notes, and snippets.

@nevehallon
Created October 19, 2023 16:59
Show Gist options
  • Save nevehallon/803b735567b9ab69551c91c5e16d8b33 to your computer and use it in GitHub Desktop.
Save nevehallon/803b735567b9ab69551c91c5e16d8b33 to your computer and use it in GitHub Desktop.
aggregationPipeline.dart
final aggSteps = [
{
"\$match": {
"region.itemRefID": "6268a16f964b7b20e3d6beb2",
"reportType.itemRefID": {"\$ne": "60fbda43f3b16318ac07c79c"},
"reportStatus._id": "c2rmj8223akg00drt34g",
},
},
{
"\$sort": {
"_createdDate": -1,
},
},
{
"\$project": {
"_createdDate": 0,
"_lastUpdatedDate": 0,
"solved": 0,
"solvedBy": 0,
"comments": 0,
"coordinates": 0,
},
},
{
"\$limit": 20,
},
{
"\$skip": 5,
},
];
BagelResponse response =
await db.collection('reports').aggregationPipeline(aggSteps).get();
print(json.encode(response.data));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment