I have a mongodb collection with multiple fields and nested ones, also the value are strings and numbers.
I want to search through all or just some specific fields and return the data to the user from my API which is built with Spring Boot.
I could search using an index only for String values but not numbers.
Here is what the data looks like :
{
"id": "string",
"type": "atm",
"request_id": "string",
"state": "created",
"reason_code": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"scheduled_for": "2019-08-24",
"related_transaction_id": "77cf4c8f-163c-4c22-acc4-3cade5f744f0",
"merchant": {
"name": "string",
"city": "string",
"category_code": "string",
"country": "string"
},
"reference": "string",
"legs": [
{
"leg_id": "b1c630e1-a27d-4ede-94f0-ee42391a3c4e",
"amount": 0,
"fee": 0,
"currency": "string",
"bill_amount": 0,
"bill_currency": "string",
"account_id": "449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65",
"counterparty": {},
"description": "string",
"balance": 0
}
],
"card": {
"card_number": "string",
"first_name": "string",
"last_name": "string",
"phone": "string"
}
}
The fields i wanna search through are ID, refernce ,Legs.amount, Legs.description.
Any Help would be appreciated ,Thanks in advance