The Database Hub | Back4App
The Database Hub | Back4App
How it works
  • Log In
  • Sign Up

  1. Back4App
  2. World Continents, Countries, and Cities
Public

1210
5633
1210
5633
  • DatabaseDatabase
  • GraphQL API PlaygroundAPI Playground
  • Get Started GuideGet Started
  • IssuesIssues
  • ContributorsContributors
  • Database
    Database
    GraphQL API Playground
    API Playground
    Get Started Guide
    Get Started
    Contributors
    Contributors

  1. Closed IssueClosed
  2. Duplicate cities

New IssueNew

sptvzfjmexeytodpif commented this issue on Feb 2021

I found some duplicate cities with same Name (i.e. "Pagnacco") but very very close (i.e.: -) for the first result: "latitude": 46.11842, "longitude": 13.18003 -) for the second result: "latitude": 46.11462, "longitude": 13.18377

How can I ignore the duplicates from results? I want ony the city with the higher population.

Thanks.

alexb4abr commented this issue on Feb 2021

You can use the query.first() method to retrieve only the first result to match your query, but if you wish to retrieve based on the highest population, you actually have two routes that you can follow: 1- Create a query that brings all the "Pagnacco" cities and loop through the results, selecting the highest population one, or 2 - Create a Cloud Code Function that performs this query and retrieve the result by calling this CCF. More about Cloud Code Functions here: https://docs.parseplatform.org/cloudcode/guide/#cloud-functions

Closed Issuesptvzfjmexeytodpif closed this issue on May 2021
Please enter a comment for this issue.