0

I am new to Mongo DB can we insert the data in java and retrieve the data from Mongo DB using java script?

Please suggest.

2 Answers 2

1
  1. Take a look into mongodb quick start

  2. Take a look into mongodb java tutorial. Here you can find how to connect/query/update mongodb.

  3. To retrieve data from mongodb via javascript create some service layer (it can be simple rest api) that will return data in json format for example.

Sign up to request clarification or add additional context in comments.

Comments

1

Javascript way of printing output of MongoDB query to a file

1] create a javascript file

test.js

cursor = db.printShardingStatus();
while(cursor.hasNext()){
  printjson(cursor.next());
}

2] run

mongo admin --quiet test.js > output.txt

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.