3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

FirestoreではMapデータの値としてundefinedは使っちゃダメですよ

Posted at

怒られました。

nullは大丈夫

data = {key:null}ではちゃんと登録されます。

名称未設定.png

undefinedはダメ

data = {key:undefined}

怒られます。

Value for argument "data" is not a valid Firestore document. Cannot use "undefined" as a Firestore value (found in field key).

エラーメッセージが親切なのがありがたいです。

ドキュメントはここ<[https://firebase.google.com/docs/firestore/manage-data/data-types](https://firebase.google.com/docs/firestore/manage-data/data-types)>です。

使っていいのはこれらの種類です...との説明がありますが、undefinedはダメ!とまでは書いてありません。

MongoDBとかだとundefinedがnullとして登録されることもありますが、Firestoreでは注意しましょう。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?