mirror of
https://github.com/wassname/talk.git
synced 2026-10-28 13:30:17 +08:00
enhanced flag migration
This commit is contained in:
1 parent
6caae2df97
commit
57a77a7edf
2 files changed
+17
-14
No files matched your search
@@ -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