Skip to main content

Global Address Book

Using Streams

On GDN

EmailPassswordGeo FabricCollectionGUISource Code
[email protected]xxxxxxxx_systemaddressesAddressBookgithub

Populate addresses collection with data:


// Query to insert addresses
FOR persons IN [
{ firstName: "Joseph", lastName: "Smith", email: "[email protected]" },
{ firstName: "Astrid", lastName: "Young", email: "[email protected]" },
{ firstName: "Boris", lastName: "Balastikov", email: "[email protected]" },
{ firstName: "Sherlock", lastName: "Jones", email: "[email protected]" },
{ firstName: "Alpha", lastName: "Simpson", email: "[email protected]" },
{ firstName: "Jose", lastName: "Garcia", email: "[email protected]" },
{ firstName: "Lee", lastName: "Ki", email: "[email protected]" },
{ firstName: "Mark", lastName: "Goldfine", email: "[email protected]" },
{ firstName: "Ramesh", lastName: "Sriram", email: "[email protected]" }
]
INSERT persons INTO addresses

Queries for RESTQL

Query Name: addAddress

INSERT { firstName: @firstName, lastName: @lastName, email: @email }
INTO addresses

Query Name: getAddresses

FOR address IN addresses
RETURN address

Query Name: updateEmail

UPDATE { _key: @key }
WITH { email: @email }
IN addresses

Query Name: removeAddress

REMOVE { _key: @key} 
IN addresses

Using RESTQL

GDN

EmailPassswordGeo FabricCollectionGUISource Code
[email protected]xxxxxx_systemaddressesAddressBook (RESTQL)github

Note: The demo app automatically creates the following RESTQLs as part of startup.

insertAddress:

INSERT { firstName: @firstName, lastName: @lastName, email: @email}
INTO addresses

getAddresses:

FOR entry IN addresses
RETURN entry

removeAddress:

REMOVE @_key IN addresses

updateAddress:

UPDATE @_key
WITH { firstName: @firstName, lastName: @lastName, email: @email }
IN addresses