Чтобы добавить к @ssytvane ответ и ответить @Guarav: вы можете добавить «upsert = True», если его не существует:
def update_tags(ref, new_tag):
coll.update({'ref': ref}, {'$push': {'tags': new_tag}}, upsert = True)
или
def update_tags(ref, new_tag):
coll.update_one({'ref': ref}, {'$push': {'tags': new_tag}}, upsert = True)