2013-02-26 63 views

回答

0

在谷歌組評論人稱爲Stephen說關於db.model

IDs are 64bit positive integers. If you allocate IDs for an entity called 'Sequence' you can use them for any other entity kind, including entities with parents which would otherwise use a unique range if auto allocated. IDs from 'Sequence' will be unique within your datastore, which is a superset of the requirement that IDs be unique per-entity group. However, you must always then use an ID from Sequence and never allow auto-allocation.

他似乎知道他在說什麼。我無法找到另一個對數據存儲的自動ID序列發生器,但在這種類似question這裏的allocateids java的定義被鏈接到和它說,它可以拋出這個錯誤:

java.lang.IllegalArgumentException - If parent is not a complete key, if num is less than 1, or if num is greater than 1 billion.

+0

嗨,保羅。感謝您的幫助。我明白它不應該返回負數或零數字。 – hogedigo 2013-02-27 00:21:39

+0

第二個引用超出了上下文 - 它並沒有引用該ID,而是指定了該參數應該返回多少個ID。還要注意,生成的ID現在限制爲53位,以便與js整數一起使用。 – Tom 2014-07-18 17:25:34