[英]Google app engine - Accessing datastore
Hi i wonder if you could help provide some advice; 嗨,我想知道您是否可以提供一些建议?
I have a python script allows users to post messages to the google app engine datastore - which uses ajax to post a message to the app engine. 我有一个python脚本,允许用户将消息发布到google app引擎数据存储区-使用ajax将消息发布到app引擎。 What i am trying to achieve is to have - in javascript- check the latest message being posted.
我想达到的目的是-在javascript中-查看发布的最新消息。 I have looked at the GQL docs but cannot find out how to check for the latest post.
我看过GQL文档,但找不到如何检查最新帖子。
// if {{message.**LastPost**}} == "hello"
//do this....
//end if
The GQL query would simply be to order your data by the date ascending and then limit to 1. GQL查询仅是按日期升序排序数据,然后限制为1。
Example: 例:
SELECT * FROM messages ORDER BY date_submitted DESC LIMIT 1
See https://developers.google.com/appengine/docs/python/datastore/gqlreference for reference. 请参阅https://developers.google.com/appengine/docs/python/datastore/gqlreference以获取参考。
If all you want is the latest record of your messages object which contains the DB query you can simply use something like messages.get().message
如果您想要的只是包含数据库查询的message对象的最新记录,则可以简单地使用
messages.get().message
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.