Methods
create(optionsopt, callback)
Create a column family.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
See Table#createFamily. |
||||||||||||||||
callback |
function |
The callback function. Properties
|
Example
const options = {};
// options.rule = {
// age: {
// seconds: 0,
// nanos: 5000
// },
// versions: 3,
// union: true
// };
table
.createFamily(familyId, options)
.then(result => {
const family = result[0];
// const apiResponse = result[1];
})
.catch(err => {
// Handle the error.
});
delete(gaxOptionsopt, callbackopt)
Delete the column family.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
<optional> |
The callback function. Properties
|
Example
const {Bigtable} = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const table = instance.table(tableId);
const family = table.family(familyId);
family
.delete()
.then(result => {
const apiResponse = result[0];
})
.catch(err => {
// Handle the error.
});
exists(gaxOptionsopt, callback)
Check if the column family exists.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
The callback function. Properties
|
Example
const {Bigtable} = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const table = instance.table(tableId);
const family = table.family(familyId);
family
.exists()
.then(result => {
const exists = result[0];
})
.catch(err => {
// Handle the error.
});
get(optionsopt)
Get a column family if it exists.
You may optionally use this to "get or create" an object by providing an
object with autoCreate set to true. Any extra configuration that is
normally required for the create method must be contained within this
object as well.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Configuration object. Properties
|
|||||||||||||||
callback.error |
error |
<nullable> |
An error returned while making this request. |
|||||||||||||||
callback.family |
Family |
The Family object. |
||||||||||||||||
callback.apiResponse |
object |
The resource as it exists in the API. |
Example
const {Bigtable} = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const table = instance.table(tableId);
const family = table.family(familyId);
family
.get()
.then(result => {
const family = result[0];
// const apiResponse = result[1];
})
.catch(err => {
// Handle the error.
});
getMetadata(gaxOptionsopt, callback)
Get the column family's metadata.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
The callback function. Properties
|
Example
const {Bigtable} = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const table = instance.table(tableId);
const family = table.family(familyId);
family
.getMetadata()
.then(result => {
const metaData = result[0];
// const apiResponse = result[1];
})
.catch(err => {
// Handle the error.
});
setMetadata(metadata, gaxOptionsopt, callback)
Set the column family's metadata.
See Table#createFamily for a detailed explanation of the arguments.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
metadata |
object |
Metadata object. Properties
|
|||||||||||||
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions. |
||||||||||||
callback |
function |
The callback function. Properties
|
Example
const {Bigtable} = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const table = instance.table(tableId);
const family = table.family(familyId);
const metadata = {
rule: {
versions: 2,
union: true,
},
};
family
.setMetadata(metadata)
.then(result => {
const apiResponse = result[0];
})
.catch(err => {
// Handle the error.
});