App Engine 中的列表属性字段如何排序?
我计划将一些数据存储在列表属性中,并希望确保当我查询实体时列表中项目的顺序保持不变。从数据存储区放入和获取数据时是否有这样的保证?
需要明确的是,我并不是试图通过列表属性中的任何内容对一组结果进行排序,我只是想确保我是否有一个字符串列表(例如:“Sam”、“Alberto”、“Rick”) ,当我访问该实体时,它们始终按该顺序排列。
此问题的答案 意味着它们总是保持不变,但我想确定: 使用 ListProperty 或自定义元组属性应用程序引擎?
I am planning to store some data in a listproperty and want to be sure that the order of the items in the list remains the same when I query my entity back out. Is there such a guarantee when putting and getting data from the datastore?
To be clear, I am not trying to order a set of results by anything in the listproperty, I just want to make sure that if I have a list of strings (for example: "Sam", "Alberto", "Rick"), they are always in that order when I access that entity.
The answer to this question would imply that they do always stay the same, but I'd like to be sure:
Use a ListProperty or custom tuple property in App Engine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ListProperties 的工作方式与 Python 列表类似;它们已被订购并且将保持订购状态。
ListProperties work just like python lists; they are ordered and will remain ordered.
文档中的声明是:
(来自 http://code.google.com/appengine/docs/python /datastore/datamodeling.html)
因此,如果您仅存储字符串,则应以正确的顺序返回它们。
The statement from the documentation is:
(From http://code.google.com/appengine/docs/python/datastore/datamodeling.html)
So, if you are only storing strings, they should be returned in the correct order.