@@ -1471,41 +1471,58 @@ class Datastore extends DatastoreRequest {
14711471 * @returns {Key } A newly created Key from the options given.
14721472 *
14731473 * @example
1474- * <caption>Create an incomplete key with a kind value of `Company`.</caption>
1474+ * <caption>Create an incomplete key with a kind value of `Company`.
1475+ * Since no Id is supplied, Datastore will generate one on save.</caption>
14751476 * const {Datastore} = require('@google-cloud/datastore');
14761477 * const datastore = new Datastore();
14771478 * const key = datastore.key('Company');
14781479 *
14791480 * @example
1480- * <caption>Create a complete key with a kind value of `Company` and id
1481- * `123`.</caption> const {Datastore} = require('@google-cloud/datastore');
1481+ * <caption>Create a complete key with a kind value of `Company` and Id `123`.</caption>
1482+ * const {Datastore} = require('@google-cloud/datastore');
14821483 * const datastore = new Datastore();
14831484 * const key = datastore.key(['Company', 123]);
14841485 *
14851486 * @example
14861487 * <caption>If the ID integer is outside the bounds of a JavaScript Number
1487- * object, create an Int.</caption> const {Datastore} =
1488- * require('@google-cloud/datastore'); const datastore = new Datastore();
1488+ * object, create an Int.</caption>
1489+ * const {Datastore} = require('@google-cloud/datastore');
1490+ * const datastore = new Datastore();
14891491 * const key = datastore.key([
14901492 * 'Company',
14911493 * datastore.int('100000000000001234')
14921494 * ]);
14931495 *
14941496 * @example
1497+ * <caption>Create a complete key with a kind value of `Company` and name `Google`.
1498+ * Because the supplied Id is a string, Datastore will prefix it with "name=".
1499+ * Had the supplied Id been numeric, Datastore would prefix it with the standard, "id=".</caption>
14951500 * const {Datastore} = require('@google-cloud/datastore');
14961501 * const datastore = new Datastore();
1497- * // Create a complete key with a kind value of `Company` and name `Google`.
1498- * // Note: `id` is used for numeric identifiers and `name` is used otherwise.
14991502 * const key = datastore.key(['Company', 'Google']);
15001503 *
15011504 * @example
1502- * <caption>Create a complete key from a provided namespace and
1503- * path.</caption> const {Datastore} = require('@google-cloud/datastore');
1505+ * <caption>Create a complete key from a provided namespace and path.</caption>
1506+ * const {Datastore} = require('@google-cloud/datastore');
15041507 * const datastore = new Datastore();
15051508 * const key = datastore.key({
15061509 * namespace: 'My-NS',
15071510 * path: ['Company', 123]
15081511 * });
1512+ *
1513+ * @example
1514+ * <caption>Create a complete key that specifies an ancestor. This will create a Team entity
1515+ * with a name of "Datastore", which belongs to the Company with the "name=Google" key.</caption>
1516+ * const {Datastore} = require('@google-cloud/datastore');
1517+ * const datastore = new Datastore();
1518+ * const key = datastore.key(['Company', 'Google', 'Team', 'Datastore']);
1519+ *
1520+ * @example
1521+ * <caption>Create a incomplete key that specifies an ancestor. This will create an Employee entity
1522+ * with an auto-generated Id, which belongs to the Company with the "name=Google" key.</caption>
1523+ * const {Datastore} = require('@google-cloud/datastore');
1524+ * const datastore = new Datastore();
1525+ * const key = datastore.key(['Company', 'Google', 'Employee']);
15091526 */
15101527 key ( options : string | entity . KeyOptions | PathType [ ] ) : entity . Key {
15111528 const keyOptions = is . object ( options )
0 commit comments