[SERVER-8322] Shell allows insert() of objects which don't make sense Created: 24/Jan/13  Updated: 10/May/22

Status: Backlog
Project: Core Server
Component/s: Shell
Affects Version/s: 2.2.2
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Gerd Jungbluth Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Unresolved Votes: 0
Labels: insert, move-sa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

mongo
db.foo.insert(123);
db.foo.find();
db.foo.insert(/\d/);
db.foo.find();

etc.

Participants:

 Description   

Calling db.foo.insert(o) with o = /\d/ | o = '123' | o = 123 | o = ISODate() is accepted. Afterwards db.foo.find() throws errors.



 Comments   
Comment by Steven Vannelli [ 10/May/22 ]

Moving this ticket to the Backlog and removing the "Backlog" fixVersion as per our latest policy for using fixVersions.

Comment by Gerd Jungbluth [ 24/Jan/13 ]

Just saw in https://github.com/mongodb/mongo/blob/master/src/mongo/shell/collection.js#L130 that there is a check now for 'typeof(o) != "object"', which is just fine for RegExp, Number and String, but not for ISODate, since 'typeof ISODate()' yields 'object'. Should I hate JavaScript?

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