试图用mysql测试compoundjs但它失败了.
我的系统是Debian 7,其中包含以下版本的nodejs和npm
$ node -v v0.10.13 $ npm -v 1.3.4
这是我安装compoundjs的方法
sudo npm install -g compound sudo npm install -g jugglingdb --save sudo npm install -g jugglingdb-mysql compound init testapp --db mysql cd testapp npm install
$ node server.js
WARNING: JugglingDB adapter "mysql" is not installed,
so your models would not work, to fix run:
npm install jugglingdb-mysql
/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55
if (!schema.adapter) throw new Error('Adapter is not defined');
^
Error: Adapter is not defined
at init (/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55:36)
at CompoundServer.initialize (/srv/www/playground/node/testapp/node_modules/jugglingdb/index.js:31:19) … 我有关系数据库的用户模型.
每个用户都可以拥有"chiefId"为FK的"用户".
"relations": {
"users": {
"type": "hasMany",
"model": "User",
"foreignKey": "chiefId"
},
}
Run Code Online (Sandbox Code Playgroud)
我可以查询每个主要用户的相关用户,如下所示:
GET /users?filter={"include":"users"}
Run Code Online (Sandbox Code Playgroud)
但它返回完整的用户对象.