[SERVER-670] indexing arrays breaks some queries Created: 24/Feb/10  Updated: 12/Jul/16  Resolved: 02/Mar/10

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 1.2.3
Fix Version/s: 1.3.4

Type: Bug Priority: Major - P3
Reporter: Ian White Assignee: Aaron Staple
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Tried this on 1.2.3:

> db.test.drop();
true
> db.test.save(

{ list: [1, 2] }

);
> db.test.save(

{ list: [1, 3] }

);
> db.test.find( { list:

{ $in: [1], $ne: 3 }

} );

{ "_id" : ObjectId("4b8536ef71f969641118df0b"), "list" : [ 1, 2 ] }

> db.test.ensureIndex(

{ list: 1 }

);
> db.test.find( { list:

{ $in: [1], $ne: 3 }

} );

{ "_id" : ObjectId("4b8536ef71f969641118df0b"), "list" : [ 1, 2 ] } { "_id" : ObjectId("4b8536f371f969641118df0c"), "list" : [ 1, 3 ] }

 Comments   
Comment by Eliot Horowitz (Inactive) [ 02/Mar/10 ]

No - don't want to backport.

Comment by auto [ 02/Mar/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-670 don't allow simple index matching with negating operators
http://github.com/mongodb/mongo/commit/2bdb76cf6f0652e90ef35c23de35225c3e0b0ef8

Comment by Aaron Staple [ 02/Mar/10 ]

The possibility of an array entry means we cannot do a simple key match with a negating operator. We must test against the whole object. Let me know if I should backport.

Generated at Thu Feb 08 02:54:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.