# データの移行

## NCMB データストアのエクスポート

ニフクラ Mobile Backendからのデータのエクスポートは、次の手順で行います。

1. ニフクラ Mobile Backendでプロジェクトにアクセスし、右上のアプリ設定をクリック

   <figure><img src="https://3046938759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfWrOnV1iKerkfShm9O%2Fuploads%2FAXmqjJ9LFFIlUJKc1vI2%2F%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-12-18%2020.08.53.png?alt=media&#x26;token=20051b73-593c-40d7-94e6-9c6390d99bca" alt="" width="563"><figcaption></figcaption></figure>
2. メニューから「エクスポート」を選択し、エクスポートボタンをクリック

   <figure><img src="https://3046938759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfWrOnV1iKerkfShm9O%2Fuploads%2FT72B6LUCzkPASVDnwqnq%2F%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-12-18%2020.09.15.png?alt=media&#x26;token=527ced64-7c3f-4347-88a5-d17e53d3fabb" alt="" width="563"><figcaption></figcaption></figure>
3. エクスポートダイアログでエクスポートを実行すると、登録されているメールアドレスにデータをダウンロードするURLが届きます<br>

   <figure><img src="https://3046938759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfWrOnV1iKerkfShm9O%2Fuploads%2F66gyC4ISmdjBB1jdJwEL%2F%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-12-18%2020.09.44.png?alt=media&#x26;token=6aea229d-9b74-468b-9b5f-216af1091bc1" alt="" width="563"><figcaption></figcaption></figure>

ダウンロードしたデータは、JSON形式でクラス毎に別々のファイルとして出力されます。下の内容は、エクスポートされたクラスの中身の例です。

```json
{
    "results": [
        {
            "acl": {
                "*": {
                    "read": true,
                    "write": true
                }
            },
            "createDate": {
                "__type": "Date",
                "iso": "2023-12-04T09:17:12.023Z"
            },
            "updateDate": {
                "__type": "Date",
                "iso": "2023-12-04T09:17:12.024Z"
            },
            "date": "2023/12/4",
            "item": "昼食",
            "price": "950",
            "objectId": "9JsKYvflevuq4ULZ"
        },
```

## Firestoreへのインポート

NCMBのデータストアからエクスポートしたJSON形式のデータは、Firestore Admin SDKを使用してFirestoreに登録することが可能です。

多様なプログラミング言語に対応していますが、JavaScriptを使用する場合、Node.jsでのデータ書き込みで行えます。基本的なデータ形式の移行は、下のデータ移行スクリプトをご利用ください。

{% content-ref url="data-migration-script" %}
[data-migration-script](https://ja.docs.monaca.io/migration-guide/nifcloud/datastore/data-migration-script)
{% endcontent-ref %}

なお、Firestoreにはデータのインポート機能も備わっていますが、下記の点に注意が必要です。

* インポート機能を使用するには、Blazeプランへの加入が必要です。
* この機能は主に、Firestoreからエクスポートしたデータを異なるプロジェクトのFirestoreにインポートするために設計されています。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ja.docs.monaca.io/migration-guide/nifcloud/datastore/data-migration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
