"The results generally suggest increased THC exposure was related to pain-related improvement, while increased CBD exposure was related to improved mood."
This longitudinal, observational study from 2021 is published in Experimental and Clinical Psychopharmacology. It followed 37 patients for 3 and 6 months after initiating cannabis use. They each had chronic pain symptoms and were not cannabis users before the study.
"MC [medical cannabis] patients exhibited improvements in pain which were accompanied by improved sleep, mood, anxiety, and quality of life". The patients that did not use medical cannabis and continued treatment as usual did not experience the same improvement.
The article abstract (summary) is here.