Multikey, partially filtered index in TokuMX

12 views
Skip to first unread message

alvinf...@gmail.com

unread,
Aug 23, 2016, 10:10:21 AM8/23/16
to Percona Discussion
The following code worked in MongoDB and Percona MongoDB Server, but not in TokuMX. (We need TokuMX because we need transactions and rollbacks; we'll upgrade to PMDBS when it has them.)

```C++
//dbCnxn is the mongo::DBClientConnection
//clxn is the name of the collection we're indexing
dbCnxn.createIndex(IndexSpec()
.addKeys(BSON("DL_Number" << 1 << "docType" << 1))
.unique(true)
.partialFilterExpression(BSON("DL_Number" << BSON("$exists" << true)))
);
```

In the collection, the combination of "DL_Number" (int) and "docType" (int) should be unique, but not every document has a "DL_Number" field.

With this index in place, as soon as I try to insert the second document without a "DL_Number" field, it throws an OPerationException, code 1100.

Am I setting up my index wrong, or is this a TokuMX bug that was corrected for PMDBS?

Reply all
Reply to author
Forward
0 new messages