Operational Defect Database

BugZero found this defect 2418 days ago.

MongoDB | 402826

[SERVER-30098] Projections using dot notation to select an array element don't work

Last update date:

10/27/2023

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

db.getCollection('SomeCollection').find({}, {'array.0':1}) I would expect the above to return documents like: {array:[{a:'a',b:'b'}]} but instead returns all elements of the array, just as empty objects: {array:[{}, {}, {}]} This doesn't make any sense. It seem broken.

Top User Comments

thomas.schubert commented on Tue, 11 Jul 2017 22:24:27 +0000: Hi fresheneesz, Please note that this behavior is documented. I would recommend using the $slice to achieve the functionality you're looking for: db.getCollection('SomeCollection').find({}, {array:{$slice:1}}) Kind regards, Thomas fresheneesz commented on Tue, 11 Jul 2017 21:34:54 +0000: Thanks Thomas! fresheneesz commented on Tue, 11 Jul 2017 21:04:58 +0000: Ugh, freaking jira "preformatted" style didn't work.. why can't I edit the ticket I created? Well... ignore the first two and last two curly braces then...

Additional Resources / Links

Share:

BugZero Risk Score

Coming soon

Status

Closed

Have you been affected by this bug?

cost-cta-background

Do you know how much operational outages are costing you?

Understand the cost to your business and how BugZero can help you reduce those costs.

Discussion

Login to read and write comments.

Have you ever...

had your data corrupted from a

VMware

bug?

Search:

...