//PlaceName:'$PlaceName',CityCode:'$CityCode' 查询条件
//dups 查询到的重复数据
db.getCollection('HotLocation').aggregate([
{
$group:{_id:{PlaceName:'$PlaceName',CityCode:'$CityCode'},count:{$sum:1},dups:{$addToSet:'$_id'}}
},
{
$match:{count:{$gt:1}}
}
]).forEach(function(it){
//it.dups.shift(); 保留重复的第一条 避免全部删除了
it.dups.shift();
db.getCollection("HotLocation").remove({_id: {$in: it.dups}});
});