How do I obtain the sum of a Loopback PersistedModel?
There does not seem to be a documentation on how to achieve that.
If possible I would like to avoid having to find all the rows and sum it in Node.js.
UPDATE
Trying out the example from https://github.com/strongloop/loopback/issues/890
var bookCollection = Book.getDataSource().connector.collection(Book.modelName);
I got an error
throw new Error('MongoDB connection is not established');
How do I get a handle on the collection to manually run aggregate query on a MongoDB collection?