Environment Details
- Alteryx Server
- Alteryx Designer
- User-Managed MongoDB
- Server Usage Report
The following error is seen when running the Alteryx Server Usage Report
Error: Alteryx Server Usage Report (8): RunBatch (695): Tool #1: The external program ".\CollectionCheck.bat" returned an error code: -4
Cause
The Database Host field is configured to use the Secondary MongoDB node instead of the Primary/Master node. It cannot read from a secondary node in a user-managed MongoDB replica set.
Resolution
To double-check that you are using the primary node:
- Open Command Prompt as an Admin
- Change the directory to the location of the mongo.exe (Path will vary based on your installation)
cd C:\Program Files\Alteryx\bin
- Connect to a MongoDB node:
mongo mongodb://user:password@hostname:port/AlteryxService
- Query the nodes to see which is primary:
db.runCommand("ismaster")

- Once you know the primary node, you can update it in the Server Usage Report: