1) Create a database with 1 collection
2) Insert 20 million documents in that collection
3) documents contain:
- ID field
- Text field (with a text index) 'text'
- Date field (with an index) 'start'
4) Text field has the value 'andreas.estermann@dynatrace.com' for all documents. Date field values are distributed over time.
5) Issue the following queries in the mongodb shell:
db.collection.find({"text": "andreas.estermann@dynatrace.com"})
db.collection.find({"text": "andreas.estermann@dynatrace.com"}).count()
db.collection.find({"text": "andreas.estermann@dynatrace.com"}).limit(25)
db.collection.find({"text": "andreas.estermann@dynatrace.com"}).limit(25).sort({"start": -1})
db.collection.find({$text: {$search: "\"andreas.estermann@dynatrace.com\"" }})
db.collection.find({$text: {$search: "\"andreas.estermann@dynatrace.com\"" }}).count()
db.collection.find({$text: {$search: "\"andreas.estermann@dynatrace.com\"" }}).limit(25)
db.collection.find({$text: {$search: "\"andreas.estermann@dynatrace.com\"" }}).limit(25).sort({"start": -1})
6) Find the following results for the queries
db.collection.find({"text": "andreas.estermann@dynatrace.com"})
-> executes within milliseconds, result correct, expected
db.collection.find({"text": "andreas.estermann@dynatrace.com"}).count()
-> executes within about 1 minute, result correct, expected
db.collection.find({"text": "andreas.estermann@dynatrace.com"}).limit(25)
-> executes within milliseconds, result correct, expected
db.collection.find({"text": "andreas.estermann@dynatrace.com"}).limit(25).sort({"start": -1})
-> executes within milliseconds, result correct, expected
db.collection.find({$text: {$search: "\"andreas.estermann@dynatrace.com\"" }})
-> executes within milliseconds, result correct, expected
db.collection.find({$text: {$search: "\"andreas.estermann@dynatrace.com\"" }}).count()
-> crashes server because of excessive memory consumption, not expected
db.collection.find({$text: {$search: "\"andreas.estermann@dynatrace.com\"" }}).limit(25)
-> executes within milliseconds, result correct, expected
db.collection.find({$text: {$search: "\"andreas.estermann@dynatrace.com\"" }}).limit(25).sort({"start": -1})
-> crashes server because of excessive memory consumption, not expected