从子集合中的文档获取快照时路径无效



我正试图从一个名为userPosts的子集合中的文档创建一个文档快照,该子集合位于名为posts 的主集合中的一个文档中

DocumentSnapshot doc = await Firestore.instance.collection('posts').document(authorId).collection('userPosts').document(postID).get();
//code stops here and the followng exception is raised:

出现异常。PlatformException(PlatformException((错误,无效路径(posts//userPosts/MyhwixjFnOV0vh2jt4Qo(。路径中不能包含//。,空((

在我看来,您的authorId是一个空字符串。请注意无效路径中的双斜杠,它应该位于"one_answers"之间;帖子";以及";userPosts";。

最新更新