@dhyasama/totem-models 10.57.0 → 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,7 +360,7 @@ 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',
@@ -368,11 +368,9 @@ module.exports = function(mongoose, config) {
368
368
  }
369
369
  }
370
370
  ]).exec(function(err, result) {
371
-
372
371
  if (err) return cb(err);
373
- else if (result.length > 0) { return cb(null, { uuid: result[0].uuid, document: result[0].document }); }
374
- else { return cb(null, null); }
375
-
372
+ else if (!result || result.length === 0) return cb(null, null);
373
+ else return cb(null, result[0]);
376
374
  });
377
375
 
378
376
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "10.57.0",
3
+ "version": "10.57.2",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",