alabid / flylatex

FlyLatex: A Realtime Collaborative Environment (with a concurrent editor) in node-js.
766 stars 85 forks source link

NewLines should not be stored in the DB as they never get deleted #27

Closed DavidSichau closed 11 years ago

DavidSichau commented 11 years ago

Removed the saving of DocumentLine to the DB.

The DocumentLine were previously stored in the DB as an own collection.

However the DocumentLine were also stored in the document (where they actually belong to).

As an DocumentLine collection does not have any connection with an document if they are stored as an collection in the DB they were also never deleted. To avoid to get a DB full of DocumentLine entries, I switched of the storage of them.

DavidSichau commented 11 years ago

What is the design decision behind storing the individual lines in the DB?

Because it might be easier to store file as one entry in the DB?

alabid commented 11 years ago

MongoDB restricts the size of a document in any collection to 16MB (when I wrote FlyLatex, it was 4MB) so if you had a document that exceeded the 4MB limit, it gave an error. So I split each document into "lines" of 1024 bytes (should be adjustable in the future). I'm still yet to really look your pull request. I've been really busy. I'll look into it today or tomorrow.

alabid commented 11 years ago

Hey @DavidSichau , you are right in that, there's duplication of data. Also, my worries about document limits has been taken care of. Very few documents will have size 16MB. So, I'd have to re-architecture storage of data by making changes to routes.js and models.js. I hope to finish this weekend. I'd close this ticket immediately I'm done with that. Thanks!