🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

read MongoDB create criteria input

User: "Bautasten"
New Altair Community Member
Updated by Jocelyn
Hi,

I have data that is pulled form a different data source and now I need to use the id from that data in MongoDB criteria to filter the result, I can't figure out how to do that.

Any ideas?

BR,
Patrik

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "kayman"
    New Altair Community Member
    Updated by kayman
    Hi @Bautasten,  One possible solution is the following : 

    - Get the attribute you need (the ID of your source table)
    - If the attribute is a nominal quote it using the replace functions so myID1 becomes "myID1". If it is numeric you can skip this step. 
    - Next use the aggregate operator and concatenate your field, now you get something like "myid1"|"myid2"|"myid3" and so on
    - Replace the pipe (|) with a comma so you get  "myid1","myid2", "myid3"
    - store your field as a macro and call it for instance ids

    Finally call Mongo like {_id:{$in:[%{ids}]} but with using the fields you need