xamarin.forms - Couchdb filter using reduce functions/linked documents -


considering: doc profile { _id:"1", name:"john", likes: ["2222","1111"] }

doc likes { _id:"2222", value:"true" }

{ _id:"1111", value:"false" }

i have filter on xamarin app profile, , works need include "children" (linked) docs... can view setting include_docs=true want couchdb filter can use replication. also, possible accomplish same result if use reduce function filter data, can't make filter use reduce function.. so, idea?

the expected result be:

doc profile { _id:"1", name:"john", likes: { {_id:"2222", value:"true"}, {_id:"1111", value:"false"] } }

thanks!

i can view setting include_docs=true want couchdb filter can use replication

you might know can use couchdb views filters.

also, possible accomplish same result if use reduce function filter data

the reduce function "reducing" values returned map function. map function returns key , value so:

emit(key,value)

the reduce function gets keys , values returned map function. example if call view

?key=abc

and returns results

[{ _id:..., type: abc }, { _id:..., type:abc } .... ] 

you have documents filtered key "abc". reduce function inputs key, value , rereduce parameters. if use reduce function post map processing step further filter results view there 2 problems:

  1. there no way pass parameter reduce. keys specify used map function , passed reduce.

  2. it not idea anyway. reduce want return small value aggregates results view. taking above example if return integer value map function ( in emit(key,value)//suppose value integer) reduce function may return sum or aggregate of values. trying return modified document not reduce function for. the docs

"a reduce function must reduce input values smaller output value. if building composite return structure in reduce, or transforming values field, rather summarizing it, might misusing feature. "

list functions might more suited trying do. if want process results of view query before returning them they way go.

in list functions set of results returned view function. can pass additional parameters if you'd apply complex filters on them. won't able use list functions replication.

finally replication works on document level. documents have _rev fields used replicator process check version document in before replication performed. won't able replicate results returned view. documents replicated.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -