[英]How to remove documents from embedded where name is.. and start is greater than…?
I'm trying to remove some embedded documents from history. 我正试图从历史中删除一些嵌入式文档。 I'm using mongodb 3.2 There are two conditions:
我正在使用mongodb 3.2有两个条件:
{
"name" : "sa",
"history" : [
{
"start" : ISODate("2015-11-11T12:46:32.000Z"),
"value" : "color1"
},
{
"start" : ISODate("2015-11-12T11:54:20.000Z"),
"value" : "color2"
}]
}
{
"name" : "sa",
"history" : [
{
"start" : ISODate("2015-11-11T12:46:32.000Z"),
"value" : "color1"
},
]
"start" : ISODate("2015-11-12T11:54:20.000Z"),
"value" : "color2"
}]
}
{
"name" : "so",
"history" : [
{
"start" : ISODate("2015-11-11T12:46:32.000Z"),
"value" : "color1"
},
{
"start" : ISODate("2015-11-12T11:54:20.000Z"),
"value" : "color2"
}]
}
I couldn't do it directly. 我不能直接这样做。 I download the collection and then do the operations that I need, remove the old collection and then insert the new collection with the data that I need.
我下载了该集合,然后执行我需要的操作,删除旧集合,然后使用我需要的数据插入新集合。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.