This repository has been archived by the owner on Aug 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Simple Query Example
william chang(張仲威) edited this page Mar 26, 2018
·
1 revision
{
users: {
id1: {
name: "alovelace",
birth: 1815
},
id2: {
name: "ghopper",
birth: 1906
}
}
}
const query = gql`
query getUsers {
users @rtdbQuery(ref: "/users", type: "Users") @array {
id @key
name
birth
}
}
`;
[{
__typename: "Users",
id: "id1",
name: "alovelace",
birth: 1815
}, {
__typename: "Users",
id: "id2",
name: "ghopper",
birth: 1906
}]
const query = gql`
query getUsers {
users @rtdbQuery(ref: "/users", orderByChild: "birth", limitToFirst: 1, type: "Users") @array {
id @key
name
birth
}
}
`;
[{
__typename: "Users",
id: "id1",
name: "alovelace",
birth: 1815
}]
const query = gql`
query getUsers {
users @rtdbQuery(ref: "/users", orderByKey: true, type: "Users") @array {
id @key
name
birth
}
}
`;
[{
__typename: "Users",
id: "id1",
name: "alovelace",
birth: 1815
}, {
__typename: "Users",
id: "id2",
name: "ghopper",
birth: 1906
}]