mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 18:46:01 +01:00 
			
		
		
		
	feat: update to mongodb 6.1 (#12087)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							212a341575
						
					
				
				
					commit
					e542b27d1d
				
			| @@ -87,7 +87,7 @@ | ||||
|         "lru-cache": "10.0.1", | ||||
|         "mime": "3.0.0", | ||||
|         "mkdirp": "3.0.1", | ||||
|         "mongodb": "5.9.0", | ||||
|         "mongodb": "6.1.0", | ||||
|         "morgan": "1.10.0", | ||||
|         "mousetrap": "1.6.5", | ||||
|         "multiparty": "4.2.3", | ||||
|   | ||||
| @@ -17,7 +17,6 @@ | ||||
| 	"mongo.file-size": "File Size", | ||||
| 	"mongo.resident-memory": "Resident Memory", | ||||
| 	"mongo.virtual-memory": "Virtual Memory", | ||||
| 	"mongo.mapped-memory": "Mapped Memory", | ||||
| 	"mongo.bytes-in": "Bytes In", | ||||
| 	"mongo.bytes-out": "Bytes Out", | ||||
| 	"mongo.num-requests": "Number of Requests", | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -28,7 +28,6 @@ | ||||
| 						<hr/> | ||||
| 						<div class="d-flex justify-content-between"><span>[[admin/advanced/database:mongo.resident-memory]]</span> <span class="text-end">[[admin/advanced/database:x-gb, {mongo.mem.resident}]]</span></div> | ||||
| 						<div class="d-flex justify-content-between"><span>[[admin/advanced/database:mongo.virtual-memory]]</span> <span class="text-end">[[admin/advanced/database:x-gb, {mongo.mem.virtual}]]</span></div> | ||||
| 						<div class="d-flex justify-content-between"><span>[[admin/advanced/database:mongo.mapped-memory]]</span> <span class="text-end">[[admin/advanced/database:x-gb, {mongo.mem.mapped}]]</span></div> | ||||
| 						<hr/> | ||||
| 						<div class="d-flex justify-content-between"><span>[[admin/advanced/database:mongo.bytes-in]]</span> <span class="text-end">[[admin/advanced/database:x-gb, {mongo.network.bytesIn}]]</span></div> | ||||
| 						<div class="d-flex justify-content-between"><span>[[admin/advanced/database:mongo.bytes-out]]</span> <span class="text-end">[[admin/advanced/database:x-gb, {mongo.network.bytesOut}]]</span></div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user