updated database api with example