[SERVER-5353] _id query on capped collection warning can be printed incorrectly Created: 21/Mar/12  Updated: 11/Jul/16  Resolved: 25/Apr/12

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 2.0.6, 2.1.1

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

Issue Links:
Depends
Operating System: ALL
Participants:

 Description   

Wed Mar 21 16:37:37 [conn1] warning: _id query on capped collection without an _id index, performance will be poor collection: test.c

This message is printed if there is a constraint on _id and there is a candidate collection scan plan. This means it can be printed when an _id index is present and is the basis of an additional candidate plan. For example:

 
> db.createCollection( 'c', { capped:true, size:10000, autoIndexId:true } )
{ "ok" : 1 }
> db.c.getIndexes()
[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"ns" : "test.c",
		"name" : "_id_"
	}
]
> db.c.find( { _id:0, a:0 } ).itcount() // Causes the warning to be logged.
0



 Comments   
Comment by auto [ 13/May/12 ]

Author:

{u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-5353 Backport print capped collection scan on _id query warning message in appropriate cases.
Branch: v2.0
https://github.com/mongodb/mongo/commit/03c34bd5fa1f4ebe9f626306f2c67d507c11a4eb

Comment by auto [ 25/Apr/12 ]

Author:

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

Message: SERVER-5353 Print capped collection scan on _id query warning message in appropriate cases.
Branch: master
https://github.com/mongodb/mongo/commit/46ad79fdf5769e6adb5aeda1aac6b92b471dcd75

Comment by Antoine Girbal [ 24/Mar/12 ]

One workaround to get rid of log line is to specify hint({_id:1})

Generated at Thu Feb 08 03:08:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.