如何在Nodejs和krakenJS中使用jaydata?

时间:2014-10-24 05:36:42

标签: node.js mongodb jaydata kraken.js

从教程中,我得到以下代码:  https://www.youtube.com/watch?v=5Vav84nA_Sg&list=PL1LlnouBcIIDUwyUq9kzngcFDcfhvP0iw&index=26

我正在使用krakenJS,NodeJS,Jaydata,MongoDb。当我运行服务器并导航到localhost:8000 /时,它显示以下错误:

Internal server error

The URL / had the following error TypeError: Cannot call method 'resolveSetOperations' of undefined.

我不熟悉上述任何技术。希望有人能帮我一臂之力。如何调试?在Mongodb提供商处查找Jaydata的文档?感谢。

控制器/ index.js

'use strict';


var IndexModel = require('../models/index');


module.exports = function (router) {

var model = new IndexModel();


router.get('/', function (req, res) {
    var $data = require('jaydata');

    $data.Class.define('Product',$data.Entity,null,{
    id:{type:'id',key:true,computed:true,nullable:false},
    title:{type:'string'},
    date:{type:'string'},
    description:{type:'string'},
    price:{type:'int'},
    category:{type:'string'},
    teaserUrl:{type:'string'}
},null);

    $data.Class.defineEx('Database',[$data.EntityContext,$data.ServiceBase],null,{
    Products:{type:$data.EntitySet,elementType:Product}
});

    var db = new Database({name:'mongoDB',
    databaseName:'ScreencastEcommerce',
    address:'localhost',
    port:27017});
    db.Products.toArray(function  (products) {
        res.render('admin/products',{
            title:'Admin - Products',
            prodcuts:products
        });
    });
    // res.render('index', model);

});

};

1 个答案:

答案 0 :(得分:0)

这两件是正交的。你得到的错误根本不是特定于海妖的。看起来方法resolveSetOperations来自jaydata的StorageProviderBase。也许你写的东西需要从中继承而不是。