Matt Blair

Matt Blair

I read that you learn more from a poor example than from a correct one. I don't believe this but that means my site will be a success.

2-Minute Read

Been playing around with Derby in my spare time. The idea behind the platform is smart - using node and express, you write one set of code, and that code automatically syncs data between browsers, servers, and a database.

Derby is still raw. The documentation is comprehensive but puts important information about the same topic in different places.

I’ve culled the following eight lines of documentation of defining models from the documentation:

Racer Paths Racer paths are translated into database collections and documents using a natural mapping: collection.documentId.document All synced paths (anything that doesn’t start with an underscore) must follow this convention. In other words, all model data stored at the first two path segments should be an object and not a string, number, or other primitive type.

** Private paths** Paths that contain a segment starting with an underscore (e.g. _showFooter or flowers.10._hovered) have a special meaning. These paths are considered “private,” and they are not synced back to the server or to other clients. Private paths are frequently used with references and for rendering purposes.

Now, this information is useful if you’re trying out the model system for the first time. The most important line (at least for my initial playing around), was this one:

In other words, all model data stored at the first two path segments should be an object and not a string, number, or other primitive type.

What this means: if, in creating your first model, you trying something like this: model.set('people', []); you will get an error. model.set('myApp.containers.people', []); will work just fine.

A follow up to this post is here.

Recent Posts

Categories

About

This theme was developed for Hugo.