Mongodb Mongoose Sailsjs模式';填充时未为模型注册

Mongodb Mongoose Sailsjs模式';填充时未为模型注册,mongodb,mongoose,sails.js,populate,sails-hook,Mongodb,Mongoose,Sails.js,Populate,Sails Hook,我想让猫鼬用这个钩子和帆一起工作 在我尝试填充之前,当我得到错误时,它可以正常工作 MissingSchemaError:尚未为模型注册架构 下面是我的模式设置的示例 var Schema = sails.mongoose.Schema; module.exports = { schema: { product: { type: Schema.Types.ObjectId, ref: 'Product' }, order: { t

我想让猫鼬用这个钩子和帆一起工作

在我尝试填充之前,当我得到错误时,它可以正常工作

MissingSchemaError:尚未为模型注册架构

下面是我的模式设置的示例

var Schema = sails.mongoose.Schema;
module.exports = {
  schema: {
    product: {
      type: Schema.Types.ObjectId,
      ref: 'Product'
    },
    order: {
      type: Schema.Types.ObjectId,
      ref: 'Order'
    },
    qty: {
      type: Number,
      default: 1
    },
    image: {
      type: Schema.Types.ObjectId,
      ref: 'Image'
    },
    total: Number,
    custom_items: [{
      type: Schema.Types.ObjectId,
      ref: 'CustomLineItem'
    }],
    createdBy: {
      type: Schema.Types.ObjectId,
      ref: 'User',
      index: true
    },
    owner: {
      type: Schema.Types.ObjectId,
      ref: 'User',
      index: true
    }
  },

  /**
   * constructSchema()
   *
   * Note that this function must be synchronous!
   *
   * @param  {Dictionary} schemaDefinedAbove  [the raw schema defined above, or `{}` if no schema was provided]
   * @param  {SailsApp} sails                 [just in case you have globals disabled, this way you always have access to `sails`]
   * @return {MongooseSchema}
   */
  constructSchema: function(schemaDefinedAbove, sails) {
    // e.g. we might want to pass in a second argument to the schema constructor
    var lineItemSchema = new sails.mongoose.Schema(schemaDefinedAbove, {
      autoIndex: false,
      collection: 'lineitem'
    });
    return lineItemSchema;
  }
};

发现它是因为我的ref需要小写

发现它是因为我的ref需要小写