Mongodb将_id设置为IP

时间:2019-07-08 02:36:07

标签: mongodb

我在网络上收集了具有IP唯一性的设备。我应该为诸如“ MD2”之类的设备以及诸如路由器或交换机之类的类别进行分组。因此,我将“类别”和“类别”字段添加到集合中,并在它们上创建索引。同时我也显示了“ ProblemCount”字段设备有问题,我在此字段上创建了索引。

{
    _id: String,
    Name: String,
    // IP: { type: String, index: true },
    Community: String,
    Group: { type: String, index: true },
    Priority: Number,
    Category: { type: String },
    Manufacture: String,
    Serial: String,
    Description: String,
    IsAlive: Boolean,
    LastUpdate: Date,
    ProblemCount: { type: Number, index: true },
    Rules: [
        {
            Title: String,
            OID: String,
            Result: Boolean,
            LastChange: String
        }
    ]
}

我想知道更好的IP字段应该是新字段或_id。如果我将_id设置为IP值,那么性能是否有问题?

0 个答案:

没有答案