I'm creating a video sharing site as a test project, and in my mongoose schema, each video has a String array field 'tags', for example, it might look like this:
{
title: "Test video",
tags: ["video", "test", "1080p"]
}
and, in order to give suggestions of similar items, I'd like to query my videos table and sort by the ammount of common items between this video's tags array and another's.
For example, a document which also has the tag "1080p" would get a 'score' of 1, but one which has all three tags, "video", "test" and "1080p" would get a score of 3, and then I would sort them by this score descending to get some suggestions of similar documents.
Does anyone know how I can do something like this with Mongoose & Node?