balderdashy/sails

Problem using multiple adapters in a single sails application

開放

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

 (2 則留言) (0 個反應) (0 位負責人)JavaScript (1,953 個分叉)batch import
help wantedmongoormsails-disktry this out please

倉庫指標

星標
 (22,778 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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?

貢獻者指南