Map Field

Simple Query

Sample Map Query - Latitude + Longitude

{
shops {
location {
latitude
longitude
}
}
}

Output

{
"data": {
"shops": [
{
"location": {
"latitude": 48.7,
"longitude": -122.5
}
}
]
}
}

Sample Map Query - Distance Between

{
shops {
location {
distance(from: {
latitude: 47.6,
longitude: -122.3
})
}
}
}

Output

{
"data": {
"shops": [
{
"location": {
"distance": 122616.8
}
}
]
}
}

Mutating a Map

Mutation

mutation {
createShop(data: {
title: "Delight Coffee",
location: {
latitude: -18.1,
longitude: 178.4
}
}) {
title
location {
latitude
longitude
}
}
}

Output

{
"data": {
"createShop": {
"title": "Delight Coffee",
"location": {
"latitude": -18.1,
"longitude": 178.4
}
}
}
}

Were you expecting something more?

We are constantly contributing to our documentation, but if you spot something we're missing, let us know and we'll be sure to add it.

This site uses cookies to provide you with a better user experience. For more information, refer to our Privacy Policy