{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/3179","repository_url":"https://api.github.com/repos/realm/realm-cocoa","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3179/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3179/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3179/events","html_url":"https://github.com/realm/realm-cocoa/issues/3179","id":131613241,"number":3179,"title":"How to use LIKE Operator in Realm at the time of query.","user":{"login":"anandkumarsharma","id":10652590,"avatar_url":"https://avatars.githubusercontent.com/u/10652590?v=3","gravatar_id":"","url":"https://api.github.com/users/anandkumarsharma","html_url":"https://github.com/anandkumarsharma","followers_url":"https://api.github.com/users/anandkumarsharma/followers","following_url":"https://api.github.com/users/anandkumarsharma/following{/other_user}","gists_url":"https://api.github.com/users/anandkumarsharma/gists{/gist_id}","starred_url":"https://api.github.com/users/anandkumarsharma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anandkumarsharma/subscriptions","organizations_url":"https://api.github.com/users/anandkumarsharma/orgs","repos_url":"https://api.github.com/users/anandkumarsharma/repos","events_url":"https://api.github.com/users/anandkumarsharma/events{/privacy}","received_events_url":"https://api.github.com/users/anandkumarsharma/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/T:Help","name":"T:Help","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"mrackwitz","id":1389011,"avatar_url":"https://avatars.githubusercontent.com/u/1389011?v=3","gravatar_id":"","url":"https://api.github.com/users/mrackwitz","html_url":"https://github.com/mrackwitz","followers_url":"https://api.github.com/users/mrackwitz/followers","following_url":"https://api.github.com/users/mrackwitz/following{/other_user}","gists_url":"https://api.github.com/users/mrackwitz/gists{/gist_id}","starred_url":"https://api.github.com/users/mrackwitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrackwitz/subscriptions","organizations_url":"https://api.github.com/users/mrackwitz/orgs","repos_url":"https://api.github.com/users/mrackwitz/repos","events_url":"https://api.github.com/users/mrackwitz/events{/privacy}","received_events_url":"https://api.github.com/users/mrackwitz/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-02-05T10:59:13Z","updated_at":"2016-02-05T15:02:20Z","closed_at":"2016-02-05T15:02:20Z","body":"I am getting problem related to LIKE operator, at the time of Queries.\r\n\r\nI have this query in sqlite3:\r\n\r\n   NSString *sqlQuery = [NSString stringWithFormat:@\"SELECT * FROM ServiceAccountsTbl WHERE      serviceModes LIKE '%%%@%%'\",serviceMode];\r\n\r\n  Query of above sqlQuery :\r\n        SELECT * FROM ServiceAccountsTbl WHERE serviceModes LIKE '%Email%'\r\n\r\nEquivalent of above query, I have tried in Realm as follows:\r\n\r\n RLMResults *allResults;\r\n\r\n NSPredicate *pred = [NSPredicate predicateWithFormat:@\"serviceModes LIKE[c] %@\",serviceMode];\r\n allResults = [ServiceAccountsModel objectsWithPredicate:pred];\r\n\r\nBut i am not getting success, please help."},"comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments/180390858","html_url":"https://github.com/realm/realm-cocoa/issues/3179#issuecomment-180390858","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3179","id":180390858,"user":{"login":"mrackwitz","id":1389011,"avatar_url":"https://avatars.githubusercontent.com/u/1389011?v=3","gravatar_id":"","url":"https://api.github.com/users/mrackwitz","html_url":"https://github.com/mrackwitz","followers_url":"https://api.github.com/users/mrackwitz/followers","following_url":"https://api.github.com/users/mrackwitz/following{/other_user}","gists_url":"https://api.github.com/users/mrackwitz/gists{/gist_id}","starred_url":"https://api.github.com/users/mrackwitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrackwitz/subscriptions","organizations_url":"https://api.github.com/users/mrackwitz/orgs","repos_url":"https://api.github.com/users/mrackwitz/repos","events_url":"https://api.github.com/users/mrackwitz/events{/privacy}","received_events_url":"https://api.github.com/users/mrackwitz/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T15:02:20Z","updated_at":"2016-02-05T15:02:20Z","body":"`LIKE` is not supported yet as operator in NSPredicates by Realm, as seen in #1490. In general please refer to our [predicate cheatsheet for an overview of supported operators](https://realm.io/news/nspredicate-cheatsheet/).\r\nFor your specific query here, it seems like you could easily workaround this limitation by falling back to using just the `CONTAINS` operator like that:\r\n```objc\r\n[NSPredicate predicateWithFormat:@\"serviceModes CONTAINS %@\", serviceMode];\r\n```"}}