1

I am trying to find out number of collections in model and use that number for calculation.

This is what I have

var gcount=Shop.count({}, ( err, count)=>{
  gcount=count;
});

This doesn’t give any number back.

Please let me know how I can get gcount to give total number of recorded in collection assigned to a variable.

Serverless chap
  • 183
  • 1
  • 9
J. Davidson
  • 3,297
  • 13
  • 54
  • 102
  • The question mentioned has solution what i dont want. There main solution is to move the value back inside the query with call back. While I want to access the value outside globally. They start with same issue i am trying to solve but there solution is not what i want. – J. Davidson Nov 16 '17 at 10:01

0 Answers0