Question

I'd like to just use .json files to store data, rather than using a database. Many simple sites have little data, and reading/writing to a file (that can be added to version control) seems adequate, and eliminates the need for database versioning / deployment logistics.

npm: node-store Here's one way to do it, yet I'd need to implement all kinds of query functionality.

I'm really unfamiliar with CouchDB. From the little I've read, it looks like it might use files to store the JSON data, but it might use some kind of disk storage. Can someone shed some light on this?

Does CouchDB store its JSON in text-based files that can be added to version control (git)?

Does anyone know of another text-based storage system with some query functionality?

Was it helpful?

Solution

CouchDB is a full fledged database. The value that gives you above simply using file based storage is additional indexing. Ie., if you do file based then you can either only do key based look ups (the file name) or build your own secondary indexing methodology (symlinks or whatever). Now you're in the database building business instead of the app building business, which is silly because your entire premise seems to be simplicity and focusing on your app.

Also, keep in mind that when you have many (even just 2) people causing writes to your file(s), then you're going to run into either file system locking problems or users overwriting one another.

You're correct though, if you only have a few pieces of information then a single JSON file - basically a config file - is far easier than a database. Especially if people are only reading from the file.

Also, keep in mind that there are Database-as-a-Service solutions that remove the need for DIY install/configure/maintenance/administration. One of them is Cloudant which is based on CouchDB, is API compatible, contributes back, etc. (I work at Cloudant).

OTHER TIPS

Does anyone know of another text-based storage system with some query functionality?

You can use ueberDB module with Dirty file storage.

As far as I remember, this storage just appends your data to the same text file over and over again, so if you really have small dataset, it'll work just fine.

If you data will grow too much, you can always change storage while using the same module.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top