MongoDB是否有很多更新?

时间:2022-10-17 04:17:51

I'm creating a blog.

我正在创建一个博客。

Everytime someone views the page of a blog, can I do this:

每当有人浏览一个博客的页面时,我可以这样做:

post['views'] += 1
db.collection.save(post)

I don't index 'views'.

我不指数“视图”。

1 个解决方案

#1


3  

You should use $inc (or your driver's implementation), it does an atomic update.

您应该使用$inc(或您的驱动程序的实现),它进行原子更新。

You should be good, but as with anything it will depend on your traffic volume.

你应该表现得很好,但这取决于你的交通流量。

#1


3  

You should use $inc (or your driver's implementation), it does an atomic update.

您应该使用$inc(或您的驱动程序的实现),它进行原子更新。

You should be good, but as with anything it will depend on your traffic volume.

你应该表现得很好,但这取决于你的交通流量。