{
    "content": [
        {
            "type": "text",
            "text": "# MongoDB::QueryResult (perldoc)\n\n## NAME\n\nMongoDB::QueryResult - An iterator for Mongo query results\n\n## SYNOPSIS\n\n$cursor = $coll->find( $filter );\n$result = $cursor->result;\nwhile ( $doc = $result->next ) {\nprocessdoc($doc)\n}\n\n## DESCRIPTION\n\nThis class defines an iterator against a query result. It automatically fetches additional\nresults from the originating mongod/mongos server on demand.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **USAGE** (3 subsections)\n- **METHODS**\n- **AUTHORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "MongoDB::QueryResult",
        "section": "",
        "mode": "perldoc",
        "summary": "MongoDB::QueryResult - An iterator for Mongo query results",
        "synopsis": "$cursor = $coll->find( $filter );\n$result = $cursor->result;\nwhile ( $doc = $result->next ) {\nprocessdoc($doc)\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "USAGE",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Error handling",
                        "lines": 5
                    },
                    {
                        "name": "Cursor destruction",
                        "lines": 3
                    },
                    {
                        "name": "Multithreading",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "METHODS",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "MongoDB::QueryResult - An iterator for Mongo query results\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version v2.2.2\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "$cursor = $coll->find( $filter );\n$result = $cursor->result;\n\nwhile ( $doc = $result->next ) {\nprocessdoc($doc)\n}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This class defines an iterator against a query result. It automatically fetches additional\nresults from the originating mongod/mongos server on demand.\n\nFor backwards compatibility reasons, MongoDB::Cursor encapsulates query parameters and generates\na \"MongoDB::QueryResult\" object on demand. All iterators on \"MongoDB::Cursor\" delegate to\n\"MongoDB::QueryResult\" object.\n\nRetrieving this object and iterating on it directly will be slightly more efficient.\n",
                "subsections": []
            },
            "USAGE": {
                "content": "",
                "subsections": [
                    {
                        "name": "Error handling",
                        "content": "Unless otherwise explicitly documented, all methods throw exceptions if an error occurs. The\nerror types are documented in MongoDB::Error.\n\nTo catch and handle errors, the Try::Tiny and Safe::Isa modules are recommended:\n"
                    },
                    {
                        "name": "Cursor destruction",
                        "content": "When a \"MongoDB::QueryResult\" object is destroyed, a cursor termination request will be sent to\nthe originating server to free server resources.\n"
                    },
                    {
                        "name": "Multithreading",
                        "content": "NOTE: Per threads documentation, use of Perl threads is discouraged by the maintainers of Perl\nand the MongoDB Perl driver does not test or provide support for use with threads.\n\nIterators are cloned in threads, but not reset. Iterating from multiple threads will give\nunpredictable results. Only iterate from a single thread.\n"
                    }
                ]
            },
            "METHODS": {
                "content": "hasnext\nif ( $response->hasnext ) {\n...\n}\n\nReturns true if additional documents are available. This will attempt to get another batch of\ndocuments from the server if necessary.\n\nnext\nwhile ( $doc = $result->next ) {\nprocessdoc($doc)\n}\n\nReturns the next document or \"undef\" if the server cursor is exhausted.\n\nbatch\nwhile ( @batch = $result->batch ) {\nfor $doc ( @batch ) {\nprocessdoc($doc);\n}\n}\n\nReturns the next batch of documents or an empty list if the server cursor is exhausted.\n\nall\n@docs = $result->all;\n\nReturns all documents as a list.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "*   David Golden <david@mongodb.com>\n\n*   Rassi <rassi@mongodb.com>\n\n*   Mike Friedman <friedo@friedo.com>\n\n*   Kristina Chodorow <k.chodorow@gmail.com>\n\n*   Florian Ragwitz <rafl@debian.org>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "This software is Copyright (c) 2020 by MongoDB, Inc.\n\nThis is free software, licensed under:\n\nThe Apache License, Version 2.0, January 2004\n",
                "subsections": []
            }
        }
    }
}