MongoDB.live, free & fully virtual. June 9th - 10th. Register Now MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

GraphQL: Use of mathematical functions

Hello,
it is possible to use mathematical functions in GraphQL-Queries?
For example i want to do something like this:

  1. query { addresses(query: “sin(field1)+sin(field2)<field3”) {Id}}
  2. query { addresses(query: “Street = ‘myStreet’ AND City = myCity”) {Id, sin(field1),sin(field2)}}

where sin is the sinus-function.

best regards

Volkhard Vogeler

@Volkhard_Vogeler Math functions are not currently part of Realm’s GraphQL API. Supported queries are based on objects & relationships. For more details, see How to use the Realm GraphQL API: Queries.

However, your examples look like fields that could be pre-calculated and included in the saved object (which would also be more efficient to query).

Regards,
Stennie

1 Like

Hello Stennie,
thanks for this informations.
i know - the sample is a liitle bit too simple - it is just for clarifying, what i wanted to do (e.g. Radius-Search)

best regards

Volkhard

Thanks for the further info. As a workaround you could perhaps use a geocoding system like geohash. There are several implementations of this including libraries for generating covering geohashes for radius searches (for example: ProximityHash).

You can also create a feature suggestion with more details on your use case at the MongoDB Feedback site so others can upvote & watch the suggestion for updates.

Regards,
Stennie