How to add conditional schema based on other field?
<p>I have this structure:</p>

<pre><code>{
    personFullName: String,
    personMobileOS: Number // 1 = IOS, 2 = Android,
    moreDetails: Mixed
}
</code></pre>

<p>I want to add conditional schema based on other field like this:</p>

<pre><code>if (personMobileOS === 1) { // IOS
    moreDetails = { 
        iosVersion: Number, 
        loveApple: Boolean
    }
} else if (personMobileOS === 2) { // Android
    moreDetails = {
        wantToSell: Boolean,
        wantToSellPrice: Number
        wantToSellCurrency: Number // 1 = Dollar, 2 = Euro, 3 = Pound
    }
}
</code></pre>

<p>As you can see, the schema for "moreDetails" is conditional, it's possible to achieve this in mongoose?</p>