The MongoDB documentation states:
For indexes with more than one key (i.e. compound indexes) the sequence of fields is important.
But ECMAScript defines an object as follows:
An object is a member of the type Object. It is an unordered collection of properties each of which contains a primitive value, object, or function.
When using MongoDB
in node.js
(for example by using this module), you're using server side javascript, like the example below.
How do you specify a sequence when MongoDB expects an object
(AKA unordered collection of properties)?
collection.ensureIndex({
date : -1,
client : 1,
product : 1
});