Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
*mgo.Collection
}
Collection represents a database collection. It embeds mgo.Collection for operations, and holds a session to MongoDB. The user may close the session using the method close.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage holds the connection with the database.
func Open ¶
Open dials to the MongoDB database, and return the connection (represented by the type Storage).
addr is a MongoDB connection URI, and dbname is the name of the database.
This function returns a pointer to a Storage, or a non-nil error in case of any failure.
func (*Storage) Close ¶
func (s *Storage) Close()
Close closes the storage, releasing the connection.
func (*Storage) Collection ¶
func (s *Storage) Collection(name string) *Collection
Collection returns a collection by its name.
If the collection does not exist, MongoDB will create it.