Family
Constructor
Family
new Family(table, name)
Create a Family object to interact with your table column families.
Parameter |
|
---|---|
table |
|
name |
string |
Example
const Bigtable = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance('my-instance');
const table = instance.table('prezzy');
const family = table.family('follows');
Property
familyName
string
Methods
create
create(options)
Create a column family.
Parameter |
|
---|---|
options |
Optional object See Table#createFamily. |
Example
family.create(function(err, family, apiResponse) {
// The column family was created successfully.
});
//-
// If the callback is omitted, we'll return a Promise.
//-
family.create().then(function(data) {
const family = data[0];
const apiResponse = data[1];
});
delete
delete(callback)
Delete the column family.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
callback |
Optional function() The callback function. Values in
|
Example
family.delete(function(err, apiResponse) {});
//-
// If the callback is omitted, we'll return a Promise.
//-
family.delete().then(function(data) {
const apiResponse = data[0];
});
exists
exists(callback)
Check if the column family exists.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
callback |
function() The callback function. Values in
|
Example
family.exists(function(err, exists) {});
//-
// If the callback is omitted, we'll return a Promise.
//-
family.exists().then(function(data) {
const exists = data[0];
});
get
get(options)
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.
Parameter |
|||||
---|---|---|---|---|---|
options |
Optional object Configuration object. Values in
|
Example
family.get(function(err, family, apiResponse) {
// `family.metadata` has been populated.
});
//-
// If the callback is omitted, we'll return a Promise.
//-
family.get().then(function(data) {
const family = data[0];
const apiResponse = data[1];
});
getMetadata
getMetadata(callback)
Get the column family's metadata.
Parameter |
|||||||||
---|---|---|---|---|---|---|---|---|---|
callback |
function() The callback function. Values in
|
Example
family.getMetadata(function(err, metadata, apiResponse) {});
//-
// If the callback is omitted, we'll return a Promise.
//-
family.getMetadata().then(function(data) {
var metadata = data[0];
var apiResponse = data[1];
});
setMetadata
setMetadata(metadata, callback)
Set the column family's metadata.
See Table#createFamily for a detailed explanation of the arguments.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
metadata |
object Metadata object. Values in
|
||||||
callback |
function() The callback function. Values in
|
- See also
Example
var metadata = {
rule: {
versions: 2,
union: true
}
};
family.setMetadata(metadata, function(err, apiResponse) {});
//-
// If the callback is omitted, we'll return a Promise.
//-
family.setMetadata(metadata).then(function(data) {
var apiResponse = data[0];
});