Nodeclipse / nodeclipse

Nodeclipse-1 : Eclipse plugin for Node.js, PhantomJS development (Nodeclipse core plugin); Maven and Gradle (with Android) plugins
https://nodeclipse.github.io/
158 stars 78 forks source link

mongo shell integration in nodeclipse 0.9.0 #110

Open ghost opened 10 years ago

ghost commented 10 years ago

I am not sure I am following the correct path to use mongo shell integration but there is a simple use case that raises a few questions.

I created a simple javascript file in IDE with the following statement:

db.getCollectionNames();

Now I Run this file As MongoDB Shell Javascript: in console view, it opens a connection to default mongod then send this output to console view:

MongoDB shell version: 2.4.8 connecting to: test type "help" for help

Typing help at console prompt is actually displaying mongo shell help and we can close the connection with a control-D key: the console view works like an instance of the mongo shell - so far so good.

But nodeclipse is an IDE and this _integration_ is raising some doubts...

If the idea was to provide a mongo shell view within nodeclispse - and there is a few reasons to provide such a feature, especially on Windows - then I don't see why it should be called from a _Run As_ contextual menu: _Run As_ requires a javascript file - it would make sense if the javascript code in this file was actually sent to the mongo shell.

But it's not: the db.getCollectionNames() statement in my JS file is never sent to the database when you _Run As_ the file...

If the idea was to provide a mongo shell from IDE then I think it would make more sense to provide this feature as a view you'll open from Window > Show View submenu: you'll start a shell from the view and use it as as mongo shell.

What would make much more sense is to actually _Run_ a MongoDB Shell Javascript file from Project Explorer's _Run As_ submenu - sending the javascript code to a new mongo shell instance, etc...

paulvi commented 10 years ago

Windows shell is awful and I could not find any standalone Eclipse plugins (Check Nodeclipse Plugin LIst for those I tried, and Aptana IDE www.aptana.com for great example of Shell inside Eclipse)

Nodeclipse Mongo Shell was implemented similar to Node.js, PhantomJS, JJS. It is just running .js file with executable that is configured in preferences.

After it worked, I see it is good for some simple usecase (while learning), but some more complicated usecases like replica set #111

the db.getCollectionNames() statement in my JS file is never sent to the database when you _Run As_ the file...

try the same from mongo. I guess when mongo has enough information, it does not send request to mongod

What would make much more sense is to actually _Run_ a MongoDB Shell Javascript file from Project Explorer's _Run As_ submenu - sending the javascript code to a new mongo shell instance, etc...

It is exactly how it is now. Any .js file can be _Run As_ with mongo