n(',\n')}})\n)`
        } else {
          const field = projection.fields[0]
          query = `_.map(${query}, item => _.get(item, '${field}'))`
        }
      }

      return query
    },
    executeQuery: function (json, query) {
      console.log('executeQuery', query)

      // WARNING: Using new Function() with arbitrary input can be dangerous! Be careful.
      const execute = new Function('data', 'return ' + query)

      return execute(json)
    },
    queryDescription: 'Enter a JavaScript query 