asd123
asd123

Reputation: 69

Error when doing query on RealmList<String> in realm 4.1.1

I have read that new realm update supports RealmLists of String, Integer and similar objects, so I decided to change RealmList<RealmString> to RealmList<String> in one of my realm objects. RealmString was my realm object which contained only String value field. When I was doing a query to see if that list contained specific value I would write
query.contains("nameList.value", name, Case.INSENSITIVE);
and it worked. After change I replaced the code with
query.contains("nameList", name, Case.INSENSITIVE);
however, now I'm getting following error:

java.lang.IllegalArgumentException: Invalid query: field 'nameList' in class 'RealmTimelineItem' is of invalid type 'STRING_LIST'.
                                                                 at io.realm.internal.fields.FieldDescriptor.verifyColumnType(FieldDescriptor.java:277)
                                                                 at io.realm.internal.fields.FieldDescriptor.setCompilationResults(FieldDescriptor.java:250)
                                                                 at io.realm.internal.fields.CachedFieldDescriptor.compileFieldDescription(CachedFieldDescriptor.java:92)
                                                                 at io.realm.internal.fields.FieldDescriptor.compileIfNecessary(FieldDescriptor.java:285)
                                                                 at io.realm.internal.fields.FieldDescriptor.getColumnIndices(FieldDescriptor.java:178)
                                                                 at io.realm.RealmQuery.contains(RealmQuery.java:1378)  

Can queries be done on String realm list, or do I have to wrap it in some RealmObject, or is it maybe issue with my query.

Upvotes: 1

Views: 2082

Answers (1)

EpicPandaForce
EpicPandaForce

Reputation: 81539

4.0.0 (2017-10-16)

RealmList can now contain String, byte[], Boolean, Long, Integer, Short, Byte, Double, Float and Date values. Queries and Importing primitive lists from JSON are not supported yet.

See the changelog.

Upvotes: 3

Related Questions