开发者

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

开发者 https://www.devze.com 2023-04-05 22:54 出处:网络
I am new to Mo开发者_运维问答ngo DB can we insert the data in java and retrieve the data from Mongo DB using java script?

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

精彩评论

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