Skip to content
Node.js client for Google Cloud Datastore: a highly-scalable NoSQL database for your web and mobile applications.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore: move CONTRIBUTING.md to root (#321) Feb 7, 2019
.kokoro chore: publish to npm using wombat (#367) Mar 20, 2019
proto
protos/google/datastore/v1 chore: update proto docs and code style Feb 26, 2019
samples Release v3.1.2 (#353) Mar 6, 2019
src chore: update require statement code style Mar 12, 2019
system-test
test refactor(ts): enable noImplicitAny in tsconfig (#355) Mar 8, 2019
.clang-format
.cloud-repo-tools.json Delete reference to non-existent sample. (#149) Aug 2, 2018
.eslintignore chore: update nyc and eslint configs (#284) Dec 11, 2018
.eslintrc.yml
.gitignore
.jsdoc.js build: check broken links in generated docs (#292) Jan 15, 2019
.nycrc
.prettierignore
.prettierrc Repo migration (#4) Dec 16, 2017
CHANGELOG.md Release v3.1.2 (#353) Mar 6, 2019
CODE_OF_CONDUCT.md Repo migration (#4) Dec 16, 2017
CONTRIBUTING.md docs: update links in contrib guide (#334) Feb 14, 2019
LICENSE
README.md
codecov.yaml
package.json
renovate.json
synth.metadata chore: update require statement code style Mar 12, 2019
synth.py refactor(ts): convert to typescript (#236) Nov 7, 2018
tsconfig.json
tslint.json refactor(ts): convert to typescript (#236) Nov 7, 2018

README.md

Google Cloud Platform logo

Google Cloud Datastore: Node.js Client

release level npm version codecov

Cloud Datastore is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Datastore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects.

Using the client library

  1. Select or create a Cloud Platform project.

  2. Enable billing for your project.

  3. Enable the Google Cloud Datastore API.

  4. Set up authentication with a service account so you can access the API from your local workstation.

  5. Install the client library:

     npm install --save @google-cloud/datastore
    
  6. Try an example:

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

async function quickStart() {
  // Your Google Cloud Platform project ID
  const projectId = 'YOUR_PROJECT_ID';

  // Creates a client
  const datastore = new Datastore({
    projectId: projectId,
  });

  // 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().catch(console.error);

Samples

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

Sample Source Code Try it
Tasks source code Open in Cloud Shell
Concepts source code Open in Cloud Shell

The 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

What's Next

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

You can’t perform that action at this time.