I'm trying to build a system of documents that have hundreds of tags assigned to them, but each document-tag association has a certain condition it has to also meet so the document would be returned:
{
title: "new document",
tags: [
{
label: "label1",
intervals: [
{start_date: "2012-01-05", end_date: "2013-01-05"},
{start_date: "2012-01-06", end_date: "2013-01-25"},
],
applicable_for: ["birthdays","anniversaries"]
},
{
label: "label2",
start_date: "2012-04-05",
end_date: "2014-02-05",
applicable_for: ["anniversaries"]
}
]
};
A typical search would be something like:
Show me documents tagged with "label1", but only if this tag is applicable for "birthdays" and a certain date interval D0-D1 overlaps with one of the tag's intervals.
I have two questions:
- can this type of query be performed in MongoDB?
- is MongoDB the correct choice for this scenario? I've never used it until now, but it sems a better fit than MySQL or SOLR for tens of thousands of documents, each with hundreds of tags.
Thanks in advance!
