Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.