balderdashy/sails

Problem using multiple adapters in a single sails application

Open

#6,956 建立於 2020年2月26日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)JavaScript (22,778 star) (1,953 fork)batch import
help wantedmongoormsails-disktry this out please

描述

Node version: 12.10.0 Sails version (sails): 1.2.3 ORM hook version (sails-hook-orm): 2.1.1 Sockets hook version (sails-hook-sockets): 2.0.0 Uploads hook version (sails-hook-uploads): DB adapter & version (e.g. sails-mysql@5.55.5): sails-mongo@1.1.0

and I have 2 models - 1) post 2) comment. Here are the model definitions:

/**
 * Post.js
 */

module.exports = {
  attributes: {
    nameOnMenu: { type: 'string', required: true },
    price: { type: 'string', required: true }
  },

};

and here is the comment model :

/**
 * Comment.js
 */

module.exports = {
  datastore: 'mongo',
  attributes: {
    nameOnMenu: { type: 'string', required: true },
    price: { type: 'string', required: true }
  },
};

so I am trying to connect comment model with mongo adapter and post model to default adapter. But when I run "sails lift", it shows the below error:

alt

What's wrong am I doing?

貢獻者指南