reactjs - Realm JS Create objects with primitive data type list -


i unable create list of string objects

this how 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 how response 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 following error

target type 'string' doesn't exists property 'categories'

am creating category field in wrong way.

this limitation realm js react native, work around wrap list of strings list of objects (as key value pairs) before doing db transaction, more info , status of issue tracked in github issue


Comments