你如何找到所有[options]
未列出時可用?閱讀不完整的API文檔 - 您如何知道所有[選項]如果不在列表中?
在mongoose
的情況下nodejs
: http://mongoosejs.com/docs/api.html#schema_Schema-index
例子幫助,但往往不是完整的。如何跟蹤可以作爲第二個參數傳入的options
的全部範圍?
它讀取:
Schema#index(fields, [options])
Defines an index (most likely compound) for this schema.
show code
Parameters:
fields <Object>
[options] <Object>
Example
schema.index({ first: 1, last: -1 }, { unique: true })
在一些地方,所有的選項都詳細說明了,這是美妙的。 例如:
http://mongoosejs.com/docs/api.html#connection_Connection-openSet
感謝。
此外,我發現這個可愛的問題/答案。
How to read API documentation for newbs?
一個找到的最好辦法看看可用的選項(實際上是什麼功能)是看看測試。 – booyaa 2013-05-13 07:57:32
聰明的建議。所以,我只是去測試源代碼。得到它了。 – 2013-05-13 11:29:44
這是假設他們編寫好的測試,但在這個項目的情況下,你會沒事的:https://github.com/LearnBoost/mongoose/blob/master/test/schema.test.js#L1028 – booyaa 2013-05-13 13:03:30