Is there an easy way to fetch a site name from a URL string?
Example:
http://www.mysite.com/mypath/mypage -> www.mysite.com
http://mysite.com/mypath/mypage -> mysite.com
The JS code is executed on mongodb CLI side, not in a browser.
This one worked well for me:
urlString.split('/')[2]