我正在使用Play框架和mongoDB创建一个scala应用程序.我设法使用Leon Play-Salat建立联系.我有一个模特
case class Person(
  id: ObjectId = new ObjectId,
  fname: String,
  mname: String,
  lname: String
)
Run Code Online (Sandbox Code Playgroud)
在我的控制器中,我需要将其映射到表单
val personForm: Form[Person] = Form(
// Defines a mapping that will handle Contact values
mapping(
  "id" -> of[ObjectId],
  "fname" -> nonEmptyText,
  "mname" -> text,
  "lname" -> nonEmptyText     
)(Person.apply)(Person.unapply))
Run Code Online (Sandbox Code Playgroud)
如何将ObjectID映射到表单?我收到错误ObjectId找不到Object.
我有一个简单的集合用户,文档 id 使用带有名称字符串的 uid

我正在使用 angularfire2 连接到集合
this.users = afs.collection<User>('users').valueChanges();
Run Code Online (Sandbox Code Playgroud)
我正在使用 firebase 身份验证。显示用户 ID 时,我得到 4NxoeUeB4OXverhHhiw86eKl0Sj1 ,它与用户文档匹配。
this.afAuth.authState.subscribe(auth => console.log(auth.uid));
Run Code Online (Sandbox Code Playgroud)
我正在尝试为集合添加规则。如果我使用下面的规则,我会收到错误“缺少或权限不足”。
`service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
        allow read, write: if request.auth.uid == userId;
    }
  }
}`
Run Code Online (Sandbox Code Playgroud)
如果我将规则更改为 request.auth != null 则会显示数据。
`service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
        allow read, write: if request.auth != null;
    }
  }
}`
Run Code Online (Sandbox Code Playgroud)
我可能做错了什么?我也在尝试一些不同的规则,例如。resource.data.name != null。它也不起作用。
我正在测试规则。最终结果我想要一个 reader 数组字段和 writers 数组字段,这样我就可以尝试request.auth.uid in resource.data.readers控制对文档的访问
我有一个收藏品.每个文档都有一个对象阅读器,用于存储可以访问文档的人的uid.它可以是一个或多个可以访问文档的用户

我正在使用角火基
constructor(private afAuth: AngularFireAuth, private afs: AngularFirestore) { 
    this.afAuth.authState.subscribe(auth => {
      this.users = afs.collection<User>('users', ref => ref.where('readers.' + auth.uid, '==', true)).valueChanges();
    });
  }
Run Code Online (Sandbox Code Playgroud)
如果我使用规则允许所有读取,我的页面将显示正确的条目
match /users/{userId=**} {
      allow read, write;
    }
Run Code Online (Sandbox Code Playgroud)
如果我添加规则以使用uid进行过滤,我会收到错误缺失或权限不足的错误.
match /users/{userId=**} {
      allow read, write: if resource.data.readers[request.auth.uid] == true ||
                        resource.readers[request.auth.uid] == true;
    }
Run Code Online (Sandbox Code Playgroud)
感谢我对规则做错的任何帮助.提前致谢.
我正在使用 showDatePicker 来显示日历。如何更改按钮颜色以及今天的日期背景颜色
我在主题数据中尝试了不同的颜色设置。但是确定、取消和今天的日期仍然是蓝色的
Theme(data: ThemeData(
      splashColor: Color(0xFFFE9BC0),
    )
    child: myWidget(),
);
Run Code Online (Sandbox Code Playgroud)