todo.find() .exec(function(err, todos){ todos[0].test = 1; console.log(todos[0].test);//打印结果不是1 res.render('index', function(){ todos : todos }) })
测试过当test为data类型或为objectID类型是对其赋值不生效,当其为String类型时赋值生效!为什么呢?
todo.find() .exec(function(err, todos){ todos[0].test = 1; console.log(todos[0].test);//打印结果不是1 res.render('index', function(){ todos : todos }) })
测试过当test为data类型或为objectID类型是对其赋值不生效,当其为String类型时赋值生效!为什么呢?