# Invalidate

> Invalidates all the properties stored for an entire document.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Search](/engine/6000.7/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

## Invalidate(string)

Invalidates all the properties stored for an entire document.

```csharp
void Invalidate(string documentId)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): A document identifier.

### Examples

```csharp
using (var view = propertyDatabase.GetView())
{
    // Store multiple properties of a document.
    var document = "path/to/my/asset";
    view.Store(document, "prop1", "value1");
    view.Store(document, "prop2", "value2");

    // Invalidate the entire document.
    view.Invalidate(document);

    // The invalidated document can no longer be retrieved.
    if (view.TryLoad(view.CreateDocumentKey(document), out IEnumerable<object> documentValues))
        Assert.Fail("TryLoad should have failed to retrieve the document values.");
}
```

## Invalidate(ulong)

Invalidates all the properties stored for an entire document.

```csharp
void Invalidate(ulong documentKey)
```

### Parameters

**** (\[ulong]\(https\://learn.microsoft.com/dotnet/api/system.uint64)): A document key.

### Remarks

```csharp
using (var view = propertyDatabase.GetView())
{
    // Store multiple properties of a document.
    var documentKey = view.CreateDocumentKey("path/to/my/asset");
    view.Store(documentKey, view.CreatePropertyHash("prop1"), "value1");
    view.Store(documentKey, view.CreatePropertyHash("prop2"), "value2");

    // Invalidate the entire document by its key.
    view.Invalidate(documentKey);

    // The invalidated document can no longer be retrieved.
    if (view.TryLoad(documentKey, out IEnumerable<object> documentKeyValues))
        Assert.Fail("TryLoad should have failed to retrieve the document values.");
}
```

Additional Resources: [IPropertyDatabaseView.CreateDocumentKey](/engine/6000.7/script-reference/unityeditor/search/ipropertydatabaseview/createdocumentkey.md).
