keynesiancross
keynesiancross

Reputation: 3529

Mongo Partial Filter Expression

I am trying to use create a unique index with a partial filter expression. I've tried all sorts of different things, but I keep getting syntax errors in Compass. Any suggestions on how this should be written. I've tried things like:

{partialFilterExpression: aim_id: {$type: "string"}}
aim_id: {$type: "string"}
aim_id": {$type: "string"}

enter image description here

Upvotes: 2

Views: 2396

Answers (1)

rickhg12hs
rickhg12hs

Reputation: 11942

I just "played" with MongoDB Compass (v1.34.2), and it seems an acceptable incantation for your partialFilterExpression is:

{"aim_id": {"$type": "string"}}

Upvotes: 3

Related Questions