@dhyasama/totem-models 10.57.2 → 10.58.0
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 +11 -0
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -238,6 +238,17 @@ module.exports = function(mongoose, config) {
|
|
|
238
238
|
// Statics operate on the entire collection
|
|
239
239
|
//////////////////////////////////////////////////////
|
|
240
240
|
|
|
241
|
+
Financials.statics.addMetrics = function updateProperty(snapshotUUID, metrics, cb) {
|
|
242
|
+
|
|
243
|
+
const self = this;
|
|
244
|
+
const filter = { 'snapshots.uuid': snapshotUUID };
|
|
245
|
+
const update = { '$push': { 'snapshots.$.metrics': { $each: metrics } } };
|
|
246
|
+
const options = { 'upsert': false, 'new': true };
|
|
247
|
+
|
|
248
|
+
self.updateOne(filter, update, options, cb);
|
|
249
|
+
|
|
250
|
+
};
|
|
251
|
+
|
|
241
252
|
Financials.statics.getAll = function getAll(options, cb) {
|
|
242
253
|
|
|
243
254
|
const self = this;
|