问题
Does the realm.io database support multi column indexes or sorted indexes?
The documentation does not mention these features, but that seems odd since Realm is billed as a replacement for core data.
回答1:
Yep!
Realm lets you define multiple indexed properties in a single object class by overriding the
indexedPropertiesclass method and returning an array of the names of the properties you wish to index. Realm mentions this in the documentation here.You can sort objects by an index (Or any other property for that matter) by using the
[RLMResults sortedResultsUsingProperty:ascending:]after querying for a group of objects. That's covered in the documentation here.
Please let me know if you require any additional clarification. :)
来源:https://stackoverflow.com/questions/33978682/does-the-realm-io-database-support-multi-column-indexes-or-sorted-indexes