insertMany method

Future<Map<int, ObjectId>> insertMany(
  1. List<MongoDocument> documents
)

Inserts one or more documents to the collection

Implementation

Future<Map<int, ObjectId>> insertMany(List<MongoDocument> documents) async {
  Map results = await (FlutterMongoRealm.insertDocuments(
    collectionName: this.collectionName,
    databaseName: this.databaseName,
    list: documents.map((doc) => jsonEncode(doc.map)).toList(),
  ));

  return results.map<int, ObjectId>(
      (key, value) => MapEntry<int, ObjectId>(key, ObjectId.parse(value)));
}