insertDoc method
Implementation
DocRefMemory insertDoc(
Map<String, dynamic> doc,
) {
String collId = _id;
// first check if the collection exist
// here i need to check if the collection has a parent doc or not
//
if (_memoryDb[collId] == null) {
_memoryDb[collId] = [];
}
// create the doc id
String docId = doc[DBRKeys.id] ?? const Uuid().v4();
// validating the doc
DocValidation docValidation = DocValidation(docId, doc);
doc = docValidation.validate();
// here just save the new doc
_memoryDb[collId]!.add(doc);
return DocRefMemory(
docId,
_collRefMemory,
_memoryDb,
);
}