Partial indexes in mongodb / mongoose

前端 未结 3 1147
暗喜
暗喜 2020-12-20 17:41

In the sparse index documentation I found note about mongodb 3.2 partial indexes

Changed in version 3.2: Starting in MongoDB 3.2, MongoDB provides the

3条回答
  •  时光说笑
    2020-12-20 18:11

    Now it's possible natively with Mongoose +4.6.1

    Book.index({user: 1, author: 1, complete: 1}, {unique: true, partialFilterExpression: {complete: true}});
    

提交回复
热议问题