<commit_before>{{#template name="Pop"}}
You should always use the `pop()` method to pop values from the fields of array type. Let's take a look at the example.

```js
Phone = Astro.Class({
  name: 'Phone',
  fields: {
    number: 'number'
  }
});

User = Astro.Class({
  name: 'User',
  /* ... */
  fields: {
    phones: {
      type: 'array',
      nested: 'Phone',
      default: function() {
        return [];
      }
    }
  }
});

var user = Users.findOne();
user.pop('phones', 1);
```

In the example above, we've popped the most top value from the `phones` field. You may wonder what the second argument of the `pop()` method does. It determines if an element should be popped from the top (`1`) or from the bottom (`-1`) of the array. They correspond to the `pop()` and `unshift()` JavaScript methods accordingly.

**Popping from multiple fields at once**<commit_msg>Pop return value<commit_after>{{#template name="Pop"}}
You should always use the `pop()` method to pop values from the fields of array type. Let's take a look at the example.  As of version 1.2.3, `pop()` will return the item removed from the array or undefined if there is no such item.

```js
Phone = Astro.Class({
  name: 'Phone',
  fields: {
    number: 'number'
  }
});

User = Astro.Class({
  name: 'User',
  /* ... */
  fields: {
    phones: {
      type: 'array',
      nested: 'Phone',
      default: function() {
        return [];
      }
    }
  }
});

var user = Users.findOne();
user.pop('phones', 1);
```

In the example above, we've popped the most top value from the `phones` field. You may wonder what the second argument of the `pop()` method does. It determines if an element should be popped from the top (`1`) or from the bottom (`-1`) of the array. They correspond to the `pop()` and `unshift()` JavaScript methods accordingly.

**Popping from multiple fields at once**
{'fraction_non_alphanumeric': 0.139186295503212, 'fraction_numerical': 0.004817987152034261, 'mean_word_length': 3.190582959641256, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1616281', 'n_tokens_mistral': 573, 'n_tokens_neox': 546, 'n_words': 248}