How is aggregate db rolled up from tick db under the hood?

From the documentation, I understand that tick db lets us collect, query and stream real-time market data and a tick is the minimum price change a security can make on an exchange.

Aggregate databases provide rolled-up views of tick databases up to any bar size, for example 1 second or 1 day.

How is the rolling up performed to create the aggregate db? Is it created by taking the average of the tick values?

This is determined by the fields parameter.

From the API Reference:

Available aggregate functions are “Close”, “Open”, “High”, “Low”, “Mean”, “Sum”, and “Count”.

Create an aggregate database of 1 second bars containing the closing bid and ask and the mean bid size and ask size, from a tick database of futures trades and quotes, resulting in fields called BidPriceClose, AskPriceClose, BidSizeMean, and AskSizeMean:

>>> create_agg_db("cme-fut-taq-1sec", tick_db_code="cme-fut-taq",
                  bar_size="1s",
                  fields={"BidPrice":["Close"],
                          "AskPrice": ["Close"],
                          "BidSize": ["Mean"],
                          "AskSize": ["Mean"]
                          })

So if i create a aggregate database of 1minute bars with fields = {"BidPrice": ["Close"]}
and the price of security is like

00: 00: 00 is 1.231
.....
.....
00: 00: 59 is 1.597

then the BidPriceClose of aggregate databse will contain price as 1.597

am i correct?

Correct.

Just one more question. There are scenerios where we don't have the data for 59th second.

00: 00: 00 is 1.231
.....
.....
00: 00: 50 is 1.432

then the BidPriceClose of aggregate databse will contain price as 1.432 basically whatever the last price present in i-1th minute to ith minute will be the price of ith minute

Correct.