# Collection.doc

Gets the reference of record.

The method signature is shown as below:

function doc(id: string | number): Document

The method accepts an id parameter to specify the ID of the record to be referenced.

Sample code

const myTodo = db.collection('todos').doc('my-todo-id')
点击咨询小助手