Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function _prepareDetails(activityId, dealId) {
- var offerInfo;
- var details = [];
- client.connect(function(err) {
- assert.equal(null, err);
- console.log("Connected correctly to server");
- const db = client.db(dbName);
- const offers_collection = db.collection('collection_name');
- await offers_collection.aggregate([
- { "$match": { 'id': Id} },
- ]).toArray(function(err, docs) {
- assert.equal(err, null);
- console.log("Found the following records");
- details = docs;
- });
- })
- return details;
- }
- app.post('/getDetails',(request,response)=>{
- var Id = request.body.Id;
- var activityId = request.body.activityId;
- _prepareDetails(activityId,Id).then(xx => console.log(xx));
- response.send('xx');
- })
- function _prepareDetails(activityId, dealId) {
- var offerInfo;
- var details = [];
- client.connect(async (err) => {
- assert.equal(null, err);
- console.log("Connected correctly to server");
- const db = client.db(dbName);
- const offers_collection = db.collection('collection_name');
- await offers_collection.aggregate([
- { "$match": { 'id': Id} },
- ]).toArray(function(err, docs) {
- assert.equal(err, null);
- console.log("Found the following records");
- details = docs;
- });
- })
- return details;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement