[SERVER-12687] creating index on a collection named "oplog" creates spurious collections Created: 12/Feb/14  Updated: 27/Oct/21  Resolved: 27/Oct/21

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.4.9, 2.5.5
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Thomas Rueckstiess Assignee: Geert Bosch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

See description

Participants:

 Description   

Creating an index on a collection named oplog will create a spurious collection with the name of the index.

Here the shell transcript of a fresh mongod node:

$ mongo
MongoDB shell version: 2.5.5
connecting to: test
Server has startup warnings:
2014-02-12T16:54:46.726+1100 [initandlisten]
2014-02-12T16:54:46.727+1100 [initandlisten] ** NOTE: This is a development version (2.5.5) of MongoDB.
2014-02-12T16:54:46.727+1100 [initandlisten] **       Not recommended for production.
2014-02-12T16:54:46.727+1100 [initandlisten]
> show collections
> db.oplog.ensureIndex({foo:1, bar:1})
> show collections
oplog
oplog.$_id_
oplog.$foo_1_bar_1
system.indexes
>

Querying that spurious collection generates a BSONObj size error.

> db.getCollection('oplog.$foo_1_bar_1').find()
error: {
        "$err" : "BSONObj size: -2 (0xFFFFFFFE) is invalid. Size must be between 0 and 16793600(16MB) First element: EOO",
        "code" : 10334
}

Other collection names, including oplog_foo, oplog.rs, foo_oplog don't show this behavior.



 Comments   
Comment by Geert Bosch [ 27/Oct/21 ]

This issue doesn't seem to be present in MongoDB 5.0, and likely was fixed long ago.

Comment by Eliot Horowitz (Inactive) [ 20/Feb/14 ]

This is a "bug" in the shell helper for Database.getCollectionNames
It checks for the magic string oplog.$, but maybe should check for something else.

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