MongoDB 3.2.1 - collections are getting delete which have options: { temp: true }

In My Mongo version 3.2.1, collections are getting deleted after every restart.

In debug logs i could see that, what ever the collection have options: { temp: true } are getting deleted.

Could someone please let me know how to can i remove options: { temp: true } for a collection which is already created under conn_prod database.

2021-07-14T18:23:18.044+0530 D COMMAND [conn25] run command conn_prod.$cmd { create: “conn_user::tanaga_1.0_test”, temp: true }
2021-07-14T18:23:18.044+0530 D STORAGE [conn25] create collection conn_prod.conn_user::tanaga_1.0_test { temp: true }
2021-07-14T18:23:18.044+0530 D STORAGE [conn25] WT begin_transaction
2021-07-14T18:23:18.044+0530 D STORAGE [conn25] stored meta data for conn_prod.conn_user::tanaga_1.0_test @ RecordId(366)
2021-07-14T18:23:18.044+0530 D STORAGE [conn25] WiredTigerKVEngine::createRecordStore uri: table:conn_prod/collection-12–5968079627423616812 config: type=file,memory_page_max=10m,split_pct=90,leaf_value_max=64MB,checksum=on,block_compressor=snappy,key_format=q,value_format=u,app_metadata=(formatVersion=1)
2021-07-14T18:23:18.046+0530 D STORAGE [conn25] WiredTigerUtil::checkApplicationMetadataFormatVersion uri: table:conn_prod/collection-12–5968079627423616812 ok range 1 → 1 current: 1
2021-07-14T18:23:18.046+0530 D STORAGE [conn25] looking up metadata for: conn_prod.conn_user::tanaga_1.0_test @ RecordId(366)
2021-07-14T18:23:18.046+0530 D STORAGE [conn25] fetched CCE metadata: { ns: “conn_prod.conn_user::tanaga_1.0_test”, ident: “conn_prod/collection-12–5968079627423616812”, md: { ns: “conn_prod.conn_user::tanaga_1.0_test”, options: { temp: true }, indexes: [] } }
2021-07-14T18:23:18.046+0530 D STORAGE [conn25] returning metadata: md: { ns: “conn_prod.conn_user::tanaga_1.0_test”, options: { temp: true }, indexes: [] }

Welcome to the MongoDB Community Forums @Rajasekhar_Reddy_V !

MongoDB 3.2.1 was released more than 5 years ago (Jan 2016) and the 3.2 series reached end of life in 2018. I would start by upgrading to the final MongoDB 3.2 release (3.2.22) to see if your issue is still present. Minor releases include bug fixes as well as security and stability improvements and do not introduce any backward-breaking compatibility changes. Ideally you should plan to upgrade to a supported server release series (currently MongoDB 4.0 or newer) as there has been significant evolution in the last 5 years of product development.

I believe temp:true is an internal option used for temporary collections in Map/Reduce and Aggregation. Are you running either of those operations? What MongoDB driver version are you using?


HI @Stennie_X Thank you for your response.
We have almost 300+ collections in the DB. But temp:true is for only around 7-8 collections. Not sure how it got created.
But Yes, with minor version upgrade temp:true is getting wiped-out.
But just wanted to know like, is there an option to remove temp:true parameter from the collection?


Hi Rajasekhar,

I believe the issue you are encountering may be SERVER-23274, which affected collections that were created with the $out aggregation stage. This was fixed in MongoDB 3.2.5.

If you have collections which have temp:true incorrectly set, you should be able to clear the temp flag using the renameCollection workaround specified in that server issue:

    renameCollection: "dbname.created_with_$out",
    to: "dbname.some_other_name"

You could also use equivalent arguments via the db.collection.renameCollection() helper.


Sure. Thank you @Stennie_X
I will try this and update you. thank you.


1 Like

Thank you @Stennie_X
Renaming the collection worked for me.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.