enhanced flag migration

This commit is contained in:
Wyatt Johnson
2018-01-25 19:21:00 -07:00
parent 6caae2df97
commit 57a77a7edf
2 changed files with 17 additions and 14 deletions
+16 -13
View File
@@ -53,22 +53,25 @@ const transformTags = ({ id, tags }) => ({
module.exports = {
async up({ transformSingleWithCursor }) {
// Find all comments that have tags.
const cursor = CommentModel.collection.aggregate([
{
$match: {
tags: {
$exists: true,
$ne: [],
const cursor = CommentModel.collection.aggregate(
[
{
$match: {
tags: {
$exists: true,
$ne: [],
},
},
},
},
{
$project: {
id: true,
tags: true,
{
$project: {
id: true,
tags: true,
},
},
},
]);
],
{ allowDiskUse: true }
);
await transformSingleWithCursor(cursor, transformTags, CommentModel);
},
+1 -1
View File
@@ -23,7 +23,7 @@ const debugProcessStatistics = (count, totalCount) => {
debug(
`processed ${(count / totalCount * 100).toFixed(
2
)}% (${count}/${totalCount}) update`
)}% (${count}/${totalCount}) updates`
);
} else {
debug(`processed ${count} updates`);