Defining a MongoDB Schema/Collection in mgo
<p>I want to use mgo to create/save a MongoDB collection. But I would like to define it more extensively (for e.g to mention that one of the attribute is mandatory, another one is of an enum type and has a default value).</p>

<p>I have defined the struct like this, but don't know how to describe the constraints on it.</p>

<pre><code>type Company struct {
    Name        string `json:"name" bson:"name"` // --&gt; I WANT THIS TO BE MANDATORY
    CompanyType string `json:"companyType" bson:"companyType"` // --&gt;I WANT THIS TO BE AN ENUM
}
</code></pre>

<p>Is this possible to do in mgo, like how we can do it in MongooseJS? </p>