예제 #1
0
func Add(f *srv.File, uid go9p.User, db *mgo.Database) error {
	c := new(Collections)
	c.uid = uid
	c.db = db

	collections, err := db.CollectionNames()
	if err != nil {
		return err
	}
	c.collections = make(map[string]*srv.File)
	for _, collection := range collections {
		if _, err := c.Create(nil, collection, 0); err != nil {
			return err
		}
	}

	return c.Add(f, "collections", uid, nil, go9p.DMDIR|0777, c)
}