question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FireStore Question] What's difference between Unary.IsNull and Binary.Equal null ? Are there Unary.NotNull?

See original GitHub issue

What’s difference between Unary.IsNull and Binary.Equal null ?

Is it has any difference behavior? Can we use it to find document that has specific field exist or not exist?

At first I look at UnaryOperator to find operator for NotNull

I have document like this

{
    "_id" : "1",
    "result" : {}
}
{
    "_id" : "2"
}
{
    "_id" : "3",
    "result" : {}
}

I want to query for all document that already has any result. And also I want to query for any document that don’t has any result yet too, how should I make query?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
schmidt-sebastiancommented, May 2, 2018

Firestore distinguishes between two kind of queries. Most types allow inequality comparisons (such as >=), but NaN and Null only allows for equality. In this specific example, you can work around this with startAfter. For now, where("a",">=",null) unfortunately does not work directly.

1reaction
schmidt-sebastiancommented, Jan 9, 2018

Yes, you can sort types against one another. Specifying > null would return everything that is defined and not null since null sorts first in Firestore. I don’t know out of the top of my head if we have any publicly available documentation on our ordering semantics, but you can take a look here to see how types compare: https://github.com/googleapis/nodejs-firestore/blob/master/src/order.js#L29

Read more comments on GitHub >

github_iconTop Results From Across the Web

Operators | BigQuery
Value is [not] in the set of values specified, Binary. IS [NOT] NULL, All, Value is [not] NULL, Unary. IS [NOT] TRUE, BOOL,...
Read more >
Firestore select where is not null
Firestore has no "not equal" operator. But looking at the logic, what you're trying to do is query for values which are String...
Read more >
Functions, operators, and conditionals | BigQuery
Value is [not] in the set of values specified, Binary. IS [NOT] NULL, All, Value is [not] NULL, Unary. IS [NOT] TRUE, BOOL,...
Read more >
Why is my currentUser == null in Firebase Auth?
Auth state seems binary: null or non-null (or is it?) Here's an easy enough bit of code in JavaScript that checks to see...
Read more >
Get doc by id firestore. uid
I trying to get the document id of a document in firestore but i get a random ... You have to make sure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found