actarus2003 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I'm playing with mongodb and i need to apply filters from dancer2 query_parameters, but i fail to construct the filter object.
I had try to create a base object like
my %serchstrx={'$and' => []};and then pushing the pair (key&value) in the array like
for(my $id=0;$id < keys %hfields;$id++){ if(query_parameters->get("columns[$id][searchable]") eq 'true' && defined query_parameters->get("columns[$id][search][value]") && query_parameters->get("columns[$id][search][value]") ne ''){ push @{$serchstrx{'$and'}},'{"'. query_parameters->get("column +s[$id][data]") . '" => qr/' . query_parameters->get("columns[$id][sea +rch][value]").'/i}'; } }
%hfield contain the name of possible key name in the form
but, it never work for me
Any suggestione ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mongodb dynamic filter
by roboticus (Chancellor) on Nov 06, 2017 at 21:04 UTC | |
by actarus2003 (Novice) on Nov 09, 2017 at 15:52 UTC | |
|
Re: mongodb dynamic filter
by 1nickt (Canon) on Nov 06, 2017 at 23:00 UTC | |
by actarus2003 (Novice) on Nov 08, 2017 at 12:26 UTC | |
by 1nickt (Canon) on Nov 08, 2017 at 13:16 UTC | |
|
Re: mongodb dynamic filter
by poj (Abbot) on Nov 06, 2017 at 21:04 UTC |