nodebb-plugin-dbsearch 6.2.10 → 6.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-dbsearch",
3
- "version": "6.2.10",
3
+ "version": "6.2.11",
4
4
  "description": "A Plugin that lets users search posts and topics",
5
5
  "main": "index.js",
6
6
  "repository": {
package/plugin.json CHANGED
@@ -7,7 +7,6 @@
7
7
  "upgrades": [
8
8
  "upgrades/dbsearch_change_mongodb_schema.js",
9
9
  "upgrades/dbsearch_change_integer_index.js",
10
- "upgrades/dbsearch_fix_mongodb_postsearch.js",
11
10
  "upgrades/dbsearch_mongodb_ts_index.js"
12
11
  ],
13
12
  "hooks": [
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
-
4
- const db = module.parent.require('./database');
5
-
6
- module.exports = {
7
- name: 'Fix _id convert upgrade for mongodb',
8
- timestamp: Date.UTC(2025, 1, 18),
9
- method: async function () {
10
- const { progress } = this;
11
- const nconf = require.main.require('nconf');
12
- const mainDB = nconf.get('database');
13
- if (mainDB !== 'mongo') {
14
- return;
15
- }
16
-
17
- async function convertIdToString(collection, docs) {
18
- for (const doc of docs) {
19
- if (doc._id) {
20
- const stringId = doc._id.toString();
21
- // eslint-disable-next-line no-await-in-loop
22
- await db.client.collection(collection).deleteMany({ _id: { $in: [doc._id, stringId] } });
23
- // eslint-disable-next-line no-await-in-loop
24
- await db.client.collection(collection).insertOne({
25
- ...doc,
26
- _id: stringId,
27
- });
28
- }
29
- progress.incr(1);
30
- }
31
- }
32
-
33
- const posts = await db.client.collection('searchpost').find({}).toArray();
34
- progress.total = posts.length;
35
- await convertIdToString('searchpost', posts);
36
- },
37
- };