Skip to content
Advertisement

Regex query in spring boot mongoDB on integer

My data schema in mongoDB

{

 id:type(string),
 itemId:type(int),
 itemName:type(string)

}

I want to query on itemId such that if (In my database itemId is (1,2,12 , 13 , 15 27) )

if i search for itemId 1 then it fetch data start from 1 mean fetch data of itemId(1,12,13,15)

if i am not pass itemId then fetch whole data.

Please help me

thanks in advance

Advertisement

Answer

To solve this problem i store all itemId in string and build like query.

Thanks for support

Advertisement