Google Firebase关注和在Web应用程序中混合数据库技术 [英] Google Firebase concerns and mixing database technologies in a web application

查看:42
本文介绍了Google Firebase关注和在Web应用程序中混合数据库技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与一家小型初创公司合作,正在构建一个Web应用程序.我们选择的最初技术堆栈是:React JS前端,服务器端用于处理一些外部数据请求的Python,以及Google的Fire-base(实时数据库)作为后端.

Hi I am working with a small start-up which is building a web application. The initial tech stack we had chosen was, a React JS front end, Python on the server-side to handle some external data requests, and Googles Fire-base (real-time DB) as the back-end.

我们专门研究了Firebase,这是由于Google工具套件(包括google分析和大型查询)已记录在案的插件,以及Google Firebase仪表板随附的已提供用户身份验证.

We specifically looked at Firebase due to the documented plugins to the Google suite of tools including google analytics and big query, and the already provided users authentication that comes along with the Google Firebase dashboard.

但是,自从与一组开发人员合作以来,在将Firebase与我们的应用程序一起使用时,他们在两个方面提出了担忧.Firebase已记录了对其支持的搜索深度和复杂性的限制.

However since engaging a group of developers, concerns have been raised by them in two areas when using Firebase with our application. Firebase has documented limitations to its depth and complexity of search that it supports.

对于需要跨表进行复杂联接或部分查询或要求类似或类似返回的搜索条件的查询,Firebase被认为不具备功能或功能非常有限.

In that for queries that require complex joins across tables or search criteria that is partial or requires returns of similar or LIKE, Firebase is said to either have no capability or very limited capability.

对于用户而言,该产品在构建需要用户组和角色的环境时功能有限.

with regards to users the product is said to have limited capability when building an environment that requires user groups and roles.

因此,建议我们考虑远离Firebase.或者,我们考虑将Firebase的使用减少到应用程序环境的简单元素中,将关键数据和通过复杂的搜索/数据查询找到并显示的数据转移到对数据和搜索复杂性有更大支持的替代数据库技术上.

It has been therefore suggest we look at moving away from Firebase. Or we consider reducing the use of Firebase to simpler elements of our application environment, moving critical data and data that is found and displayed via complex searching / data queries, onto alternative database technologies that have greater support for data and search complexity.

为此,我希望了解是否有人在两个Firebase数据库产品(实时db或FireServe)中的任何一个中都有其整个Web应用程序后端,并且您是否遇到过有关性能,功能缺乏的问题,当您尝试在后端执行复杂操作时缺乏能力.

To that end I am looking to understand if anyone else has their entire web application back-end in either of the two Firebase database offerings (real time db or FireServe) and if you have faced any issues around performance, lack of functionality, lack of capability when trying to do complex things within your back-end.

然后,如果执行了操作,则如何解决该问题.您是使用第三方插件添加到Firebase的,还是将部分或全部数据从Firebase移到了替代数据库技术,或者完全从Firebase移开了?

Then if you did how did you resolve the issue. Did you add on to Firebase with third-party plugins, did you move part or all of your data off Firebase to alternative database technologies, or completely moved away from Firebase altogether?

最后,我想知道是否可以以更有限的方式使用Firebase,例如在关键数据驻留在另一个数据库(例如MongoDB或SQL)中时管理用户对您的应用程序的访问是否可行,或者我们是否过于复杂利用两种不同的数据库技术来构建基础架构?

And lastly I would like to know if using Firebase in a more limited way, for example to manage user access to your application while the critical data resides in another database (for example MongoDB or SQL) is possible or are we over complicating the infrastructure build by leveraging two different database technologies?

感谢任何提供建议的人.邓肯

Thanks for to anyone who offers their advise. Duncan

推荐答案

这不是完全正确的答案,但阅读注释表明该帖子的一个要求是部分字符串查询.根据评论,这是关注点

This isn't exactly an answer but reading the comments shows that one requirement of the post was a partial string query. According the comment, this is the concern

一个用户键入"A1"以尝试搜索他的朋友"Alex".您要获取名称中包含以下内容的数据库中的所有用户文字"Al"以帮助用户缩小搜索范围.该任务不是可能仅通过Cloud Firestore.

One user types in "Al" in an attempt to search for his friend "Alex". You want to fetch all users in the database whose name contains the text "Al" to help the user narrow down his search. This task is not possible through Cloud Firestore alone.

因此,检查一项需求,让我们假设我们要执行该任务;返回名称以"Al"开头的所有用户

So examining that one requirement, let's suppose we want to perform that task; return all users that have a name that starts with 'Al'

func findPartialString(startingWith: String) {
    let usersColl = self.db.collection("users")
    let endingWith = startingWith + "\u{f8ff}"
    let query = usersColl.whereField("name", isGreaterThanOrEqualTo: startingWith).whereField("name", isLessThan: endingWith)
    query.getDocuments { querySnapshot, err in
        if let err = err {
            print("there was an error: \(err.localizedDescription)")
            return
        }

        if let snap = querySnapshot {
            if snap.count > 0 {
                for document in snap.documents {
                    let key = document.documentID
                    let name = document.get("name") as! String
                    print(key, name)
                }
            } else {
                print("no matches")
            }
        } else {
            print("no data returned in snapshot")
        }
    }
}

并且会这样称呼

findPartialString(startingWith: "Al")

结果是

uid_5 Alex
uid_4 Albert

还有几种其他方法可以执行同一任务,因此很显然,不仅很有可能,而且它是易于维护的紧凑代码.

There are several other ways to perform this same task, so clearly it's not only very possible to do, it's also compact code that easy to maintain.

这篇关于Google Firebase关注和在Web应用程序中混合数据库技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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