use database for aggregate command