@@ -196,6 +196,76 @@ DatastoreRequest.prototype.insert = function(entities, callback) {
196196 * data: {
197197 * rating: '10'
198198 * }
199+ * }, function(err) {
200+ * console.log(key.path); // [ 'Company', 5669468231434240 ]
201+ * console.log(key.namespace); // undefined
202+ * });
203+ *
204+ * //-
205+ * // Save a single entity using a provided name instead of auto-generated ID.
206+ * //
207+ * // Here we are providing a key with name instead of an ID. After saving, the
208+ * // original Key object used to save will be updated to contain the path with
209+ * // the name instead of a generated ID.
210+ * //-
211+ * var key = dataset.key(['Company', 'donutshack']);
212+ *
213+ * dataset.save({
214+ * key: key,
215+ * data: {
216+ * name: 'DonutShack',
217+ * rating: 8
218+ * }
219+ * }, function(err) {
220+ * console.log(key.path); // ['Company', 'donutshack']
221+ * console.log(key.namespace); // undefined
222+ * });
223+ *
224+ * //-
225+ * // Save a single entity with a provided namespace. Namespaces allow for
226+ * // multitenancy. To read more about this, see
227+ * // [the Datastore docs on key concepts](https://goo.gl/M1LUAu).
228+ * //
229+ * // Here we are providing a key with namespace.
230+ * //-
231+ * var key = dataset.key({
232+ * namespace: 'my-namespace',
233+ * path: ['Company', 'donutshack']
234+ * });
235+ *
236+ * dataset.save({
237+ * key: key,
238+ * data: {
239+ * name: 'DonutShack',
240+ * rating: 8
241+ * }
242+ * }, function(err) {
243+ * console.log(key.path); // ['Company', 'donutshack']
244+ * console.log(key.namespace); // 'my-namespace'
245+ * });
246+ *
247+ * //-
248+ * // Save different types of data, including ints, doubles, dates, booleans,
249+ * // blobs, and lists.
250+ * //
251+ * // Notice that we are providing an incomplete key. After saving, the original
252+ * // Key object used to save will be updated to contain the path with its
253+ * // generated ID.
254+ * //-
255+ * var key = dataset.key('Company');
256+ *
257+ * dataset.save({
258+ * key: key,
259+ * data: {
260+ * name: 'DonutShack', // strings
261+ * rating: datastore.int(8), // ints
262+ * worth: datastore.double(123456.78), // doubles
263+ * numDonutsServed: 45, // detect number type (int or double)
264+ * founded: new Date('Tue May 12 2015 15:30:00 GMT-0400 (EDT)'), // dates
265+ * isStartup: true, // booleans
266+ * donutEmoji: new Buffer('\uD83C\uDF69'), // buffers
267+ * keywords: ['donut', 'coffee', 'yum'] // lists of objects
268+ * }
199269 * }, function(err) {});
200270 *
201271 * //-
0 commit comments