Version limit

Create a filter to limit the number of versions of columns to retrieve.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample

C#

To learn how to install and use the client library for Bigtable, see Bigtable client libraries.

RowFilter filter = RowFilters.CellsPerRowLimit(1);

C++

To learn how to install and use the client library for Bigtable, see Bigtable client libraries.

cbt::Filter filter = cbt::Filter::ColumnRangeClosed("family", "c0", "c0");

Node.js

To learn how to install and use the client library for Bigtable, see Bigtable client libraries.

const filter = [
  {
    column: {
      cellLimit: 1, // Only retrieve the most recent version of the cell.
    },
  },
];

Python

To learn how to install and use the client library for Bigtable, see Bigtable client libraries.

# Create a filter to only retrieve the most recent version of the cell
# for each column accross entire row.
row_filter = row_filters.CellsColumnLimitFilter(1)

Ruby

To learn how to install and use the client library for Bigtable, see Bigtable client libraries.

# Only retrieve the most recent version of the cell.
filter = Google::Cloud::Bigtable::RowFilter.cells_per_column 1

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.