Melatonin while pregnant

I'm 6 weeks, 5 days and cannot get a good night's sleep. I'm waking up every two hours. Is it safe to take melatonin while pregnant?