Simulate slow query in mongodb?

前端 未结 3 1733
野性不改
野性不改 2021-02-15 23:35

Does MongoDb have anything like MySql\'s SELECT SLEEP(5); ?

I can see some internal sleep function that would pause the whole server, but I need to pause ju

3条回答
  •  别跟我提以往
    2021-02-16 00:41

    You can use the $where operator as code_monkey_steve says, but be sure you do with mongo version >= 2.4. Before that version no javascript can be run on parallel on the same server. The sleep command is javascript, so it would apparently block other javascript queries you could be making.

提交回复
热议问题