THOL | 18 Nov 00:55 2011
Picon

spool output from mongodb shell

Hi,

Is there a way to spool output to a file when working in mongodb
shell? Similar to spool command in sqlplus.

Thanks
Thol

Tyler Brock | 18 Nov 01:10 2011

Re: spool output from mongodb shell

You can always redirect the output to a file by using ">"

Example:
mongo commands.js > output.txt

If you use print statements whatever you would normally see during the
session will be written to the file.

Does that help?

-Tyler

On Nov 17, 6:55 pm, THOL <tholkap...@...> wrote:
> Hi,
>
> Is there a way to spool output to a file when working in mongodb
> shell? Similar to spool command in sqlplus.
>
> Thanks
> Thol

--

-- 
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@...
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Tyler Brock | 18 Nov 01:24 2011

Re: spool output from mongodb shell

You might also want to take a peek at this documentation:

http://www.mongodb.org/display/DOCS/Scripting+the+shell

On Nov 17, 7:10 pm, Tyler Brock <ty...@...> wrote:
> You can always redirect the output to a file by using ">"
>
> Example:
> mongo commands.js > output.txt
>
> If you use print statements whatever you would normally see during the
> session will be written to the file.
>
> Does that help?
>
> -Tyler
>
> On Nov 17, 6:55 pm, THOL <tholkap...@...> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Is there a way to spool output to a file when working in mongodb
> > shell? Similar to spool command in sqlplus.
>
(Continue reading)

THOL | 18 Nov 06:00 2011
Picon

Re: spool output from mongodb shell

Thank you for the reply. I wanted to have formatted JSON output saved
in a file just as you query the database. That can be later used for
reference.
I guess printjson() is a good alternative but it has to be run as a
script.

Thanks
Thol

On Nov 17, 4:24 pm, Tyler Brock <ty...@...> wrote:
> You might also want to take a peek at this documentation:
>
> http://www.mongodb.org/display/DOCS/Scripting+the+shell
>
> On Nov 17, 7:10 pm, Tyler Brock <ty...@...> wrote:
>
> > You can always redirect the output to a file by using ">"
>
> > Example:
> > mongo commands.js > output.txt
>
> > If you use print statements whatever you would normally see during the
> > session will be written to the file.
>
> > Does that help?
>
> > -Tyler
>
> > On Nov 17, 6:55 pm, THOL <tholkap...@...> wrote:
>
(Continue reading)

Crazybaby | 18 Nov 07:18 2011
Picon

Re: spool output from mongodb shell

you can use mongoexport of Mongo Tools . export json and scv fmt;

On Nov 18, 1:00 pm, THOL <tholkap...@...> wrote:
> Thank you for the reply. I wanted to have formatted JSON output saved
> in a file just as you query the database. That can be later used for
> reference.
> I guess printjson() is a good alternative but it has to be run as a
> script.
>
> Thanks
> Thol
>
> On Nov 17, 4:24 pm, Tyler Brock <ty...@...> wrote:
>
> > You might also want to take a peek at this documentation:
>
> >http://www.mongodb.org/display/DOCS/Scripting+the+shell
>
> > On Nov 17, 7:10 pm, Tyler Brock <ty...@...> wrote:
>
> > > You can always redirect the output to a file by using ">"
>
> > > Example:
> > > mongo commands.js > output.txt
>
> > > If you use print statements whatever you would normally see during the
> > > session will be written to the file.
>
> > > Does that help?
>
(Continue reading)


Gmane