首先,这段代码从今天起完美运行,我不知道为什么,这已经改变了,我没有修改它 . 这是代码:

app.post('/upload', function (req, res){

  var tags = req.body.tags.split(" ");

  usermodel.findOne({ user: req.session.user }, function (err, user){

    console.log(user);

   var img = user.imagen.push({

     title: req.body.title,
     name: req.files.art.name,
     author: user.user,
     description: req.body.description,
     index: user.imagen.length + 1,
     path: './users/' + user.user + '/' + req.files.art.name,
     dowload: req.body.share,
     tags: tags

  });

    user.save(function (err, suser){

     if (err) throw err;


    fs.readFile(req.files.art.path, function(err, data){

       if (err) throw err;

       fs.writeFile(user.path + '/' + req.files.art.name, data, function(err){

             if(err) throw err;

             res.redirect('/home');

      }); 
     });
    });
  });

当我检查用户时,该用户的imagen数组看起来像'[object Object]' . 为什么会这样?对此有任何解决方案......?

谢谢你的进步!

编辑:

这是架构:

var userschema = new mongoose.Schema({

user: String,
  pass: String,
  imagen: [{ 

              title: String,
              name: String,
              views: Number,
              type: String,
              author: String,
              tags: [String],
              description: String,
              index: Number,
              path: String,
              date: { type: Date, default: Date.now },
              dowload: String,
              like: Number,

           }],

});