• 4/16

Create a table/collection reference

Collection is one of the methods defined by db.Database. This method can be used to create a collection reference.

col := sess.Collection("books")

A collection reference satisfies db.Collection.

Name and Exists are two methods defined by db.Collection.

log.Println("Collection:", col.Name(), "Exists?:", col.Exists())

Keep in mind that you can create references for collections that do not necessarily exist yet.

  • 4/16