# Admin Tools
## Subjects and Roles ```{include} /nightscout/tokens.md ```
## Database Maintenance If you use a small or a free database (like MongoDB Atlas), it will require maintenance as nothing in Nightscout is setup to perform cleanup and unless you planned for a larger size database, it will eventually fill-up. ```{warning} Make sure you leave [`dbsize`](/nightscout/setup_variables.md#dbsize-database-size) visible on your page to keep it under control. ```
This panel will give access to basic maintenance actions on various database collections. ```{admonition} Back up before deleting :class: warning Database-maintenance actions permanently remove records. Export or back up data you may need before using them, verify the preview or retention value carefully, and keep the confirmation dialog visible until you have checked the selection. ```
### Mongo `status` Database
Your status database contains battery, pump, ... extra information as those defined in [devicestatus](/nightscout/setup_variables.md#devicestatus-device-status) that you can safely delete when necessary.
When it comes to `treatments` and `entries`, deleting data is something you need to carefully evaluate if you like Nightscout to be the main repository for your history. ### Mongo `treatments` Database

### Mongo `entries` Database

### Delete records by date range Nightscout 15.0.8 adds a date-range deletion tool for correcting imports or sync jobs that wrote unwanted data during a known period. 1. Authenticate the browser with an administrator-capable token or the API secret. 2. Select `entries`, `treatments`, `devicestatus`, or all three collections. 3. Select inclusive start and end dates. Day boundaries use the active Nightscout profile timezone. 4. Select **Preview** and review the number of matching records. Preview counts are capped at 10,000 per collection, so a displayed count can be an underestimate when the limit is reached. 5. Start the deletion only after checking the collection and dates, then confirm the warning. Deletion cannot be undone. When `all` is selected, Nightscout processes each collection separately and reports the total removed.
### Remove old profile records The profile cleanup tool removes older profile documents while retaining the newest records. Enter how many profile records to keep, from 10 to 10,000; the default is 100. Authentication and confirmation are required. This tool is useful when repeated profile uploads have created excessive history. It does not edit the retained profile documents.
### Remove future items from Database
Future treatments and entries generated by an incorrect time zone, daylight saving time change, or any other mistake can completely block your site. Using this feature will purge the database of these unwanted values automatically. Detected issues will appear in `Database contains `*`x`*` future records` and should be fixed.