From 1121d28f3b93b646ea910e3acfb4b6cb8505e017 Mon Sep 17 00:00:00 2001 From: Abhimanyu Singh Gaur <12651351+abhimanyusinghgaur@users.noreply.github.com> Date: Tue, 15 Sep 2020 15:25:08 +0530 Subject: [PATCH] add docs about list acting as unordered set --- wiki/content/graphql/schema/types.md | 4 +++- wiki/content/query-language/schema.md | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wiki/content/graphql/schema/types.md b/wiki/content/graphql/schema/types.md index 6374eaa77e4..c474e54f7d2 100644 --- a/wiki/content/graphql/schema/types.md +++ b/wiki/content/graphql/schema/types.md @@ -11,7 +11,9 @@ This page describes how you use GraphQL types to set the Dgraph GraphQL schema. Dgraph GraphQL comes with the standard GraphQL scalars: `Int`, `Float`, `String`, `Boolean` and `ID`. There's also a `DateTime` scalar - represented as a string in RFC3339 format. -Scalars `Int`, `Float`, `String` and `DateTime` can be used in lists. All scalars may be nullable or non-nullable. +Scalars `Int`, `Float`, `String` and `DateTime` can be used in lists. Note that lists behave like an unordered set in Dgraph. For example: `["e1", "e1", "e2"]` may get stored as `["e2", "e1"]`, i.e., duplicate values will not be stored and order may not be preserved. + +All scalars may be nullable or non-nullable. The `ID` type is special. IDs are auto-generated, immutable, and can be treated as strings. Fields of type `ID` can be listed as nullable in a schema, but Dgraph will never return null. diff --git a/wiki/content/query-language/schema.md b/wiki/content/query-language/schema.md index b7b81e9d8db..cb7265e51d2 100644 --- a/wiki/content/query-language/schema.md +++ b/wiki/content/query-language/schema.md @@ -435,8 +435,7 @@ For predicates with the `@count` Dgraph indexes the number of edges out of each ## List Type Predicate with scalar types can also store a list of values if specified in the schema. The scalar -type needs to be enclosed within `[]` to indicate that its a list type. These lists are like an -unordered set. +type needs to be enclosed within `[]` to indicate that its a list type. ``` occupations: [string] . @@ -448,6 +447,7 @@ score: [int] . * Querying for these predicates would return the list in an array. * Indexes can be applied on predicates which have a list type and you can use [Functions]({{}}) on them. * Sorting is not allowed using these predicates. +* These lists are like an unordered set. For example: `["e1", "e1", "e2"]` may get stored as `["e2", "e1"]`, i.e., duplicate values will not be stored and order may not be preserved. ## Filtering on list