I've got years of experience with SQL. I'm starting on a side project with a fairly simple (to me) data model. I've read a number of posts, articles, guides, etc. over the last few weeks and am trying to wrap my head around SQL vs NoSQL, particularly the relationship component.
As a hypothetical, say my application is something that you'll store some search terms you're interested in and there will be a job that runs nightly to query some data source for those search terms. Hits on those terms will be compared to what's been seen before and you'll get notified that there are new results. From those results, you'll flag ones you're interested in following for further activity (another nightly job to search for those)
For more concrete examples (but none that I'm planning, the source of data I'm querying is comparatively finite), you're interested in finding books (source is Amazon, Goodreads, etc.) or movies (IMDB, Rotten Tomatoes) for things you're interested in (search terms: "medieval history", "commercial fishing", "alien abduction") and when you get results back, you flag some books/movies that you're interested in and want to get notified (activity: book is released in paperback format; movie is opening in theaters)
The way I envision storing the data, there's a relationship between the hits/results and the term(s) that produced those hits.
In a RDBMS, I'd have a simple structure like this
With this structure, I can ask for and get a list of search terms associated with a particular result or a list of results for a specific search term pretty easily. I could also get a list of all paperback releases (activity) in the next week.
Thinking that document-based would be the NoSQL approach to use if going that route, a similarly simple structure I can imagine for a Result as a document would be:
{
"id" : 1,
"url" : "https://something.com/idxyz123",
"summary" : "Great book about alien abduction aboard a commercial fishing vessel",
"follow" : true,
"matchedSearchTerms" : [ "commercial fishing", "alien abduction" ]
"activity" : [
{
"description" : "Paperback Release",
"eventDate" : "2022-10-15"
},
{
"description" : "eBook Release",
"eventDate" : "2023-02-01"
}
]
}
Where I'm struggling is whether the relationship between search terms and results is a relationship that "violates" NoSQL principles, and if not, if there's an approach where there's a document for SearchTerm with an id and the matches would be reprsented in the Result document like "matchedSearchTermIds" : [1, 3]
As far as ACID goes, there'd be a very limited number of users (small family) and little concurrent activity outside the control of the nightly jobs so it's not a concern for a NoSQL approach.
So even though this is a side project, just understanding the approach one would take (both SQL vs NoSQL and the NoSQL approach if it makes sense) would help me immensely!