嗨,我正在使用 nodejs 和 mongoose 开发一个应用程序,我有许多运行良好的模式和模块,但是我不明白它有什么问题。这是我的架构:
var mongoose = require('mongoose');
var rel_pv_parSchema = new mongoose.Schema({
"ins_utente": String,
"ins_data": { type: Date, default: Date.now },
"pv_id": Number,
"mod_utente": String,
"mod_data": { type: Date, default: Date.now },
"tc_clpar_id": Number,
"tc_par_id": Number
},{ collection:'rel_pv_par' })
module.exports = rel_pv_parSchema
这是我的模块:
var mongoose = require('mongoose');
var Schema = require('../schemas/rel_pv_par');
var rel_pv_par = mongoose.model('Rel_pv_par', Schema);
module.exports = rel_pv_par;
这就是我使用模块的方式:
var test = require ('tap').test
var rel_pv_par = require('../schemas/rel_pv_par');
var tc_par = require('../schemas/tc_par');
var mongoose = require('mongoose')
test('rel_pv_par',function(t){
var conn = mongoose.connect('127.0.0.1','saloniTest',27017)
var Rel_pv_par = conn.model('rel_pv_par', rel_pv_par);
Rel_pv_par.find({},function(err,out){
console.log('last out');
console.log(out)
})
t.ok(true,'ok')
t.end()
})
除了点击之外,我没有得到任何输出,看起来集合是空的,但事实并非如此,在测试运行几分钟后,我收到以下错误消息:
FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory
我不应该复杂,但我真的很困惑,不明白错误。