---
title: "Read all objects"
description: "How to iterate through all objects in a collection with code examples in Python, TypeScript, Go, Java, and C#."
url: https://docs.weaviate.io/weaviate/manage-objects/read-all-objects
---

# Read all objects

Weaviate provides the necessary APIs to iterate through all your data. This is useful when you want to manually copy/migrate your data (and vector embeddings) from one place to another.

This is done with the help of the `after` operator, also called the [cursor API](https://docs.weaviate.io/weaviate/api/graphql/additional-operators#cursor-with-after).

> [!NOTE]
>
> **Iterator**
>
> Some clients, such as the Python client, encapsulate this functionality as an `Iterator`.

## Read object properties and ids

The following code iterates through all objects, providing the properties and id for each object.

**Python**

```py
collection = client.collections.use("WineReview")

for item in collection.iterator():
    print(item.uuid, item.properties)
```

**JavaScript/TypeScript**

```ts
const myCollection = client.collections.use("WineReview");

for await (let item of myCollection.iterator()) {
  console.log(item.uuid, item.properties);
}
```

**Go (v5)**

```go
sourceClient, err := weaviate.NewClient(weaviate.Config{
  Scheme: "https",
  Host:   "WEAVIATE_INSTANCE_URL", // Replace WEAVIATE_INSTANCE_URL with your instance URL
  AuthConfig: auth.ApiKey{
  	Value: "YOUR-WEAVIATE-API-KEY", // If auth enabled. Replace with your Weaviate instance API key.
  },
})
if err != nil {
  // handle error
  panic(err)
}

batchSize := 20
className := "WineReview"
classProperties := []string{"title"}

getBatchWithCursor := func(client weaviate.Client,
  className string, classProperties []string, batchSize int, cursor string) (*models.GraphQLResponse, error) {
  fields := []graphql.Field{}
  for _, prop := range classProperties {
  	fields = append(fields, graphql.Field{Name: prop})
  }
  fields = append(fields, graphql.Field{Name: "_additional { id vector }"})

  get := client.GraphQL().Get().
  	WithClassName(className).
  	// Optionally retrieve the vector embedding by adding `vector` to the _additional fields
  	WithFields(fields...).
  	WithLimit(batchSize)

  if cursor != "" {
  	return get.WithAfter(cursor).Do(context.Background())
  }
  return get.Do(context.Background())
}
```

**Go (v6)**

```go
collection := client.Collections.Use("WineReview")

iter := collection.Objects(ctx)
for {
  obj, err := iter.Next()
  if err == iterator.Done {
    break
  }
  if err != nil {
    // handle error
    panic(err)
  }
  fmt.Println(obj.UUID, obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> collection =
    client.collections.use("WineReview");

for (WeaviateObject<Map<String, Object>> item : collection.paginate()) {
  System.out.printf("%s %s\n", item.uuid(), item.properties());
}
```

**C#**

```csharp
var collection = client.Collections.Use("WineReview");

await foreach (var item in collection.Iterator())
{
    Console.WriteLine($"{item.UUID} {JsonSerializer.Serialize(item.Properties)}");
}
```

> [!NOTE]
>
> **Returned properties**
>
> By default, all properties and object UUIDs are returned. Blob and reference properties are excluded [unless specified otherwise](https://docs.weaviate.io/weaviate/search/basics#retrieve-object-properties). *This does not apply to the Go client library.*

## Read all objects including vectors

Read through all data including the vectors. (Also applicable where [named vectors](https://docs.weaviate.io/weaviate/config-refs/collections#named-vectors) are used.)

**Python**

```py
collection = client.collections.use("WineReview")

for item in collection.iterator(
    include_vector=True  # If using named vectors, you can specify ones to include e.g. ['title', 'body'], or True to include all
):
    print(item.properties)
    print(item.vector)
```

**JavaScript/TypeScript**

```ts
const myCollection = client.collections.use("WineReview");

for await (let item of myCollection.iterator({
    includeVector: true
  })) {
    console.log(item.uuid, item.properties);
    console.log(item.vectors);
}
```

**Go (v6)**

```go
collection := client.Collections.Use("WineReview")

// The object iterator returns no vectors, so page with After and request them.
var after uuid.UUID
for {
  res, err := collection.Query.OverAll(ctx, query.OverAll{
    Limit: 100,
    After: after,
    ReturnVectors: []string{"default"},
  })
  if err != nil {
    // handle error
    panic(err)
  }
  if len(res.Objects) == 0 {
    break
  }
  for _, obj := range res.Objects {
    fmt.Println(obj.Properties)
    fmt.Println(obj.Vectors["default"].Single)
  }
  after = res.Objects[len(res.Objects)-1].UUID
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> collection =
    client.collections.use("WineReview");

for (WeaviateObject<Map<String, Object>> item : collection.paginate(
    i -> i.returnMetadata() // If using named vectors, you can specify ones to include
)) {
  System.out.println(item.properties());
  System.out.println(item.vectors());
}
```

**C#**

```csharp
var collection = client.Collections.Use("WineReview");

await foreach (
    var item in collection.Iterator(
        includeVectors: true // If using named vectors, you can specify ones to include
    )
)
{
    Console.WriteLine(JsonSerializer.Serialize(item.Properties));
    Console.WriteLine(JsonSerializer.Serialize(item.Vectors));
}
```

## Read all objects - Multi-tenant collections

Iterate through all tenants and read data for each.

> [!TIP]
>
> **Multi-tenancy**
>
> For classes where [multi-tenancy](https://docs.weaviate.io/weaviate/concepts/data#multi-tenancy) is enabled, you need to specify the tenant name when reading or creating objects. See [Manage data: multi-tenancy operations](https://docs.weaviate.io/weaviate/manage-collections/multi-tenancy) for details.

**Python**

```py
multi_collection = client.collections.use("WineReviewMT")

# Get a list of tenants
tenants = multi_collection.tenants.get()

# Iterate through tenants
for tenant_name in tenants.keys():
    # Iterate through objects within each tenant
    for item in multi_collection.with_tenant(tenant_name).iterator():
        print(f"{tenant_name}: {item.properties}")
```

**JavaScript/TypeScript**

```ts
const multiCollection = client.collections.use("WineReviewMT");

const tenants = await multiCollection.tenants.get()

for (let tenantName in tenants) {
  for await (let item of multiCollection.withTenant(tenantName).iterator()) {
    console.log(`${tenantName}:`, item.properties);
  }
}
```

**Go (v6)**

```go
multiCollection := client.Collections.Use("WineReviewMT")

// Get a list of tenants
tenants, err := multiCollection.Tenants.Get(ctx)
if err != nil {
  // handle error
  panic(err)
}

// Iterate through tenants
for _, tn := range tenants {
  // Iterate through objects within each tenant
  iter := multiCollection.WithOptions(collections.WithTenant(tn.Name)).Objects(ctx)
  for {
    obj, err := iter.Next()
    if err == iterator.Done {
      break
    }
    if err != nil {
      // handle error
      panic(err)
    }
    fmt.Printf("%s: %v\n", tn.Name, obj.Properties)
  }
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> multiCollection =
    client.collections.use("WineReviewMT");

// Get a list of tenants
var tenants = multiCollection.tenants.get();

// Iterate through tenants
for (Tenant tenant : tenants) {
  // Iterate through objects within each tenant
  for (WeaviateObject<Map<String, Object>> item : multiCollection
      .withTenant(tenant.name())
      .paginate()) {
    System.out.printf("%s: %s\n", tenant.name(), item.properties());
  }
}
```

**C#**

```csharp
var multiCollection = client.Collections.Use("WineReviewMT");

// Get a list of tenants
var tenants = await multiCollection.Tenants.List();

// Iterate through tenants
foreach (var tenant in tenants)
{
    // Iterate through objects within each tenant
    var tenantCollection = multiCollection.WithTenant(tenant.Name);
    await foreach (var item in tenantCollection.Iterator())
    {
        Console.WriteLine($"{tenant.Name}: {JsonSerializer.Serialize(item.Properties)}");
    }
}
```

## Related pages

- [Connect to Weaviate](https://docs.weaviate.io/weaviate/connections)
- [How-to: Read objects](https://docs.weaviate.io/weaviate/manage-objects/read)
- [References: GraphQL - Additional Operators](https://docs.weaviate.io/weaviate/api/graphql/additional-operators#cursor-with-after)
- [Manage data: multi-tenancy operations](https://docs.weaviate.io/weaviate/manage-collections/multi-tenancy)
