为什么模型未定义?

时间:2019-01-02 06:29:16

标签: feathersjs

我使用FeathersJS应用生成器v3.9.0创建了新的数据库服务。

// Initializes the `mongo` service on path `/mongo`
const createService = require('feathers-mongodb');
const hooks = require('./mongo.hooks');

module.exports = function (app) {
  const paginate = app.get('paginate');
  const mongoClient = app.get('mongoClient');
  const options = { paginate };

  // Initialize our service with any options it requires
  app.use('/mongo', createService(options));

  // Get our initialized service so that we can register hooks and filters
  const service = app.service('mongo');

  mongoClient.then(db => {
    console.log(db);
    service.Model = db.collection('mongo');
    console.log(service.Model);
  });

  service.hooks(hooks);
};

为什么模型未定义here

0 个答案:

没有答案