unable to use custom function in loopback extended api's

I am trying to create a extended api, for loopback model

using the below mentioned doc, http://docs.strongloop.com/display/LB/Extend+your+API

But I am not able to use the custom function provided by loopback, like MainReview.count()

module.exports = function(MainReview){


    MainReview.greet = function(msg, cb) {
      var MainReview = this;
      cb(null, 'Greetings... ' + **MainReview.count()** );
    }

    MainReview.remoteMethod(
        'greet', 
        {
          accepts: {arg: 'msg', type: 'Object'},
          returns: {arg: 'greeting', type: 'string'}
        }
    );
};

I tried googling it , but no help.

Please be aware that MainReview.count() is asynchronous and it needs to take a callback function. Your code can be revised to:

module.exports = function(MainReview){


    MainReview.greet = function(msg, cb) {
      var MainReviewModel = this;
      MainReviewModel.count(function(err, result) {
        cb(err, 'Greetings... ' + result );
      }); 
    }

    MainReview.remoteMethod(
        'greet', 
        {
          accepts: {arg: 'msg', type: 'Object'},
          returns: {arg: 'greeting', type: 'string'}
        }
    );
};