A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mongodb.github.io/node-mongodb-native/3.6/api/GridStore.html below:

Class: GridStore

Node.js MongoDB Driver API Class: GridStore
new GridStore(db, id, filename, mode, options){GridStore} lib/gridfs/grid_store.js

,

line 93

Create a new GridStore instance

Modes

Name Type Description db Db

A database instance to interact with.

id object optional

optional unique id for this file

filename string optional

optional filename for this file, no unique constrain on the field

mode string

set the mode for this file.

options object optional

Optional settings.

Name Type Default Description w number | string optional

Deprecated The write concern. Use writeConcern instead.

wtimeout number optional

Deprecated The write concern timeout. Use writeConcern instead.

j boolean false optional

Deprecated Specify a journal write concern. Use writeConcern instead.

fsync boolean false optional

Deprecated Specify a file sync write concern. Use writeConcern instead.

writeConcern object | WriteConcern optional

Specify write concern settings.

root string optional

Root collection to use. Defaults to {GridStore.DEFAULT_ROOT_COLLECTION}.

content_type string optional

MIME type of the file. Defaults to {GridStore.DEFAULT_CONTENT_TYPE}.

chunk_size number 261120 optional

Size for the chunk. Defaults to {Chunk.DEFAULT_CHUNK_SIZE}.

metadata object optional

Arbitrary data the user wants to store.

promiseLibrary object optional

A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible

readPreference ReadPreference | string optional

The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).

Properties:
Name Type Description chunkSize number

Get the gridstore chunk size.

md5 number

The md5 checksum for this file.

chunkNumber number

The current chunk number the gridstore has materialized into memory

Deprecated
  • Use GridFSBucket API instead
    Returns: GridStore instance.
    Members

    staticGridStore.DEFAULT_CONTENT_TYPE

    Default file mime type

    staticGridStore.DEFAULT_ROOT_COLLECTION

    The collection to be used for holding the files and chunks collection.

    staticGridStore.IO_SEEK_CUR

    Seek mode where the given length is an offset to the current read/write head.

    staticGridStore.IO_SEEK_END

    Seek mode where the given length is an offset to the end of the file.

    staticGridStore.IO_SEEK_SET

    Seek mode where the given length is absolute.

    Methods
    staticGridStore.exist(db, name, rootCollection, options, callback){Promise} lib/gridfs/grid_store.js

    ,

    line 1296

    Checks if a file exists in the database.

    Name Type Description db Db

    the database to query.

    name string

    The name of the file to look for.

    rootCollection string optional

    The root collection that holds the files and chunks collection. Defaults to {GridStore.DEFAULT_ROOT_COLLECTION}.

    options object optional

    Optional settings.

    Name Type Description readPreference ReadPreference | string optional

    The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).

    promiseLibrary object optional

    A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible

    session ClientSession optional

    optional session to use for this operation

    callback GridStore~resultCallback optional

    result from exists.

    Deprecated
    • Use GridFSBucket API instead
      Returns: Promise if no callback passed
      staticGridStore.list(db, rootCollection, options, callback){Promise} lib/gridfs/grid_store.js

      ,

      line 1359

      Gets the list of files stored in the GridFS.

      Name Type Description db Db

      the database to query.

      rootCollection string optional

      The root collection that holds the files and chunks collection. Defaults to {GridStore.DEFAULT_ROOT_COLLECTION}.

      options object optional

      Optional settings.

      Name Type Description readPreference ReadPreference | string optional

      The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).

      promiseLibrary object optional

      A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible

      session ClientSession optional

      optional session to use for this operation

      callback GridStore~resultCallback optional

      result from exists.

      Deprecated
      • Use GridFSBucket API instead
        Returns: Promise if no callback passed
        staticGridStore.read(db, name, length, offset, options, callback){Promise} lib/gridfs/grid_store.js

        ,

        line 1427

        Reads the contents of a file.

        This method has the following signatures

        (db, name, callback)
        (db, name, length, callback)
        (db, name, length, offset, callback)
        (db, name, length, offset, options, callback)

        Name Type Description db Db

        the database to query.

        name string

        The name of the file.

        length number optional

        The size of data to read.

        offset number optional

        The offset from the head of the file of which to start reading from.

        options object optional

        Optional settings.

        Name Type Description readPreference ReadPreference | string optional

        The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).

        promiseLibrary object optional

        A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible

        session ClientSession optional

        optional session to use for this operation

        callback GridStore~readCallback optional

        the command callback.

        Deprecated
        • Use GridFSBucket API instead
          Returns: Promise if no callback passed
          staticGridStore.readlines(db, name, separator, options, callback){Promise} lib/gridfs/grid_store.js

          ,

          line 1481

          Read the entire file as a list of strings splitting by the provided separator.

          Name Type Description db Db

          the database to query.

          name String | object

          the name of the file.

          separator string optional

          The character to be recognized as the newline separator.

          options object optional

          Optional settings.

          Name Type Description readPreference ReadPreference | string optional

          The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).

          promiseLibrary object optional

          A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible

          session ClientSession optional

          optional session to use for this operation

          callback GridStore~readlinesCallback optional

          the command callback.

          Deprecated
          • Use GridFSBucket API instead
            Returns: Promise if no callback passed
            staticGridStore.unlink(db, names, options, callback){Promise} lib/gridfs/grid_store.js

            ,

            line 1518

            Deletes the chunks and metadata information of a file from GridFS.

            Name Type Description db Db

            The database to query.

            names string | array

            The name/names of the files to delete.

            options object optional

            Optional settings.

            Name Type Description promiseLibrary object optional

            A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible

            session ClientSession optional

            optional session to use for this operation

            callback GridStore~resultCallback optional

            the command callback.

            Deprecated
            • Use GridFSBucket API instead
              Returns: Promise if no callback passed
              chunkCollection(callback){Collection} lib/gridfs/grid_store.js

              ,

              line 569

              Retrieve this file's chunks collection.

              Name Type Description callback GridStore~collectionCallback

              the command callback.

              Deprecated
              • Use GridFSBucket API instead
                close(options, callback){Promise} lib/gridfs/grid_store.js

                ,

                line 481

                Saves this file to the database. This will overwrite the old entry if it
                already exists. This will work properly only if mode was initialized to
                "w" or "w+".

                Name Type Description options object optional

                Optional settings

                Name Type Description session ClientSession optional

                optional session to use for this operation

                callback GridStore~resultCallback optional

                this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object.

                Deprecated
                • Use GridFSBucket API instead
                  Returns: Promise if no callback passed
                  collection(callback){Collection} lib/gridfs/grid_store.js

                  ,

                  line 621

                  Retrieves the file collection associated with this object.

                  Name Type Description callback GridStore~collectionCallback

                  the command callback.

                  Deprecated
                  • Use GridFSBucket API instead
                    destroy() lib/gridfs/grid_store.js

                    ,

                    line 374

                    Handles the destroy part of a stream

                    Deprecated
                    • Use GridFSBucket API instead
                      eof(){boolean} lib/gridfs/grid_store.js

                      ,

                      line 262

                      Verify if the file is at EOF.

                      Deprecated
                      • Use GridFSBucket API instead
                        Returns: if the read/write head is at the end of this file.
                        getc(callback){Promise} lib/gridfs/grid_store.js

                        ,

                        line 283

                        Retrieves a single character from this file.

                        Name Type Description callback GridStore~resultCallback optional

                        this gets called after this method is executed. Passes null to the first parameter and the character read to the second or null to the second if the read/write head is at the end of the file.

                        Deprecated
                        • Use GridFSBucket API instead
                          Returns: Promise if no callback passed
                          open(options, callback){Promise} lib/gridfs/grid_store.js

                          ,

                          line 200

                          Opens the file from the database and initialize this object. Also creates a
                          new one if file does not exist.

                          Name Type Description options object optional

                          Optional settings

                          Name Type Description session ClientSession optional

                          optional session to use for this operation

                          callback GridStore~openCallback optional

                          this will be called after executing this method

                          Deprecated
                          • Use GridFSBucket API instead
                            Returns: Promise if no callback passed
                            puts(string, options, callback){Promise} lib/gridfs/grid_store.js

                            ,

                            line 319

                            Writes a string to the file with a newline character appended at the end if
                            the given string does not have one.

                            Name Type Description string string

                            the string to write.

                            options object optional

                            Optional settings

                            Name Type Description session ClientSession optional

                            optional session to use for this operation

                            callback GridStore~resultCallback optional

                            this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object.

                            Deprecated
                            • Use GridFSBucket API instead
                              Returns: Promise if no callback passed
                              read(length, buffer, options, callback){Promise} lib/gridfs/grid_store.js

                              ,

                              line 743

                              Retrieves the contents of this file and advances the read/write head. Works with Buffers only.

                              There are 3 signatures for this method:

                              (callback)
                              (length, callback)
                              (length, buffer, callback)

                              Name Type Description length number optional

                              the number of characters to read. Reads all the characters from the read/write head to the EOF if not specified.

                              buffer string | Buffer optional

                              a string to hold temporary data. This is used for storing the string data read so far when recursively calling this method.

                              options object optional

                              Optional settings

                              Name Type Description session ClientSession optional

                              optional session to use for this operation

                              callback GridStore~readCallback optional

                              the command callback.

                              Deprecated
                              • Use GridFSBucket API instead
                                Returns: Promise if no callback passed
                                readlines(separator, options, callback){Promise} lib/gridfs/grid_store.js

                                ,

                                line 644

                                Read the entire file as a list of strings splitting by the provided separator.

                                Name Type Description separator string optional

                                The character to be recognized as the newline separator.

                                options object optional

                                Optional settings

                                Name Type Description session ClientSession optional

                                optional session to use for this operation

                                callback GridStore~readlinesCallback optional

                                the command callback.

                                Deprecated
                                • Use GridFSBucket API instead
                                  Returns: Promise if no callback passed
                                  rewind(options, callback){Promise} lib/gridfs/grid_store.js

                                  ,

                                  line 684

                                  Deletes all the chunks of this file in the database if mode was set to "w" or
                                  "w+" and resets the read/write head to the initial position.

                                  Name Type Description options object optional

                                  Optional settings

                                  Name Type Description session ClientSession optional

                                  optional session to use for this operation

                                  callback GridStore~resultCallback optional

                                  this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object.

                                  Deprecated
                                  • Use GridFSBucket API instead
                                    Returns: Promise if no callback passed
                                    seek(position, seekLocation, options, callback){Promise} lib/gridfs/grid_store.js

                                    ,

                                    line 863

                                    Moves the read/write head to a new location.

                                    There are 3 signatures for this method

                                    Seek Location Modes

                                    Name Type Description position number optional

                                    the position to seek to

                                    seekLocation number optional

                                    seek mode. Use one of the Seek Location modes.

                                    options object optional

                                    Optional settings

                                    Name Type Description session ClientSession optional

                                    optional session to use for this operation

                                    callback GridStore~gridStoreCallback optional

                                    the command callback.

                                    Deprecated
                                    • Use GridFSBucket API instead
                                      Returns: Promise if no callback passed
                                      stream(){GridStoreStream} lib/gridfs/grid_store.js

                                      ,

                                      line 339

                                      Return a modified Readable stream including a possible transform method.

                                      Deprecated
                                      • Use GridFSBucket API instead
                                        tell(length, buffer, options, callback){Promise} lib/gridfs/grid_store.js

                                        ,

                                        line 827

                                        Retrieves the position of the read/write head of this file.

                                        Name Type Description length number optional

                                        the number of characters to read. Reads all the characters from the read/write head to the EOF if not specified.

                                        buffer string | Buffer optional

                                        a string to hold temporary data. This is used for storing the string data read so far when recursively calling this method.

                                        options object optional

                                        Optional settings

                                        Name Type Description session ClientSession optional

                                        optional session to use for this operation

                                        callback GridStore~tellCallback optional

                                        the command callback.

                                        Deprecated
                                        • Use GridFSBucket API instead
                                          Returns: Promise if no callback passed
                                          unlink(options, callback){Promise} lib/gridfs/grid_store.js

                                          ,

                                          line 584

                                          Deletes all the chunks of this file in the database.

                                          Name Type Description options object optional

                                          Optional settings

                                          Name Type Description session ClientSession optional

                                          optional session to use for this operation

                                          callback GridStore~resultCallback optional

                                          the command callback.

                                          Deprecated
                                          • Use GridFSBucket API instead
                                            Returns: Promise if no callback passed
                                            write(data, close, options, callback){Promise} lib/gridfs/grid_store.js

                                            ,

                                            line 355

                                            Writes some data. This method will work properly only if initialized with mode "w" or "w+".

                                            Name Type Description data string | Buffer

                                            the data to write.

                                            close boolean optional

                                            closes this file after writing if set to true.

                                            options object optional

                                            Optional settings

                                            Name Type Description session ClientSession optional

                                            optional session to use for this operation

                                            callback GridStore~resultCallback optional

                                            this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object.

                                            Deprecated
                                            • Use GridFSBucket API instead
                                              Returns: Promise if no callback passed
                                              writeFile(file, options, callback){Promise} lib/gridfs/grid_store.js

                                              ,

                                              line 396

                                              Stores a file from the file system to the GridFS database.

                                              Name Type Description file string | Buffer | FileHandle

                                              the file to store.

                                              options object optional

                                              Optional settings

                                              Name Type Description session ClientSession optional

                                              optional session to use for this operation

                                              callback GridStore~resultCallback optional

                                              this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object.

                                              Deprecated
                                              • Use GridFSBucket API instead
                                                Returns: Promise if no callback passed
                                                Type Definitions
                                                collectionCallback(error, collection) lib/gridfs/grid_store.js

                                                ,

                                                line 554

                                                The collection callback format.

                                                Name Type Description error MongoError

                                                An error instance representing the error during the execution.

                                                collection Collection

                                                The collection from the command execution.

                                                gridStoreCallback(error, gridStore) lib/gridfs/grid_store.js

                                                ,

                                                line 837

                                                The tell callback format.

                                                Name Type Description error MongoError

                                                An error instance representing the error during the execution.

                                                gridStore GridStore

                                                The gridStore.

                                                openCallback(error, gridStore) lib/gridfs/grid_store.js

                                                ,

                                                line 182

                                                The callback format for the Gridstore.open method

                                                Name Type Description error MongoError

                                                An error instance representing the error during the execution.

                                                gridStore GridStore

                                                The GridStore instance if the open method was successful.

                                                readCallback(error, data) lib/gridfs/grid_store.js

                                                ,

                                                line 718

                                                The read callback format.

                                                Name Type Description error MongoError

                                                An error instance representing the error during the execution.

                                                data Buffer

                                                The data read from the GridStore object

                                                readlinesCallback(error, strings) lib/gridfs/grid_store.js

                                                ,

                                                line 626

                                                The readlines callback format.

                                                Name Type Description error MongoError

                                                An error instance representing the error during the execution.

                                                strings Array.<string>

                                                The array of strings returned.

                                                resultCallback(options, error, result) lib/gridfs/grid_store.js

                                                ,

                                                line 266

                                                The callback result format.

                                                Name Type Description options object optional

                                                Optional settings

                                                Name Type Description session ClientSession optional

                                                optional session to use for this operation

                                                error MongoError

                                                An error instance representing the error during the execution.

                                                result object

                                                The result from the callback.

                                                tellCallback(error, position) lib/gridfs/grid_store.js

                                                ,

                                                line 808

                                                The tell callback format.

                                                Name Type Description error MongoError

                                                An error instance representing the error during the execution.

                                                position number

                                                The current read position in the GridStore.


                                                RetroSearch is an open source project built by @garambo | Open a GitHub Issue

                                                Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

                                                HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4