Open wolfgang-s opened 7 years ago
Thanks for the heads up.
Other than fixing it so we are not running into an exception, in terms of expected behavior
:
null
?null
, <empty>
, or undefined
I realize that some of my questions are silly because of how ES indexing/storage works but still please humor me.
Also I wonder if loopback has smartly defined an explicit behavior for their ORM for such queries so we don't make this up as we do along! cc @bajtos - What do you think?
Also I wonder if loopback has smartly defined an explicit behavior for their ORM for such queries so we don't make this up as we do along! cc @bajtos - What do you think?
My knowledge of juggler and connectors is limited, @strongloop-community/sq-lb-apex are better suited to help you.
Is there any movement on this? It seems to me like pretty necessary functionality to be able to query a database for nulls.
As to your three questions, I don't much experience with ES, so I can't say all the implications here, but I would say "yes" to 1.
As far as 2, I'm not positive what <empty>
and undefined
mean to you (or ES), but I take <empty>
to mean an empty string value whereas undefined
means a document that doesn't have the field (as opposed to a null
value for the field). My answer here is that I would not treat an empty string as a null
. I'm not so sure on undefined
; in a way it seems like it would be nice to include them but on the other hand, if there were some other mechanism to query for undefined
then it could simply be added as an or
condition (just like you could add the empty string to a query).
For question 3, this would not make sense to me since the query would return documents that don't have the field but not return documents where that field is null
.
Also, FWIW, a similar query (filter of {"where": {"field": null}}
) with a MongoDB datasource returns documents with an explicit null
for the given field, but not documents with an empty string for the field or that do not have such a field.
When I try to query:
{filter: {where: {empty_field_name: null}}} there is an exception:
Trace: [parsing_exception] No text specified for text query, with { line=1 & col=64 } at .../node_modules/loopback-connector-es/lib/esConnector.js:835:12
Line number could be different, since I'm on my on branch.