I am new to Mo开发者_运维问答ngo DB can we insert the data in java and retrieve the data from Mongo DB using java script?
Please suggest.
Take a look into mongodb quick start
Take a look into mongodb java tutorial. Here you can find how to connect/query/update mongodb.
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.
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
精彩评论