I am having a field named “listID” as string in my documents. While querying using iOS SDK I have to use orderBy property. Since “listID”(it is int) is saved as string So orderBy(Ordering.property(“listID”).descending()) is treating it as string. Is there any way to typecast any property to Int in query?
have you tried using SQL++/N1QL query, with
toNumber() function and
let q = try self.db.createQuery("SELECT indexInString, toNumber(indexInString) FROM _ ORDER BY toNumber(indexInString) ASC")
Thank you for responding Jayahari, Yes, Above query is working. But I need query in Couchbase lite iOS SDK.Can you please help me.
If you are using CouchbaseLite 3.0, you could use the SQL++/N1QL query string in it?
Thank you Jayahari, Updated Couchbase Lite SDK to 3.0. Now its working.