Mongo Shell MethodThis page documents the shell method, and doesnot refer to the MongoDB Node.js driver (or any other driver)method. For corresponding MongoDB driver API, refer to your specificdocumentation instead.Finds the distinctvalues for a specified field across a single collection or view and returnsthe results in an array. ParameterTypeDescriptionfieldstringThe field for which to return distinct values.querydocumentA query that specifies the documents from which to retrieve the distinct values.optionsdocumentOptional. A document that specifies the options.
See.The method provides a wrapperaround the command. ImportantIn most cases, multi-document transaction incurs a greaterperformance cost over single document writes, and theavailability of multi-document transactions should not be areplacement for effective schema design. For many scenarios, thewill continue to be optimal for yourdata and use cases. That is, for many scenarios, modeling your dataappropriately will minimize the need for multi-documenttransactions.For additional transactions usage considerations(such as runtime limit and oplog size limit), see also.
The processing of the push operation with modifiers occur in the following order, regardless of the order in which the modifiers appear. Update array to add elements in the correct position. Apply sort, if specified. Slice the array, if specified. Store the array. Unique Array Keys in MongoDB. In MongoDB can never violate 'their own' unique value constraint. Now let's look at a simple insert: db.