What is the best way to create 10k documents?

I have a collection to store individual NFTs that look like this:

{
    name: "Azuki #45",
    image: "https://ikzttp.mypinata.cloud/ipfs/QmYDvPAXtiJg7s8JdRBSLWdgSphQdac8j1YuQNNxcGE1hg/45.png",
    attributes: [...],
};

There are 10k of these NFT documents I need to create. What is the best way to bulk create these documents?

You’ll need 10K Create calls. Fauna doesn’t have a “bulk insert” function. The sample data looks small enough that it might be possible to create all of the documents in a single query, but if any of the Creates fails, none get created. So, you might experiment with creating 100 documents per query, and continue running queries until all of the documents have been successfully created.

We recently updated fauna-shell's import command. If your data is available in CSV or JSON/JSONL format, you might find that to be an easier approach:

Note that the import command is in “early access”. We can’t guarantee that you won’t run into issues when using it, but if you do, we’d definitely like to hear about your experience so that we can make improvements.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.