Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ /

Read Properties

On this page

  • Filter by Property Type
  • Query Collections (List, Set, Dictionary)
  • Query Geospatial Data
  • Query a Mixed Property
  • Query a Custom Persistable Property
  • Filter by Property Behaviors
  • Find an Object by Primary Key
  • Filter by Remapped Property Name
  • Filter a Full-Text Search Property
  • Filter Relationships

This page describes how to read and query specific property types, and properties that have special behaviors, with Atlas Device SDK.

For other information related to reading data from the database, refer to:

  • Read Objects: General information about read operations, including information on how to access, sort, and limit results.

  • Information about specific query APIs and supported operators:

The SDK provides several shapes to simplify querying geospatial data. You can use the circle, polygon, and box shapes to set the boundaries for your geospatial data queries.

To query geospatial data:

  1. Define a geospatial shape representing the bounds within which you want to query data.

  2. Use the geospatial shape in a query with the relevant geospatial query operators.

After you define a geospatial shape, you can use these shapes in a geospatial query.

2 GeoPoints
click to enlarge

A Generic (Mixed) Data Type property represents a polymorphic value that can hold any one of its supported data types at a particular moment. You can query a mixed property the same way you would any property.

A mixed data type can hold collections (a list or dictionary, but not a set) of mixed elements. You can use mixed collections to model unstructured or variable data. For more information, refer to Model Unstructured Data.

  • You can nest mixed collections up to 100 levels.

  • You can query mixed collection properties and register a listener for changes, as you would a normal collection.

  • You can find and update individual mixed collection elements

  • You cannot store sets or embedded objects in mixed collections.

For details about supported operators and list comparisons, refer to the Mixed Properties with Nested Data documentation.

When you use type projection to map unsupported types to supported types, accessing those properties is often based on the persisted type.

Finding a specific object by its primary key is a common operation, which some of the SDK languages support through a dedicated method.

Tip

Device Sync Always Uses _id as Primary Key

If you use Atlas Device Sync, you can always query by the primary key field _id. This is because the Device Sync data model requires objects have a primary key named _id. For more information, refer to Model Data with Device Sync.

If your data model includes stored property names that you have mapped to different names, you can filter by both the mapped property name used in your code and the stored property name that's persisted in the database.

If your data model includes a Full-Text Search (FTS) index property, you can filter by the property using the TEXT predicate. Words in the query are converted to tokens by a tokenizer using the following rules:

  • Tokens can only consist of characters from ASCII and the Latin-1 supplement (western languages). All other characters are considered whitespace.

  • Words split by a hyphen (-) are split into two tokens. For example, full-text splits into full and text.

  • Tokens are diacritics- and case-insensitive.

You can search for an entire word or phrase, or limit your results with the following characters:

  • Exclude results for a word by placing the - character in front of the word. For example, fiction -science would include all search results for fiction and exclude those that include the word science.

  • Specify prefixes by placing the * character at the end of a word. For example, fict* would include all search results for fiction and fictitious. The SDK does not currently support suffix searches.

The SDK returns a Boolean match for the specified query, instead of a relevance-based match.

A to-one relationship property maps to a single instance of another object type. You can filter by the relationship property using dot notation, the same way you would a nested object.

The SDK requires to-one relationships to be optional. Your code should handle the possible nil or null value.

To-many relationships properties are collections to another object type:

You can filter by and iterate through the relationship property the same way you would any other collection property.

An inverse relationship links an object back to any other objects that refer to it in a defined to-one or to-many relationship. Relationship definitions are unidirectional, so you must explicitly define a property in the object's model as an inverse relationship.

When you follow an inverse relationship, the result may include zero or more objects. You must access the collection to work with an originating object.

← Read
Update →