python - mongodb deduplication
高洛峰
高洛峰 2017-05-17 10:02:13
0
1
728

1. The function needs to determine whether it is duplicated based on a field, such as ownerId, and discard whatever exists. So I used the distinct method, but as the amount of data gradually increased during this period, a question:

OperationFailure: distinct too big, 16mb cap

This is an error in the command line. It says that the result returned by distinct is too large, exceeding 16M. Can any experts contribute some methods?

Requirements: Check whether the ownerId field appears in the database every time. The database is constantly being updated, and the non-existent ownerId will be stored in the database after being processed for a while, so it is required to judge every time. We need to re-check the owner field in the database. Therefore, the speed requirements are relatively high.
Please take a look and give us your opinion.

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
迷茫

If I understand correctly, have you considered Unique Indexes?

For reference.

Love MongoDB! Have fun!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!