MongoDb Remove last element from array if length is greater
<p>I am using Mongodb and the stucture is as below:</p>

<pre><code>**{
    "_id" : ObjectId("5693af5d62f0d4b6af5124f1"),
    "uid" : 1,
    "terms" : [
        "sasasdsds",
        "test",
        "abcd"
    ]
}**
</code></pre>

<p>I want to remove the last element from array if the length of it is greater than 10.
Is it possible to be done in a single query?</p>