Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An Aggregation Pipeline is a way of processing MongoDB data through a number of different stages, we will be using some of the more common stages, $match, $project and $sort.

Note

You may get “JSON reader was expecting a name but found { if you are trying to project values that do not exist, be sure to include a filter in the $match stage that checks that the value exists.

Get Companies from Quickbooks

Code Block
languagejson
{
   aggregate: 'Company Name',
   pipeline: [
      
      { $match: {'Value.S9QBItemType': 'Account',  'Value.FullName':{$exists:true}}},
      { $project: {_id: 0, 'ListValue': '$Value.FullName', 'creationtime'} },
      { $sort: { 'ListValue': 1 } },
   ],
   cursor: { batchSize: 500 }
}

...