was able to finally successfully write to the database. had to make a connection to the colelction first