Clarified Question: how to set a type with SetNquads

Hi there, I was wondering how I can create a new node with a specific Type with SetNquads ie:

type Document {
  title string
  content string
  created datetime
  modified datetime

Here’s an example struct:

node := Document {
  title: "hello",
  content: "foobar",
  created: time.Time(),
  modified: time.Time()

How can I create a new Document record with an N-quad then assert all the individual properties to it? I want to pass them into SetNQuad in my mutation.


Hey @ddibiase, welcome back!

The type information in Dgraph is stored under dgraph.type edge which has underlying type of [string]. See In SetNquads, this would just be another edge with a string value which is the type of the node.

Thanks Pawan. We’re re-evaluating dgraph for a new project. You’ll hear from me quite a bit I’d imagine :-p a lot has changed since we last used Dgraph, great to see the progress! :slight_smile:

Let me give this a try and get back to you.