[SERVER-19683] Shell inserts no longer display returned WriteResult under SpiderMonkey Created: 31/Jul/15  Updated: 14/Apr/16  Resolved: 03/Aug/15

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

Type: Bug Priority: Major - P3
Reporter: David Hows Assignee: Mira Carey
Resolution: Duplicate Votes: 0
Labels: regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-19710 shellPrintHelper() and shellPrint() p... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

> db.foo.insert({_id:1})
> db.foo.insert({_id:1})
> a = db.foo.insert({_id:1})
> a.toString()
WriteResult({
	"nInserted" : 0,
	"writeError" : {
		"code" : 11000,
		"errmsg" : "E11000 duplicate key error index: test.foo.$_id_ dup key: { : 1.0 }"
	}
})

Participants:

 Description   

As of 2a6a8f7cf32465da072e63ee9e1272907b6bfa54 the Mongo shell no longer displays WriteResult's following the execution of a write operation.



 Comments   
Comment by Mira Carey [ 03/Aug/15 ]

I'm going to close this out as a dupe.

I'm happy to follow up in SERVER-19710, but we as we're now back to the behavior we have in 3.0.X, the specific regression called out for this ticket is solved.

Comment by Kevin Pulo [ 01/Aug/15 ]

Agreed. As it turns out, shellPrintHelper() returns the string that's returned by WriteResult.shellPrint(), which was then being printed via printResult == true in the scope->exec() call which runs shellPrintHelper(). I've opened SERVER-19710 to follow up on that somewhat confusing situation.

Comment by Mira Carey [ 31/Jul/15 ]

I think this is a dupe of: SERVER-19690.

On re-testing post 2e6b61bc6136b2192fdfbbe86fb6759de9393567 I get:

> db.test.insert({_id:1})
WriteResult({ "nInserted" : 1 })
> db.test.insert({_id:1})
WriteResult({
        "nInserted" : 0,
        "writeError" : {
                "code" : 11000,
                "errmsg" : "E11000 duplicate key error collection: test.test index: _id_ dup key: { : 1.0 }"
        }
})

Comment by Kevin Pulo [ 31/Jul/15 ]

The root cause is that __lastres__ is now undefined where it's passed to shellPrintHelper(). This is the only place where __lastres__ is used. Looks like SpiderMonkey doesn't do this, but V8 did? There is a reference to it (and kExecResult) under mozjs.

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