@dhyasama/totem-models 10.57.1 → 10.57.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Financials.js CHANGED
@@ -360,14 +360,18 @@ module.exports = function(mongoose, config) {
360
360
  self.aggregate([
361
361
  { $unwind: '$snapshots' },
362
362
  { $unwind: '$snapshots.documents' },
363
- { $match: { 'snapshots.documents.document': documentId } },
363
+ { $match: { 'snapshots.documents.document': new mongoose.Types.ObjectId(documentId) } },
364
364
  {
365
365
  $project: {
366
366
  uuid: '$snapshots.uuid',
367
367
  document: '$snapshots.documents'
368
368
  }
369
369
  }
370
- ]).exec(cb);
370
+ ]).exec(function(err, result) {
371
+ if (err) return cb(err);
372
+ else if (!result || result.length === 0) return cb(null, null);
373
+ else return cb(null, result[0]);
374
+ });
371
375
 
372
376
  };
373
377
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "10.57.1",
3
+ "version": "10.57.2",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",