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:
function(text){
// find all entities where text contains at least one of entity tags
}
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.
Answer:
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.