Split the write step in two
Just want to bring this up as a discussion:
In some situations, the user may want to make several changes to their data before committing them to the database.
For example, imagine a post which has an array of category IDs. If the user decides to create a new category while creating a new post, a developer might decide to put these two requests in a submit function. If the category creation request fails BUT the post creation succeeds with a reference to a non-existent category, our data integrity is compromised.
In Rails, SQLAlchemy, and others, they solve this issue by storing a working copy of the DB in session. In SQLAlchemy pseudocode, this looks like...
db.session.add('thing')
db.session.remove('something else')
... perform other operations
db.session.commit()
In addition to abstracting data integrity management to Compass, this also cuts down on the number of requests the user is making.
Of course, this is made slightly more difficult since it's happening on the client... but I'm curious to hear you guys' thoughts.