add count api for mongodb.