Skip to main content

Global Address Book

Using Streams

On GDN

EmailPassswordGeo FabricCollectionGUISource Code
demo@macrometa.ioxxxxxxxx_systemaddressesAddressBookgithub

Populate addresses collection with data:


// Query to insert addresses
FOR persons IN [
{ firstName: "Joseph", lastName: "Smith", email: "jsmith2020@gmail.com" },
{ firstName: "Astrid", lastName: "Young", email: "missmoneybags@young.co.sg" },
{ firstName: "Boris", lastName: "Balastikov", email: "bb@refundit.com" },
{ firstName: "Sherlock", lastName: "Jones", email: "pd@elementary.org" },
{ firstName: "Alpha", lastName: "Simpson", email: "alf@simpsonrealtech.com" },
{ firstName: "Jose", lastName: "Garcia", email: "j.garcia@nebulus.com" },
{ firstName: "Lee", lastName: "Ki", email: "Lee.ki@symbol.com" },
{ firstName: "Mark", lastName: "Goldfine", email: "mark@tidalwave.com" },
{ firstName: "Ramesh", lastName: "Sriram", email: "ramesh@lifely.com" }
]
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
demo@macrometa.ioxxxxxx_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