guides:changing_the_default_site_in_unifi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
guides:changing_the_default_site_in_unifi [2018/06/08 10:03] – created jliechtyguides:changing_the_default_site_in_unifi [2025/05/12 13:37] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Changing the Default Site in UniFi ======
 +
 +
 While it is not possible from within the UniFi UI to change which site is considered the default, this can be done by manipulating the mongo database. It can be desirable to make another site the default if the currently designated default site needs to be deleted. While it is not possible from within the UniFi UI to change which site is considered the default, this can be done by manipulating the mongo database. It can be desirable to make another site the default if the currently designated default site needs to be deleted.
  
 On the CLI of the server instance on which the UniFi controller is running, start mongo (the UniFi service must also be running): On the CLI of the server instance on which the UniFi controller is running, start mongo (the UniFi service must also be running):
  
-''mongo --port 27117''+<code>mongo --port 27117</code>
  
 On the mongo CLI, switch to the UniFi database: On the mongo CLI, switch to the UniFi database:
  
-''use ace''+<code>use ace</code>
  
 List the sites in the database: List the sites in the database:
  
-''db.site.find()''+<code>db.site.find()</code>
  
 Several sites should be listed; note the differences in properties between the default site and the the other site(s): Several sites should be listed; note the differences in properties between the default site and the the other site(s):
  
-''{ "_id" : ObjectId("[hex number 1]"), "name" : "default", "desc" : "Default", "attr_hidden_id" : "default", "attr_no_delete" : true }'' +<code>{ "_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" : "utn83o47", "location_lat" : 40.7128, "location_lng" : -74.0060, "location_accuracy" : 0 }</code>
-''{ "_id" : ObjectId("[hex number 2]"), "desc" : "Site 2", "name" : "utn83o47", "location_lat" : 40.7128, "location_lng" : -74.0060, "location_accuracy" : 0 }''+
  
 Using these commands, remove the default properties from the current default site and assign them to the site which is to become the new default site: Using these commands, 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: ""}})''+<code>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}})</code> 
 + 
 +Use <code>db.site.find()</code> to verify that the changes were made as desired, and <code>exit</code> the mongo CLI. 
 + 
 +Restart the UniFi service for the changes to take effect. After the UniFi controller has restarted, the formerly default site can be deleted on the Site page of the UniFi Settings. 
 + 
 +Once the old default site is deleted from within the controller UI, you can re-enter mongo and update your desired default site's name to 'default' so that it is addressable with 'default' in the controller URL (e.g. <https://unifi:8443/manage/default>): 
 +<code>db.site.update({ _id: ObjectId("[hex number 2]") }, { $set: { name: "default"}})</code>
  
-''db.site.update({ _id: ObjectId("[hex number 2]") }, { $set: { attr_hidden_id: "default", attr_no_delete: true}})''+If you don't want to delete the old default site, make sure you also change its default name so that two sites are not both named 'default': 
 +<code>db.site.update({ _id: ObjectId("[hex number 1]") }, { $set: { name: "[any unique 8-char alphanumeric string]"}})</code>
  
-Use ''db.site.find()'' to verify that the changes were made as desired, and ''exit'' the mongo CLI. 
  
-Restart the UniFi service for the changes to take effect. 
  
 //Credit: @ckd in the unofficial Ubiquiti Discord// //Credit: @ckd in the unofficial Ubiquiti Discord//
  • guides/changing_the_default_site_in_unifi.1528470210.txt.gz
  • Last modified: 2025/05/12 13:37
  • (external edit)