3

Is there any NoSQL database or "ready to use solution" which combines duplicating data by application needs for fast reading and relations of data for data integrity with auto distribution of changes to duplicated data?

Example:

Entities:

Topic
  - id
  - title
  - first_comment_id

Comment
  - id
  - topic_id
  - text

Documents / Materialized Views:

TopicList
  - topic_id
  - topic_title
  - first_comment_text

When I change topic title, change will be distributed to every documents containing this property at database layer. So integrity would be managed by database.

I really like MongoDB with its schema-less behavior, so Oracle or other relational databases is not solution.

vaclav_o
  • 1,705
  • 3
  • 15
  • 24
  • Question, do materialized views in a Sql RDBMS not meet your needs? Why does it need to be NoSql when what you're describing exists in Oracle, Sql Server, MySql, etc... – Michael Fredrickson Jan 10 '13 at 22:26
  • I really like schema-less MongoDB with posibility of nested documents.. I will specify it in my question better ;) – vaclav_o Jan 10 '13 at 22:35

1 Answers1

1

I have some experience with Mongo and joining entities/documents, so I'll contribute an answer towards that. You can create a map/reduce query in Mongo that outputs to a collection. The behavior is really nice and avoids issues with reading from the newly created collection before it's "ready" (before map/reduce finishes running etc.)

To keep that collection updated I've used an external process to issue the map/reduce function on a schedule. It allows you to be a bit more arbitrary with your queries.

I suppose this would also manage consistency as each entity would be authoritative and when the temporary collection was generated again, you would see the changes. The caveat of course is that it wouldn't be real time.

ryan1234
  • 7,237
  • 6
  • 25
  • 36
  • It's good idea, but the real time treatment is needed. Also, does it generates all collection each time? It would be very inefficient when managing lot of entities. – vaclav_o Jan 11 '13 at 10:13
  • It generates the entire collection each time. That's how it maintains the integrity of the entities. For large "joins" or for two entities where you have a lot of documents ... it would be slow. Definitely not real time. But if you are looking at any NoSQL solution it's assumed data won't be consistent. You're working against the grain to try and enforce consistency. – ryan1234 Jan 11 '13 at 17:54
  • I just remembered this from a sponsored Twitter ad (geez): http://www.foundationdb.com/ Claims to do NoSQL and ACID. Haven't checked it out, but maybe worth a look? – ryan1234 Jan 11 '13 at 18:11