I want to be able to search in my documents by subsequences.
For example
{
"name": "doc1",
"sequence": ["a", "b", "d", "g", "k"]
}
{
"name": "doc2",
"sequence": ["c", "a", "b", "m", "d"]
}
I want to match multiple items in order. Queries example:
- return all documents that have the sequence ["a","b"]. (returns doc1 and doc2)
- return all documents that have an "a" and after 3 positions a "d" (return doc2)
- return all documents that have a sequence ["b","d","(whatever)", "k"] (return doc1)
I am not sure I can do this with MongoDB. Another solution would be to save sequences as strings instead of arrays and use regular expressions (but I don't like much that solution).
If I can't do it in MongoDB, is there another noSql engine or whatever engine that supports this?