Yes it is possible. What you use is a “dot notation” property to verify that the array contains at least 11 members, and then apply the update modifier $popto the array:
db.collection.update(
{ "terms.10": { "$exists": 1 } },
{ "$pop": { "terms": 1 } },
{ "multi": true }
)
, n-1 , , , , , $exists. $size, .
$pop .
, 10 , , $slice $push :
db.collection.update(
{ "terms.10": { "$exists": 1 } },
{ "$push": { "terms": { "$each": [], "$slice": 10 } } },
{ "multi": true }
)
$push, $each , ( ) , $slice . , ( n ), . "" "" n .
"multi" . , .