AttributeJoinedData

Summary

Joined Data attributes allow you to store certain attributes of an object in a separate table in the database. We use this attribute type for Message bodies. Storing message bodies, which can be very large, in a separate table allows us to make queries on message metadata extremely fast, and inflate Message objects without their bodies to build the thread list.

When building a query on a model with a JoinedData attribute, you need to call include to explicitly load the joined data attribute. The query builder will automatically perform a LEFT OUTER JOIN with the secondary table to retrieve the attribute:

DatabaseStore.find(Message, '123').then (message) ->
  // message.body is undefined

DatabaseStore.find(Message, '123').include(Message.attributes.body).then (message) ->
  // message.body is defined

When you call persistModel, JoinedData attributes are automatically written to the secondary table.

JoinedData attributes cannot be queryable.

results matching ""

    No results matching ""