Adding array of geo gives "Input for predicate example.Loc of type scalar is uid"

Moved from GitHub dgo/11

Posted by commesan:

When using:


type loc struct {
		Type   string    `json:"type,omitempty"`
		Coords []float64 `json:"coordinates,omitempty"`
	}

	type Tracker struct {
		Uid  string `json:"uid,omitempty"`
		Name string `json:"example.Name,omitempty"`
		Loc  []loc  `json:"example.Loc,omitempty"`
	}

	t := Tracker{
		Name: "Tom Baker",
		Loc: []loc{
			{
				Type:   "Point",
				Coords: []float64{1.1, 2},
			},
			{
				Type:   "Point",
				Coords: []float64{1.9, 5},
			},
		},
	}

And mapping:

	example.Name: string @index(exact) .
	example.Loc: [geo] @index(geo) .

I get Input for predicate example.Loc of type scalar is uid

When using geo as a list the parser seems to view the geojson types as nodes instead of scalars.

Btw I’ve heard that the python client seems to have the same problem.

commesan commented :

Sorry, more an issue with setjson of dgraph itself. Will open issue there.