fix a few more mongodb count deprecated #7067

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Feb 24, 2026 at 15:49 UTC d30762e8a57ef9a2dfd93f5b053e6965477f3816
1 file changed +10 -2
db.js
+10 -2
@@ -2783,12 +2783,20 @@ module.exports.CreateDB = function (parent, func) {
2783 const x = { type: type, domain: domain, meshid: { $in: meshes } };
2784 if (id) { x._id = id; }
2785 var f = obj.file.find(x, { type: 0 });
2786 - f.count(function (err, count) { func(err, count); });
2786 + if (f.countDocuments){
2787 + f.countDocuments(function (err, count) { func(err, count); });
2788 + } else {
2789 + f.count(function (err, count) { func(err, count); });
2790 + }
2791 } else {
2792 const x = { type: type, domain: domain, $or: [{ meshid: { $in: meshes } }, { _id: { $in: extrasids } }] };
2793 if (id) { x._id = id; }
2794 var f = obj.file.find(x, { type: 0 });
2791 - f.count(function (err, count) { func(err, count); });
2795 + if (f.countDocuments){
2796 + f.countDocuments(function (err, count) { func(err, count); });
2797 + } else {
2798 + f.count(function (err, count) { func(err, count); });
2799 + }
2800 }
2801 };
2802 obj.GetAllTypeNodeFiltered = function (nodes, domain, type, id, func) {