使用upsert工作的mongoDB更新

时间:2015-05-05 09:09:15

标签: mongodb

我正在尝试使用up with update同时提供查询(userId,folderId,word),但以下内容无效。

Words.update({
            userId: req.session.passport.user,
            folderId: req.body.folderId,
            word:req.body.addword
        }, {
            $set:{
                userId: req.session.passport.user,
                folderId: req.body.folderId,
                word:req.body.addword,
                meaning: req.body.addmeaning,
                example: req.body.addexample,
                image: req.body.addimage,
                NoCorrectAns: 0,
                createdAt: Date()
            }

        },{
            upsert: true
        });

0 个答案:

没有答案