我正在尝试在我的收藏中创建索引,而我几乎就在那里。但是,我不知道我的代码中的partialFilterExpression
和boolean
值如何。我试过跟随 -
DBCollection TransmissionCharge = db.getCollection("Charge")
BufferedReader br = new BufferedReader(new FileReader("src\\test\\resources\\datasheets\\Charge.json"))
String name= "TrIndex"
String Charge = null;
while ((Charge= br.readLine()) != null) {
DBObject record = (DBObject) JSON.parse(Charge);
TransmissionCharge.createIndex(**record,name**)
}
br.close()
MongoQuery如下 -
db.Charge.createIndex({"_id.@Name": 1, "_id.InstanceId": 1, "_id}Recipient":1, "_id.Code":1 }, { "name": "RecipientIdx", "partialFilterExpression": {"_id.revenueRecipient": {$exists:true}}})
如何在我的java代码中获取partialFilterExpression
和$exists:true