node-firestore-import-export icon indicating copy to clipboard operation
node-firestore-import-export copied to clipboard

Import fails with Cannot use "undefined" as a Firestore value if any field is NaN

Open arthabus opened this issue 4 years ago • 1 comments
trafficstars

Expected behavior

Import preserves NaN values and completes the import

Actual behavior

If a document contains NaN values, they are translated to "undefined" which makes firebase import fail

Steps to reproduce the behavior

   let profileData = {
        __collections__:{},
        nanField: parseFloat("sfg"),
    }

    const profileRef = firebase.firestore().doc(`users/${uid}`);
    await firestoreImport(profileData, profileRef)

arthabus avatar Mar 05 '21 22:03 arthabus

I guess adding (val !== val) to isScalar can fix that (this expression returns true in case of NaN)

arthabus avatar Mar 06 '21 10:03 arthabus