开发者

Inserting data in Mongo DB using java and retrieve the data from Mongo DB using javascript

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.


  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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜