Read Data
Fetch a Document
Retrieve the contents of a single document using the Document ID.
You can get a Document using the Document Id:
- The Document Id is a unique identifier for a document in a collection.
- The Document Id is automatically generated when a document is created.
- OR, You can also manually define the Document Id while creating a document.
Initialize Database Modules
const worqhat = require('worqhat');
var config = new worqhat.Configuration({
apiKey: "your-api-key",
debug: true,
max_retries: 3,
});
worqhat.initializeApp(config);
let db = worqhat.database();
Example
db.collection('NodeJSDb1').doc('de79272c-2ed3-46d9-ae93-ff195364466e').get().then((response) => {
console.log(response.data);
}).catch((error) => {
console.log(error);
});
Was this page helpful?