c++mongodbindexingtokumx

Partial Indexes in TokuMX


We recently switched from MongoDB to TokuMX. In one collection our documents all have a numerical filed, "docType". Some documents have a field "DL_Number", and others don't. For those documents with a "DL_Number" field, the combination of "docType" and "DL_Number" should serve as a unique index.

Using C++ Legacy, we originally created an index like this:

mongo::IndexSpec().addKey("docType").addKey("DL_Number").unique().partialFilterExpression(BSON("DL_Number" << BSON("$exists" << true)));

What we were going for was an index where "docType" and "DL_Number" would provide a unique key for documents that had a field "DL_Number".

The statement worked find in MongoDB, but now that we've switched to TokuMX, the partial filter doesn't work any more. Trying to insert the second document without a "DL_Number" field throws an exception.

Has anybody else had this problem with TokuMX? Were you able to find a work-around?


Solution

  • Partial indexes are a MongoDB 3.2 feature, but TokuMX is based on MongoDB 3.0, so this MongoDB feature is not available with TokuMX.