GithubHelp home page GithubHelp logo

Comments (8)

escamoteur avatar escamoteur commented on August 26, 2024

Hi,
The location based queries either by using GetDataInArea or by creating a location constraints and use get data are executed on the server with one small caveat. It's only possible to query for locations inside a square that encompasses a circle with the desired radius. Which means the server will return also entries that are in the corners of the square but outside the radius. That entries are then filtered out on the client side.

from firestore_helpers.

JCPradelPH avatar JCPradelPH commented on August 26, 2024

Okay so lets say that I have 100 documents and then with my given radius there are only 30 documents inside the square encompassing my radius, will Firestore only charge me for 30 document reads?

from firestore_helpers.

escamoteur avatar escamoteur commented on August 26, 2024

All I can say that its a serverbased query and that only that data should be transmitted. You have to check the payment details yourself

from firestore_helpers.

JCPradelPH avatar JCPradelPH commented on August 26, 2024

Thanks for the quick response it is very much appreciated. We are aware of the pricing details, we were just asking how your library filter the results. Is it whether your querying all the documents inside the collection and loops through those documents to perform the filters needed or do you implement some kind of geohashing to avoid querying all the documents within the collection.

from firestore_helpers.

escamoteur avatar escamoteur commented on August 26, 2024

I thought I already wrote that above. I query all documents in a given geografical rectangle based on an greater / less than query on geopoints on the server side.

from firestore_helpers.

JCPradelPH avatar JCPradelPH commented on August 26, 2024

What we mean is are you performing the query like this:

const businesses = await firebaseAdmin.firestore().collection("businesses").get()
// perform logic for nearby location

or like this

const businesses = await firebaseAdmin.firestore().collection("businesses")
     .where("location", "==", geoLoc).get()

We just want to verify how are you fetching records from firestore because the first approach is pretty expensive in read operations.

Thanks in advance.

from firestore_helpers.

escamoteur avatar escamoteur commented on August 26, 2024

The second one which is meant if you say server side query. Also you can always look into the code

from firestore_helpers.

JCPradelPH avatar JCPradelPH commented on August 26, 2024

Great! Thanks for clearing that out. Cheers!

from firestore_helpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.