enable maxDeviceView (pagination) for nedb!
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Dec 12, 2025 at 15:09 UTC
1037aa7c009f605309012718eac302d0b784429a
1 file changed
+13
-2
db.js
+13
-2
@@ -3011,15 +3011,26 @@ module.exports.CreateDB = function (parent, func) {
3011
//if (id) { x._id = id; }
3012
//obj.file.find(x, { type: 0 }, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); });
3013
//};
3014
+ obj.CountAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) {
3015
+ if (extrasids == null) {
3016
+ const x = { type: type, domain: domain, meshid: { $in: meshes } };
3017
+ if (id) { x._id = id; }
3018
+ obj.file.count(x, function (err, count) { func(err, count); });
3019
+ } else {
3020
+ const x = { type: type, domain: domain, $or: [{ meshid: { $in: meshes } }, { _id: { $in: extrasids } }] };
3021
+ if (id) { x._id = id; }
3022
+ obj.file.count(x, function (err, count) { func(err, count); });
3023
+ }
3024
+ };
3025
obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, skip, limit, func) {
3026
if (extrasids == null) {
3027
const x = { type: type, domain: domain, meshid: { $in: meshes } };
3028
if (id) { x._id = id; }
3018
- obj.file.find(x, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); });
3029
+ obj.file.find(x).skip(skip).limit(limit).exec(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); });
3030
} else {
3031
const x = { type: type, domain: domain, $or: [{ meshid: { $in: meshes } }, { _id: { $in: extrasids } }] };
3032
if (id) { x._id = id; }
3022
- obj.file.find(x, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); });
3033
+ obj.file.find(x).skip(skip).limit(limit).exec(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); });
3034
}
3035
};
3036
obj.GetAllTypeNodeFiltered = function (nodes, domain, type, id, func) {