add method
Add a document in the collection
Implementation
Future<Document> add(Map<String, dynamic> data,
{bool? waitForSync,
bool? returnNew,
bool? returnOld,
bool? silent,
bool? overwrite}) async {
var d = jsonEncode(data);
var url = formatUrl('/_api/document/${collection.name}',
waitForSync: waitForSync,
returnNew: returnNew,
returnOld: returnOld,
silent: silent,
overwrite: overwrite);
var request = collection.client.prepareRequest(url, methode: 'post');
request.body = d;
Map<dynamic, dynamic> doc;
doc = await collection.client.exec(request);
id = doc.remove('_id');
key = doc.remove('_key');
rev = doc.remove('_rev');
this.data = data;
return this;
}