8000 How to set timeout · Issue #136 · mongo-dart/mongo_dart · GitHub
[go: up one dir, main page]

Skip to content

How to set timeout #136

Open
Open

Description

@simc

Hi,

How can I set a timeout for opening a connection and querying data?

Thanks

Activity

  1. matisiekpl commented on May 27, 2021

    @matisiekpl

    Yup, it will be very helpful feature

  2. giorgiofran commented on Jun 4, 2021

    @giorgiofran
    Contributor

    On crud operations you have to use the "modern" methods.
    For setting a timeout of 5000 MS on a find operation you could do:

     var res = await collection.modernFind(filter: {
        'rating': {r'$gt': 60}
      }, sort: {
        'state': 1,
        'name': 1
      }, findOptions: FindOptions(maxTimeMS: 5000)).toList();
  3. natgross commented on Feb 9, 2022

    @natgross

    Can we set a timeout on the open() command?

  4. stMerlHin commented on May 4, 2023

    @stMerlHin

    On crud operations you have to use the "modern" methods. For setting a timeout of 5000 MS on a find operation you could do:

     var res = await collection.modernFind(filter: {
        'rating': {r'$gt': 60}
      }, sort: {
        'state': 1,
        'name': 1
      }, findOptions: FindOptions(maxTimeMS: 5000)).toList();

    Is there any way to do the same with an insert or delete ?

  5. cjcj125125 commented on Mar 25, 2024

    @cjcj125125

    How do I set the timeout period when I connect to db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0