Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 范围错误:mongodb节点中超出了最大调用堆栈大小_Node.js_Mongoose - Fatal编程技术网

Node.js 范围错误:mongodb节点中超出了最大调用堆栈大小

Node.js 范围错误:mongodb节点中超出了最大调用堆栈大小,node.js,mongoose,Node.js,Mongoose,我试图在mongodb中创建一个嵌套模式,如下所示,但在插入值时,它给了我范围错误: var UserInfo = new Schema({ userName : {type : String, required: true, index:{unique:true}}, password : {type : String, required: true}, country : {type : String, required: true}, city : {type :

我试图在mongodb中创建一个嵌套模式,如下所示,但在插入值时,它给了我范围错误:

  var UserInfo = new Schema({

  userName : {type : String, required: true, index:{unique:true}},
  password : {type : String, required: true},
  country  : {type : String, required: true},
  city : {type : String , required: true},
  profileImage :{type: String, required:true},


});


var StatusUpdate= new Schema({

   status : {type: String},
   user : [UserInfo],
   likers : {type: Array, def :[]} 


});
我在post请求中发送用户名,如果找到用户,我将把用户对象插入statusUpdate模式。但这里它给了我距离误差

var user = mongoose.model('UserInfo');

user.findOne({userName: req.param('username')},function(e,o){

      if(e)
        callback('not found');
      else
      {

        statusUpdate.collection.insert({status: req.param('status'), user : o},     function(e,o)
        {
                   console.log(e);
                  if(e)
                    callback('unable to update status')
                  else
                    callback(o)
        });
      }

 });

哪个功能?我想将用户的输出插入StatUpdate模式您得到的具体错误是什么?感谢您的回复,实际上我犯了一个错误。现在问题解决了。如果从你的错误中吸取的教训可以帮助其他人避免这样做,那么回答你自己的问题是值得的:)。