Questions tagged [realm]

Realm, formally known as MongoDB Realm, is an object-oriented database widely used as an alternative to SQLite & ORMs that includes a built-in device-to-cloud data sync. Realm supports a variety of platforms including Android, iOS, Linux, macOS, and Windows.

Realm formally known as MongoDB Realm, is an object-oriented database widely used as an alternative to CoreDate, SQLite & ORMs. Realm supports a variety of platforms including Android, iOS, Linux, macOS, and Windows.

Realm can be used as a local-only data store or synchronized to MongoDB’s multi-cloud database platform Atlas via a built-in, real-time device-to-cloud sync service – Realm Sync.

Originally released in 2016, Realm was acquired by MongoDB in 2019. It remains open source under the Apache License.

Useful Links

9370 questions
265
votes
26 answers

How to find my realm file?

I have created a DB by realm and I am not able to find the file as my OS (Yosemite) dont have a mobile folder in the /private/var/mobile. How should I access my realm to run in the browser? Cross posted from google groups
yoshyosh
  • 13,956
  • 14
  • 38
  • 46
176
votes
12 answers

RealmSwift: Convert Results to Swift Array

What I want to implement: class func getSomeObject() -> [SomeObject]? { let objects = Realm().objects(SomeObject) return objects.count > 0 ? objects : nil } How can I return object as [SomeObject] instead if Results?
Sahil Kapoor
  • 11,183
  • 13
  • 64
  • 87
139
votes
15 answers

How do I view my Realm file in the Realm Browser?

I've just discovered Realm and wanted to explore it in more detail so I decided to create sample application and having a mess around with it. So far so good. However, one thing I haven't been able to work out just yet is how to view my database in…
Andy Joyce
  • 2,802
  • 3
  • 15
  • 24
79
votes
1 answer

Proper Realm usage patterns/best practices?

We're in the process of converting a project to use Realm. We're really impressed so far especially with the Realm Browser (so handy!). As a result, a few questions have come up and we'd like to get some concrete usage patterns down before going any…
lionpants
  • 1,469
  • 14
  • 24
75
votes
2 answers

Realm VS Room in Android

I'm building an app and I need to use a database in it. I'm considering using Room as it's new and hot right now. But I've heard a lot of great stuff about Realm too. Can someone point out the possible advantages of using each? I did my research and…
Rainmaker
  • 10,294
  • 9
  • 54
  • 89
73
votes
8 answers

Using enum as property of Realm model

Is it possible to use an Enum as a property for my model? I currently have a class like this: class Checkin: RLMObject { dynamic var id: Int = 0 dynamic var kind: String = "checked_in" var kindEnum: Kind = .CheckedIn { willSet { self.kind…
Dave Long
  • 9,569
  • 14
  • 59
  • 89
72
votes
13 answers

Realm object has been deleted or invalidated

When I start my app, I perform an API call to see whether there's new data available. The data is stored in my local Realm database, and some of it is displayed in the initial table view controller. Once the API call is finished, I check if some…
padarom
  • 3,529
  • 5
  • 33
  • 57
52
votes
3 answers

Do I understand MongoDB Realm correctly?

There are three components: Realm Database: Local Storage & Persistence Realm Sync: Sync Realm Databases between clients and the Mongo DB Atlas Mongo DB Atlas: A Cloud Database. You can use each separately or together. So you can Just store…
Iskeraet
  • 731
  • 1
  • 6
  • 12
48
votes
5 answers

How to delete object from Realm Database Android?

I want remove all message object from realm those are equal to userid RealmQuery rowQuery = realm.where(Message.class).equalTo(Message.USER_ID, userId); realm.beginTransaction(); //TODO : here I want to remove all messages where userId is…
Pradeep Bishnoi
  • 1,843
  • 2
  • 22
  • 26
48
votes
8 answers

RLMException, Migration is required for object type

I have an object NotSureItem in which I have three properties title whose name is renamed from text and textDescription which I had added later and a dateTime property. Now when I am going to run my app it crashes when I want to add something to…
shahin ali agharia
  • 1,629
  • 4
  • 21
  • 36
45
votes
1 answer

Correct way to retrieve a single object from Realm database

I am absolutely loving Realm (0.92) in combination with Swift but have a question about reading an object from the database. My goal is to retrieve a single object with a known, unique ID (which also happens to be the primary key. All the…
Andy
  • 1,801
  • 3
  • 22
  • 33
44
votes
4 answers

How to set primary key in Swift for Realm model

I'm using Realm in a new iOS Swift project. I'm using Xcode 6.0.1 with iOS SDK 8.0 and Realm 0.85.0 I'm trying to use the new Realm primary key feature so I can do an addOrUpdateObject. Here is a sample model: import Foundation import Realm class…
jeffjv
  • 3,461
  • 2
  • 21
  • 28
43
votes
5 answers

"realm migration needed", exception in android while retrieving values from realm db

I am using Realm as a back end in my application. I have created one table named Setting. I added values in that table, by following the steps given on Realm's official site. But when I am going to retrieve values from that table in, I getting…
Sanket Ranaware
  • 603
  • 2
  • 6
  • 13
42
votes
5 answers

Primary key property 'name' does not exist on object 'RealmSwiftPermissionRole'

I'm using RealmSwift as a database in my swift project. Today, after opening my project in Xcode-beta version 11, my app crash with this error: Terminating app due to uncaught exception 'RLMException', reason: 'Primary key property 'name' does not…
Hamed Ghadirian
  • 6,159
  • 7
  • 48
  • 67
42
votes
6 answers

Clear complete Realm Database

I'm playing around with realm (currently 0.85.0) and my application uses the database to store user-specific data such as the contacts of the current user. When the user decides to log out I need to remove every single bit of information about the…
floriankrueger
  • 2,003
  • 2
  • 16
  • 25
1
2 3
99 100