Hi,
I’m coming from Mongo to RedisJSON. I don’t see any direct equivalents to ‘collections’ (or ‘rows’ in SQL - essentially multiple documents of the same type), so I am wondering what is the best approach here:
- Having a unique key for each document (e.g.
JSON.SET myJson:<id1> . { ...json... }
) - A single JSON document with a nested document for each ID: ( e.g.
JSON.SET myJson . { <id1>: { ...json...}, <id2>: { ...json....} }
) - An array of JSON documents (e.g. `JSON.SET myJson . [{ …json…, id: }, { …json…, id: }]
- Some other method?
Documents are written one at a time with a frequency of a few hundred a day. We support 3 main ways of accessing documents:
- Retrieving a single document by ID
- Retrieving all documents belonging to a particular user (in mongo, ownership is marked in the document but we will look at any other kind of access control methods)
- Filtering documents by different fields.
We currently have around ~100k documents to migrate. We don’t expect to have to store more than 1m at any one time.
I’ve googled a lot for some examples or use cases but turned up nothing so far…