Expry is a JavaScript library for defining logic using JSON syntax. It enables you to store your code in databases, making it ideal for use cases such as forms and validation rules.
const expression = { name: { $concat: ["$name", " ", "$surname"] }, mostFavoriteSports: { $filter: { input: "$sports", as: "sport", cond: { $gt: ["$$sport.rating", 8] }, }, },};
const variables = { name: "John", surname: "Doe", sports: [ { name: "football", rating: 9 }, { name: "basketball", rating: 10 }, { name: "tennis", rating: 5 }, { name: "swimming", rating: 7 }, ],};
{ "name": "John Doe", "mostFavoriteSports": [ { "name": "football", "rating": 9 }, { "name": "basketball", "rating": 10 } ]}