G’day Folks @Lawgiver2, @Raymond_Michael,
I acknowledge the time since you asked this question.
I hope you have been able to find a solution to this. If not, and for the others who have stumbled upon this.
Option 1: To remove the constructors entirely from your schema:
import {ObjectId} from 'bson';
class Track {
static schema = {
name: 'Track',
properties: {
_id: 'objectId',
_partition: 'string?',
trackName: 'string',
streetAddress: 'string',
city: 'string',
state: 'string',
zipCode: 'int',
trackType: 'string',
availability: 'string',
},
primaryKey: '_id',
};
}
export {Track};
class User {
static schema = {
name: 'User',
properties: {
_id: 'objectId',
_partition: 'string?',
username: 'string',
password: 'string',
email: 'string',
homeCity: 'string',
state: 'string',
},
primaryKey: '_id',
};
}
export {User};
Option 2: In the current code, if you add .schema
after the schema class name, as shown in Tutorial.
Change the code statement
const realm = await Realm.open({schema: [Track]});
to
const realm = await Realm.open({schema: [Track.schema]});
I hope this helps resolve your issue. Please feel free to ask if you have more questions.
Cheers,