Google Cloud v8.40.0 published on Monday, Aug 11, 2025 by Pulumi
gcp.firestore.getDocument
Explore with Pulumi AI
Reads a document from a Firestore database. See the official documentation and API.
Example Usage
Retrieve a document from the Firestore database.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const mydoc = new gcp.firestore.Document("mydoc", {
project: database.project,
database: database.name,
collection: "somenewcollection",
documentId: "my-doc-id",
});
import pulumi
import pulumi_gcp as gcp
mydoc = gcp.firestore.Document("mydoc",
project=database["project"],
database=database["name"],
collection="somenewcollection",
document_id="my-doc-id")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firestore"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := firestore.NewDocument(ctx, "mydoc", &firestore.DocumentArgs{
Project: pulumi.Any(database.Project),
Database: pulumi.Any(database.Name),
Collection: pulumi.String("somenewcollection"),
DocumentId: pulumi.String("my-doc-id"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var mydoc = new Gcp.Firestore.Document("mydoc", new()
{
Project = database.Project,
Database = database.Name,
Collection = "somenewcollection",
DocumentId = "my-doc-id",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.firestore.Document;
import com.pulumi.gcp.firestore.DocumentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var mydoc = new Document("mydoc", DocumentArgs.builder()
.project(database.project())
.database(database.name())
.collection("somenewcollection")
.documentId("my-doc-id")
.build());
}
}
resources:
mydoc:
type: gcp:firestore:Document
properties:
project: ${database.project}
database: ${database.name}
collection: somenewcollection
documentId: my-doc-id
Using getDocument
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getDocument(args: GetDocumentArgs, opts?: InvokeOptions): Promise<GetDocumentResult>
function getDocumentOutput(args: GetDocumentOutputArgs, opts?: InvokeOptions): Output<GetDocumentResult>
def get_document(collection: Optional[str] = None,
database: Optional[str] = None,
document_id: Optional[str] = None,
project: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetDocumentResult
def get_document_output(collection: Optional[pulumi.Input[str]] = None,
database: Optional[pulumi.Input[str]] = None,
document_id: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetDocumentResult]
func LookupDocument(ctx *Context, args *LookupDocumentArgs, opts ...InvokeOption) (*LookupDocumentResult, error)
func LookupDocumentOutput(ctx *Context, args *LookupDocumentOutputArgs, opts ...InvokeOption) LookupDocumentResultOutput
> Note: This function is named LookupDocument
in the Go SDK.
public static class GetDocument
{
public static Task<GetDocumentResult> InvokeAsync(GetDocumentArgs args, InvokeOptions? opts = null)
public static Output<GetDocumentResult> Invoke(GetDocumentInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDocumentResult> getDocument(GetDocumentArgs args, InvokeOptions options)
public static Output<GetDocumentResult> getDocument(GetDocumentArgs args, InvokeOptions options)
fn::invoke:
function: gcp:firestore/getDocument:getDocument
arguments:
# arguments dictionary
The following arguments are supported:
- Collection string
- The name of the collection of documents.
- Database string
- The name of the Firestore database.
- Document
Id string - The id of the document to get.
- Project string
- The project in which the database resides.
- Collection string
- The name of the collection of documents.
- Database string
- The name of the Firestore database.
- Document
Id string - The id of the document to get.
- Project string
- The project in which the database resides.
- collection String
- The name of the collection of documents.
- database String
- The name of the Firestore database.
- document
Id String - The id of the document to get.
- project String
- The project in which the database resides.
- collection string
- The name of the collection of documents.
- database string
- The name of the Firestore database.
- document
Id string - The id of the document to get.
- project string
- The project in which the database resides.
- collection str
- The name of the collection of documents.
- database str
- The name of the Firestore database.
- document_
id str - The id of the document to get.
- project str
- The project in which the database resides.
- collection String
- The name of the collection of documents.
- database String
- The name of the Firestore database.
- document
Id String - The id of the document to get.
- project String
- The project in which the database resides.
getDocument Result
The following output properties are available:
- Collection string
- Create
Time string - Database string
- Document
Id string - Fields string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Path string
- Update
Time string - Project string
- Collection string
- Create
Time string - Database string
- Document
Id string - Fields string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Path string
- Update
Time string - Project string
- collection String
- create
Time String - database String
- document
Id String - fields String
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- path String
- update
Time String - project String
- collection string
- create
Time string - database string
- document
Id string - fields string
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- path string
- update
Time string - project string
- collection str
- create_
time str - database str
- document_
id str - fields str
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- path str
- update_
time str - project str
- collection String
- create
Time String - database String
- document
Id String - fields String
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- path String
- update
Time String - project String
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.