I am using Loopback for my project. I created a Model 'test' and a remote-method 'createOrder' for the test model.
'use strict';
module.exports = function (Test) {
/**
*
* @param {number} amount
* @param {Function(Error)} callback
*/
Test.createOrder = function (amount, callback) {
// Add log to the logs collection
callback(null);
};
};
I am using MongoDB as datasource.
{
"db": {
"name": "db",
"connector": "memory"
},
"paymentDS": {
"host": "localhost",
"port": 27017,
"url": "",
"database": "test",
"password": "",
"name": "testDS",
"user": "",
"useNewUrlParser": true,
"connector": "mongodb"
}
}
I want to insert logs into logs collection from the createOrder remote-method defined in test model. How can I do that?
from custom CRUD in loopback remote-method for collection other than model for mongodb
No comments:
Post a Comment