Facets aren't working with setSetJson
Fohlen opened this issue · 2 comments
Fohlen commented
Howdy! Unfortunately facet's are not quite working as documented.
When I try the following code:
const wellFormedFixtures = [
{ name: 'reprehenderit',
description: 'Cum tempore excepturi qui numquam illo.',
location: { name: 'libero', position: [Object] },
entity: { name: 'maiores', contact: '813 Hayes Ports Bradleyberg' },
source: { name: 'et', url: 'http://clay.name', aggregator: 0 },
'location|date': new Date('2018-12-11T21:21:32.455Z'),
url: 'http://jovanny.org',
images: [ 'http://lorempixel.com/640/480' ] }
]
const transaction = dgraphClient.newTxn()
let mutation = new dgraph.Mutation()
mutation.setSetJson(wellFormedFixtures)
The below query:
{
some_events(func: allofterms(name@., "omnis")) {
uid,
name@.,
location {
uid,
name@.,
position {
expand(_all_)
}
} @facets(date: date),
entity {
name@.
},
source {
name@.
}
}
}
will not include the date
element. However if I manually mutate on ratel via
{
set {
<0x29a> <location> <0x29c> (date=2018-11-22T12:10:04.106Z) .
}
}
it does work fine.
Can you please explain how this is intended to be used, and clarify whether this is a bug or just weirdly documented.
yashafromrussia commented
I had a similar problem. It worked when I put the facet inside of the predicate value:
const wellFormedFixtures = [
{ name: 'reprehenderit',
description: 'Cum tempore excepturi qui numquam illo.',
location: { name: 'libero', position: [Object], 'location|date': new Date('2018-12-11T21:21:32.455Z') },
entity: { name: 'maiores', contact: '813 Hayes Ports Bradleyberg' },
source: { name: 'et', url: 'http://clay.name', aggregator: 0 },
url: 'http://jovanny.org',
images: [ 'http://lorempixel.com/640/480' ] }
]
MichelDiz commented
Yeah, the Right usage is as gorjuspixels shows.