Skip to content

docs(create-index): align createIndex output with ascending index definition#6309

Open
ThatDott wants to merge 1 commit into
mongodb:mainfrom
ThatDott:main
Open

docs(create-index): align createIndex output with ascending index definition#6309
ThatDott wants to merge 1 commit into
mongodb:mainfrom
ThatDott:main

Conversation

@ThatDott

@ThatDott ThatDott commented Jun 11, 2026

Copy link
Copy Markdown

The existing example in the docs creates an ascending index with { name: 1 },

collection.createIndex( { name : 1 }, function(err, result) {
  console.log(result);
  callback(result);
} )

But the resulting index list shows { name: -1 }.

[
  { v: 2, key: { _id: 1 }, name: '_id_' },
  { v: 2, key: { name: -1 }, name: 'name_-1' }
]

This change updates the output example to { name: 1 } so that it
matches the index definition and avoids confusion for readers.

Updated

[
  { v: 2, key: { _id: 1 }, name: '_id_' },
  { v: 2, key: { name: 1 }, name: 'name_1' }
]

This removes confusion since the preceding example was creating a single key ascending index, so should the results be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant