-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying, Text Search
-
Query Integration
Suppose I create the following db/collection:
> use articles > db.stores.insert( [ {_id : 1, arr : ['abc xyz', 'def']}, {_id : 2, arr : ['jadskf', 'ljh abc']}]) > db.stores.createIndex({"arr" : "text"})
I want to do text search over the arrays arr and obtain only the array elements that match the search.
For instance,
> db.stores.find({$text : {$search : "abc"}}) { "_id" : 1, "arr" : [ "abc xyz", "def" ] } { "_id" : 2, "arr" : [ "jadskf", "ljh abc" ] }
Ideally I'd like to only obtain the first element of the arr in the first document: abc xyz and only the second element of the arr in the second document: ljh abc, and also the _id of the matched documents.
Note that what I want is not a simple projection of the arr element, but of the elements of the arr where the match occurred.
- depends on
-
SERVER-17648 Implement matcher for text predicates
- Backlog