Why can't I run explain on MongoDB update?

后端 未结 2 813
一个人的身影
一个人的身影 2021-01-11 20:40

I\'m trying to explain a mongoDB update; but nothing is happening? Does Mongo not support this?

> db.movies.update({\"actors.name\": \"Christian Bale\"},          


        
2条回答
  •  遥遥无期
    2021-01-11 21:23

    Why do you want to call explain on update? AFAIK, explain will show you how your query will fetch the rows, so you could simply do:

    db.movies.find(
        {$query:  {"actors.name": "Christian Bale"}},
        {$explain: 1}
    );
    

提交回复
热议问题