Is it acceptable to store json api responses directly into mongoDB, as your main document structure and work from that? Is 45kb per document workable?
-
I am looking to develop a simple webapp, that really relies on 3rd party API's and I can't see why I can't just query the REST endpoint, store the returning JSON into MongoDB, and then just throw that to a client-side library e.g. knockout-js. Is this one of the purpose-built mechanisms for mongo's conception?
-
Answer:
After attending a presentation done by Ross Lawley, I think the situation is thus: 45kb is a workable document file size, and that with the latest aggregation functions implemented, then given the structure of the REST response, this approach is totally feasible
Sky Viker-Rumsey at Quora Visit the source
Other answers
Hi,You are on correct track.MongoDB actually stores the documents in JSON itself. So, whatever JSON you have can go directly into Mongo document. Just make sure you serialize them.Blog : https://www.mongodb.com/json-and-bsonAbout your second question âThe maximum document size that is allowed in Mongo is 16 MB. So, if you are storing about 45 KB per document then it is totally fine. But, it is recommended that your document size should be minimum, so that you have a proper schema. That depends on your usecase.Read : https://docs.mongodb.com/manual/reference/limits/Good luck for your webapp! :)_RB
Rohit Badwaik
Interesting you ask that because we are doing that too, We are logging every api request and reply to the MongoDb, itâs working great with much bigger doc too (1MB). Do keep in mind the record restrictions to avoid API outage - keys cannot contain dots and some strange characters might be rejected by the DB.
Avi Kapuya
Related Q & A:
- How to store json data in jquery?Best solution by Stack Overflow
- How Many Work Hours Per Week?Best solution by Quora
- How does Per Diem work?Best solution by Yahoo! Answers
- Does photosynthesis work directly with respiration?Best solution by Yahoo! Answers
- How does online pay per click work?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.