I am unable to create a list of only string objects
This is how my model looks like
class ProductSummary extends Realm.Object {}
ProductSummary.schema = {
name: 'ProductSummary',
properties: {
productId:'string',
name:'string',
description:'string',
rating:'int',
comments:'int',
categories:{type:'list',objectType:'string'},
images:{type:'list',objectType:'string'},
price:{type:'Price'}
}
};
This is how the response I get from the api
"productSummary": { "links": [], "productId": "PRD_1ola611nd0t", "name": "Sample", "description": "<p>Sample<br></p>", "categories": [ "CAT_1rua60fnd0u" ], "rating": 0, "comments": 0, "tags": [], "image": "http://test.testsite.com/testProject/app-images/189_66164247/189_42527954.jpeg", "price": { "lowest": 100, "highest": 100 } }
I get the following error
Target Type 'string' doesn't Exists for property 'categories'
Am I creating the Category field in the wrong way.
This is a limitation with realm js for react native, a work around is to wrap the list of strings as list of objects (as key value pairs) before doing the db transaction, more info and the status of the issue is tracked in this github issue