@google-cloud/datastore
Cloud Datastore Client Library for Node.js
Last updated 5 days ago by google-wombot .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @google-cloud/datastore 
SYNC missed versions from official npm registry.
Google Cloud Platform logo

Google Cloud Datastore: Node.js Client

release level npm version codecov

Cloud Datastore Client Library for Node.js

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable the Google Cloud Datastore API.
  3. Set up authentication with a service account so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/datastore

Using the client library

// Imports the Google Cloud client library
const {Datastore} = require('@google-cloud/datastore');

// Creates a client
const datastore = new Datastore();

async function quickstart() {
  // The kind for the new entity
  const kind = 'Task';

  // The name/ID for the new entity
  const name = 'sampletask1';

  // The Cloud Datastore key for the new entity
  const taskKey = datastore.key([kind, name]);

  // Prepares the new entity
  const task = {
    key: taskKey,
    data: {
      description: 'Buy milk',
    },
  };

  // Saves the entity
  await datastore.save(task);
  console.log(`Saved ${task.key.name}: ${task.data.description}`);
}
quickstart();

Troubleshooting

Emulator returning DEADLINE_EXCEEDED, java.lang.OutOfMemoryError

Reference Issue: #95

When using the emulator, you may experience errors such as "DEADLINE_EXCEEDED" within your application, corresponding to an error in the emulator: "java.lang.OutOfMemoryError". These errors are unique to the emulator environment and will not persist in production.

A workaround is available, provided by @ohmpatel1997 here.

Samples

Samples are in the samples/ directory. The samples' README.md has instructions for running the samples.

Sample Source Code Try it
Concepts source code Open in Cloud Shell
Error source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell
Add Task source code Open in Cloud Shell
Delete Task source code Open in Cloud Shell
Legacy Samples source code Open in Cloud Shell
List Tasks source code Open in Cloud Shell
Update Task source code Open in Cloud Shell

The Google Cloud Datastore Node.js Client API Reference documentation also contains samples.

Versioning

This library follows Semantic Versioning.

This library is considered to be General Availability (GA). This means it is stable; the code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against GA libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

License

Apache Version 2.0

See LICENSE

Current Tags

  • 5.0.1                                ...           latest (5 days ago)

56 Versions

  • 5.0.1                                ...           5 days ago
  • 5.0.0                                ...           25 days ago
  • 4.5.2                                ...           a month ago
  • 4.5.1                                ...           a month ago
  • 4.5.0                                ...           a month ago
  • 4.4.1                                ...           2 months ago
  • 4.4.0                                ...           2 months ago
  • 4.3.0                                ...           3 months ago
  • 4.2.0                                ...           4 months ago
  • 4.1.4                                ...           5 months ago
  • 4.1.3                                ...           5 months ago
  • 4.1.2                                ...           6 months ago
  • 4.1.1                                ...           6 months ago
  • 4.1.0                                ...           6 months ago
  • 4.0.0                                ...           7 months ago
  • 3.1.2                                ...           9 months ago
  • 3.1.1                                ...           10 months ago
  • 3.1.0                                ...           10 months ago
  • 3.0.1                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.4.2                                ...           a year ago
  • 1.4.1                                ...           a year ago
  • 1.4.0                                ...           2 years ago
  • 1.3.5                                ...           2 years ago
  • 1.3.4                                ...           2 years ago
  • 1.3.3                                ...           2 years ago
  • 1.3.2                                ...           2 years ago
  • 1.3.1                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.8.0                                ...           3 years ago
  • 0.7.1                                ...           3 years ago
  • 0.7.0                                ...           3 years ago
  • 0.6.1                                ...           3 years ago
  • 0.5.3                                ...           3 years ago
  • 0.5.2                                ...           3 years ago
  • 0.6.0                                ...           3 years ago
  • 0.5.1                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 3
This Month 124
Last Day 0
Last Week 121
Last Month 865
Dependencies (13)
Dev Dependencies (31)
Dependents (158)

Copyright 2014 - 2017 © taobao.org |