Compound index key order

Properties order in objects is not guaranteed in JavaScript

But when we create compound index from node.js client or mongodb shell, we actually relied on properties(field) order. How does this work?

const indexDescrObj = {name: 1, city: -1};
db.myColl.createIndex(indexDescrObj)

@ BOGa

If this is a question, I don’t understand what you’re asking. If not, then Stack Overflow is probably the best place for the discussion.