FAQ
hello folks. i have a file called "fix-CUSIP.js"

it contains:

db.secMasterImport.count({"CUSIP":{$type:18}});
db.secMasterImport.find({CUSIP:{$type:18}}).forEach(function(doc){
doc.CUSIP = doc.CUSIP. toNumber().toString();
db.secMasterImport.save(doc);
});
db.secMasterImport.count({"CUSIP":{$type:18}});

when i run these commands in the shell i get a count for the first command,
the second command soes the fix,

then the last command returns a count showing zeroe, that all the bad
cusips were fixed.

when i run the file using:

./mongo --shell --port portnumber mydatabase fix-CUSIP.js

i do not the counts. how can i get them returned to me ?

thanks.

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user+unsubscribe@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Search Discussions

  • Alan at Dec 14, 2012 at 6:18 pm
    You can read about the difference in printing here
    http://www.mongodb.org/display/DOCS/Scripting+the+shell

    you have to explicitly print it in a script

    print(db.secMasterImport.count({"CUSIP":{$type:18}}));
    On Friday, December 14, 2012 9:00:45 AM UTC-8, davidmo wrote:

    hello folks. i have a file called "fix-CUSIP.js"

    it contains:

    db.secMasterImport.count({"CUSIP":{$type:18}});
    db.secMasterImport.find({CUSIP:{$type:18}}).forEach(function(doc){
    doc.CUSIP = doc.CUSIP. toNumber().toString();
    db.secMasterImport.save(doc);
    });
    db.secMasterImport.count({"CUSIP":{$type:18}});

    when i run these commands in the shell i get a count for the first
    command, the second command soes the fix,

    then the last command returns a count showing zeroe, that all the bad
    cusips were fixed.

    when i run the file using:

    ./mongo --shell --port portnumber mydatabase fix-CUSIP.js

    i do not the counts. how can i get them returned to me ?

    thanks.
    --
    You received this message because you are subscribed to the Google
    Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com
    See also the IRC channel -- freenode.net#mongodb
  • Davidmo at Dec 14, 2012 at 8:09 pm
    thanks a million. you know, its not that i don't read this stuff. i just
    cannot come up with the syntax that reflects what the doc is telling you to
    do. i think this is a common problem - why so many posters say "please tell
    me the exact syntax".
    hopefully this changes with experience. thanks again

    david

    On Friday, December 14, 2012 12:00:45 PM UTC-5, davidmo wrote:

    hello folks. i have a file called "fix-CUSIP.js"

    it contains:

    db.secMasterImport.count({"CUSIP":{$type:18}});
    db.secMasterImport.find({CUSIP:{$type:18}}).forEach(function(doc){
    doc.CUSIP = doc.CUSIP. toNumber().toString();
    db.secMasterImport.save(doc);
    });
    db.secMasterImport.count({"CUSIP":{$type:18}});

    when i run these commands in the shell i get a count for the first
    command, the second command soes the fix,

    then the last command returns a count showing zeroe, that all the bad
    cusips were fixed.

    when i run the file using:

    ./mongo --shell --port portnumber mydatabase fix-CUSIP.js

    i do not the counts. how can i get them returned to me ?

    thanks.
    --
    You received this message because you are subscribed to the Google
    Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com
    See also the IRC channel -- freenode.net#mongodb

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmongodb-user @
categoriesmongodb
postedDec 14, '12 at 5:28p
activeDec 14, '12 at 8:09p
posts3
users2
websitemongodb.org
irc#mongodb

2 users in discussion

Davidmo: 2 posts Alan: 1 post

People

Translate

site design / logo © 2022 Grokbase