简体   繁体   中英

How to handle data that is null in firestore?

I was wondering how to handle data that is null in firestore?

I'm currently checking that the value I am looking for is null, but I was wondering if there was a better way.

What I have at the moment is this:

if(!!doc.data().field)

But this is very verbose for many fields.

i prefer this way

if(doc.data().field != null && typeof doc.data().field != 'undefined' && !isNaN(doc.data().field ))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM