The MongoDB documentation emphasizes the importance of the sequence of fields in compound indexes.
The definition of an object in ECMAScript states that it is an unordered collection of properties.
When using MongoDB
with node.js
(such as with this module), server-side JavaScript is utilized, as shown in the example below.
How can you specify a sequence when MongoDB expects an object
(an unordered collection of properties)?
collection.ensureIndex({
date : -1,
client : 1,
product : 1
});