Best database/solution for searching if any of db.item.tags is contained in given string

Title might be confusing - let me explain:

I have to store data in format like this (this example is in mongoDB format):

    name: 'entity1',
    field: 'value',
    tags: ['tag1','tag2','tag3'],

Now I need function like this:

    // find all entities where text contains at least one of entity tags
  1. Usually number of tags should not be greater than 5.
  2. Number of entities should not be greater than 100 but it may grow in the future.
  3. I need this in "realtime" - so as fast as possible.
  4. Search has to be case-Insensitive.
  5. Data have to be stored in some kind of DB - when db is updated then function searches through updated entities.
  6. My app is written in node.js.
  7. It would be cool if function returned information on what position of string each tag was found (if it was found at all).

I tried to accomplish this on mongoDB and found solution to use $where query but it does mot work on array attribute and anyway it is pretty slow.

I am looking for solution/db I could use...


You are getting downvotes as your question does not relate to any code-related problem, but a generic educational question based on lack of knowledge. SO does not encourages such type of questions. As you basically asking others to do your homework.


MongoDB allows to create index for strings in array:

db.item.ensureIndex({ tags: 1 });

And find just by:

db.item.find({ tags: 'tag2' });

MongoDB is smart enough to understand that it is array and you are looking for value in array.

Need Your Help

Why does my switch statement always goes to default case?

c switch-statement

The default case is always executed in this switch statement, no matter what I type at the prompts.

webdriver - selecting country from drop down list without using xpath


<a id="SIU2_country" class="button combobox-button country" onclick="event.cancelBubble = true; if (event.stopPropagation) { event.stopPropagation(); }" tabindex="9" style="cursor: auto;">