lila/bin/mongodb/forum-fix-int.js

38 lines
672 B
JavaScript
Raw Normal View History

2021-02-06 06:26:05 -07:00
db.f_categ
.find({
pos: {
$type: 1,
},
})
.forEach(function (o) {
print(o.name);
db.f_categ.update(
{
_id: o._id,
},
{
$unset: {
pos: 1,
nbTopics: 1,
nbPosts: 1,
nbTopicsTroll: 1,
nbPostsTroll: 1,
},
}
);
db.f_categ.update(
{
_id: o._id,
},
{
$set: {
pos: NumberInt(o.pos),
nbTopics: NumberInt(o.nbTopics),
nbPosts: NumberInt(o.nbPosts),
nbTopicsTroll: NumberInt(o.nbTopicsTroll),
nbPostsTroll: NumberInt(o.nbPostsTroll),
},
}
);
2016-11-03 05:19:25 -06:00
});