【发布时间】:2019-01-02 06:34:50
【问题描述】:
是否有可能避免 firebase 数据库中的冗余?
我有一个应用程序,用户可以在其中添加第一个词和第二个词。通过一个按钮,您可以获得这两个单词的随机单词。
Random rand = new Random();
int n = rand.nextInt(9);
Random rand1 = new Random();
int m = rand1.nextInt(8);
String first = sp.getItemAtPosition(n).toString();
String second = sp2.getItemAtPosition(m).toString();
out.setText(first + second);
所以我从 Spinner 那里得到的话(请不要问为什么这样)
现在好了。我如何检查随机选择的单词是否已经在数据库中?
使用 if-else 指令?
结构如下:
{"1stWord" : {
"1stWord" : {
"-LI125GLPy0-IPAm4GEM" : {
"name" : "test"
},
提前谢谢各位!
【问题讨论】:
-
你能告诉我们你的数据库结构吗?
标签: typescript firebase firebase-realtime-database google-cloud-firestore