In Flutter,
- Let firestore creates document reference with it's automatic document ID
DocumentReference docRef = firestore.collection('Groups').document();
print(docRef.documentID);
docRef.setData({JSON Data});
- Providing your own document ID for groups
String groupID = 'unique_id'
DocumentReference docRef = firestore.collection('Groups').document(groupID);
print(docRef.documentID);
docRef.setData({JSON Data});
For constraints on document ID - https://firebase.google.com/docs/firestore/quotas#collections_documents_and_fields
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…