moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 509 forks source link

Wrong mongodb indexing? #538

Open ByTE1974 opened 8 years ago

ByTE1974 commented 8 years ago

Hi, when using mongodb as persistence, packets collection created automatically. When I looked at indexes, I saw the following indexes:

In reality, there is no client field in the stored documents. But I see topic field. Example: { "_id" : ObjectId("57d1186d684247110e4c92ba"), "topic" : "garage/light/ext/status", "payload" : BinData(0, "MA=="), "messageId" : "BJKcK90i", "qos" : NumberInt(0), "retain" : true } As far as I understand, topic field must be indexed instead of client. Am I wrong?

mcollina commented 8 years ago

Yes, would you mind to send a PR?