The chemical your doctor
placed in your eye was most likely pilocarpine, a drug which can temporarily dilate the eye to make an internal eye exam much easier. The dilated eye is kind of like an eye with the shades open. More light can get in than is supposed to. This can cause temporary blindness (similar to snow blindness) because the photosensitive chemicals in your eye gets used up. Not wearing your sunglasses should not be dangerous to your sight long term, and it should not result in your eye aching a few days later.
One concern is that the pilocarpine unmasked a problem in your eye. In extremely rare circumstances, these types of medications can induce a condition called angle closure glaucoma. This type of glaucoma can be dangerous to your sight. While your symptoms do not sound exactly like angle closure glaucoma, your doctor would want to know about any eye pain you are experiencing so that this can be ruled out.
I suggest that you give your doctor a call to discuss these symptoms. If you eye pain continues, you may need to go back and see him or her. If you doctor is not an ophthalmologist
then you will need referral to one.