CollectionsCollections Database

Sources

Source script

Sources are used to search documents in external APIs such as Google Books. A source is based on two Javascript scripts: Search and Document. For a real example, take a look at the Google Books source included in the Books template.

Search script

The Search script returns a list of results based on the user input. For example, when you search a book by title, the script sends a request to the Google Books API and returns a list of results that will be presented to you.

Document script

The Document script inserts a new document in the collection. It receives one or more parameters from the Search script, sends a new request if needed, and insert a document.

Library script

The Library script is an additional script shared between the Search and Document ones. You can put your classes or functions in it.

Tip: use the keyboard shortcut Cmd ⌘ + S to save the scripts without closing the editor.

Documentation

You can find the full documentation at this page: Javascript API.