简体   繁体   中英

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.

  1. Does MongoDB guarantee that an entry will be saved? Eg 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?

  2. Is NumberLong only for integers? What if I wanted to use high precision decimals?

  3. 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 using JavaScript with MongoDB? What do you think?

  1. 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.
  2. MongoDB's underlying storage format BSON doesn't support high-percision decimals, only 64-bit floating point numbers.
  3. 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.
  1. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM