3 ms·
Am I missing something fundamental here? I think in the home page Q shouldn't be compared to just JSON as they are in principle two different things. If I were
by nevi-me 13y ago
Am I missing something fundamental here? I think in the home page Q shouldn't be compared to just JSON as they are in principle two different things. If I were to write a 'data language' or to extend an existing language to cater for data, wouldn't I write my validators in that said language? If I am correct, then I was expecting Q to be compared to the closest other 'data language', not be compared with a document/schema.
For example, if I was doing it in JS, I'd say:
var validDoc = true;
var Temp = function (t) {return t >= 33.5 && t <= 45.0};
then when I get the doc, I loop through my conditions, as such:
validDoc = Temp(doc.temperature);
// reject if !validDoc
From here, the benefit of Q becomes that it's much easier to do validations, instead of writing them from scratch, considering that my example above only returns a true || false, as it doesn't have the error handling to let me know what went wrong and where.
One could also achieve some of what Q is doing by using an ORM if said data is going to a database/document store.
So, HN, am I missing something here?