Not sure what you mean exactly by 1 and 4 though.
The usual workaround to that is to create subdirectories based on the first few characters of the filename.
Since you're using bash, you could do something like:
$ echo 1df8be33-4392-471a-99af-3df967b87cb6 |sed -e 's/^\(.\)\(.\)/\1\/\2\/\1\2/'
1/d/1df8be33-4392-471a-99af-3df967b87cb6
Edit: You may want more than 2 levels of directories, or directories with 2 character names instead of 1, etc. Apache's mod_cache defaults to 2 levels of 2 character names, but the filenames are base 64, so more possibilities than hex.With 4, I find once a directory has about 100,000 files in it, things get bad, from the simple (ls * won't work) to the nastier (git starts using huge amounts of space, you'll hit github's size limit even though all your files are quite small).
You could just as do stuff like "int x=1; assert(x == 1);" and so on. And it would be just as futile.
Many systems are relying on the statistical improbability of 32-hexdigits uuid collision (name-dropping one - Disque).
For instance, if you run this database on Linux, the RAM overhead for each document is 1K just for the file handle, see the comment at the bottom here http://lxr.free-electrons.com/source/fs/file_table.c
New version is 1.1.0 (https://github.com/nodesocket/jsonlite/releases/tag/1.1.0) if you care.
Instead, there are two tiny tests, and I found a couple of issues in 30 seconds of looking at the code.
EDIT: I should prove my point.
1) Race condition on calculating uuid (obviously won't be too serious for a good uuid implementation)
2) No check that file is written successfully.
3) No check when json is invalid, just silently swallowed, or filesystem full.
4) Makes one file a json file, will scale terribly past a few thousand json files.