DDCODE

Share programming skills from Magic Oriental

upArrow

Elements in mongodb array values are saved in order

 May 12, 2019   mongodb, question

For example, I have a value already saved in mongodb

[
 1,
 2,
 5,
 4,
 3,
 ...
 ]

Want to update to this

[
 1,
 2,
 3,
 4,
 5,
 ...
 ]

How to achieve the highest efficiency, assuming that the content of this array is about 100k and has thousands of elements

With aggregate, first unwind, then sort.

Related Posts:

  • When assigning values to different data types, when…
  • [set up a challenge ring] has an integer array with…
  • C language two-dimensional array, print array, all…
  • In Table 1, the first five values are sorted…
  • Can the time saved in the database be directly saved…
  • How is the E-commerce Website order number…
  • Error in output sequence during traversal of binary…
  • How to quickly fetch array elements whose key value…
  • How do Mutablearray and array compare whether the…
<< How does MongoDB design multi-level classification? How to Limit MongoDB’s Maximum Memory Consumption? >>

Related Posts:

  • When assigning values to different data types, when…
  • [set up a challenge ring] has an integer array with…
  • C language two-dimensional array, print array, all…
  • In Table 1, the first five values are sorted…
  • Can the time saved in the database be directly saved…
  • How is the E-commerce Website order number…
  • Error in output sequence during traversal of binary…
  • How to quickly fetch array elements whose key value…
  • How do Mutablearray and array compare whether the…

Tags

Android android-studio apache c c++ centos Css css3 Database Docker Eclipse Express Front end git GitHub golang Html html5 Ios java javascript Jquery Laravel linux macos mongodb mysql Nginx node.js npm objective-c php Programmer python redis ruby shell Spring Sql Swift ubuntu vim vue.js Web xcode

Powered by MyWiki WordPress Theme