Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion $and operator seems to be causing mongo to not use index.

Received: by 10.58.135.42 with SMTP id pp10mr3323216veb.18.1348945286755;
        Sat, 29 Sep 2012 12:01:26 -0700 (PDT)
X-BeenThere: mongodb-user@googlegroups.com
Received: by 10.220.154.17 with SMTP id m17ls4265095vcw.1.gmail; Sat, 29 Sep
 2012 12:01:17 -0700 (PDT)
Received: by 10.52.29.225 with SMTP id n1mr980760vdh.5.1348945277687;
        Sat, 29 Sep 2012 12:01:17 -0700 (PDT)
Date: Sat, 29 Sep 2012 12:01:17 -0700 (PDT)
From: Sam Martin <sambomar...@gmail.com>
To: mongodb-user@googlegroups.com
Message-Id: <d743e62c-a7a0-4a63-bfd2-e94019698605@googlegroups.com>
Subject: $and operator seems to be causing mongo to not use index.
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1687_2779589.1348945277319"

------=_Part_1687_2779589.1348945277319
Content-Type: multipart/alternative; 
	boundary="----=_Part_1688_8799282.1348945277319"

------=_Part_1688_8799282.1348945277319
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hi all,

got a wierd problem,

using simple find on indexed attribute

{ "myatt":1234}

explained, all good using BTree index 

do an
 
{$and :[ {myattr:1234},{myatt:1234}]}

reverts to basic cursor

any ideas?

thanks,
sam

------=_Part_1688_8799282.1348945277319
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

Hi all,<div><br></div><div>got a wierd problem,</div><div><br></div><div>using simple find on indexed attribute</div><div><br></div><div>{ "myatt":1234}</div><div><br></div><div>explained, all good using BTree index&nbsp;</div><div><br></div><div>do an</div><div>&nbsp;</div><div>{$and :[ {myattr:1234},{myatt:1234}]}</div><div><br></div><div>reverts to basic cursor</div><div><br></div><div>any ideas?</div><div><br></div><div>thanks,</div><div>sam</div>
------=_Part_1688_8799282.1348945277319--

------=_Part_1687_2779589.1348945277319--