@@ -47,7 +47,7 @@ function Entity(projectId) {
4747 if ( keyFile ) {
4848 options . keyFilename = keyFile ;
4949 }
50- this . datastore = gcloud . datastore . dataset ( options ) ;
50+ this . datastore = gcloud . datastore ( options ) ;
5151
5252 // To create the keys, we have to use this instance of Datastore.
5353 datastore . key = this . datastore . key ;
@@ -210,6 +210,27 @@ Entity.prototype.testBasicEntity = function(callback) {
210210 } , callback ) ;
211211} ;
212212
213+ Entity . prototype . testUpsert = function ( callback ) {
214+ var taskKey = this . getIncompleteKey ( ) ;
215+ var task = this . getTask ( ) ;
216+
217+ // [START upsert]
218+ datastore . upsert ( {
219+ key : taskKey ,
220+ data : task
221+ } , function ( err ) {
222+ if ( ! err ) {
223+ // Task inserted successfully.
224+ }
225+ } ) ;
226+ // [END upsert]
227+
228+ this . datastore . upsert ( {
229+ key : taskKey ,
230+ data : task
231+ } , callback ) ;
232+ } ;
233+
213234Entity . prototype . testInsert = function ( callback ) {
214235 var taskKey = this . getIncompleteKey ( ) ;
215236 var task = this . getTask ( ) ;
@@ -423,7 +444,7 @@ function Index(projectId) {
423444 if ( keyFile ) {
424445 options . keyFilename = keyFile ;
425446 }
426- this . datastore = gcloud . datastore . dataset ( options ) ;
447+ this . datastore = gcloud . datastore ( options ) ;
427448}
428449
429450Index . prototype . testUnindexedPropertyQuery = function ( callback ) {
@@ -473,7 +494,7 @@ function Metadata(projectId) {
473494 if ( keyFile ) {
474495 options . keyFilename = keyFile ;
475496 }
476- this . datastore = gcloud . datastore . dataset ( options ) ;
497+ this . datastore = gcloud . datastore ( options ) ;
477498}
478499
479500Metadata . prototype . testNamespaceRunQuery = function ( callback ) {
@@ -611,7 +632,7 @@ function Query(projectId) {
611632 if ( keyFile ) {
612633 options . keyFilename = keyFile ;
613634 }
614- this . datastore = gcloud . datastore . dataset ( options ) ;
635+ this . datastore = gcloud . datastore ( options ) ;
615636
616637 this . basicQuery = this . getBasicQuery ( ) ;
617638 this . projectionQuery = this . getProjectionQuery ( ) ;
@@ -1046,7 +1067,7 @@ function Transaction(projectId) {
10461067 if ( keyFile ) {
10471068 options . keyFilename = keyFile ;
10481069 }
1049- this . datastore = gcloud . datastore . dataset ( options ) ;
1070+ this . datastore = gcloud . datastore ( options ) ;
10501071
10511072 this . fromKey = this . datastore . key ( [ 'Bank' , 1 , 'Account' , 1 ] ) ;
10521073 this . toKey = this . datastore . key ( [ 'Bank' , 1 , 'Account' , 2 ] ) ;
0 commit comments