Docs Menu

Docs HomeRealm

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'
};
←  Define a Default Property Value - React Native SDKRelationships - React Native SDK →

On this page

Share Feedback
© 2023 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.