void Namespace::insert(const char* str) { int count = 0; bson** bs = json_to_bson(str, count); Extent* lastExtent = getLastExtent(); int success = 0; for (int i(0); i < count; i++) { success = lastExtent->addRecord(bs[i]); while (success != 0) { db->attachExtent(this); lastExtent = getLastExtent(); success = lastExtent->addRecord(bs[i]); } free(bs[i]); } free(bs); }