我的文档如下所示
{
"list" :{
"friends": [
{
"Name": "John",
"Contact": "xyz",
"Code": "B"
},
{
"Name": "Smith",
"Contact": "abc",
"Code": "A"
}
]
}
}
我尝试使用基于过滤器的$unset
运算符删除字段。我的代码如下:
result = db.collection.update_many({"list.friends.code": "A"},
{"$unset": {"list.friends.$.Name": "", "list.frieds.$.Contact": ""}})
但是,我得到pymongo.errors.WriteError: Invalid BSON field name 'list.friends.$.Name'
答案 0 :(得分:1)
请改为尝试:
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry : './src/app.js',
output : {
filename : './dist/bundle.js'
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader','sass-loader']
})
}
]
},
plugins: [
new ExtractTextPlugin({
filename : 'app.bundle.css'
}),
]
}