Array Field
noun
say it: “uh-RAY feeld” /əˈreɪ fiːld/
A field in a MongoDB document that holds a list of values, such as tags or ingredients.
What is Array Field?
An array field holds a list, like a recipe's tags. Queries match if any element matches, and operators like $push and $pull change the list.
db.recipes.updateOne({ _id: id }, { $push: { tags: 'vegan' } })
In a sentence
- “The recipe's tags are an array field, so one filter finds every recipe tagged vegan.”
- “An array field can hold documents too, such as each ingredient with its amount.”
Level: Apprentice · More MongoDB terms at this level
Updated