AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

convertShardKeyToHashed (mongosh 메서드)

convertShardKeyToHashed(<Object>)

Returns the hashed value for the input. The convertShardKeyToHashed() method uses the same hashing function as the hashed index and can be used to see what the hashed value would be for a key.

이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

참고

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

Consider a sharded collection that uses a hashed shard key [1]

use test
db.orders.createIndex( { _id: "hashed" } )
sh.shardCollection( "test.orders", { _id : "hashed" } )

collection에 다음 문서가 있는 경우 _id 필드의 해시된 값이 문서를 배포하는 데 사용됩니다.

{
_id: ObjectId("5b2be413c06d924ab26ff9ca"),
"item" : "Chocolates",
"qty" : 25
}

To determine the hashed value of _id field used to distribute the document across the shards, you can use the convertShardKeyToHashed() method:

convertShardKeyToHashed( ObjectId("5b2be413c06d924ab26ff9ca") )
[1] collection에 이미 데이터가 포함되어 있는 경우, collection을 샤딩하기 전에 샤드 키에 해시 인덱스를 생성해야 합니다. 빈 collection의 경우 MongoDB는 sh.shardCollection() 의 일부로 인덱스를 생성합니다.
이 페이지 평가하기

이 페이지의 내용