I am new into mongodb, nodejs and mongooseJS. Lately, I have been trying to create a mongoose schema for my JSON.
{
"endpoints":["a","z"],
"poi":[{
"location_name": "a",
"latitude": " 10.1075702",
"longitude": "76.345662",
"distance" : "0.0"
}, {
"location_name": "b",
"latitude": "10.110199",
"longitude": "76.3489361",
"distance" : "2.0"
}, {
"location_name": "c",
"latitude": "10.1197471",
"longitude": "76.342873",
"distance" : "3.1"
}, {
"location_name": "d",
"latitude": "10.1254479",
"longitude": "76.3332626",
"distance" : "4.4"
}, {
"location_name": "e",
"latitude": "10.1443277",
"longitude": "76.2566017",
"distance" : "13.9"
}, {
"location_name": "f",
"latitude": "10.1487145",
"longitude": "76.2441114",
"distance" : "15"
}, {
"location_name": "z",
"latitude": "10.145578",
"longitude": "76.2317077",
"distance" : "16.9"
}]
}
This is my JSON file that I have. I tried using generate-schema from https://github.com/nijikokun/generate-schema which gave me the following output
{
endpoints:[ 'String' ],
poi: [ 'String' ]
}
I used this and when I tested it using Postman from chrome webstore, I was not able to retrieve the complete JSON from the database using the get request. Neither I was able to run a post request successfully.
Recently I tried using JSON schema instead of the mongoose schema using
mongoose.Schema("JSON Schema')
When I try using JSON Schema I am able to retrieve the data from the mongodb collections using the GET request but I'm not able to POST data correctly with the JSON Schema
I was also thinking about dropping nodejs and redeveloping the webservice in java and mongodb. If I try to use Java web service for interacting with mongodb, is it going to affect the performance of my web app?