node.js - Partial indexes in mongodb / mongoose -


in sparse index documentation found note mongodb 3.2 partial indexes

changed in version 3.2: starting in mongodb 3.2, mongodb provides option create partial indexes. partial indexes offer superset of functionality of sparse indexes. if using mongodb 3.2 or later, partial indexes should preferred on sparse indexes.

partial indexes helpfull , want use them in project. possible use them mongoose?

in current mongoose version 4.3.7 cannot define partial indexes in scheme, can still use partial indexes of mongodb 3.2.

you have create indexes using native driver.

// schedulemodel mongoose model schedulemodel.collection.createindex({"type" : 1 } , {background:true , partialfilterexpression : { type :"g" }} , function(err , result){      console.log(err , result); }); 

after that, every query matches partialfilterexpression indexed.


Comments

Popular posts from this blog

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -