[SERVER-9290] Queries are not recorded in top stats when run in a script Created: 08/Apr/13  Updated: 10/Dec/14  Resolved: 21/Jan/14

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

Type: Bug Priority: Minor - P4
Reporter: Shaun Verch Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-7774 Add jstest for db.adminCommand('top') Closed
Related
is related to SERVER-7774 Add jstest for db.adminCommand('top') Closed
Operating System: ALL
Steps To Reproduce:

As a script:

[sv@sv ~/dev/mongodb_repos/SERVER-7774 (master)]$ mongo testfile.js
MongoDB shell version: 2.3.3-pre-
connecting to: test
{ "time" : 0, "count" : 0 }

In the shell:

[sv@sv ~/dev/mongodb_repos/SERVER-7774 (master)]$ cat testfile.js
db.test.drop();
db.test.insert({x:1});
db.test.find({x:1});
db.test.find({x:1});
db.test.find({x:1});
printjson(db.adminCommand("top").totals["test.test"].queries);
[sv@sv ~/dev/mongodb_repos/SERVER-7774 (master)]$ mongo
MongoDB shell version: 2.3.3-pre-
connecting to: test
Server has startup warnings:
Mon Apr  8 13:38:23.719 [initandlisten]
Mon Apr  8 13:38:23.719 [initandlisten] ** NOTE: This is a development version (2.5.0-pre-) of MongoDB.
Mon Apr  8 13:38:23.719 [initandlisten] **       Not recommended for production.
Mon Apr  8 13:38:23.719 [initandlisten]
> db.test.drop();
true
> db.test.insert({x:1});
> db.test.find({x:1});
{ "_id" : ObjectId("516343b8a4cd2ac566f62971"), "x" : 1 }
> db.test.find({x:1});
{ "_id" : ObjectId("516343b8a4cd2ac566f62971"), "x" : 1 }
> db.test.find({x:1});
{ "_id" : ObjectId("516343b8a4cd2ac566f62971"), "x" : 1 }
> printjson(db.adminCommand("top").totals["test.test"].queries);
{ "time" : 200, "count" : 2 }
>
bye

Participants:

 Description   

Queries are recorded differently in the top stats depending on whether they are run from a script or from the shell. I posted an example of running the same test in both places with different results.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 21/Jan/14 ]

Hint: What does .find() return.

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