mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 03:01:08 +01:00
feat: update to mongodb 6.1 (#12087)
This commit is contained in:
committed by
GitHub
parent
212a341575
commit
e542b27d1d
@@ -144,10 +144,9 @@ mongoModule.info = async function (db) {
|
||||
indexSizes: collectionInfo.indexSizes,
|
||||
}));
|
||||
|
||||
stats.mem = serverStatus.mem || { resident: 0, virtual: 0, mapped: 0 };
|
||||
stats.mem = serverStatus.mem || { resident: 0, virtual: 0 };
|
||||
stats.mem.resident = (stats.mem.resident / 1024).toFixed(3);
|
||||
stats.mem.virtual = (stats.mem.virtual / 1024).toFixed(3);
|
||||
stats.mem.mapped = (stats.mem.mapped / 1024).toFixed(3);
|
||||
stats.collectionData = listCollections;
|
||||
stats.network = serverStatus.network || { bytesIn: 0, bytesOut: 0, numRequests: 0 };
|
||||
stats.network.bytesIn = (stats.network.bytesIn / scale).toFixed(3);
|
||||
@@ -170,7 +169,11 @@ mongoModule.info = async function (db) {
|
||||
|
||||
async function getCollectionStats(db) {
|
||||
const items = await db.listCollections().toArray();
|
||||
return await Promise.all(items.map(collection => db.collection(collection.name).stats()));
|
||||
return await Promise.all(
|
||||
items.map(collection => db.collection(collection.name).aggregate([
|
||||
{ $collStats: { latencyStats: {}, storageStats: {}, count: {} } },
|
||||
]))
|
||||
);
|
||||
}
|
||||
|
||||
mongoModule.close = async function () {
|
||||
|
||||
@@ -248,6 +248,7 @@ module.exports = function (module) {
|
||||
$inc: increment,
|
||||
}, {
|
||||
returnDocument: 'after',
|
||||
includeResultMetadata: true,
|
||||
upsert: true,
|
||||
});
|
||||
cache.del(key);
|
||||
|
||||
@@ -112,6 +112,7 @@ module.exports = function (module) {
|
||||
$inc: { data: 1 },
|
||||
}, {
|
||||
returnDocument: 'after',
|
||||
includeResultMetadata: true,
|
||||
upsert: true,
|
||||
});
|
||||
return result && result.value ? result.value.data : null;
|
||||
|
||||
@@ -435,6 +435,7 @@ module.exports = function (module) {
|
||||
$inc: data,
|
||||
}, {
|
||||
returnDocument: 'after',
|
||||
includeResultMetadata: true,
|
||||
upsert: true,
|
||||
});
|
||||
return result && result.value ? result.value.score : null;
|
||||
|
||||
Reference in New Issue
Block a user