_, _, err := client.Collection("cities").Add(ctx, map[string]interface{}{
"name": "Tokyo",
"country": "Japan",
})
if err != nil {
// Handle any errors in an appropriate way, such as returning them.
log.Printf("An error has occurred: %s", err)
}
// Add a new document with a generated id.
const res = await db.collection('cities').add({
name: 'Tokyo',
country: 'Japan'
});
console.log('Added document with ID: ', res.id);