我正在尝试用sails-orientdb适配器替换waterline-orientdb,但在顶部我仍然想使用waterline,因为waterline-orientdb适配器存在关于orientdb边缘的问题,所以这可以在水线下使用sails-orientdb适配器吗?我只想知道我可以用sails-orientdb替换waterline-orientdb吗?
1 回答
Zeeshan, I'm the developer of waterline-orientdb and I'm not aware of the issue with edges you mention. Can you please raise an issue in https://github.com/appscot/waterline-orientdb and give a few more details? I'll gladly look into it.
Regarding your specific question, you should be able to switch to sails-orientdb but your configuration, models and schema may need adjustments.
Config
sails-orientdb uses:
database: {
name: 'dataBaseName'
},
while waterline-orientdb uses:
database: 'dataBaseName'
models / schema
Associations
waterline-orientdb converts Many-to-many through associations (see also balderdashy/waterline#705) into edges but regular Many-to-many associations will use a join table (waterline default behaviour). This will be changed in the future, but not supported yet.
Currently I'm not 100% sure how sails-orientdb handles associations.
id
In waterline-orientdb an id attribute will be automatically created and replaced by @rid. sails-orientdb does not do this so you may need to adjust your models accordingly.
EDIT: regular Many-to-many associations will use a join table (waterline default behaviour) -> This is no longer true, since v0.10.40 waterline-orientdb will use edges for all kinds of many-to-many associations.
UPDATE: former sails-orientdb and waterline-orientdb have converged into sails-orientdb. The new adapter is maintained by the developers of the previous adapters.