@@ -97,7 +97,7 @@ KuzzleDataCollection.prototype.count = function (filters, options, cb) {
9797
9898 query = this . kuzzle . addHeaders ( { body : filters } , this . headers ) ;
9999
100- this . kuzzle . query ( this . buildQueryArgs ( 'read ' , 'count' ) , query , options , function ( error , result ) {
100+ this . kuzzle . query ( this . buildQueryArgs ( 'document ' , 'count' ) , query , options , function ( error , result ) {
101101 cb ( error , result && result . result . count ) ;
102102 } ) ;
103103} ;
@@ -120,7 +120,7 @@ KuzzleDataCollection.prototype.create = function (options, cb) {
120120 }
121121
122122 data = this . kuzzle . addHeaders ( data , this . headers ) ;
123- this . kuzzle . query ( this . buildQueryArgs ( 'write ' , 'createCollection ' ) , data , options , cb ) ;
123+ this . kuzzle . query ( this . buildQueryArgs ( 'collection ' , 'create ' ) , data , options , cb ) ;
124124
125125 return this ;
126126} ;
@@ -175,7 +175,7 @@ KuzzleDataCollection.prototype.createDocument = function (id, document, options,
175175
176176 data = self . kuzzle . addHeaders ( data , self . headers ) ;
177177
178- self . kuzzle . query ( this . buildQueryArgs ( 'write ' , action ) , data , options , cb && function ( err , res ) {
178+ self . kuzzle . query ( this . buildQueryArgs ( 'document ' , action ) , data , options , cb && function ( err , res ) {
179179 var doc ;
180180
181181 if ( err ) {
@@ -226,7 +226,7 @@ KuzzleDataCollection.prototype.deleteDocument = function (arg, options, cb) {
226226
227227 data = this . kuzzle . addHeaders ( data , this . headers ) ;
228228
229- this . kuzzle . query ( this . buildQueryArgs ( 'write ' , action ) , data , options , cb && function ( err , res ) {
229+ this . kuzzle . query ( this . buildQueryArgs ( 'document ' , action ) , data , options , cb && function ( err , res ) {
230230 if ( err ) {
231231 cb ( err ) ;
232232 }
@@ -258,7 +258,7 @@ KuzzleDataCollection.prototype.fetchDocument = function (documentId, options, cb
258258 self . kuzzle . callbackRequired ( 'KuzzleDataCollection.fetch' , cb ) ;
259259 data = self . kuzzle . addHeaders ( data , this . headers ) ;
260260
261- self . kuzzle . query ( this . buildQueryArgs ( 'read ' , 'get' ) , data , options , function ( err , res ) {
261+ self . kuzzle . query ( this . buildQueryArgs ( 'document ' , 'get' ) , data , options , function ( err , res ) {
262262 var document ;
263263
264264 if ( err ) {
@@ -377,7 +377,7 @@ KuzzleDataCollection.prototype.publishMessage = function (document, options, cb)
377377 }
378378
379379 data = this . kuzzle . addHeaders ( data , this . headers ) ;
380- this . kuzzle . query ( this . buildQueryArgs ( 'write ' , 'publish' ) , data , options , cb ) ;
380+ this . kuzzle . query ( this . buildQueryArgs ( 'realtime ' , 'publish' ) , data , options , cb ) ;
381381
382382 return this ;
383383} ;
@@ -410,7 +410,7 @@ KuzzleDataCollection.prototype.replaceDocument = function (documentId, content,
410410
411411 data = self . kuzzle . addHeaders ( data , this . headers ) ;
412412
413- self . kuzzle . query ( this . buildQueryArgs ( 'write ' , 'createOrReplace' ) , data , options , cb && function ( err , res ) {
413+ self . kuzzle . query ( this . buildQueryArgs ( 'document ' , 'createOrReplace' ) , data , options , cb && function ( err , res ) {
414414 var document ;
415415
416416 if ( err ) {
@@ -452,7 +452,7 @@ KuzzleDataCollection.prototype.search = function (filters, options, cb) {
452452 query = self . kuzzle . addHeaders ( { body : filters } , this . headers ) ;
453453
454454
455- self . kuzzle . query ( this . buildQueryArgs ( 'read ' , 'search' ) , query , options , function ( error , result ) {
455+ self . kuzzle . query ( this . buildQueryArgs ( 'document ' , 'search' ) , query , options , function ( error , result ) {
456456 var documents = [ ] ;
457457
458458 if ( error ) {
@@ -467,8 +467,8 @@ KuzzleDataCollection.prototype.search = function (filters, options, cb) {
467467 documents . push ( newDocument ) ;
468468 } ) ;
469469
470- if ( result . result [ ' _scroll_id' ] ) {
471- options . scrollId = result . result [ ' _scroll_id' ] ;
470+ if ( result . result . _scroll_id ) {
471+ options . scrollId = result . result . _scroll_id ;
472472 }
473473
474474 cb ( null , new KuzzleSearchResult (
@@ -531,8 +531,8 @@ KuzzleDataCollection.prototype.scroll = function (scrollId, options, filters, cb
531531 documents . push ( newDocument ) ;
532532 } ) ;
533533
534- if ( result . result [ ' _scroll_id' ] ) {
535- filters . scrollId = result . result [ ' _scroll_id' ] ;
534+ if ( result . result . _scroll_id ) {
535+ filters . scrollId = result . result . _scroll_id ;
536536 }
537537
538538 cb ( null , new KuzzleSearchResult (
@@ -593,7 +593,7 @@ KuzzleDataCollection.prototype.truncate = function (options, cb) {
593593 }
594594
595595 data = this . kuzzle . addHeaders ( data , this . headers ) ;
596- this . kuzzle . query ( this . buildQueryArgs ( 'admin ' , 'truncateCollection ' ) , data , options , cb ) ;
596+ this . kuzzle . query ( this . buildQueryArgs ( 'collection ' , 'truncate ' ) , data , options , cb ) ;
597597
598598 return this ;
599599} ;
@@ -627,7 +627,7 @@ KuzzleDataCollection.prototype.updateDocument = function (documentId, content, o
627627
628628 data = self . kuzzle . addHeaders ( data , this . headers ) ;
629629
630- self . kuzzle . query ( this . buildQueryArgs ( 'write ' , 'update' ) , data , options , cb && function ( err , res ) {
630+ self . kuzzle . query ( this . buildQueryArgs ( 'document ' , 'update' ) , data , options , cb && function ( err , res ) {
631631 if ( err ) {
632632 return cb ( err ) ;
633633 }
0 commit comments