
How to create Batch document

This feature has some issues, you can read about it here https://github.com/appwrite/appwrite/pull/3285#issuecomment-1288129353
The best way would be using a loop with createDocument
function.

using loop can give error rate limit exceed

You need it to be for the user side?

If so then create a function, let the user send all the new documents to the function. Then, in the function you'll use Server sdk with API key which don't suffers from rate limits

yes any example if can you provide for bulk creation of document

Maybe something like this
import 'package:dart_appwrite/dart_appwrite.dart';
import 'dart:convert';
Future<void> start(final req, final res) async {
final client = new Client();
final database = Databases(client);
if (req.variables['APPWRITE_FUNCTION_ENDPOINT'] == null ||
req.variables['APPWRITE_FUNCTION_API_KEY'] == null) {
print("Environment variables are not set. Function cannot use Appwrite SDK.");
} else {
client
.setEndpoint(req.variables['APPWRITE_FUNCTION_ENDPOINT'])
.setProject(req.variables['APPWRITE_FUNCTION_PROJECT_ID'])
.setKey(req.variables['APPWRITE_FUNCTION_API_KEY'])
.setSelfSigned(true);
}
try {
final documents = jsonDecode(req.variables.APPWRITE_FUNCTION_DATA);
final userID = req.APPWRITE_FUNCTION_USER_ID ?? '';
// check Document structure
documents.forEach((doc)=>{
//TODO: Add user id
//TODO: Add permission
await database.createDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', doc);
});
res.json({areDevelopersAwesome: true,});
} catch (e) {
res.json({areDevelopersAwesome: false,});
}
};

is this is in node js

Yes

any example in dart, if it s possible?

The code is now in dart

ok

It's not a complete working code. But should give you a heads-up

i have posted another post regarding the use of currency api,

ok, thanks
Recommended threads
- 2 Columns still processing since yesterd...
Hey o/ Yesterday (around <t:1758045600:f>), I created a database and added several columns to it. After about 15 minutes, most of the "processing" tags disappe...
- 503 Timeout when Updating or Upserting D...
Hey Iβm running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
- Row with the requested ID already exists...
Iβm hitting a blocking issue creating rows in Appwrite (both from the console and my React Native app). After successfully inserting the first row, every subseq...
