====== Ubiquiti - Site - Change the Default Site ====== It is not possible to change which site is considered the default within the UniFi UI. * This can be done by manipulating the mongo database. ---- ===== Access the CLI ===== SSH into the UniFi controller. ---- ===== Start the Mongo Database ===== mongo --port 27117 ---- ===== Switch to the UniFi database ===== use ace ---- ===== List the sites in the database ===== db.site.find() returns: { "_id" : ObjectId("[hex number 1]"), "name" : "default", "desc" : "Default", "attr_hidden_id" : "default", "attr_no_delete" : true } { "_id" : ObjectId("[hex number 2]"), "desc" : "Site 2", "name" : "utn68o25", "location_lat" : 10.3245, "location_lng" : -24.5703, "location_accuracy" : 0 } **NOTE:** This should list several sites. * Notice the differences in properties between the default site and the the other sites. ---- ===== Change the properties for the replacement default site ===== Remove the default properties from the current default site and assign them to the site which is to become the new default site db.site.update({ _id: ObjectId("[hex number 1]") },{ $unset: { attr_hidden_id: "",attr_no_delete: ""}}) db.site.update({ _id: ObjectId("[hex number 2]") }, { $set: { attr_hidden_id: "default", attr_no_delete: true}}) ---- ===== Verify the changes ===== db.site.find() ---- ===== Exit the mongo CLI ===== exit **NOTE:** Restart the UniFi service for the changes to take effect. ---- ===== Optionally delete the original default site ===== After the UniFi controller has restarted, the original default site can be deleted on the Site page of the UniFi Settings. **NOTE:** Once the old default site is deleted from within the controller UI: * Re-enter mongo * Update the replacement site as the default site name to **default** so that it is addressable with **default** in the controller URL db.site.update({ _id: ObjectId("[hex number 2]") }, { $set: { name: "default"}}) ---- ===== Rename the old default site ===== The old default site does not have to be deleted. * But the name of the old site will need to be changed; so that two sites are not both named **default**: db.site.update({ _id: ObjectId("[hex number 1]") }, { $set: { name: "[any unique 8-char alphanumeric string]"}}) ----