Mongodb query for selected data

Hello Knime expert!!!
Hope you are doing well.

I am having issue to fetch some data from server using MongoDB reader node.I am not able to create query for same.

Requirement:
Fetch data in different range like:
(1)Code ranges from:1100 to 1399
(2)Code ranges from : 1400 to 1799
(3) Code ranges from : 1800 to 1999

Input data in server

Code Name Amt
1100 A 78
1101 b 98
1200 c 74
1300 d 65
1400 e 41
1500 f 75
1600 g 78
1705 h 65
1810 i 12
1880 j 32
1900 k 12
1910 l 45

Output required:
(1)Code ranges from:1100 to 1399

Code Name Amt
1100 A 78
1101 b 98
1200 c 74
1300 d 65

(2)Code ranges from : 1400 to 1799

Code Name Amt
1400 e 41
1500 f 75
1600 g 78
1705 h 65

(3) Code ranges from : 1800 to 1999

Code Name Amt
1810 i 12
1880 j 32
1900 k 12
1910 l 45

Can you help me develop query in mongodb reader…

Thanks in advance.

Hi,
for this you need to have a look at the Jongo query operators. In your case, you will need $and, $gte, and $lte:

{$and: [{"code": {$gte: 1100}}, {"code": {$lte: 1399}}]}

Kind regards,
Alexander

5 Likes

Thanks @AlexanderFillbrunn
Always for helping me.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.