Hi @Andrew_Davidson

I don’t now…

First I used this command, the return was slow:

const app = new Realm.App({ id: ID_APP })
const mongo = app.currentUser.mongoClient("mongodb-atlas").db(app.currentUser.customData.lojas[i].base)
const data = await mongo.collection("vendas").aggregate(...);

Then, as I said, I created an Atlas Function to execute this aggregate and started calling it directly, as shown below, which improved the speed 10 times:

const app = new Realm.App({ id: ID_APP })
const data = await app.currentUser.functions["getStatistic1"]();

And now that I’m migrating the data and I’m no longer using the Atlas Functions, basically in the REST API every time the user accesses the endpoint, for example, https:my_domain/statistics the aggregate is executed and returns the data to it, however with the same slowness as in the first case.

In this scenario that I reported, does the Atlas Function use this pool?

How can I use this?

Thx for the help