mirror of
https://github.com/wassname/talk.git
synced 2026-07-16 11:22:16 +08:00
enhanced flag migration
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user