In MongoDB, the $indexOfArray aggregation pipeline operator searches an array for an occurrence of a specified value and returns the array index of the first occurrence.
arrays
MongoDB $arrayToObject
In MongoDB, the $arrayToObject aggregation pipeline operator converts an array to a document.
MongoDB $objectToArray
In MongoDB, the $objectToArray aggregation pipeline operator converts a document to an array.
MongoDB $reverseArray
In MongoDB, the $reverseArray aggregation pipeline operator reverses the order of items in an array.
It accepts an array expression as an argument and returns an array with the elements in reverse order.
Import Documents into MongoDB from an Array of JSON Documents
When using mongoimport, you can use the --jsonArray parameter to import an array of JSON documents.
MongoDB $concatArrays
In MongoDB, the $concatArrays aggregation pipeline operator concatenates two or more arrays and returns the concatenated array.
Import CSV Data as an Array in MongoDB using mongoimport
MongoDB’s import utility – mongoimport – introduced a new parameter that allows you to import CSV data as an array.
The --useArrayIndexFields parameter interprets natural numbers in fields as array indexes when importing CSV or TSV files.
MongoDB $arrayElemAt
In MongoDB, the $arrayElemAt aggregation pipeline operator returns the element at the specified array index.
It accepts two arguments;
- The array
- The index of the element you want to retrieve
How the arrayFilters Parameter Works in MongoDB
In MongoDB, when you update documents that contain arrays, you have the option of using the arrayFilters parameter.
The arrayFilters parameter allows you to specify an array of filter documents that determine which array elements to modify.
In the update document, use the $[<identifier>] filtered positional operator, which identifies the array elements that match the arrayFilters conditions for the update operation.