Hacker News new | ask | show | jobs
by brmunk 3424 days ago
Realm certainly has a schema - anything that made you think it doesn't? It's ACID and Serializable.

It also has a query language. But as one of the core design principles is to be as native to the language and platform as possible, the query language takes different forms. In Java it's a fluent API, in Cocoa it's NSPredicates string based. And the JS string based is roughly identical to that as well.

It's absolutely designed to be offline first. I'm curious as to which limitations you see with that?

Operational Transform is used to resolve conflicts at the property level, so I would say it's much more fine-grained than most other systems that would overwrite entire objects. The specific resolution rules are very simple and intuitive and how to deal with custom needs are described here: https://realm.io/docs/realm-object-server/#conflict-resoluti.... There is ordered lists already and explicit counters are being exposed in the SDKs at the moment.

You might find this article useful as well: https://realm.io/news/eventually-consistent-making-a-mobile-...

1 comments

I couldn't, and still can't, find any documentation or "list of features" that mention schema support, query language or ACID semantics. The documentation is pretty sparse and disorganized.

(By query language I don't mean an opaque builder based on NSPredicates or whatever, I mean a query language, written as text, which is portable across clients.)

OT is great, but it doesn't have that until it's actually exposed. My pet use case is string edits, which absolutely need to be cleanly conflict-resolvable.

The inconvenience with offline-first is that by definition you're never operating on current data: You have to sync to a central server before the data is visible to others, and you're editing potentially stale data. The latency of inbound syncing is particularly dependent on the volume of changes being sent from upstream, which might require that a client, so as not to be overwhelmed with updates, subscribe to a very small subset of the entire dataset. For example, if you open up a UI that edits a single document, you might want to subscribe to changes to only that document, in order to update the UI in real time. I don't know if that's even possible with Realm, or if you can in fact run it in "classic client/server" (i.e. "online first") mode.

Why would you want a text-based query language if you are an idiomatic C# programmer? Every database product on that platform is queried through the standard LINQ syntax - that's why we implemented it that way.
I'm not an idiomatic C# programmer, but having a text-based language is really useful in all sorts of situations:

* Interactive REPL (think psql)

* Use outside of C#, e.g. small bash scripts for automation of small tasks such as deleting old records in a cron job

* Copy/paste a into Slack, Github issues etc. without having to drag along any dependent code or worrying that it's not a complete query

Query builders are nice, but eventually they have to compile down to something "neutral" and portable.