[SERVER-12659] Return new instance of Collection from db.coll/db["coll"] Created: 07/Feb/14  Updated: 27/Oct/21  Resolved: 27/Oct/21

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

Type: Bug Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Geert Bosch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Currently getting a collection from db.coll returns the same instance every time but calling db.getCollection("coll") will return a new instance every time. We should get these playing together.

these return the same instance

> var a = db.coll
> var b = db.coll
> a === b
true

these return new instances every time

> var a = db.getCollection('coll')
> var b = db.getCollection('coll')
> a === b
false



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

This works correctly with mongosh.

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