@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 +3 -5
- package/package.json +1 -1
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
|
|
374
|
-
else
|
|
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
|
};
|