从教程中,我得到了以下代码:https://www.youtube.com/watch?v=5Vav84nA_Sg&list=PL1LlnouBcIIDUwyUq9kzngcFDcfhvP0iw&索引=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的文档?谢谢
controllers/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);
});
};
这两块是正交的。你得到的错误根本不是海怪特有的。看起来方法resolveSetOperations
来自jaydata的StorageProviderBase
。也许你正在写的东西需要从中继承,而不是。