We're a place where coders share, stay up-to-date and grow their careers.
I am trying to create this output
{ "$and": [ { "type": "Nanoheal" }, { "$or": [ { "specialFields.address": "Jaysingpur" }, { "specialFields.email": "prathameshmore@gmail.com" } ] } ] }
It's working when I am using a string like this
let operands = query.split("'").filter(Boolean); //Output [ '(', '"type": "Nanoheal"', 'AND', '(', '"specialFields.email": "prathameshmore@nanoheal"', 'OR', '"specialFields.address": "Jaysingpur"', ')', ')' ]
const query = `'('"type": "Nanoheal"'AND'('"specialFields.email": "prathameshmore@nanoheal"'OR'"specialFields.address": "Jaysingpur"')'')'`;
I want to make the query simple from the user side.
("type": "Person" AND ("specialFields.email": "prathameshmore@gmail.com" OR "specialFields.address": "Jaysingpur"))
The stack is used to create this object
I am trying to create this output
It's working when I am using a string like this
I want to make the query simple from the user side.
("type": "Person" AND ("specialFields.email": "prathameshmore@gmail.com" OR "specialFields.address": "Jaysingpur"))
The stack is used to create this object