qmgo icon indicating copy to clipboard operation
qmgo copied to clipboard

建议加个索引列出功能

Open 888go opened this issue 1 year ago • 5 comments

我看了我们的, 没有取集合索引的功能. 其他人之前也在issues提过.

888go avatar Feb 23 '24 04:02 888go

你是指这个功能? https://www.mongodb.com/docs/manual/reference/command/listIndexes/

有兴趣可以提个 PR. 参考官方 driver 的代码。 https://github.com/mongodb/mongo-go-driver/blob/f9ce69809fd84b5a6448a34d34b15975985333a1/mongo/index_view.go#L68-L150

个人以为提供一个 ListIndexes 接口,返回 []ops.IndexModel 就行。这个结果可以基于官方 driver 的这个结构体构建。

type IndexSpecification struct {
	// The index name.
	Name string

	// The namespace for the index. This is a string in the format "databaseName.collectionName".
	Namespace string

	// The keys specification document for the index.
	KeysDocument bson.Raw

	// The index version.
	Version int32

	// The length of time, in seconds, for documents to remain in the collection. The default value is 0, which means
	// that documents will remain in the collection until they're explicitly deleted or the collection is dropped.
	ExpireAfterSeconds *int32

	// If true, the index will only reference documents that contain the fields specified in the index. The default is
	// false.
	Sparse *bool

	// If true, the collection will not accept insertion or update of documents where the index key value matches an
	// existing value in the index. The default is false.
	Unique *bool

	// The clustered index.
	Clustered *bool
}

cupen avatar Feb 29 '24 03:02 cupen

项目死了吗

veronica-bytes avatar Mar 07 '24 08:03 veronica-bytes

项目死了吗 没, 好好的, 另外词语干净点.

888go avatar Mar 09 '24 01:03 888go

项目死了吗 作者说稳定了, 也没什么好更新的. 所以不会经常更新, 如有bug一样在维护 .

888go avatar Mar 09 '24 01:03 888go

@888go 抄家伙,跟他干! :D

cupen avatar Mar 09 '24 08:03 cupen