简体   繁体   English

如何在Firestore数据库中映射特定字段

[英]How to map a particular field in firestore database

For example, if I have the fields like empId,empName in Employees collection and empName,city in another collection called EmployeeCities If I change the empName in the Employees collection, the change should reflect in EmployeeCities. 例如,如果我在Employees集合中有empId,empName,在另一个名为EmployeeCities的集合中有empName,city等字段。 I know I can update them manually but, I am asking if we can map certain fields as in SQL primary key and foreign key. 我知道我可以手动更新它们,但是,我问是否可以像SQL主键和外键中那样映射某些字段。

Firestore is a NoSQL database, (not a relational database), which means it doesn't enforce relationships between documents and collections. Firestore是NoSQL数据库(不是关系数据库),这意味着它不强制文档和集合之间的关系。 You cannot designate fields as primary or foreign key. 您不能将字段指定为主键或外键。 Any relationship between documents and collection are those that you impose for yourself in your source code. 文档和集合之间的任何关系都是您在源代码中强加给自己的关系。 The database will not enforce them for you. 数据库不会为您强制执行它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM