Sorry for the late reply, I didn’t receive any notifications by mail or overlooked them in all the spam.
Well no, I’m just looking for means to say…
this data type has these indices
and this one has those
In a translated, SQL, sense yes you could say it’s like every table has their own schema.
The way I see dgraph is
It’s 1 giant MongoDB collection (because a MongoDB collection’s content is also undefined or doesn’t have a schema apart from the _id field being bson.ObjectId by default if not overwritten)
Now I can define a schema
schema
actually I forgot how to write a schema, now that I’ve been absent like 2 weeks, let’s see
mutation {
schema {
name: string @index(exact, fulltext) @count .
}
}
how we have some data types
type Person struct {
Name string
Age uint
}
and it just happens to also have a data type of Profile, which also has a Name field
type Profile struct {
Name string
}
maybe the name example isn’t the best example.
Basically when setting a “schema” which is essentially a “index those fields in those ways” and “treat them as being this”
Here’s a good example
type Article struct {
created time.Time
}
type Order struct {
created uint64 // because it's a unix timestamp
}
Those 2 mean the same thing but their field members are different.
So you can’t have 2 nodes with the same predicate be different types.
You could just not mention those fields in the schema, but how would you query?
Regarding documenation, it’s not clear how to create a schema with the Go client.
I’ll create an issue.
The 0.9 client (the 0.8 one is even more confusing)
SchemaUpdate
https://godoc.org/github.com/dgraph-io/dgraph/protos#SchemaUpdate
is used in
Dgraph.CheckSchema
https://godoc.org/github.com/dgraph-io/dgraph/client#Dgraph.CheckSchema
What does CheckSchema mean? Is that how you define a schema?
If so what does a schemadefinition look like in this context?
Let’s take this schema definition from the documentation
mutation {
schema {
name: string @index(exact, fulltext) @count .
age: int @index(int) .
friend: uid @count .
dob: dateTime .
location: geo @index(geo) .
occupations: [string] @index(term) .
}
}