index.js
function (id, options, callback) {
            var query = '',
                handler,
                retry = false,
                fields,
                args = arguments;

            if (typeof options === 'function') {
                callback = options;
                fields = '';
            } else {
                options = extend({}, options);
                fields = options.fields || '';
                retry = options.retry;
            }

            if (Array.isArray(fields)) {
                fields = fields.join(',');
            }

            retry = (retry === true) && function () {
                this.get.apply(this, args);
            }.bind(this);

            if (fields) {
                query = '?' + querystring.stringify({
                    fields: fields
                });
            }

            handler = createResponseHandler(callback, retry);

            return req(client.documentsURL + '/' + id + query, handler);
        }
function (id, options, callback) {
            var query = '',
                handler,
                retry = false,
                fields,
                args = arguments;

            if (typeof options === 'function') {
                callback = options;
                fields = '';
            } else {
                options = extend({}, options);
                fields = options.fields || '';
                retry = options.retry;
            }

            if (Array.isArray(fields)) {
                fields = fields.join(',');
            }

            retry = (retry === true) && function () {
                this.get.apply(this, args);
            }.bind(this);

            if (fields) {
                query = '?' + querystring.stringify({
                    fields: fields
                });
            }

            handler = createResponseHandler(callback, retry);

            return req(client.documentsURL + '/' + id + query, handler);
        }
function ( id , options , callback ) { var query = '' , handler , retry = false , fields , args = arguments ; if ( typeof options === 'function' ) { callback = options ; fields = '' ; } else { options = extend ( { } , options ) ; fields = options . fields || '' ; retry = options . retry ; } if ( Array . isArray ( fields ) ) { fields = fields . join ( ',' ) ; } retry = ( retry === true ) && function ( ) { this . get . apply ( this , args ) ; } . bind ( this ) ; if ( fields ) { query = '?' + querystring . stringify ( { fields : fields } ) ; } handler = createResponseHandler ( callback , retry ) ; return req ( client . documentsURL + '/' + id + query , handler ) ; }
Fetch the metadata for a single document
@param   {String}        id                  The document uuid
@param   {Object}        [options]           Get options
@param   {boolean}       [options.retry]     Whether to retry the request after 'retry-after' seconds if the retry-after header is sent
@param   {String|Array}  [options.fields]    Array of strings or comma-separated string of fields to return. id and type are always returned.
@param   {Function}      [callback]          A callback to call with the response data (or error)
@returns {Request}
Fetch the metadata for a single document