The Telerik Platform product is retired.Learn more

Working with Telerik Platform Data

Working with Telerik Platform Data

The Backend Services JavaScript SDK works with plain JavaScript objects. It does not require a proprietary model like some JavaScript frameworks do.

To work with data stored in Telerik Platform, you need to first specify the content type that you want to work with. Having done that, you can call data methods to create, read, update, delete, and otherwise manipulate data.

Working with external data from Data Connectors follows the exact same workflow because the data is always mapped to Telerik Platform content types.

Accessing Content Types

You need to specify a content type name to work with when accessing Backend Services data. To do that, call the data() method of your Everlive instance and pass the content type name to it. This method returns a new collection instance that can be queried to perform the basic CRUD operations.

var el = new Everlive('your-app-id');
var books ='Books');
        // ...

Each Everlive instance has a predefined collection object for the Users content type that allows for User Management. This object has a few additional methods such as register() and login().

How Telerik Platform Types Map to JavaScript Types

The next table shows how the Telerik Platform value types are translated to JavaScript property types.

Telerik Platform Type JavaScript Property Type
Id UUID string
Text string
Number number
Yes/No boolean
Date and Time Date
File UUID string
Object Plain JavaScript object
Geo Point Plain JavaScript object { "longitude": number, "latitude": number }
Array Array

Working with Undefined Content Type Fields

The Backend Services JavaScript SDK keeps the Telerik Platform content types' fields' names which means that fields that are not present in the structure of a content type can also be persisted and retrieved. This is unlike relational databases where you must always adhere to the predefined table structure.

Assume that you have a content type called Books that defines three fields in its structure: Title, Author, and Price. You can add the non-predefined field Notes to a given instance of the Books type and you will still be able to save and read this field.

var el = new Everlive('your-app-id');
var book = new Book('author', 'title', 'price');
book['Notes'] = 'A very interesting book.';'Books').updateSingle(book);

Querying Data

When you need to make more elaborate queries to read, update, or delete Telerik Platform data, create an instance of the Query class. Then use its methods to specify filters, sorting, paging, and so on.

var el = new Everlive('your-app-id');
var books ='Books');

var query = new Everlive.Query();
query.where().eq('Author', 'Sample Text');

books.get(query) // filter
        // ...

See Also

Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.