Clarifying questions about MongoDB
These are newb questions, I'm sure, so let's get this out of the way sooner rather than later: I'm new to MongoDB.
Does MongoDB guarantee that an entry will be saved? E.g. if I have a process load 1,000,000 objects into MongoDB, am I guaranteed that they will all load properly or at least retry / raise an error when an error occurs?
Is NumberLong only for integers? What if I wanted to use high precision decimals?
I know V8 / SpiderMonkey can be just as fast as C, but has anyone done any benchmarks for calculations of data in MongoDB? For example, if I wanted to find the average over those 1,000,000 items I loaded in 1, I could probably do it in a map-reduce way with any programming language... have people run in to any trouble with usi开发者_如何学编程ng JavaScript with MongoDB? What do you think?
- Most Mongo drivers let you insert data with "safe-mode" which waits for an insert to complete sucessfully, or raises an error on failure. This is done behind the scenes by calling the getLastError command immediately after the insert.
- MongoDB's underlying storage format BSON doesn't support high-percision decimals, only 64-bit floating point numbers.
- JavaScript in MongoDB is single-threaded, and can be a bit slow. Hopefully the JavaScript engine will be upgraded to V8 which should speed things up.
- MongoDB follows eventual consistency model, which is defined as:
The storage system guarantees that if no new updates are made to the object, eventually all accesses will return the last updated value.
Thanks
精彩评论