You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Stefan Buhrmester (JIRA)" <ji...@apache.org> on 2017/04/09 04:22:41 UTC

[jira] [Commented] (COUCHDB-2927) Move $elemMatch into view query instead of in-memory

    [ https://issues.apache.org/jira/browse/COUCHDB-2927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15962033#comment-15962033 ] 

Stefan Buhrmester commented on COUCHDB-2927:
--------------------------------------------

Hello [~tonysun83]

let me jump in here because we are really longing for this feature and we don't have the necessary experience with couchdb internals to implement it.
I think the best way of doing is, is to just copy the structure from the text-type lucene indexes.

So when we have an index like
{code}
{"fields": ["tags.[]"]}
{code}
it should make one index entry for each array element in the tags field and a selector like the following should automatically use it:

{code}
{"tags" : {"$elemMatch" : {"$eq" : "sunny"}}
or
{"tags" : {"$all" : {"$eq" : "sunny"}}
{code}

for the other example, the indexes should be able to be defined with this syntax:

{code}
{"fields": ["tags.[].name.last"]}
{code}

and the selector that would use this index would look like

{code}
{"tags" : {"$elemMatch" : {"name.last" : "sun" }}
{code}

Thanks,
Stefan

> Move $elemMatch into view query instead of in-memory
> ----------------------------------------------------
>
>                 Key: COUCHDB-2927
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2927
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: Mango
>            Reporter: Garren Smith
>
> $elemMatch is in-memory - I think we should just auto-index arrays, because otherwise people have absolutely no way of doing a simple thing like categories/tags in pouchdb-find and are forced to use map/reduce instead



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)