Installing an Unifi controller on a Raspberry Pi seems like a straightforward task until you notice the section with system requirements.
The software requires a MongoDB version before 4.0. The last version that satisfies this is 3.7.9 which is almost four years old at the time of writing. You may find old versions packaged on the MongoDB website or in other repositories but certainly not for ARM. The second problem is that MongoDB dropped 32-bit support in version 3.4 so the latest we can actually use is 3.2.22 (also 4 years old).
In the end I was unable to find a build of MongoDB 3.2 that could run on a Pi which leaves only the option of compiling from source. This is what I ended up doing, it required lots of trial and error  before it succeeded. To (hopefully) save someone else time I put up the final Debian package for download.
Raspberry Pi OS Lite 11 (bullseye)
Add the Unifi repository
apt install ca-certificates apt-transport-https echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' >/etc/apt/sources.list.d/100-ubnt-unifi.list apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50 apt update
Install required packages. Unifi needs Java 8 so other versions are temporarily put on hold.
apt-mark hold openjdk-9-* openjdk-11-* apt install ./mongodb-server_3.2.22_armhf.deb unifi apt-mark unhold openjdk-9-* openjdk-11-*
Create a mongod wrapper script
printf '%s\n' '#!/bin/bash' 'exec /usr/bin/mongod --journal "$@"' >/usr/lib/unifi/bin/mongod chmod +x /usr/lib/unifi/bin/mongod
Enable and start the Unifi service:
systemctl enable --now unifi
Wait a while, it can take about 5 minutes until the controller is reachable at