📃 db.listall 🔍 db.findall
The listall and findall modules provide high-level traversal utilities for HBH-DBMS.
They are designed to safely scan the entire filesystem hierarchy without breaking DBMS rules.
📌 These utilities do not bypass DBMS 📌 They reuse DBMS pagination & limits 📌 Built for CMS, admin panels, dashboards, and search systems
📃 listall
listall is used to list entities across hierarchy levels using safe pagination traversal.
1db.listall
Available Methods
1listall.User2listall.Channel3listall.Content
👤 listall.User(options)
Lists users using paginated traversal.
1await listall.User({2 userPage: 1,3 userLimit: 104});
Parameters
| Name | Type | Description |
|---|---|---|
userPage |
Number | Page number (example: 1) |
userLimit |
Number | Users per page (example: 10) |
Response
1{2 success: true,3 message: "Users fetched",4 data: [ "alice@example.com", "bob@example.com" ],5 pagination: { userPage: 1, userLimit: 10 }6}
Notes
- Internally uses
UserDB.list() - Safe for large datasets
- No eager filesystem traversal
📺 listall.Channel(options)
Lists channels across all users under a given product.
1await listall.Channel({2 productName: "HBH-CMS",3 userPage: 1,4 userLimit: 10,5 channelPage: 1,6 channelLimit: 107});
Parameters
| Name | Description |
|---|---|
productName |
Product scope (example: "HBH-CMS") |
userPage |
User pagination (example: 1) |
userLimit |
Users per page (example: 10) |
channelPage |
Channel pagination (example: 1) |
channelLimit |
Channels per page (example: 10) |
Response
1{2 success: true,3 data: {4 "alice@example.com": ["Channel1", "Channel2"],5 "bob@example.com": ["News"]6 }7}
Notes
- Traverses User → Product → Channel
- Channel names are normalized
- Errors per user are safely skipped
📝 listall.Content(options)
Lists content across users, channels, and content types.
1await listall.Content({2 productName: "HBH-CMS",3 userPage: 1,4 userLimit: 10,5 channelPage: 1,6 channelLimit: 10,7 contentPage: 1,8 contentLimit: 209});
Response
1{2 success: true,3 data: {4 "content-id-1": { user: "alice@example.com", channel: "Channel1" },5 "content-id-2": { user: "bob@example.com", channel: "News" }6 }7}
Notes
- Traverses entire DB hierarchy
- Content types are auto-detected
- Designed for CMS indexing
🔍 findall
findall provides deep search utilities to locate entities without knowing their exact path.
1db.findall
Available Methods
1findall.User2findall.Channel3findall.Findchannel4findall.Content5findall.Findcontent
👤 findall.User(username)
Finds a user by ID using paginated scanning.
1await findall.User("alice@example.com");
Behavior
- Scans user pages sequentially
- Stops immediately when found
- Safe for very large datasets
📺 findall.Channel or findall.Findchannel (channelName, options)
Finds a channel across all users under a product. Uses ChannelManager for indexed channel lookup.
1await findall.Channel("Channel1", {2 productName: "HBH-CMS"3});
Response
1{2 success: true,3 data: {4 user: "alice@example.com",5 channel: "Channel1"6 }7}
Notes
- Channel names are normalized
- Stops on first match
- Uses
listall.Channelinternally
📝 findall.Content or 🆔 findall.Findcontent (contentID, options)
Finds a content item anywhere in the DB. Uses IDManager for indexed content lookup.
1await findall.Content("content-id-1", {2 productName: "HBH-CMS"3});
Behavior
-
Traverses:
User → Product → Channel → Content -
Auto-advances pagination
-
Stops early on match
1await findall.Findcontent("content-id-1", { productName: "HBH-CMS" });
Notes
- Direct ID resolution
- No filesystem scanning
- Most efficient content lookup method
🎯 Design Philosophy
✔ No unsafe recursion ✔ Pagination-based traversal ✔ Early-exit search ✔ CMS & admin friendly ✔ Deterministic & recoverable
📌 listall = enumeration
📌 findall = discovery