Dentist said I had to get a cavity filled without pain medicine?

During or after? Are you saying that the dentist didn't feel the need to provide anesthetic while having the tooth filled, or after the tooth is filled? It is not typical to need pain medication after a filling, and if there is discomfort afterward, it may be from the injection site. Advil (ibuprofen) should take care of any discomfort afterward.
Pain from cavity. Pain after a cavity is filled shouldn't be severe. There might be some gum irritation for a day or two that would probably respond to over the counter Ibuprofen or a mild narcotic such as tramadol or low dose vicodin. If the pain is severe you should call your dentist and get back for another examination.