Remap a Property - React Native SDK
On this page
Overview
To use a different property name in your code than is stored in
Realm Database, set mapTo
to the name of the property as it appears in
your code.
Example
A developer opens a realm using the following Dog
object schema.
Realm Database stores each dog's first name with the snake case
first_name
property. The schema maps the property to firstName
for
objects used in JavaScript code.
const DogSchema = { name: "Dog", properties: { _id: "string", first_name: { type: 'string', mapTo: 'firstName' } }, primaryKey: '_id' };