ホーム > Uncategorized > Public bookmarks 08/01/2013 (p.m.)

Public bookmarks 08/01/2013 (p.m.)


    • If the query includes equality match conditions on an index prefix, you can sort on a subset of the index that starts after or overlaps with the prefix. For example, given an index { a: 1, b: 1, c: 1, d: 1 }, if the query condition includes equality match conditions on a and b, you can specify a sort on the subsets { c: 1 } or { c: 1, d: 1 }:
    • The following operations specify a sort document of { c: 1 }, but the query documents do not contain equality matches on the preceding index fields a and b:

       

      db.collection.find( { a: { $gt: 2 } } ).sort( { c: 1 } ) db.collection.find( { c: 5 } ).sort( { c: 1 } ) 

       

       

      These operations will not efficiently use the index { a: 1, b: 1, c: 1, d: 1 } and may not even use the index to retrieve the documents.

Posted from Diigo. The rest of my favorite links are here.

カテゴリー:Uncategorized
  1. まだコメントはありません。
  1. No trackbacks yet.

コメントを残す