Select last value of array in sub document
问题 I have the following document structure { "_id" : 1, "prices" : { "100" : [ 5.67, . . 1.7, ], "101" : [ 4.67, . . 1.4, }, "v" : 2 } We need to get the last value from each of the fields "100" and "101", e.g 1.7 & 1.4, using mongodb v3.0.2. Currently we are loading the whole document and then getting the required values in the application. It has become quite a bottleneck as each document may be ~1MB, which for 100s of documents is adding up. We are hoping there is a suitable feature of