Realm billing, Query MongoDB

hi, I’m looking to understand if when I perform a “Query MongoDB” (as mentioned by https://docs.mongodb.com/realm/sdk/dotnet/examples/mongodb-remote-access/) using the sdk realm it is considered a realm request, which would be billed.

I hope you can help me clear my doubt, thanks in advance.

Hi Josue, welcome to the forums! :wave:

Realm does count requests that come through the MongoDB API for billing purposes. Each time you call find(), insertOne(), etc counts as a single request regardless of the actual query or if the request is successful.

Hope that clears it up for you!

1 Like

hi nick, thanks for your answer.

My query was born because I have the following case.

I have the following scenario, I have multiple stores, each store works under a different partition, and each store manages different partitions per user.

There is a master user, who can consult everything that happened in each store, such as sales, warehouse, products, etc.

But since I have everything segmented, by partitions I thought to use “Query MongoDB”, to carry out the queries of the case and not worry about the partitions. But as you indicated to me that each query that comes out from the Realm api, is invoiced.

It could have an impact on cost depending on the number of queries that come out, and the size of the data transfer.

In view of this, there is a way to join partitions, in a more generic partition, for example, I have 4 stores each with a partition and after applying a merge to have a partition that represents the information of the 4 stores, that way you could do all the queries through realm, pointing to a single partition.

Or what advice could you give me. Thanks in advance.

I thought to use “Query MongoDB”, to carry out the queries of the case and not worry about the partitions.

This makes sense to me - if just one user needs this special access it’s probably easier to just go around the partitions. This is especially true if the user only needs static queries, but you can also get real-time updates using the collection.watch() API.

It could have an impact on cost depending on the number of queries that come out, and the size of the data transfer.

This is true regardless of whether you’re using the local db+sync or MongoDB queries. Sync updates send and receive requests which count toward your usage.

In fact, you’ll probably have fewer requests if you use MongoDB queries - sync requests can be relatively fine grained and will happen whenever any synced client changes the data whereas each MongoDB read/write is a single request for a single client.

In view of this, there is a way to join partitions, in a more generic partition, for example, I have 4 stores each with a partition and after applying a merge to have a partition that represents the information of the 4 stores, that way you could do all the queries through realm, pointing to a single partition.

Right now there is no easy way to join partitions like this. We’re working on making sync more flexible but in the meantime you’d have to duplicate all of your data and replace each partition key value with a new shared one.

2 Likes

Hello Nick,

Thanks for your answer and knowledge, I will continue with the development, and experimenting.

Thank you.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.