Firebase AfterSave 功能,如 Parse.com [英] Firebase AfterSave function like Parse.com

查看:19
本文介绍了Firebase AfterSave 功能,如 Parse.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我使用 Parse.com AfterSave 云代码功能来保存与特定位置相关的最新帖子列表.这样做的原因是获取某个位置的最新帖子,而无需搜索和排序所有位置的整个帖子列表.

So I was using Parse.com AfterSave cloud code function to keep a list of the most recent Posts relating to a specific location. The reason for this is to get the most recent post for a location without having to search and order the entire list of posts for all locations.

这在 Parse AfterSave 中做得很好,因为我不必担心客户端执行这个命令,它在云中运行是有意义的.现在解析正在关闭,我决定迁移到 Firebase.Firebase 中是否有类似的功能,或者我的客户是否需要维护最新帖子的列表?

This was nicely done in Parse AfterSave because I didnt have to worry about clients exectuing this command, it made sense for it to run in the cloud. Now that parse is shutting down, I've decided to migrate over to Firebase. Is there an equivilant functionality in Firebase or will my clients need to be maintaining the list of most recent posts?

谢谢

原始问题重新解析 获取每个字段的最新记录在 Parse.com JS 查询中

推荐答案

目前无法在 Firebase 的服务器上运行您的代码.因此,您必须将 Cloud Code 不太直接地映射到新的解决方案.在每个客户端上运行功能是一种选择,在廉价的机器人"/服务器上运行是另一种选择.

There is currently no way to run your code on Firebase's servers. So you will have to come up with a less-direct mapping of Cloud Code to a new solution. Running the functionality on each client is one option, running it on a cheap "bot"/server is another one.

我会找到一些之前已经讨论过的问题,并将它们链接到这里:

I'll find a few questions where this has been covered before and link them here:

  • Firebase and backend logic (recent question that covers using a nodejs server)
  • How would I run server-side code in Firebase?
  • How do I use Firebase to handle automatic server-side calculations?
  • Firebase and indexing/search
  • Server Side Calculation using Firebase (which leads to four more questions about this)

要记住的一件事是,运行这样的服务器并不是您立即想到的编写服务器"的类型.其中大多数更像是一个机器人",以与客户端代码相同的方式与 Firebase 交互.在这种情况下唯一的区别是它在您控制的环境中运行,因此它可以使用提升的凭据运行.

One thing to keep in mind is that running a server like this is not the type of "writing a server" that you're immediately thinking of. Most of these act more like a "bot" that interacts with Firebase in the same way as your client-side code does. The only difference in that case is that it runs on an environment you control, so that it can run with elevated credentials.

这篇关于Firebase AfterSave 功能,如 Parse.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆