猫鼬将 & 转换为 &
Mongoose converting & to &
Mongoose 存储 & 作为 &
我在猫鼬中有一个模式,我正在使用下面的保存方法代码在集合中插入数据
// Schema
var userSchema = new Schema({
payLoad: []
})
// in controller code
var userJson = {
payLoad: [JSON.stringify(req.body)]
}
var User = require('../models/userModel')
new User(userJson).save().then(function (res) {
})
它在集合中存储数据,但是当 & 存在时它会转换为 & 例如,如果有效负载有数据 Brothers & Sons 那么在 mongodb 它存储 Brothers &
Sons
我发现问题是我正在使用一个名为 require('mongoose-sanitizer') 的节点模块,它将 & 替换为 &
Mongoose 存储 & 作为 &
我在猫鼬中有一个模式,我正在使用下面的保存方法代码在集合中插入数据
// Schema
var userSchema = new Schema({
payLoad: []
})
// in controller code
var userJson = {
payLoad: [JSON.stringify(req.body)]
}
var User = require('../models/userModel')
new User(userJson).save().then(function (res) {
})
它在集合中存储数据,但是当 & 存在时它会转换为 & 例如,如果有效负载有数据 Brothers & Sons 那么在 mongodb 它存储 Brothers &
Sons
我发现问题是我正在使用一个名为 require('mongoose-sanitizer') 的节点模块,它将 & 替换为 &