From 67dde84c95e425c321eb73af819253cfbfd3d32f Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Wed, 8 Feb 2012 15:55:50 +0100 Subject: [PATCH 01/56] First pages commit --- index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 00000000000..03f980162b4 --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +My GitHub Page From 83fff11261b8666d16392226728995928811a0a6 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Wed, 8 Feb 2012 16:09:11 +0100 Subject: [PATCH 02/56] First sample document checkin --- .buildinfo | 4 + _sources/api-articles/index.txt | 9 + _sources/api-articles/nodekoarticle1.txt | 424 +++ _sources/api-articles/nodekoarticle2.txt | 327 +++ _sources/api-bson-generated/binary.txt | 239 ++ _sources/api-bson-generated/bson.txt | 622 +++++ _sources/api-bson-generated/code.txt | 20 + _sources/api-bson-generated/double.txt | 30 + _sources/api-bson-generated/index.txt | 16 + _sources/api-bson-generated/long.txt | 487 ++++ _sources/api-bson-generated/maxkey.txt | 17 + _sources/api-bson-generated/objectid.txt | 196 ++ _sources/api-bson-generated/symbol.txt | 30 + _sources/api-bson-generated/timestamp.txt | 487 ++++ _sources/api-generated/admin.txt | 867 ++++++ _sources/api-generated/collection.txt | 2609 ++++++++++++++++++ _sources/api-generated/cursor.txt | 947 +++++++ _sources/api-generated/cursorstream.txt | 245 ++ _sources/api-generated/db.txt | 1979 ++++++++++++++ _sources/api-generated/grid.txt | 189 ++ _sources/api-generated/gridstore.txt | 1760 +++++++++++++ _sources/api-generated/index.txt | 15 + _sources/api-generated/readstream.txt | 253 ++ _sources/changelog/changelog.txt | 393 +++ _sources/contents.txt | 16 + _sources/getting-started.txt | 19 + _sources/index.txt | 42 + _sources/markdown-docs/collections.txt | 213 ++ _sources/markdown-docs/database.txt | 189 ++ _sources/markdown-docs/gridfs.txt | 235 ++ _sources/markdown-docs/index.txt | 10 + _sources/markdown-docs/indexes.txt | 143 + _sources/markdown-docs/insert.txt | 190 ++ _sources/markdown-docs/queries.txt | 436 +++ _sources/markdown-docs/readme.txt | 19 + _sources/markdown-docs/replicaset.txt | 83 + _static/ajax-loader.gif | Bin 0 -> 673 bytes _static/basic.css | 540 ++++ _static/comment-bright.png | Bin 0 -> 3500 bytes _static/comment-close.png | Bin 0 -> 3578 bytes _static/comment.png | Bin 0 -> 3445 bytes _static/doctools.js | 247 ++ _static/down-pressed.png | Bin 0 -> 368 bytes _static/down.png | Bin 0 -> 363 bytes _static/file.png | Bin 0 -> 392 bytes _static/jquery.js | 154 ++ _static/logo-mongodb.png | Bin 0 -> 13030 bytes _static/minus.png | Bin 0 -> 199 bytes _static/mongodb-docs.css | 250 ++ _static/plus.png | Bin 0 -> 199 bytes _static/pygments.css | 62 + _static/searchtools.js | 560 ++++ _static/underscore.js | 23 + _static/up-pressed.png | Bin 0 -> 372 bytes _static/up.png | Bin 0 -> 363 bytes _static/websupport.js | 808 ++++++ api-articles/index.html | 151 ++ api-articles/nodekoarticle1.html | 442 ++++ api-articles/nodekoarticle2.html | 370 +++ api-bson-generated/binary.html | 433 +++ api-bson-generated/bson.html | 916 +++++++ api-bson-generated/code.html | 159 ++ api-bson-generated/double.html | 175 ++ api-bson-generated/index.html | 265 ++ api-bson-generated/long.html | 942 +++++++ api-bson-generated/maxkey.html | 151 ++ api-bson-generated/objectid.html | 353 +++ api-bson-generated/symbol.html | 175 ++ api-bson-generated/timestamp.html | 942 +++++++ api-generated/admin.html | 1090 ++++++++ api-generated/collection.html | 2929 +++++++++++++++++++++ api-generated/cursor.html | 1182 +++++++++ api-generated/cursorstream.html | 373 +++ api-generated/db.html | 2346 +++++++++++++++++ api-generated/grid.html | 349 +++ api-generated/gridstore.html | 2053 +++++++++++++++ api-generated/index.html | 283 ++ api-generated/readstream.html | 381 +++ changelog/changelog.html | 798 ++++++ contents.html | 216 ++ genindex.html | 975 +++++++ getting-started.html | 159 ++ index.html | 230 +- markdown-docs/collections.html | 339 +++ markdown-docs/database.html | 326 +++ markdown-docs/gridfs.html | 350 +++ markdown-docs/index.html | 136 + markdown-docs/indexes.html | 266 ++ markdown-docs/insert.html | 314 +++ markdown-docs/queries.html | 486 ++++ markdown-docs/readme.html | 138 + markdown-docs/replicaset.html | 237 ++ objects.inv | Bin 0 -> 1201 bytes search.html | 133 + searchindex.js | 1 + 95 files changed, 37967 insertions(+), 1 deletion(-) create mode 100644 .buildinfo create mode 100644 _sources/api-articles/index.txt create mode 100644 _sources/api-articles/nodekoarticle1.txt create mode 100644 _sources/api-articles/nodekoarticle2.txt create mode 100644 _sources/api-bson-generated/binary.txt create mode 100644 _sources/api-bson-generated/bson.txt create mode 100644 _sources/api-bson-generated/code.txt create mode 100644 _sources/api-bson-generated/double.txt create mode 100644 _sources/api-bson-generated/index.txt create mode 100644 _sources/api-bson-generated/long.txt create mode 100644 _sources/api-bson-generated/maxkey.txt create mode 100644 _sources/api-bson-generated/objectid.txt create mode 100644 _sources/api-bson-generated/symbol.txt create mode 100644 _sources/api-bson-generated/timestamp.txt create mode 100644 _sources/api-generated/admin.txt create mode 100644 _sources/api-generated/collection.txt create mode 100644 _sources/api-generated/cursor.txt create mode 100644 _sources/api-generated/cursorstream.txt create mode 100644 _sources/api-generated/db.txt create mode 100644 _sources/api-generated/grid.txt create mode 100644 _sources/api-generated/gridstore.txt create mode 100644 _sources/api-generated/index.txt create mode 100644 _sources/api-generated/readstream.txt create mode 100644 _sources/changelog/changelog.txt create mode 100644 _sources/contents.txt create mode 100644 _sources/getting-started.txt create mode 100644 _sources/index.txt create mode 100644 _sources/markdown-docs/collections.txt create mode 100644 _sources/markdown-docs/database.txt create mode 100644 _sources/markdown-docs/gridfs.txt create mode 100644 _sources/markdown-docs/index.txt create mode 100644 _sources/markdown-docs/indexes.txt create mode 100644 _sources/markdown-docs/insert.txt create mode 100644 _sources/markdown-docs/queries.txt create mode 100644 _sources/markdown-docs/readme.txt create mode 100644 _sources/markdown-docs/replicaset.txt create mode 100644 _static/ajax-loader.gif create mode 100644 _static/basic.css create mode 100644 _static/comment-bright.png create mode 100644 _static/comment-close.png create mode 100644 _static/comment.png create mode 100644 _static/doctools.js create mode 100644 _static/down-pressed.png create mode 100644 _static/down.png create mode 100644 _static/file.png create mode 100644 _static/jquery.js create mode 100644 _static/logo-mongodb.png create mode 100644 _static/minus.png create mode 100644 _static/mongodb-docs.css create mode 100644 _static/plus.png create mode 100644 _static/pygments.css create mode 100644 _static/searchtools.js create mode 100644 _static/underscore.js create mode 100644 _static/up-pressed.png create mode 100644 _static/up.png create mode 100644 _static/websupport.js create mode 100644 api-articles/index.html create mode 100644 api-articles/nodekoarticle1.html create mode 100644 api-articles/nodekoarticle2.html create mode 100644 api-bson-generated/binary.html create mode 100644 api-bson-generated/bson.html create mode 100644 api-bson-generated/code.html create mode 100644 api-bson-generated/double.html create mode 100644 api-bson-generated/index.html create mode 100644 api-bson-generated/long.html create mode 100644 api-bson-generated/maxkey.html create mode 100644 api-bson-generated/objectid.html create mode 100644 api-bson-generated/symbol.html create mode 100644 api-bson-generated/timestamp.html create mode 100644 api-generated/admin.html create mode 100644 api-generated/collection.html create mode 100644 api-generated/cursor.html create mode 100644 api-generated/cursorstream.html create mode 100644 api-generated/db.html create mode 100644 api-generated/grid.html create mode 100644 api-generated/gridstore.html create mode 100644 api-generated/index.html create mode 100644 api-generated/readstream.html create mode 100644 changelog/changelog.html create mode 100644 contents.html create mode 100644 genindex.html create mode 100644 getting-started.html create mode 100644 markdown-docs/collections.html create mode 100644 markdown-docs/database.html create mode 100644 markdown-docs/gridfs.html create mode 100644 markdown-docs/index.html create mode 100644 markdown-docs/indexes.html create mode 100644 markdown-docs/insert.html create mode 100644 markdown-docs/queries.html create mode 100644 markdown-docs/readme.html create mode 100644 markdown-docs/replicaset.html create mode 100644 objects.inv create mode 100644 search.html create mode 100644 searchindex.js diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 00000000000..44f3981af55 --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 435b277086116c382570a258c5eb5982 +tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/_sources/api-articles/index.txt b/_sources/api-articles/index.txt new file mode 100644 index 00000000000..6509b1aaf72 --- /dev/null +++ b/_sources/api-articles/index.txt @@ -0,0 +1,9 @@ +================== +Articles +================== + +.. toctree:: + :maxdepth: 2 + + nodekoarticle1 + nodekoarticle2 diff --git a/_sources/api-articles/nodekoarticle1.txt b/_sources/api-articles/nodekoarticle1.txt new file mode 100644 index 00000000000..fa141a4a8fd --- /dev/null +++ b/_sources/api-articles/nodekoarticle1.txt @@ -0,0 +1,424 @@ +================================ +A Basic introduction to Mongo DB +================================ + + Mongo DB has rapidly grown to become a popular database for web applications and is a perfect fit for Node.JS applications, letting you write Javascript for the client, backend and database layer. It's schemaless nature is a better match to our constantly evolving data structures in web applications and the integrated support for location queries a bonus that it's hard to ignore. Throw Replicasets for scaling and we are looking at really nice platform to grow your storage needs now and in the future. + + + + Now to shamelessly plug my driver. It can be downloaded either using npm or fetched from the github repository. To install via npm do the following. + + + + ``npm install mongodb`` + + + + or go fetch it from github at `https://github.com/christkv/node-mongodb-native `_ + + + + Once this business is taken care of let's move through the types available for the driver and then how to connect to your Mongo DB instance before facing the usage of some crud operations. + + +------------------- +Mongo DB data types +------------------- + + So there is an important thing to keep in mind when working with Mongo DB and that is that there is a slight mapping difference between the types supported in Mongo DB and what is native types in Javascript. Let's have a look at the types supported out of the box and then how types are promoted by the driver to try to fit as close to the native Javascript types as possible. + + + * **Float** is a 8 byte and is directly convertible to the Javascript type Number + * **Double class** a special class representing a float value, this is especially useful when using capped collections where you need to ensure your values are always floats. + * **Integers** is a bit trickier due to the fact that Javascript represents all Numbers as 64 bit floats meaning that the maximum integer value is at a 53 bit. Mongo has two types for integers, a 32 bit and a 64 bit. The driver will try to fit the value into 32 bits if it can and promote it to 64 bits if it has to. Similarly it will deserialize attempting to fit it into 53 bits if it can. If it cannot it will return an instance of **Long** to avoid loosing precession. + * **Long class** a special class that let's you store 64 bit integers and also let's you operate on the 64 bits integers. + * **Date** maps directly to a Javascript Date + * **RegEp** maps directly to a Javascript RegExp + * **String** maps directly to a Javascript String (encoded in utf8) + * **Binary class** a special class that let's you store data in Mongo DB + * **Code class** a special class that let's you store javascript functions in Mongo DB, can also provide a scope to run the method in + * **ObjectID class** a special class that holds a MongoDB document identifier (the equivalent to a Primary key) + * **DbRef class** a special class that let's you include a reference in a document pointing to another object + * **Symbol class** a special class that let's you specify a symbol, not really relevant for javascript but for languages that supports the concept of symbols. + + + + As we see the number type can be a little tricky due to the way integers are implemented in Javascript. The latest driver will do correct conversion up to 53 bit's of complexity. If you need to handle big integers the recommendation is to use the Long class to operate on the numbers. + + +--------------------------------------- +Getting that connection to the database +--------------------------------------- + + Let's get around to setting up a connection with the Mongo DB database. Jumping straight into the code let's do direct connection and then look at the code. + + + .. code-block:: javascript + + var mongo = require('mongodb'), + Server = mongo.Server, + Db = mongo.Db; + + var server = new Server('localhost', 27017, {auto_reconnect: true}); + var db = new Db('exampleDb', server); + + db.open(function(err, db) { + if(!err) { + console.log("We are connected"); + } + }); + + + + Let's have a quick look at the simple connection. The **new Server(...)** sets up a configuration for the connection and the **auto_reconnect** tells the driver to retry sending a command to the server if there is a failure. Another option you can set is **poolSize** , this allows you to control how many tcp connections are opened in parallel. The default value for this is 1 but you can set it as high as you want. The driver will use a round-robin strategy to dispatch and read from the tcp connection. + + + + We are up and running with a connection to the database. Let's move on and look at what collections are and how they work. + + +------------------------ +Mongo DB and Collections +------------------------ + + Collections are the equivalent of tables in traditional databases and contain all your documents. A database can have many collections. So how do we go about defining and using collections. Well there are a couple of methods that we can use. Let's jump straight into code and then look at the code. + + + + **the requires and and other initializing stuff omitted for brevity** + + + .. code-block:: javascript + + db.open(function(err, db) { + if(!err) { + db.collection('test', function(err, collection) {}); + + db.collection('test', {safe:true}, function(err, collection) {}); + + db.createCollection('test', function(err, collection) {}); + + db.createCollection('test', {safe:true}, function(err, collection) {}); + } + }); + + + + Three different ways of creating a collection object but slightly different in behavior. Let's go through them and see what they do + + + .. code-block:: javascript + + db.collection('test', function(err, collection) {}); + + + + This function will not actually create a collection on the database until you actually insert the first document. + + + .. code-block:: javascript + + db.collection('test', {safe:true}, function(err, collection) {}); + + + + Notice the **{safe:true}** option. This option will make the driver check if the collection exists and issue an error if it does not. + + + .. code-block:: javascript + + db.createCollection('test', function(err, collection) {}); + + + + This command will create the collection on the Mongo DB database before returning the collection object. If the collection already exists it will ignore the creation of the collection. + + + .. code-block:: javascript + + db.createCollection('test', {safe:true}, function(err, collection) {}); + + + + The **{safe:true}** option will make the method return an error if the collection already exists. + + + + With an open db connection and a collection defined we are ready to do some CRUD operation on the data. + + +----------------------- +And then there was CRUD +----------------------- + + So let's get dirty with the basic operations for Mongo DB. The Mongo DB wire protocol is built around 4 main operations **insert/update/remove/query** . Most operations on the database are actually queries with special json objects defining the operation on the database. But I'm getting ahead of myself. Let's go back and look at insert first and do it with some code. + + + + **the requires and and other initializing stuff omitted for brevity** + + + .. code-block:: javascript + + db.open(function(err, db) { + if(!err) { + db.collection('test', function(err, collection) { + var doc1 = {'hello':'doc1'}; + var doc2 = {'hello':'doc2'}; + var lotsOfDocs = [{'hello':'doc3'}, {'hello':'doc4'}]; + + collection.insert(doc1); + + collection.insert(doc2, {safe:true}, function(err, result) {}); + + collection.insert(lotsOfDocs, {safe:true}, function(err, result) {}); + }); + } + }); + + + + A couple of variations on the theme of inserting a document as we can see. To understand why it's important to understand how Mongo DB works during inserts of documents. + + + + Mongo DB has asynchronous **insert/update/remove** operations. This means that when you issue an **insert** operation its a fire and forget operation where the database does not reply with the status of the insert operation. To retrieve the status of the operation you have to issue a query to retrieve the last error status of the connection. To make it simpler to the developer the driver implements the **{safe:true}** options so that this is done automatically when inserting the document. **{safe:true}** becomes especially important when you do **update** or **remove** as otherwise it's not possible to determine the amount of documents modified or removed. + + + + Now let's go through the different types of inserts shown in the code above. + + + .. code-block:: javascript + + collection.insert(doc1); + + + + Taking advantage of the async behavior and not needing confirmation about the persisting of the data to Mongo DB we just fire off the insert (we are doing live analytics, loosing a couple of records does not matter). + + + .. code-block:: javascript + + collection.insert(doc2, {safe:true}, function(err, result) {}); + + + + That document needs to stick. Using the **{safe:true}** option ensure you get the error back if the document fails to insert correctly. + + + .. code-block:: javascript + + collection.insert(lotsOfDocs, {safe:true}, function(err, result) {}); + + + + A batch insert of document with any errors being reported. This is much more efficient if you need to insert large batches of documents as you incur a lot less overhead. + + + + Right that's the basics of insert's ironed out. We got some documents in there but want to update them as we need to change the content of a field. Let's have a look at a simple example and then we will dive into how Mongo DB updates work and how to do them efficiently. + + + + **the requires and and other initializing stuff omitted for brevity** + + + .. code-block:: javascript + + db.open(function(err, db) { + if(!err) { + db.collection('test', function(err, collection) { + var doc = {mykey:1, fieldtoupdate:1}; + + collection.insert(doc, {safe:true}, function(err, result) { + collection.update({mykey:1}, {$set:{fieldtoupdate:2}}, {safe:true}, function(err, result) {}); + }); + + var doc2 = {mykey:2, docs:[{doc1:1}]}; + + collection.insert(doc2, {safe:true}, function(err, result) { + collection.update({mykey:2}, {$push:{docs:{doc2:1}}, {safe:true}, function(err, result) {}); + }); + }); + }; + }); + + + + Alright before we look at the code we want to understand how document updates work and how to do the efficiently. The most basic and less efficient way is to replace the whole document, this is not really the way to go if you want to change just a field in your document. Luckily Mongo DB provides a whole set of operations that let you modify just pieces of the document `Atomic operations documentation `_ . Basically outlined below. + + + * $inc - increment a particular value by a certain amount + * $set - set a particular value + * $unset - delete a particular field (v1.3+) + * $push - append a value to an array + * $pushAll - append several values to an array + * $addToSet - adds value to the array only if its not in the array already + * $pop - removes the last element in an array + * $pull - remove a value(s) from an existing array + * $pullAll - remove several value(s) from an existing array + * $rename - renames the field + * $bit - bitwise operations + + + + Now that the operations are outline let's dig into the specific cases show in the code example. + + + .. code-block:: javascript + + collection.update({mykey:1}, {$set:{fieldtoupdate:2}}, {safe:true}, function(err, result) {}); + + + + Right so this update will look for the document that has a field **mykey** equal to **1** and apply an update to the field **fieldtoupdate** setting the value to **2** . Since we are using the **{safe:true}** option the result parameter in the callback will return the value **1** indicating that 1 document was modified by the update statement. + + + .. code-block:: javascript + + collection.update({mykey:2}, {$push:{docs:{doc2:1}}, {safe:true}, function(err, result) {}); + + + + This updates adds another document to the field **docs** in the document identified by **{mykey:2}** using the atomic operation **$push** . This allows you to modify keep such structures as queues in Mongo DB. + + + + Let's have a look at the remove operation for the driver. As before let's start with a piece of code. + + + + **the requires and and other initializing stuff omitted for brevity** + + + .. code-block:: javascript + + db.open(function(err, db) { + if(!err) { + db.collection('test', function(err, collection) { + var docs = [{mykey:1}, {mykey:2}, {mykey:3}]; + + collection.insert(docs, {safe:true}, function(err, result) { + + collection.remove({mykey:1}); + + collection.remove({mykey:2}, {safe:true}, function(err, result) {}); + + collection.remove(); + }); + }); + }; + }); + + + + Let's examine the 3 remove variants and what they do. + + + .. code-block:: javascript + + collection.remove({mykey:1}); + + + + This leverages the fact that Mongo DB is asynchronous and that it does not return a result for **insert/update/remove** to allow for **synchronous** style execution. This particular remove query will remove the document where **mykey** equals **1** . + + + .. code-block:: javascript + + collection.remove({mykey:2}, {safe:true}, function(err, result) {}); + + + + This remove statement removes the document where **mykey** equals **2** but since we are using **{safe:true}** it will back to Mongo DB to get the status of the remove operation and return the number of documents removed in the result variable. + + + .. code-block:: javascript + + collection.remove(); + + + + This last one will remove all documents in the collection. + + +------------- +Time to Query +------------- + + Queries is of course a fundamental part of interacting with a database and Mongo DB is no exception. Fortunately for us it has a rich query interface with cursors and close to SQL concepts for slicing and dicing your datasets. To build queries we have lots of operators to choose from `Mongo DB advanced queries `_ . There are literarily tons of ways to search and ways to limit the query. Let's look at some simple code for dealing with queries in different ways. + + + + **the requires and and other initializing stuff omitted for brevity** + + + .. code-block:: javascript + + db.open(function(err, db) { + if(!err) { + db.collection('test', function(err, collection) { + var docs = [{mykey:1}, {mykey:2}, {mykey:3}]; + + collection.insert(docs, {safe:true}, function(err, result) { + + collection.find().toArray(function(err, items) {}); + + var stream = collection.find({mykey:{$ne:2}}).streamRecords(); + stream.on("data", function(item) {}); + stream.on("end", function() {}); + + collection.findOne({mykey:1}, function(err, item) {}); + + }); + }); + }; + }); + + + + Before we start picking apart the code there is one thing that needs to be understood, the **find** method does not execute the actual query. It builds an instance of **Cursor** that you then use to retrieve the data. This lets you manage how you retrieve the data from Mongo DB and keeps state about your current Cursor state on Mongo DB. Now let's pick apart the queries we have here and look at what they do. + + + .. code-block:: javascript + + collection.find().toArray(function(err, items) {}); + + + + This query will fetch all the document in the collection and return them as an array of items. Be careful with the function **toArray** as it might cause a lot of memory usage as it will instantiate all the document into memory before returning the final array of items. If you have a big resultset you could run into memory issues. + + + .. code-block:: javascript + + var stream = collection.find({mykey:{$ne:2}}).streamRecords(); + stream.on("data", function(item) {}); + stream.on("end", function() {}); + + + + This is the preferred way if you have to retrieve a lot of data for streaming, as data is deserialized a **data** event is emitted. This keeps the resident memory usage low as the documents are streamed to you. Very useful if you are pushing documents out via websockets or some other streaming socket protocol. Once there is no more document the driver will emit the **end** event to notify the application that it's done. + + + .. code-block:: javascript + + collection.findOne({mykey:1}, function(err, item) {}); + + + + This is special supported function to retrieve just one specific document bypassing the need for a cursor object. + + + + That's pretty much it for the quick intro on how to use the database. I have also included a list of links to where to go to find more information and also a sample crude location application I wrote using express JS and mongo DB. + + +--------------- +Links and stuff +--------------- + * `The driver examples, good starting point for basic usage `_ + * `All the integration tests, they have tons of different usage cases `_ + * `The Mongo DB wiki pages such as the advanced query link `_ + * `A silly simple location based application using Express JS and Mongo DB `_ + diff --git a/_sources/api-articles/nodekoarticle2.txt b/_sources/api-articles/nodekoarticle2.txt new file mode 100644 index 00000000000..9eb576715d5 --- /dev/null +++ b/_sources/api-articles/nodekoarticle2.txt @@ -0,0 +1,327 @@ +============================================= +A primer for GridFS using the Mongo DB driver +============================================= + + In the first tutorial we targeted general usage of the database. But Mongo DB is much more than this. One of the additional very useful features is to act as a file storage system. This is accomplish in Mongo by having a file collection and a chunks collection where each document in the chunks collection makes up a **Block** of the file. In this tutorial we will look at how to use the GridFS functionality and what functions are available. + + +---------------- +A simple example +---------------- + + Let's dive straight into a simple example on how to write a file to the grid using the simplified Grid class. + + + .. code-block:: javascript + + var mongo = require('mongodb'), + Server = mongo.Server, + Db = mongo.Db, + Grid = mongo.Grid; + + var server = new Server('localhost', 27017, {auto_reconnect: true}); + var db = new Db('exampleDb', server); + + db.open(function(err, db) { + if(!err) { + var grid = new Grid(db, 'fs'); + var buffer = new Buffer("Hello world"); + grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) { + if(!err) { + console.log("Finished writing file to Mongo"); + } + }); + } + }); + + + + All right let's dissect the example. The first thing you'll notice is the statement + + + .. code-block:: javascript + + var grid = new Grid(db, 'fs'); + + + + Since GridFS is actually a special structure stored as collections you'll notice that we are using the db connection that we used in the previous tutorial to operate on collections and documents. The second parameter **'fs'** allows you to change the collections you want to store the data in. In this example the collections would be **fs_files** and **fs_chunks** . + + + + Having a life grid instance we now go ahead and create some test data stored in a Buffer instance, although you can pass in a string instead. We then write our data to disk. + + + .. code-block:: javascript + + var buffer = new Buffer("Hello world"); + grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) { + if(!err) { + console.log("Finished writing file to Mongo"); + } + }); + + + + Let's deconstruct the call we just made. The **put** call will write the data you passed in as one or more chunks. The second parameter is a hash of options for the Grid class. In this case we wish to annotate the file we are writing to Mongo DB with some metadata and also specify a content type. Each file entry in GridFS has support for metadata documents which might be very useful if you are for example storing images in you Mongo DB and need to store all the data associated with the image. + + + + One important thing is to take not that the put method return a document containing a **_id** , this is an **ObjectID** identifier that you'll need to use if you wish to retrieve the file contents later. + + + + Right so we have written out first file, let's look at the other two simple functions supported by the Grid class. + + + + **the requires and and other initializing stuff omitted for brevity** + + + .. code-block:: javascript + + db.open(function(err, db) { + if(!err) { + var grid = new Grid(db, 'fs'); + var buffer = new Buffer("Hello world"); + grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) { + grid.get(fileInfo._id, function(err, data) { + console.log("Retrieved data: " + data.toString()); + grid.delete(fileInfo._id, function(err, result) { + }); + }); + }); + } + }); + + + + Let's have a look at the two operations **get** and **delete** + + + .. code-block:: javascript + + grid.get(fileInfo._id, function(err, data) {}); + + + + The **get** method takes an ObjectID as the first argument and as we can se in the code we are using the one provided in **fileInfo._id** . This will read all the chunks for the file and return it as a Buffer object. + + + + The **delete** method also takes an ObjectID as the first argument but will delete the file entry and the chunks associated with the file in Mongo. + + + + This **api** is the simplest one you can use to interact with GridFS but it's not suitable for all kinds of files. One of it's main drawbacks is you are trying to write large files to Mongo. This api will require you to read the entire file into memory when writing and reading from Mongo which most likely is not feasible if you have to store large files like Video or RAW Pictures. Luckily this is not the only way to work with GridFS. That's not to say this api is not useful. If you are storing tons of small files the memory usage vs the simplicity might be a worthwhile tradeoff. Let's dive into some of the more advanced ways of using GridFS. + + +----------------------------------------------- +Advanced GridFS or how not to run out of memory +----------------------------------------------- + + As we just said controlling memory consumption for you file writing and reading is key if you want to scale up the application. That means not reading in entire files before either writing or reading from Mongo DB. The good news it's supported. Let's throw some code out there straight away and look at how to do chunk sized streaming writes and reads. + + + + **the requires and and other initializing stuff omitted for brevity** + + + .. code-block:: javascript + + var fileId = new ObjectID(); + var gridStore = new GridStore(db, fileId, "w", {root:'fs'}); + gridStore.chunkSize = 1024 * 256; + + gridStore.open(function(err, gridStore) { + Step( + function writeData() { + var group = this.group(); + + for(var i = 0; i < 1000000; i += 5000) { + gridStore.write(new Buffer(5000), group()); + } + }, + + function doneWithWrite() { + gridStore.close(function(err, result) { + console.log("File has been written to GridFS"); + }); + } + ) + }); + + + + Before we jump into picking apart the code let's look at + + + .. code-block:: javascript + + var gridStore = new GridStore(db, fileId, "w", {root:'fs'}); + + + + Notice the parameter **"w"** this is important. It tells the driver that you are planning to write a new file. The parameters you can use here are. + + + * **"r"** - read only. This is the default mode + * **"w"** - write in truncate mode. Existing data will be overwritten + * **"w+"** - write in edit mode + + + + Right so there is a fair bit to digest here. We are simulating writing a file that's about 1MB big to Mongo DB using GridFS. To do this we are writing it in chunks of 5000 bytes. So to not live with a difficult callback setup we are using the Step library with its' group functionality to ensure that we are notified when all of the writes are done. After all the writes are done Step will invoke the next function (or step) called **doneWithWrite** where we finish up by closing the file that flushes out any remaining data to Mongo DB and updates the file document. + + + + As we are doing it in chunks of 5000 bytes we will notice that memory consumption is low. This is the trick to write large files to GridFS. In pieces. Also notice this line. + + + .. code-block:: javascript + + gridStore.chunkSize = 1024 * 256; + + + + This allows you to adjust how big the chunks are in bytes that Mongo DB will write. You can tune the Chunk Size to your needs. If you need to write large files to GridFS it might be worthwhile to trade of memory for CPU by setting a larger Chunk Size. + + + + Now let's see how the actual streaming read works. + + + .. code-block:: javascript + + var gridStore = new GridStore(db, fileId, "r"); + gridStore.open(function(err, gridStore) { + var stream = gridStore.stream(true); + + stream.on("data", function(chunk) { + console.log("Chunk of file data"); + }); + + stream.on("end", function() { + console.log("EOF of file"); + }); + + stream.on("close", function() { + console.log("Finished reading the file"); + }); + }); + + + + Right let's have a quick lock at the streaming functionality supplied with the driver **(make sure you are using 0.9.6-12 or higher as there is a bug fix for custom chunksizes that you need)** + + + .. code-block:: javascript + + var stream = gridStore.stream(true); + + + + This opens a stream to our file, you can pass in a boolean parameter to tell the driver to close the file automatically when it reaches the end. This will fire the **close** event automatically. Otherwise you'll have to handle cleanup when you receive the **end** event. Let's have a look at the events supported. + + + .. code-block:: javascript + + stream.on("data", function(chunk) { + console.log("Chunk of file data"); + }); + + + + The **data** event is called for each chunk read. This means that it's by the chunk size of the written file. So if you file is 1MB big and the file has chunkSize 256K then you'll get 4 calls to the event handler for **data** . The chunk returned is a **Buffer** object. + + + .. code-block:: javascript + + stream.on("end", function() { + console.log("EOF of file"); + }); + + + + The **end** event is called when the driver reaches the end of data for the file. + + + .. code-block:: javascript + + stream.on("close", function() { + console.log("Finished reading the file"); + }); + + + + The **close** event is only called if you the **autoclose** parameter on the **gridStore.stream** method as shown above. If it's false or not set handle cleanup of the streaming in the **end** event handler. + + + + Right that's it for writing to GridFS in an efficient Manner. I'll outline some other useful function on the Gridstore object. + + +-------------------------------------------- +Other useful methods on the Gridstore object +-------------------------------------------- + + There are some other methods that are useful + + + .. code-block:: javascript + + gridStore.writeFile(filename/filedescriptor, function(err fileInfo) {}); + + + + **writeFile** takes either a file name or a file descriptor and writes it to GridFS. It does this in chunks to ensure the Eventloop is not tied up. + + + .. code-block:: javascript + + gridStore.read(length, function(err, data) {}); + + + + **read/readBuffer** lets you read a #length number of bytes from the current position in the file. + + + .. code-block:: javascript + + gridStore.seek(position, seekLocation, function(err, gridStore) {}); + + + + **seek** lets you navigate the file to read from different positions inside the chunks. The seekLocation allows you to specify how to seek. It can be one of three values. + + + * GridStore.IO *SEEK* SET Seek mode where the given length is absolute + * GridStore.IO *SEEK* CUR Seek mode where the given length is an offset to the current read/write head + * GridStore.IO *SEEK* END Seek mode where the given length is an offset to the end of the file + + GridStore.list(dbInstance, collectionName, {id:true}, function(err, files) {}) + + + + **list** lists all the files in the collection in GridFS. If you have a lot of files the current version will not work very well as it's getting all files into memory first. You can have it return either the filenames or the ids for the files using option. + + + .. code-block:: javascript + + gridStore.unlink(function(err, result) {}); + + + + **unlink** deletes the file from Mongo DB, that's to say all the file info and all the chunks. + + + + This should be plenty to get you on your way building your first GridFS based application. As in the previous article the following links might be useful for you. Good luck and have fun. + + +--------------- +Links and stuff +--------------- + * `The driver examples, good starting point for basic usage `_ + * `All the integration tests, they have tons of different usage cases `_ + diff --git a/_sources/api-bson-generated/binary.txt b/_sources/api-bson-generated/binary.txt new file mode 100644 index 00000000000..e77e47ca106 --- /dev/null +++ b/_sources/api-bson-generated/binary.txt @@ -0,0 +1,239 @@ +======== +Binary() +======== + +------------------ +Constructor +------------------ + + +A class representation of the BSON Binary type. + + + .. js:class:: Binary() + + :param buffer buffer: a buffer object containing the binary data. + :param number [subType]: the option binary type. + :returns: grid + + +Sub types + - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. + - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. + - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. + - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. + - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. + - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. + + +------------------ +Constants +------------------ + +.. csv-table:: + :header: "Constant Name", "Value", "Description" + :widths: 15, 10, 30 + + "Binary.SUBTYPE_DEFAULT", "0", "Default BSON type" + "Binary.SUBTYPE_FUNCTION", "1", "Function BSON type" + "Binary.SUBTYPE_BYTE_ARRAY", "2", "Byte Array BSON type" + "Binary.SUBTYPE_UUID", "3", "UUID BSON type" + "Binary.SUBTYPE_MD5", "4", "MD5 BSON type" + "Binary.SUBTYPE_USER_DEFINED", "128", "User BSON type" + +--- +put +--- + + +Updates this binary with byte_value. + +.. js:function:: put(byte_value) + + :param character byte_value: a single byte we wish to write. + +**Examples** + + + + A simple example showing the usage of the binary put method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create an empty Binary object + var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); + // Write some character to the Binary value + binary.put('h'); + binary.put('e'); + binary.put('l'); + binary.put('l'); + binary.put('o'); + // Validate the content of the binary + assert.equal('hello', binary.toString('ascii')); + + +----- +write +----- + + +Writes. + +.. js:function:: write(string, offset) + + :param buffer string: a string or buffer to be written to the Binary BSON object. + :param number offset: specify the binary of where to write the content. + +**Examples** + + + + A simple example showing the usage of the binary write method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create an empty Binary object + var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); + // Write some data to the binary + binary.write('hello', 0); + // Validate the content of the binary + assert.equal('hello', binary.toString('ascii')); + + +---- +read +---- + + +Reads **length** bytes starting at **position**. + +.. js:function:: read(position, length) + + :param number position: read from the given position in the Binary. + :param number length: the number of bytes to read. + :returns: buffer + + +**Examples** + + + + A simple example showing the usage of the binary read method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create an empty Binary object + var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); + // Write some data to the binary + binary.write('hello', 0); + // Read a couple of characters from the binary + var data = binary.read(1, 2); + // Validate the content of the binary + assert.equal('el', data.toString('ascii')); + + +----- +value +----- + + +Returns the value of this binary as a string. + +.. js:function:: value() + + :returns: string + + +**Examples** + + + + A simple example showing the usage of the binary value method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create an empty Binary object + var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); + // Write some data to the binary + binary.write('hello', 0); + // Validate the content of the binary + assert.equal('hello', binary.value()); + + +------ +length +------ + + +Length. + +.. js:function:: length() + + :returns: number the length of the binary. + + +**Examples** + + + + A simple example showing the usage of the binary length method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create an empty Binary object + var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); + // Write some data to the binary + binary.write('hello'); + // Validate the content of the binary + assert.equal(5, binary.length()); + diff --git a/_sources/api-bson-generated/bson.txt b/_sources/api-bson-generated/bson.txt new file mode 100644 index 00000000000..ba8baa8ee6f --- /dev/null +++ b/_sources/api-bson-generated/bson.txt @@ -0,0 +1,622 @@ +====== +BSON() +====== + +------------------ +Constructor +------------------ + + +Create a new BSON instance + + + .. js:class:: BSON() + + :returns: bson instance of BSON Parser. + + + +------------------ +Constants +------------------ + +.. csv-table:: + :header: "Constant Name", "Value", "Description" + :widths: 15, 10, 30 + + "BSON.BSON_DATA_NUMBER", "1", "Number BSON Type" + "BSON.BSON_DATA_STRING", "2", "String BSON Type" + "BSON.BSON_DATA_OBJECT", "3", "Object BSON Type" + "BSON.BSON_DATA_ARRAY", "4", "Array BSON Type" + "BSON.BSON_DATA_BINARY", "5", "Binary BSON Type" + "BSON.BSON_DATA_OID", "7", "ObjectID BSON Type" + "BSON.BSON_DATA_BOOLEAN", "8", "Boolean BSON Type" + "BSON.BSON_DATA_DATE", "9", "Date BSON Type" + "BSON.BSON_DATA_NULL", "10", "null BSON Type" + "BSON.BSON_DATA_REGEXP", "11", "RegExp BSON Type" + "BSON.BSON_DATA_CODE", "13", "Code BSON Type" + "BSON.BSON_DATA_SYMBOL", "14", "Symbol BSON Type" + "BSON.BSON_DATA_CODE_W_SCOPE", "15", "Code with Scope BSON Type" + "BSON.BSON_DATA_INT", "16", "32 bit Integer BSON Type" + "BSON.BSON_DATA_TIMESTAMP", "17", "Timestamp BSON Type" + "BSON.BSON_DATA_LONG", "18", "Long BSON Type" + "BSON.BSON_DATA_MIN_KEY", "0xff", "MinKey BSON Type" + "BSON.BSON_DATA_MAX_KEY", "0x7f", "MaxKey BSON Type" + "BSON.BSON_BINARY_SUBTYPE_DEFAULT", "0", "Binary Default Type" + "BSON.BSON_BINARY_SUBTYPE_FUNCTION", "1", "Binary Function Type" + "BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY", "2", "Binary Byte Array Type" + "BSON.BSON_BINARY_SUBTYPE_UUID", "3", "Binary UUID Type" + "BSON.BSON_BINARY_SUBTYPE_MD5", "4", "Binary MD5 Type" + "BSON.BSON_BINARY_SUBTYPE_USER_DEFINED", "128", "Binary User Defined Type" + +------------------------ +BSON.calculateObjectSize +------------------------ + + +Calculate the bson size for a passed in Javascript object. + +.. js:function:: BSON.calculateObjectSize(object[, serializeFunctions]) + + :param object object: the Javascript object to calculate the BSON byte size for. + :param boolean [serializeFunctions]: serialize all functions in the object **(default:false)**. + :returns: number returns the number of bytes the BSON object will take up. + + +**Examples** + + + + A simple example showing the usage of BSON.calculateObjectSize function returning the number of BSON bytes a javascript object needs. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){}} + // Calculate the size of the object without serializing the function + var size = BSON.calculateObjectSize(doc, false); + assert.equal(12, size); + // Calculate the size of the object serializing the function + size = BSON.calculateObjectSize(doc, true); + // Validate the correctness + assert.equal(36, size); + + +-------------------------------- +BSON.serializeWithBufferAndIndex +-------------------------------- + + +Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. + +.. js:function:: BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, index, serializeFunctions) + + :param object object: the Javascript object to serialize. + :param boolean checkKeys: the serializer will check if keys are valid. + :param buffer buffer: the Buffer you pre-allocated to store the serialized BSON object. + :param number index: the index in the buffer where we wish to start serializing into. + :param boolean serializeFunctions: serialize the javascript functions **(default:false)**. + :returns: number returns the new write index in the Buffer. + + +**Examples** + + + + A simple example showing the usage of BSON.serializeWithBufferAndIndex function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){}} + // Calculate the size of the document, no function serialization + var size = BSON.calculateObjectSize(doc, false); + // Allocate a buffer + var buffer = new Buffer(size); + // Serialize the object to the buffer, checking keys and not serializing functions + var index = BSON.serializeWithBufferAndIndex(doc, true, buffer, 0, false); + // Validate the correctness + assert.equal(12, size); + assert.equal(11, index); + + // Serialize with functions + // Calculate the size of the document, no function serialization + var size = BSON.calculateObjectSize(doc, true); + // Allocate a buffer + var buffer = new Buffer(size); + // Serialize the object to the buffer, checking keys and not serializing functions + var index = BSON.serializeWithBufferAndIndex(doc, true, buffer, 0, true); + // Validate the correctness + assert.equal(36, size); + assert.equal(35, index); + + +-------------- +BSON.serialize +-------------- + + +Serialize a Javascript object. + +.. js:function:: BSON.serialize(object, checkKeys, asBuffer, serializeFunctions) + + :param object object: the Javascript object to serialize. + :param boolean checkKeys: the serializer will check if keys are valid. + :param boolean asBuffer: return the serialized object as a Buffer object **(ignore)**. + :param boolean serializeFunctions: serialize the javascript functions **(default:false)**. + :returns: buffer returns the Buffer object containing the serialized object. + + +**Examples** + + + + A simple example showing the usage of BSON.serialize function returning serialized BSON Buffer object. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){}} + // Serialize the object to a buffer, checking keys and not serializing functions + var buffer = BSON.serialize(doc, true, true, false); + // Validate the correctness + assert.equal(12, buffer.length); + + // Serialize the object to a buffer, checking keys and serializing functions + var buffer = BSON.serialize(doc, true, true, true); + // Validate the correctness + assert.equal(36, buffer.length); + + +---------------------- +BSON.deserializeStream +---------------------- + + +Deserialize stream data as BSON documents. + + + +Options + - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. + - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. + - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. + +.. js:function:: BSON.deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex[, options]) + + :param buffer data: the buffer containing the serialized set of BSON documents. + :param number startIndex: the start index in the data Buffer where the deserialization is to start. + :param number numberOfDocuments: number of documents to deserialize. + :param array documents: an array where to store the deserialized documents. + :param number docStartIndex: the index in the documents array from where to start inserting documents. + :param object [options]: additional options used for the deserialization. + :returns: number returns the next index in the buffer after deserialization **x** numbers of documents. + + +**Examples** + + + + A simple example showing the usage of BSON.deserializeStream function returning deserialized Javascript objects. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){ console.log('hello world'); }} + // Serialize the object to a buffer, checking keys and serializing functions + var buffer = BSON.serialize(doc, true, true, true); + // Validate the correctness + assert.equal(65, buffer.length); + + // The array holding the number of retuned documents + var documents = new Array(1); + // Deserialize the object with no eval for the functions + var index = BSON.deserializeStream(buffer, 0, 1, documents, 0); + // Validate the correctness + assert.equal(65, index); + assert.equal(1, documents.length); + assert.equal(1, documents[0].a); + assert.equal('object', typeof documents[0].func); + + // Deserialize the object with eval for the functions caching the functions + // The array holding the number of retuned documents + var documents = new Array(1); + // Deserialize the object with no eval for the functions + var index = BSON.deserializeStream(buffer, 0, 1, documents, 0, {evalFunctions:true, cacheFunctions:true}); + // Validate the correctness + assert.equal(65, index); + assert.equal(1, documents.length); + assert.equal(1, documents[0].a); + assert.equal('function', typeof documents[0].func); + + +---------------- +BSON.deserialize +---------------- + + +Deserialize data as BSON. + + + +Options + - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. + - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. + - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. + +.. js:function:: BSON.deserialize(buffer[, options], [isArray]) + + :param buffer buffer: the buffer containing the serialized set of BSON documents. + :param object [options]: additional options used for the deserialization. + :param boolean [isArray]: ignore used for recursive parsing. + :returns: object returns the deserialized Javascript Object. + + +**Examples** + + + + A simple example showing the usage of BSON.deserialize function returning a deserialized Javascript function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){ console.log('hello world'); }} + // Serialize the object to a buffer, checking keys and serializing functions + var buffer = BSON.serialize(doc, true, true, true); + // Validate the correctness + assert.equal(65, buffer.length); + + // Deserialize the object with no eval for the functions + var deserializedDoc = BSON.deserialize(buffer); + // Validate the correctness + assert.equal('object', typeof deserializedDoc.func); + assert.equal(1, deserializedDoc.a); + + // Deserialize the object with eval for the functions caching the functions + deserializedDoc = BSON.deserialize(buffer, {evalFunctions:true, cacheFunctions:true}); + // Validate the correctness + assert.equal('function', typeof deserializedDoc.func); + assert.equal(1, deserializedDoc.a); + + +----------- +deserialize +----------- + + +Deserialize data as BSON. + + + +Options + - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. + - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. + - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. + +.. js:function:: deserialize(buffer[, options], [isArray]) + + :param buffer buffer: the buffer containing the serialized set of BSON documents. + :param object [options]: additional options used for the deserialization. + :param boolean [isArray]: ignore used for recursive parsing. + :returns: object returns the deserialized Javascript Object. + + +**Examples** + + + + A simple example showing the usage of BSON instance deserialize function returning a deserialized Javascript function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){ console.log('hello world'); }} + // Create a BSON parser instance + var bson = new BSON(); + // Serialize the object to a buffer, checking keys and serializing functions + var buffer = bson.serialize(doc, true, true, true); + // Validate the correctness + assert.equal(65, buffer.length); + + // Deserialize the object with no eval for the functions + var deserializedDoc = bson.deserialize(buffer); + // Validate the correctness + assert.equal('object', typeof deserializedDoc.func); + assert.equal(1, deserializedDoc.a); + + // Deserialize the object with eval for the functions caching the functions + deserializedDoc = bson.deserialize(buffer, {evalFunctions:true, cacheFunctions:true}); + // Validate the correctness + assert.equal('function', typeof deserializedDoc.func); + assert.equal(1, deserializedDoc.a); + + +----------------- +deserializeStream +----------------- + + +Deserialize stream data as BSON documents. + + + +Options + - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. + - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. + - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. + +.. js:function:: deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex[, options]) + + :param buffer data: the buffer containing the serialized set of BSON documents. + :param number startIndex: the start index in the data Buffer where the deserialization is to start. + :param number numberOfDocuments: number of documents to deserialize. + :param array documents: an array where to store the deserialized documents. + :param number docStartIndex: the index in the documents array from where to start inserting documents. + :param object [options]: additional options used for the deserialization. + :returns: number returns the next index in the buffer after deserialization **x** numbers of documents. + + +**Examples** + + + + A simple example showing the usage of BSON instance deserializeStream function returning deserialized Javascript objects. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){ console.log('hello world'); }} + // Create a BSON parser instance + var bson = new BSON(); + // Serialize the object to a buffer, checking keys and serializing functions + var buffer = bson.serialize(doc, true, true, true); + // Validate the correctness + assert.equal(65, buffer.length); + + // The array holding the number of retuned documents + var documents = new Array(1); + // Deserialize the object with no eval for the functions + var index = bson.deserializeStream(buffer, 0, 1, documents, 0); + // Validate the correctness + assert.equal(65, index); + assert.equal(1, documents.length); + assert.equal(1, documents[0].a); + assert.equal('object', typeof documents[0].func); + + // Deserialize the object with eval for the functions caching the functions + // The array holding the number of retuned documents + var documents = new Array(1); + // Deserialize the object with no eval for the functions + var index = bson.deserializeStream(buffer, 0, 1, documents, 0, {evalFunctions:true, cacheFunctions:true}); + // Validate the correctness + assert.equal(65, index); + assert.equal(1, documents.length); + assert.equal(1, documents[0].a); + assert.equal('function', typeof documents[0].func); + + +--------- +serialize +--------- + + +Serialize a Javascript object. + +.. js:function:: serialize(object, checkKeys, asBuffer, serializeFunctions) + + :param object object: the Javascript object to serialize. + :param boolean checkKeys: the serializer will check if keys are valid. + :param boolean asBuffer: return the serialized object as a Buffer object **(ignore)**. + :param boolean serializeFunctions: serialize the javascript functions **(default:false)**. + :returns: buffer returns the Buffer object containing the serialized object. + + +**Examples** + + + + A simple example showing the usage of BSON.serialize function returning serialized BSON Buffer object. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){}} + // Create a BSON parser instance + var bson = new BSON(); + // Serialize the object to a buffer, checking keys and not serializing functions + var buffer = bson.serialize(doc, true, true, false); + // Validate the correctness + assert.equal(12, buffer.length); + + // Serialize the object to a buffer, checking keys and serializing functions + var buffer = bson.serialize(doc, true, true, true); + // Validate the correctness + assert.equal(36, buffer.length); + + +------------------- +calculateObjectSize +------------------- + + +Calculate the bson size for a passed in Javascript object. + +.. js:function:: calculateObjectSize(object[, serializeFunctions]) + + :param object object: the Javascript object to calculate the BSON byte size for. + :param boolean [serializeFunctions]: serialize all functions in the object **(default:false)**. + :returns: number returns the number of bytes the BSON object will take up. + + +**Examples** + + + + A simple example showing the usage of BSON.calculateObjectSize function returning the number of BSON bytes a javascript object needs. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){}} + // Create a BSON parser instance + var bson = new BSON(); + // Calculate the size of the object without serializing the function + var size = bson.calculateObjectSize(doc, false); + assert.equal(12, size); + // Calculate the size of the object serializing the function + size = bson.calculateObjectSize(doc, true); + // Validate the correctness + assert.equal(36, size); + + +--------------------------- +serializeWithBufferAndIndex +--------------------------- + + +Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. + +.. js:function:: serializeWithBufferAndIndex(object, checkKeys, buffer, index, serializeFunctions) + + :param object object: the Javascript object to serialize. + :param boolean checkKeys: the serializer will check if keys are valid. + :param buffer buffer: the Buffer you pre-allocated to store the serialized BSON object. + :param number index: the index in the buffer where we wish to start serializing into. + :param boolean serializeFunctions: serialize the javascript functions **(default:false)**. + :returns: number returns the new write index in the Buffer. + + +**Examples** + + + + A simple example showing the usage of BSON.serializeWithBufferAndIndex function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a simple object + var doc = {a: 1, func:function(){}} + // Create a BSON parser instance + var bson = new BSON(); + // Calculate the size of the document, no function serialization + var size = bson.calculateObjectSize(doc, false); + // Allocate a buffer + var buffer = new Buffer(size); + // Serialize the object to the buffer, checking keys and not serializing functions + var index = bson.serializeWithBufferAndIndex(doc, true, buffer, 0, false); + // Validate the correctness + assert.equal(12, size); + assert.equal(11, index); + + // Serialize with functions + // Calculate the size of the document, no function serialization + var size = bson.calculateObjectSize(doc, true); + // Allocate a buffer + var buffer = new Buffer(size); + // Serialize the object to the buffer, checking keys and not serializing functions + var index = bson.serializeWithBufferAndIndex(doc, true, buffer, 0, true); + // Validate the correctness + assert.equal(36, size); + assert.equal(35, index); + diff --git a/_sources/api-bson-generated/code.txt b/_sources/api-bson-generated/code.txt new file mode 100644 index 00000000000..0fd9f15e124 --- /dev/null +++ b/_sources/api-bson-generated/code.txt @@ -0,0 +1,20 @@ +======= +DBRef() +======= + +------------------ +Constructor +------------------ + + +A class representation of the BSON DBRef type. + + + .. js:class:: DBRef() + + :param string namespace: the collection name. + :param objectid oid: the reference ObjectID. + :param string [db]: optional db name, if omitted the reference is local to the current db. + :returns: dbref + + diff --git a/_sources/api-bson-generated/double.txt b/_sources/api-bson-generated/double.txt new file mode 100644 index 00000000000..d563b36f0f3 --- /dev/null +++ b/_sources/api-bson-generated/double.txt @@ -0,0 +1,30 @@ +======== +Double() +======== + +------------------ +Constructor +------------------ + + +A class representation of the BSON Double type. + + + .. js:class:: Double() + + :param number value: the number we want to represent as a double. + :returns: double + + + +------- +valueOf +------- + + +Access the number value. + +.. js:function:: valueOf() + + :returns: number returns the wrapped double number. + diff --git a/_sources/api-bson-generated/index.txt b/_sources/api-bson-generated/index.txt new file mode 100644 index 00000000000..dae82f1f4a5 --- /dev/null +++ b/_sources/api-bson-generated/index.txt @@ -0,0 +1,16 @@ +================== +Binary JSON API +================== + +.. toctree:: + :maxdepth: 2 + + objectid + binary + code + double + maxkey + symbol + timestamp + long + bson diff --git a/_sources/api-bson-generated/long.txt b/_sources/api-bson-generated/long.txt new file mode 100644 index 00000000000..8001c79a1b4 --- /dev/null +++ b/_sources/api-bson-generated/long.txt @@ -0,0 +1,487 @@ +====== +Long() +====== + +------------------ +Constructor +------------------ + + +Defines a Long class for representing a 64-bit two's-complement +integer value, which faithfully simulates the behavior of a Java "Long". This +implementation is derived from LongLib in GWT. + + + .. js:class:: Long() + + :param number low: the low (signed) 32 bits of the Long. + :param number high: the high (signed) 32 bits of the Long. + + +Constructs a 64-bit two's-complement integer, given its low and high 32-bit +values as *signed* integers. See the from* functions below for more +convenient ways of constructing Longs. + + + +The internal representation of a Long is the two given signed, 32-bit values. +We use 32-bit pieces because these are the size of integers on which +Javascript performs bit-operations. For operations like addition and +multiplication, we split each number into 16-bit pieces, which can easily be +multiplied within Javascript's floating-point representation without overflow +or change in sign. + + + +In the algorithms below, we frequently reduce the negative case to the +positive case by negating the input(s) and then post-processing the result. +Note that we must ALWAYS check specially whether those values are MIN_VALUE +(-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as +a positive number, it overflows back into a negative). Not handling this +case would often result in infinite recursion. + + +----- +toInt +----- + + +Return the int value. + +.. js:function:: toInt() + + :returns: number the value, assuming it is a 32-bit integer. + + +-------- +toNumber +-------- + + +Return the Number value. + +.. js:function:: toNumber() + + :returns: number the closest floating-point representation to this value. + + +------ +toJSON +------ + + +Return the JSON value. + +.. js:function:: toJSON() + + :returns: string the JSON representation. + + +-------- +toString +-------- + + +Return the String value. + +.. js:function:: toString([opt_radix]) + + :param number [opt_radix]: the radix in which the text should be written. + :returns: string the textual representation of this value. + + +----------- +getHighBits +----------- + + +Return the high 32-bits value. + +.. js:function:: getHighBits() + + :returns: number the high 32-bits as a signed value. + + +---------- +getLowBits +---------- + + +Return the low 32-bits value. + +.. js:function:: getLowBits() + + :returns: number the low 32-bits as a signed value. + + +------------------ +getLowBitsUnsigned +------------------ + + +Return the low unsigned 32-bits value. + +.. js:function:: getLowBitsUnsigned() + + :returns: number the low 32-bits as an unsigned value. + + +------------- +getNumBitsAbs +------------- + + +Returns the number of bits needed to represent the absolute value of this Long. + +.. js:function:: getNumBitsAbs() + + :returns: number Returns the number of bits needed to represent the absolute value of this Long. + + +------ +isZero +------ + + +Return whether this value is zero. + +.. js:function:: isZero() + + :returns: boolean whether this value is zero. + + +---------- +isNegative +---------- + + +Return whether this value is negative. + +.. js:function:: isNegative() + + :returns: boolean whether this value is negative. + + +----- +isOdd +----- + + +Return whether this value is odd. + +.. js:function:: isOdd() + + :returns: boolean whether this value is odd. + + +------ +equals +------ + + +Return whether this Long equals the other + +.. js:function:: equals(other) + + :param long other: Long to compare against. + :returns: boolean whether this Long equals the other + + +--------- +notEquals +--------- + + +Return whether this Long does not equal the other. + +.. js:function:: notEquals(other) + + :param long other: Long to compare against. + :returns: boolean whether this Long does not equal the other. + + +-------- +lessThan +-------- + + +Return whether this Long is less than the other. + +.. js:function:: lessThan(other) + + :param long other: Long to compare against. + :returns: boolean whether this Long is less than the other. + + +--------------- +lessThanOrEqual +--------------- + + +Return whether this Long is less than or equal to the other. + +.. js:function:: lessThanOrEqual(other) + + :param long other: Long to compare against. + :returns: boolean whether this Long is less than or equal to the other. + + +----------- +greaterThan +----------- + + +Return whether this Long is greater than the other. + +.. js:function:: greaterThan(other) + + :param long other: Long to compare against. + :returns: boolean whether this Long is greater than the other. + + +------------------ +greaterThanOrEqual +------------------ + + +Return whether this Long is greater than or equal to the other. + +.. js:function:: greaterThanOrEqual(other) + + :param long other: Long to compare against. + :returns: boolean whether this Long is greater than or equal to the other. + + +------- +compare +------- + + +Compares this Long with the given one. + +.. js:function:: compare(other) + + :param long other: Long to compare against. + :returns: boolean 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. + + +------ +negate +------ + + +The negation of this value. + +.. js:function:: negate() + + :returns: long the negation of this value. + + +--- +add +--- + + +Returns the sum of this and the given Long. + +.. js:function:: add(other) + + :param long other: Long to add to this one. + :returns: long the sum of this and the given Long. + + +-------- +subtract +-------- + + +Returns the difference of this and the given Long. + +.. js:function:: subtract(other) + + :param long other: Long to subtract from this. + :returns: long the difference of this and the given Long. + + +-------- +multiply +-------- + + +Returns the product of this and the given Long. + +.. js:function:: multiply(other) + + :param long other: Long to multiply with this. + :returns: long the product of this and the other. + + +--- +div +--- + + +Returns this Long divided by the given one. + +.. js:function:: div(other) + + :param long other: Long by which to divide. + :returns: long this Long divided by the given one. + + +------ +modulo +------ + + +Returns this Long modulo the given one. + +.. js:function:: modulo(other) + + :param long other: Long by which to mod. + :returns: long this Long modulo the given one. + + +--- +not +--- + + +The bitwise-NOT of this value. + +.. js:function:: not() + + :returns: long the bitwise-NOT of this value. + + +--- +and +--- + + +Returns the bitwise-AND of this Long and the given one. + +.. js:function:: and(other) + + :param long other: the Long with which to AND. + :returns: long the bitwise-AND of this and the other. + + +-- +or +-- + + +Returns the bitwise-OR of this Long and the given one. + +.. js:function:: or(other) + + :param long other: the Long with which to OR. + :returns: long the bitwise-OR of this and the other. + + +--- +xor +--- + + +Returns the bitwise-XOR of this Long and the given one. + +.. js:function:: xor(other) + + :param long other: the Long with which to XOR. + :returns: long the bitwise-XOR of this and the other. + + +--------- +shiftLeft +--------- + + +Returns this Long with bits shifted to the left by the given amount. + +.. js:function:: shiftLeft(numBits) + + :param number numBits: the number of bits by which to shift. + :returns: long this shifted to the left by the given amount. + + +---------- +shiftRight +---------- + + +Returns this Long with bits shifted to the right by the given amount. + +.. js:function:: shiftRight(numBits) + + :param number numBits: the number of bits by which to shift. + :returns: long this shifted to the right by the given amount. + + +------------------ +shiftRightUnsigned +------------------ + + +Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. + +.. js:function:: shiftRightUnsigned(numBits) + + :param number numBits: the number of bits by which to shift. + :returns: long this shifted to the right by the given amount, with zeros placed into the new leading bits. + + +------------ +Long.fromInt +------------ + + +Returns a Long representing the given (32-bit) integer value. + +.. js:function:: Long.fromInt(value) + + :param number value: the 32-bit integer in question. + :returns: long the corresponding Long value. + + +--------------- +Long.fromNumber +--------------- + + +Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + +.. js:function:: Long.fromNumber(value) + + :param number value: the number in question. + :returns: long the corresponding Long value. + + +------------- +Long.fromBits +------------- + + +Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. + +.. js:function:: Long.fromBits(lowBits, highBits) + + :param number lowBits: the low 32-bits. + :param number highBits: the high 32-bits. + :returns: long the corresponding Long value. + + +--------------- +Long.fromString +--------------- + + +Returns a Long representation of the given string, written using the given radix. + +.. js:function:: Long.fromString(str, opt_radix) + + :param string str: the textual representation of the Long. + :param number opt_radix: the radix in which the text is written. + :returns: long the corresponding Long value. + diff --git a/_sources/api-bson-generated/maxkey.txt b/_sources/api-bson-generated/maxkey.txt new file mode 100644 index 00000000000..5134b480104 --- /dev/null +++ b/_sources/api-bson-generated/maxkey.txt @@ -0,0 +1,17 @@ +======== +MaxKey() +======== + +------------------ +Constructor +------------------ + + +A class representation of the BSON MaxKey type. + + + .. js:class:: MaxKey() + + :returns: maxkey + + diff --git a/_sources/api-bson-generated/objectid.txt b/_sources/api-bson-generated/objectid.txt new file mode 100644 index 00000000000..1189d4d59b1 --- /dev/null +++ b/_sources/api-bson-generated/objectid.txt @@ -0,0 +1,196 @@ +========== +ObjectID() +========== + +------------------ +Constructor +------------------ + + +Create a new ObjectID instance + + + .. js:class:: ObjectID() + + :param string id: Can be a 24 byte hex string, 12 byte binary string or a Number. + :returns: object instance of ObjectID. + + + +------------------ +Properties +------------------ + + +Returns the generation time in seconds that this ID was generated. + +.. js:attribute:: generationTime number [Getter|Setter] + + +**Examples** + + + + Get and set the generation time for an ObjectID + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a new ObjectID + var objectId = new ObjectID(); + // Get the generation time + var generationTime = objectId.generationTime; + // Add 1000 miliseconds to the generation time + objectId.generationTime = generationTime + 1000; + + // Create a timestamp + var timestampDate = new Date(); + timestampDate.setTime((generationTime + 1000) * 1000); + + // Get the timestamp and validate correctness + assert.equal(timestampDate.toString(), objectId.getTimestamp().toString()); + + +----------- +toHexString +----------- + + +Return the ObjectID id as a 24 byte hex string representation + +.. js:function:: toHexString() + + :returns: string return the 24 byte hex string representation. + + +**Examples** + + + + Generate a 24 character hex string representation of the ObjectID + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a new ObjectID + var objectId = new ObjectID(); + // Verify that the hex string is 24 characters long + assert.equal(24, objectId.toHexString().length); + + +------ +equals +------ + + +Compares the equality of this ObjectID with otherID. + +.. js:function:: equals(otherID) + + :param object otherID: ObjectID instance to compare against. + :returns: bool the result of comparing two ObjectID's + + +**Examples** + + + + Compare two different ObjectID's using the equals method + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a new ObjectID + var objectId = new ObjectID(); + // Create a new ObjectID Based on the first ObjectID + var objectId2 = new ObjectID(objectId.id); + // Create another ObjectID + var objectId3 = new ObjectID(); + // objectId and objectId2 should be the same + assert.ok(objectId.equals(objectId2)); + // objectId and objectId2 should be different + assert.ok(!objectId.equals(objectId3)); + + +------------ +getTimestamp +------------ + + +Returns the generation time in seconds that this ID was generated. + +.. js:function:: getTimestamp() + + :returns: number return number of seconds in the timestamp part of the 12 byte id. + + +**Examples** + + + + Generate 12 byte binary string representation using a second based timestamp or + default value + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Get a timestamp in seconds + var timestamp = Math.floor(new Date().getTime()/1000); + // Create a date with the timestamp + var timestampDate = new Date(timestamp*1000); + + // Create a new ObjectID with a specific timestamp + var objectId = new ObjectID(timestamp); + + // Get the timestamp and validate correctness + assert.equal(timestampDate.toString(), objectId.getTimestamp().toString()); + + +---------------------------- +ObjectID.createFromHexString +---------------------------- + + +Creates an ObjectID from a hex string representation of an ObjectID. + +.. js:function:: ObjectID.createFromHexString(hexString) + + :param string hexString: create a ObjectID from a passed in 24 byte hexstring. + :returns: objectid return the created ObjectID + diff --git a/_sources/api-bson-generated/symbol.txt b/_sources/api-bson-generated/symbol.txt new file mode 100644 index 00000000000..3cf5cfc13e2 --- /dev/null +++ b/_sources/api-bson-generated/symbol.txt @@ -0,0 +1,30 @@ +======== +Symbol() +======== + +------------------ +Constructor +------------------ + + +A class representation of the BSON Symbol type. + + + .. js:class:: Symbol() + + :param string value: the string representing the symbol. + :returns: symbol + + + +------- +valueOf +------- + + +Access the wrapped string value. + +.. js:function:: valueOf() + + :returns: string returns the wrapped string. + diff --git a/_sources/api-bson-generated/timestamp.txt b/_sources/api-bson-generated/timestamp.txt new file mode 100644 index 00000000000..e28ea56dc3e --- /dev/null +++ b/_sources/api-bson-generated/timestamp.txt @@ -0,0 +1,487 @@ +=========== +Timestamp() +=========== + +------------------ +Constructor +------------------ + + +Defines a Timestamp class for representing a 64-bit two's-complement +integer value, which faithfully simulates the behavior of a Java "Timestamp". This +implementation is derived from TimestampLib in GWT. + + + .. js:class:: Timestamp() + + :param number low: the low (signed) 32 bits of the Timestamp. + :param number high: the high (signed) 32 bits of the Timestamp. + + +Constructs a 64-bit two's-complement integer, given its low and high 32-bit +values as *signed* integers. See the from* functions below for more +convenient ways of constructing Timestamps. + + + +The internal representation of a Timestamp is the two given signed, 32-bit values. +We use 32-bit pieces because these are the size of integers on which +Javascript performs bit-operations. For operations like addition and +multiplication, we split each number into 16-bit pieces, which can easily be +multiplied within Javascript's floating-point representation without overflow +or change in sign. + + + +In the algorithms below, we frequently reduce the negative case to the +positive case by negating the input(s) and then post-processing the result. +Note that we must ALWAYS check specially whether those values are MIN_VALUE +(-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as +a positive number, it overflows back into a negative). Not handling this +case would often result in infinite recursion. + + +----- +toInt +----- + + +Return the int value. + +.. js:function:: toInt() + + :returns: number the value, assuming it is a 32-bit integer. + + +-------- +toNumber +-------- + + +Return the Number value. + +.. js:function:: toNumber() + + :returns: number the closest floating-point representation to this value. + + +------ +toJSON +------ + + +Return the JSON value. + +.. js:function:: toJSON() + + :returns: string the JSON representation. + + +-------- +toString +-------- + + +Return the String value. + +.. js:function:: toString([opt_radix]) + + :param number [opt_radix]: the radix in which the text should be written. + :returns: string the textual representation of this value. + + +----------- +getHighBits +----------- + + +Return the high 32-bits value. + +.. js:function:: getHighBits() + + :returns: number the high 32-bits as a signed value. + + +---------- +getLowBits +---------- + + +Return the low 32-bits value. + +.. js:function:: getLowBits() + + :returns: number the low 32-bits as a signed value. + + +------------------ +getLowBitsUnsigned +------------------ + + +Return the low unsigned 32-bits value. + +.. js:function:: getLowBitsUnsigned() + + :returns: number the low 32-bits as an unsigned value. + + +------------- +getNumBitsAbs +------------- + + +Returns the number of bits needed to represent the absolute value of this Timestamp. + +.. js:function:: getNumBitsAbs() + + :returns: number Returns the number of bits needed to represent the absolute value of this Timestamp. + + +------ +isZero +------ + + +Return whether this value is zero. + +.. js:function:: isZero() + + :returns: boolean whether this value is zero. + + +---------- +isNegative +---------- + + +Return whether this value is negative. + +.. js:function:: isNegative() + + :returns: boolean whether this value is negative. + + +----- +isOdd +----- + + +Return whether this value is odd. + +.. js:function:: isOdd() + + :returns: boolean whether this value is odd. + + +------ +equals +------ + + +Return whether this Timestamp equals the other + +.. js:function:: equals(other) + + :param timestamp other: Timestamp to compare against. + :returns: boolean whether this Timestamp equals the other + + +--------- +notEquals +--------- + + +Return whether this Timestamp does not equal the other. + +.. js:function:: notEquals(other) + + :param timestamp other: Timestamp to compare against. + :returns: boolean whether this Timestamp does not equal the other. + + +-------- +lessThan +-------- + + +Return whether this Timestamp is less than the other. + +.. js:function:: lessThan(other) + + :param timestamp other: Timestamp to compare against. + :returns: boolean whether this Timestamp is less than the other. + + +--------------- +lessThanOrEqual +--------------- + + +Return whether this Timestamp is less than or equal to the other. + +.. js:function:: lessThanOrEqual(other) + + :param timestamp other: Timestamp to compare against. + :returns: boolean whether this Timestamp is less than or equal to the other. + + +----------- +greaterThan +----------- + + +Return whether this Timestamp is greater than the other. + +.. js:function:: greaterThan(other) + + :param timestamp other: Timestamp to compare against. + :returns: boolean whether this Timestamp is greater than the other. + + +------------------ +greaterThanOrEqual +------------------ + + +Return whether this Timestamp is greater than or equal to the other. + +.. js:function:: greaterThanOrEqual(other) + + :param timestamp other: Timestamp to compare against. + :returns: boolean whether this Timestamp is greater than or equal to the other. + + +------- +compare +------- + + +Compares this Timestamp with the given one. + +.. js:function:: compare(other) + + :param timestamp other: Timestamp to compare against. + :returns: boolean 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. + + +------ +negate +------ + + +The negation of this value. + +.. js:function:: negate() + + :returns: timestamp the negation of this value. + + +--- +add +--- + + +Returns the sum of this and the given Timestamp. + +.. js:function:: add(other) + + :param timestamp other: Timestamp to add to this one. + :returns: timestamp the sum of this and the given Timestamp. + + +-------- +subtract +-------- + + +Returns the difference of this and the given Timestamp. + +.. js:function:: subtract(other) + + :param timestamp other: Timestamp to subtract from this. + :returns: timestamp the difference of this and the given Timestamp. + + +-------- +multiply +-------- + + +Returns the product of this and the given Timestamp. + +.. js:function:: multiply(other) + + :param timestamp other: Timestamp to multiply with this. + :returns: timestamp the product of this and the other. + + +--- +div +--- + + +Returns this Timestamp divided by the given one. + +.. js:function:: div(other) + + :param timestamp other: Timestamp by which to divide. + :returns: timestamp this Timestamp divided by the given one. + + +------ +modulo +------ + + +Returns this Timestamp modulo the given one. + +.. js:function:: modulo(other) + + :param timestamp other: Timestamp by which to mod. + :returns: timestamp this Timestamp modulo the given one. + + +--- +not +--- + + +The bitwise-NOT of this value. + +.. js:function:: not() + + :returns: timestamp the bitwise-NOT of this value. + + +--- +and +--- + + +Returns the bitwise-AND of this Timestamp and the given one. + +.. js:function:: and(other) + + :param timestamp other: the Timestamp with which to AND. + :returns: timestamp the bitwise-AND of this and the other. + + +-- +or +-- + + +Returns the bitwise-OR of this Timestamp and the given one. + +.. js:function:: or(other) + + :param timestamp other: the Timestamp with which to OR. + :returns: timestamp the bitwise-OR of this and the other. + + +--- +xor +--- + + +Returns the bitwise-XOR of this Timestamp and the given one. + +.. js:function:: xor(other) + + :param timestamp other: the Timestamp with which to XOR. + :returns: timestamp the bitwise-XOR of this and the other. + + +--------- +shiftLeft +--------- + + +Returns this Timestamp with bits shifted to the left by the given amount. + +.. js:function:: shiftLeft(numBits) + + :param number numBits: the number of bits by which to shift. + :returns: timestamp this shifted to the left by the given amount. + + +---------- +shiftRight +---------- + + +Returns this Timestamp with bits shifted to the right by the given amount. + +.. js:function:: shiftRight(numBits) + + :param number numBits: the number of bits by which to shift. + :returns: timestamp this shifted to the right by the given amount. + + +------------------ +shiftRightUnsigned +------------------ + + +Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. + +.. js:function:: shiftRightUnsigned(numBits) + + :param number numBits: the number of bits by which to shift. + :returns: timestamp this shifted to the right by the given amount, with zeros placed into the new leading bits. + + +----------------- +Timestamp.fromInt +----------------- + + +Returns a Timestamp representing the given (32-bit) integer value. + +.. js:function:: Timestamp.fromInt(value) + + :param number value: the 32-bit integer in question. + :returns: timestamp the corresponding Timestamp value. + + +-------------------- +Timestamp.fromNumber +-------------------- + + +Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. + +.. js:function:: Timestamp.fromNumber(value) + + :param number value: the number in question. + :returns: timestamp the corresponding Timestamp value. + + +------------------ +Timestamp.fromBits +------------------ + + +Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. + +.. js:function:: Timestamp.fromBits(lowBits, highBits) + + :param number lowBits: the low 32-bits. + :param number highBits: the high 32-bits. + :returns: timestamp the corresponding Timestamp value. + + +-------------------- +Timestamp.fromString +-------------------- + + +Returns a Timestamp representation of the given string, written using the given radix. + +.. js:function:: Timestamp.fromString(str, opt_radix) + + :param string str: the textual representation of the Timestamp. + :param number opt_radix: the radix in which the text is written. + :returns: timestamp the corresponding Timestamp value. + diff --git a/_sources/api-generated/admin.txt b/_sources/api-generated/admin.txt new file mode 100644 index 00000000000..36410b58676 --- /dev/null +++ b/_sources/api-generated/admin.txt @@ -0,0 +1,867 @@ +======= +Admin() +======= + +------------------ +Constructor +------------------ + + +Allows the user to access the admin functionality of MongoDB + + + .. js:class:: Admin() + + :param object db: Current db instance we wish to perform Admin operations on. + :returns: function Constructor for Admin type. + + + +--------- +buildInfo +--------- + + +Retrieve the server information for the current +instance of the db client + +.. js:function:: buildInfo(callback) + + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + Retrieve the buildInfo for the current MongoDB instance + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, result) { + assert.ok(result); + + // Retrive the build information for the MongoDB instance + adminDb.buildInfo(function(err, info) { + assert.ok(err == null); + + db.close(); + }); + }); + }); + }); + }); + }); + + +-------------- +profilingLevel +-------------- + + +Retrieve the current profiling Level for MongoDB + +.. js:function:: profilingLevel(callback) + + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + Retrieve the current profiling level set for the MongoDB instance + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Grab a collection object + db.collection('test', function(err, collection) { + + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {safe:true}, function(err, doc) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, replies) { + + // Retrive the profiling level + adminDb.profilingLevel(function(err, level) { + assert.equal("off", level); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + }); + + +---- +ping +---- + + +Ping the MongoDB server and retrieve results + +.. js:function:: ping([options], callback) + + :param object [options]: Optional parameters to the command. + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + An example of how to add a user to the admin database + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, result) { + assert.ok(result); + + // Ping the server + adminDb.ping(function(err, pingResult) { + assert.equal(null, err); + + db.close(); + }); + }); + }); + }); + }); + }); + + +------------ +authenticate +------------ + + +Authenticate against MongoDB + +.. js:function:: authenticate(username, password, callback) + + :param string username: The user name for the authentication. + :param string password: The password for the authentication. + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + Authenticate against MongoDB Admin user + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Grab a collection object + db.collection('test', function(err, collection) { + + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {safe:true}, function(err, doc) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, result) { + assert.ok(result); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + + +------ +logout +------ + + +Logout current authenticated user + +.. js:function:: logout([options], callback) + + :param object [options]: Optional parameters to the command. + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + An example of how add a user, authenticate and logout + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, result) { + assert.ok(result); + + // Logout the user + adminDb.logout(function(err, result) { + assert.equal(true, result); + + db.close(); + }) + }); + }); + }); + }); + }); + + +------- +addUser +------- + + +Add a user to the MongoDB server, if the user exists it will +overwrite the current password + +.. js:function:: addUser(username, password, callback) + + :param string username: The user name for the authentication. + :param string password: The password for the authentication. + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + An example of how to add a user to the admin database + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, result) { + assert.ok(result); + + db.close(); + }); + }); + }); + }); + }); + + +---------- +removeUser +---------- + + +Remove a user from the MongoDB server + +.. js:function:: removeUser(username, callback) + + :param string username: The user name for the authentication. + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + An example of how to remove a user from the admin database + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, result) { + assert.ok(result); + + // Remove the user + adminDb.removeUser('admin', function(err, result) { + + // Authenticate using the removed user should fail + adminDb.authenticate('admin', 'admin', function(err, result) { + assert.ok(err != null); + assert.ok(!result); + + db.close(); + }); + }) + }); + }); + }); + }); + }); + + +----------------- +setProfilingLevel +----------------- + + +Set the current profiling level of MongoDB + +.. js:function:: setProfilingLevel(level, callback) + + :param string level: The new profiling level (off, slow_only, all) + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + An example of how to use the setProfilingInfo + Use this command to set the Profiling level on the MongoDB server + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Grab a collection object + db.collection('test', function(err, collection) { + + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {safe:true}, function(err, doc) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, replies) { + + // Set the profiling level to only profile slow queries + adminDb.setProfilingLevel('slow_only', function(err, level) { + + // Retrive the profiling level and verify that it's set to slow_only + adminDb.profilingLevel(function(err, level) { + assert.equal('slow_only', level); + + // Turn profiling off + adminDb.setProfilingLevel('off', function(err, level) { + + // Retrive the profiling level and verify that it's set to off + adminDb.profilingLevel(function(err, level) { + assert.equal('off', level); + + // Set the profiling level to log all queries + adminDb.setProfilingLevel('all', function(err, level) { + + // Retrive the profiling level and verify that it's set to all + adminDb.profilingLevel(function(err, level) { + assert.equal('all', level); + + // Attempt to set an illegal profiling level + adminDb.setProfilingLevel('medium', function(err, level) { + assert.ok(err instanceof Error); + assert.equal("Error: illegal profiling level value medium", err.message); + + db.close(); + }); + }) + }); + }) + }); + }) + }); + }); + }); + }); + }); + }); + }); + }); + + +------------- +profilingInfo +------------- + + +Retrive the current profiling information for MongoDB + +.. js:function:: profilingInfo(callback) + + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + An example of how to use the profilingInfo + Use this command to pull back the profiling information currently set for Mongodb + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Grab a collection object + db.collection('test', function(err, collection) { + + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {safe:true}, function(doc) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, replies) { + + // Set the profiling level to all + adminDb.setProfilingLevel('all', function(err, level) { + + // Execute a query command + collection.find(function(err, cursor) { + cursor.toArray(function(err, items) { + + // Turn off profiling + adminDb.setProfilingLevel('off', function(err, level) { + + // Retrive the profiling information + adminDb.profilingInfo(function(err, infos) { + assert.ok(infos.constructor == Array); + assert.ok(infos.length >= 1); + assert.ok(infos[0].ts.constructor == Date); + assert.ok(infos[0].millis.constructor == Number); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + +------- +command +------- + + +Execute a db command against the Admin database + +.. js:function:: command(command[, options], callback) + + :param object command: A command object `{ping:1}`. + :param object [options]: Optional parameters to the command. + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + Retrieve the buildInfo using the command function + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, result) { + assert.ok(result); + + // Retrive the build information using the admin command + adminDb.command({buildInfo:1}, function(err, info) { + assert.ok(err == null); + + db.close(); + }); + }); + }); + }); + }); + }); + + +------------------ +validateCollection +------------------ + + +Validate an existing collection + +.. js:function:: validateCollection(collectionName[, options], callback) + + :param string collectionName: The name of the collection to validate. + :param object [options]: Optional parameters to the command. + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + An example of how to use the validateCollection command + Use this command to check that a collection is valid (not corrupt) and to get various statistics. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Drop the current database if it exists to avoid problems + db.dropDatabase(function(err, done) { + + // Grab a collection object + db.collection('test', function(err, collection) { + + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {safe:true}, function(err, doc) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // Add the new user to the admin database + adminDb.addUser('admin', 'admin', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin', 'admin', function(err, replies) { + + // Validate the 'test' collection + adminDb.validateCollection('test', function(err, doc) { + + // Pre 1.9.1 servers + if(doc.result != null) { + assert.ok(doc.result != null); + assert.ok(doc.result.match(/firstExtent/) != null); + } else { + assert.ok(doc.firstExtent != null); + } + + db.close(); + }); + }); + }); + }); + }); + }); + }); + }); + + +------------- +listDatabases +------------- + + +List the available databases + +.. js:function:: listDatabases(callback) + + :param function callback: Callback function of format `function(err, result) {}`. + :returns: null Returns no result + + +**Examples** + + + + An example of listing all available databases. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + + // List all the available databases + adminDb.listDatabases(function(err, dbs) { + assert.equal(null, err); + assert.ok(dbs.databases.length > 0); + + db.close(); + }); + }); + }); + diff --git a/_sources/api-generated/collection.txt b/_sources/api-generated/collection.txt new file mode 100644 index 00000000000..735c191a874 --- /dev/null +++ b/_sources/api-generated/collection.txt @@ -0,0 +1,2609 @@ +============ +Collection() +============ + +------------------ +Constructor +------------------ + + +Create a new Collection instance + + + .. js:class:: Collection() + + :param object db: db instance. + :param string collectionName: collection name. + :param object [pkFactory]: alternative primary key factory. + :param object [options]: additional options for the collection. + :returns: object a collection instance. + + +Options + - **slaveOk** {Boolean, default:false}, Allow reads from secondaries. + - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. + - **raw** {Boolean, default:false}, perform all operations using raw bson objects. + - **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. + + +------ +insert +------ + + +Inserts a single document or a an array of documents into MongoDB. + + + +Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + - **keepGoing** {Boolean, default:false}, keep inserting documents even if one document has an error, *mongodb 1.9.1 >*. + - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. + +.. js:function:: insert(docs[, options], [callback]) + + :param array docs: + :param object [options]: optional options for insert command + :param function [callback]: optional callback for the function, must be provided when using `safe` or `strict` mode + :returns: null + + +**Examples** + + + + A simple document insert example, not using safe mode to ensure document persistance on MongoDB + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch a collection to insert document into + db.collection("simple_document_insert_collection_no_safe", function(err, collection) { + + // Insert a single document + collection.insert({hello:'world_no_safe'}); + + // Wait for a second before finishing up, to ensure we have written the item to disk + setTimeout(function() { + + // Fetch the document + collection.findOne({hello:'world_no_safe'}, function(err, item) { + assert.equal(null, err); + assert.equal('world_no_safe', item.hello); + db.close(); + }) + }, 1000); + }); + }); + + + + A batch document insert example, using safe mode to ensure document persistance on MongoDB + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch a collection to insert document into + db.collection("batch_document_insert_collection_safe", function(err, collection) { + + // Insert a single document + collection.insert([{hello:'world_safe1'} + , {hello:'world_safe2'}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Fetch the document + collection.findOne({hello:'world_safe2'}, function(err, item) { + assert.equal(null, err); + assert.equal('world_safe2', item.hello); + db.close(); + }) + }); + }); + }); + + + + Example of inserting a document containing functions + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch a collection to insert document into + db.collection("simple_document_insert_with_function_safe", function(err, collection) { + + // Insert a single document + collection.insert({hello:'world' + , func:function() {}}, {safe:true, serializeFunctions:true}, function(err, result) { + assert.equal(null, err); + + // Fetch the document + collection.findOne({hello:'world'}, function(err, item) { + assert.equal(null, err); + assert.ok("function() {}", item.code); + db.close(); + }) + }); + }); + }); + + + + Example of using keepGoing to allow batch insert to complete even when there are illegal documents in the batch + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Only run the rest of the code if we have a mongodb server with version >= 1.9.1 + db.admin().serverInfo(function(err, result){ + + // Ensure we are running at least MongoDB v1.9.1 + if(parseInt((result.version.replace(/\./g, ''))) >= 191) { + + // Create a collection + client.createCollection('keepGoingExample', function(err, collection) { + + // Add an unique index to title to force errors in the batch insert + collection.ensureIndex({title:1}, {unique:true}, function(err, indexName) { + + // Insert some intial data into the collection + collection.insert([{name:"Jim"} + , {name:"Sarah", title:"Princess"}], {safe:true}, function(err, result) { + + // Force keep going flag, ignoring unique index issue + collection.insert([{name:"Jim"} + , {name:"Sarah", title:"Princess"} + , {name:'Gump', title:"Gump"}], {safe:true, keepGoing:true}, function(err, result) { + + // Count the number of documents left (should not include the duplicates) + collection.count(function(err, count) { + assert.equal(3, count); + db.close(); + }) + }); + }); + }); + }); + } else { + db.close(); + test.done(); + } + }); + }); + + +------ +remove +------ + + +Removes documents specified by selector from the db. + + + +Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + +.. js:function:: remove([selector][, options], [callback]) + + :param object [selector]: optional select, no selector is equivalent to removing all documents. + :param object [options]: additional options during remove. + :param function [callback]: must be provided if you performing a safe remove + :returns: null + + +**Examples** + + + + An example removing all documents in a collection not using safe mode + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch a collection to insert document into + db.collection("remove_all_documents_no_safe", function(err, collection) { + + // Insert a bunch of documents + collection.insert([{a:1}, {b:2}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Remove all the document + collection.remove(); + + // Wait for a second to ensure command went through + setTimeout(function() { + + // Fetch all results + collection.find().toArray(function(err, items) { + assert.equal(null, err); + assert.equal(0, items.length); + db.close(); + }); + }, 1000); + }); + }) + }); + + + + An example removing a subset of documents using safe mode to ensure removal of documents + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch a collection to insert document into + db.collection("remove_subset_of_documents_safe", function(err, collection) { + + // Insert a bunch of documents + collection.insert([{a:1}, {b:2}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Remove all the document + collection.remove({a:1}, {safe:true}, function(err, numberOfRemovedDocs) { + assert.equal(null, err); + assert.equal(1, numberOfRemovedDocs); + db.close(); + }); + }); + }) + }); + + +------ +rename +------ + + +Renames the collection. + +.. js:function:: rename(newName, callback) + + :param string newName: the new name of the collection. + :param function callback: the callback accepting the result + :returns: null + + +**Examples** + + + + An example of illegal and legal renaming of a collection + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Open a couple of collections + db.createCollection('test_rename_collection', function(err, collection1) { + db.createCollection('test_rename_collection2', function(err, collection2) { + + // Attemp to rename a collection to a number + try { + collection1.rename(5, function(err, collection) {}); + } catch(err) { + assert.ok(err instanceof Error); + assert.equal("collection name must be a String", err.message); + } + + // Attemp to rename a collection to an empty string + try { + collection1.rename("", function(err, collection) {}); + } catch(err) { + assert.ok(err instanceof Error); + assert.equal("collection names cannot be empty", err.message); + } + + // Attemp to rename a collection to an illegal name including the character $ + try { + collection1.rename("te$t", function(err, collection) {}); + } catch(err) { + assert.ok(err instanceof Error); + assert.equal("collection names must not contain '$'", err.message); + } + + // Attemp to rename a collection to an illegal name starting with the character . + try { + collection1.rename(".test", function(err, collection) {}); + } catch(err) { + assert.ok(err instanceof Error); + assert.equal("collection names must not start or end with '.'", err.message); + } + + // Attemp to rename a collection to an illegal name ending with the character . + try { + collection1.rename("test.", function(err, collection) {}); + } catch(err) { + assert.ok(err instanceof Error); + assert.equal("collection names must not start or end with '.'", err.message); + } + + // Attemp to rename a collection to an illegal name with an empty middle name + try { + collection1.rename("tes..t", function(err, collection) {}); + } catch(err) { + assert.equal("collection names cannot be empty", err.message); + } + + // Insert a couple of documents + collection1.insert([{'x':1}, {'x':2}], {safe:true}, function(err, docs) { + + // Attemp to rename the first collection to the second one, this will fail + collection1.rename('test_rename_collection2', function(err, collection) { + assert.ok(err instanceof Error); + assert.ok(err.message.length > 0); + + // Attemp to rename the first collection to a name that does not exist + // this will be succesful + collection1.rename('test_rename_collection3', function(err, collection) { + assert.equal("test_rename_collection3", collection.collectionName); + + // Ensure that the collection is pointing to the new one + collection1.count(function(err, count) { + assert.equal(2, count); + db.close(); + }); + }); + }); + }) + }); + }); + }); + + +---- +save +---- + + +Save a document. Simple full document replacement function. Not recommended for efficiency, use atomic +operators and update instead for more efficient operations. + + + +Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + +.. js:function:: save([doc][, options], [callback]) + + :param object [doc]: the document to save + :param object [options]: additional options during remove. + :param function [callback]: must be provided if you performing a safe save + :returns: null + + +**Examples** + + + + Example of a simple document save with safe set to false + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch the collection + db.collection("save_a_simple_document", function(err, collection) { + + // Save a document with no safe option + collection.save({hello:'world'}); + + // Wait for a second + setTimeout(function() { + + // Find the saved document + collection.findOne({hello:'world'}, function(err, item) { + assert.equal(null, err); + assert.equal('world', item.hello); + db.close(); + }); + }, 1000); + }); + }); + + + + Example of a simple document save and then resave with safe set to true + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch the collection + db.collection("save_a_simple_document_modify_it_and_resave_it", function(err, collection) { + + // Save a document with no safe option + collection.save({hello:'world'}, {safe:true}, function(err, result) { + + // Find the saved document + collection.findOne({hello:'world'}, function(err, item) { + assert.equal(null, err); + assert.equal('world', item.hello); + + // Update the document + item['hello2'] = 'world2'; + + // Save the item with the additional field + collection.save(item, {safe:true}, function(err, result) { + + // Find the changed document + collection.findOne({hello:'world'}, function(err, item) { + assert.equal(null, err); + assert.equal('world', item.hello); + assert.equal('world2', item.hello2); + + db.close(); + }); + }); + }); + }); + }); + }); + + +------ +update +------ + + +Updates documents. + + + +Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + - **upsert** {Boolean, default:false}, perform an upsert operation. + - **multi** {Boolean, default:false}, update all documents matching the selector. + - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. + +.. js:function:: update(selector, document[, options], [callback]) + + :param object selector: the query to select the document/documents to be updated + :param object document: the fields/vals to be updated, or in the case of an upsert operation, inserted. + :param object [options]: additional options during update. + :param function [callback]: must be provided if you performing a safe update + :returns: null + + +**Examples** + + + + Example of a simple document update with safe set to false on an existing document + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Get a collection + db.collection('update_a_simple_document', function(err, collection) { + + // Insert a document, then update it + collection.insert({a:1}, {safe:true}, function(err, doc) { + + // Update the document with an atomic operator + collection.update({a:1}, {$set:{b:2}}); + + // Wait for a second then fetch the document + setTimeout(function() { + + // Fetch the document that we modified + collection.findOne({a:1}, function(err, item) { + assert.equal(null, err); + assert.equal(1, item.a); + assert.equal(2, item.b); + db.close(); + }); + }, 1000); + }) + }); + }); + + + + Example of a simple document update using upsert (the document will be inserted if it does not exist) + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Get a collection + db.collection('update_a_simple_document_upsert', function(err, collection) { + + // Update the document using an upsert operation, ensuring creation if it does not exist + collection.update({a:1}, {b:2, a:1}, {upsert:true, safe:true}, function(err, result) { + assert.equal(null, err); + assert.equal(1, result); + + // Fetch the document that we modified and check if it got inserted correctly + collection.findOne({a:1}, function(err, item) { + assert.equal(null, err); + assert.equal(1, item.a); + assert.equal(2, item.b); + db.close(); + }); + }); + }); + }); + + + + Example of an update across multiple documents using the multi option. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Get a collection + db.collection('update_a_simple_document_multi', function(err, collection) { + + // Insert a couple of documentations + collection.insert([{a:1, b:1}, {a:1, b:2}], {safe:true}, function(err, result) { + + // Update multiple documents using the multi option + collection.update({a:1}, {$set:{b:0}}, {safe:true, multi:true}, function(err, numberUpdated) { + assert.equal(null, err); + assert.equal(2, numberUpdated); + + // Fetch all the documents and verify that we have changed the b value + collection.find().toArray(function(err, items) { + assert.equal(null, err); + assert.equal(1, items[0].a); + assert.equal(0, items[0].b); + assert.equal(1, items[1].a); + assert.equal(0, items[1].b); + + db.close(); + }); + }) + }); + }); + }); + + +-------- +distinct +-------- + + +The distinct command returns returns a list of distinct values for the given key across a collection. + +.. js:function:: distinct(key[, query], callback) + + :param string key: key to run distinct against. + :param object [query]: option query to narrow the returned objects. + :param function callback: must be provided. + :returns: null + + +**Examples** + + + + Example of running the distinct command against a collection + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Crete the collection for the distinct example + db.createCollection('simple_key_based_distinct', function(err, collection) { + + // Insert documents to perform distinct against + collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}}, + {a:2, b:{c:'a'}}, {a:3}, {a:3}], {safe:true}, function(err, ids) { + + // Peform a distinct query against the a field + collection.distinct('a', function(err, docs) { + assert.deepEqual([0, 1, 2, 3], docs.sort()); + + // Perform a distinct query against the sub-field b.c + collection.distinct('b.c', function(err, docs) { + assert.deepEqual(['a', 'b', 'c'], docs.sort()); + + db.close(); + }); + }); + }) + }); + }); + + + + Example of running the distinct command against a collection with a filter query + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Crete the collection for the distinct example + db.createCollection('simple_key_based_distinct_sub_query_filter', function(err, collection) { + + // Insert documents to perform distinct against + collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}}, + {a:2, b:{c:'a'}}, {a:3}, {a:3}, {a:5, c:1}], {safe:true}, function(err, ids) { + + // Peform a distinct query with a filter against the documents + collection.distinct('a', {c:1}, function(err, docs) { + assert.deepEqual([5], docs.sort()); + + db.close(); + }); + }) + }); + }); + + +----- +count +----- + + +Count number of matching documents in the db to a query. + +.. js:function:: count([query], callback) + + :param object [query]: query to filter by before performing count. + :param function callback: must be provided. + :returns: null + + +**Examples** + + + + Example of running simple count commands against a collection. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Crete the collection for the distinct example + db.createCollection('simple_count_example', function(err, collection) { + + // Insert documents to perform distinct against + collection.insert([{a:1}, {a:2}, {a:3}, {a:4, b:1}], {safe:true}, function(err, ids) { + + // Perform a total count command + collection.count(function(err, count) { + assert.equal(null, err); + assert.equal(4, count); + + // Peform a partial account where b=1 + collection.count({b:1}, function(err, count) { + assert.equal(null, err); + assert.equal(1, count); + + db.close(); + }); + }); + }); + }); + }); + + +---- +drop +---- + + +Drop the collection + +.. js:function:: drop([callback]) + + :param function [callback]: provide a callback to be notified when command finished executing + :returns: null + + +**Examples** + + + + Example of a simple document save and then resave with safe set to true + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('test_other_drop', function(err, collection) { + assert.equal(null, err); + + // Drop the collection + collection.drop(function(err, reply) { + + // Ensure we don't have the collection in the set of names + db.collectionNames(function(err, replies) { + + var found = false; + // For each collection in the list of collection names in this db look for the + // dropped collection + replies.forEach(function(document) { + if(document.name == "test_other_drop") { + found = true; + return; + } + }); + + // Ensure the collection is not found + assert.equal(false, found); + + // Let's close the db + db.close(); + }); + }); + }); + }); + + +------------- +findAndModify +------------- + + +Find and update a document. + + + +Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + - **remove** {Boolean, default:false}, set to true to remove the object before returning. + - **upsert** {Boolean, default:false}, perform an upsert operation. + - **new** {Boolean, default:false}, set to true if you want to return the modified object rather than the original. Ignored for remove. + +.. js:function:: findAndModify(query, sort, doc[, options], [callback]) + + :param object query: query object to locate the object to modify + :param array sort: - if multiple docs match, choose the first one in the specified sort order as the object to manipulate + :param object doc: - the fields/vals to be updated + :param object [options]: additional options during update. + :param function [callback]: returns results. + :returns: null + + +**Examples** + + + + A whole set of different ways to use the findAndModify command. + + + + The first findAndModify command modifies a document and returns the modified document back. + The second findAndModify command removes the document. + The second findAndModify command upserts a document and returns the new document. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('simple_find_and_modify_operations_', function(err, collection) { + assert.equal(null, err); + + // Insert some test documentations + collection.insert([{a:1}, {b:1}, {c:1}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Simple findAndModify command returning the new document + collection.findAndModify({a:1}, [['a', 1]], {$set:{b1:1}}, {new:true}, function(err, doc) { + assert.equal(null, err); + assert.equal(1, doc.a); + assert.equal(1, doc.b1); + + // Simple findAndModify command returning the new document and + // removing it at the same time + collection.findAndModify({b:1}, [['b', 1]], + {$set:{b:2}}, {remove:true}, function(err, doc) { + + // Verify that the document is gone + collection.findOne({b:1}, function(err, item) { + assert.equal(null, err); + assert.equal(null, item); + + // Simple findAndModify command performing an upsert and returning the new document + // executing the command safely + collection.findAndModify({d:1}, [['b', 1]], + {d:1, f:1}, {new:true, upsert:true, safe:true}, function(err, doc) { + assert.equal(null, err); + assert.equal(1, doc.d); + assert.equal(1, doc.f); + + db.close(); + }) + }); + }); + }); + }); + }); + }); + + +------------- +findAndRemove +------------- + + +Find and remove a document + + + +Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + +.. js:function:: findAndRemove(query, sort[, options], [callback]) + + :param object query: query object to locate the object to modify + :param array sort: - if multiple docs match, choose the first one in the specified sort order as the object to manipulate + :param object [options]: additional options during update. + :param function [callback]: returns results. + :returns: null + + +**Examples** + + + + An example of using findAndRemove + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('simple_find_and_modify_operations_', function(err, collection) { + assert.equal(null, err); + + // Insert some test documentations + collection.insert([{a:1}, {b:1}, {c:1}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Simple findAndModify command returning the new document and + // removing it at the same time + collection.findAndRemove({b:1}, [['b', 1]], function(err, doc) { + assert.equal(null, err); + assert.equal(1, doc.b); + + // Verify that the document is gone + collection.findOne({b:1}, function(err, item) { + assert.equal(null, err); + assert.equal(null, item); + + db.close(); + }); + }); + }); + }); + }); + + +---- +find +---- + + +Creates a cursor for a query that can be used to iterate over results from MongoDB + + + +Various argument possibilities + - callback? + - selector, callback?, + - selector, fields, callback? + - selector, options, callback? + - selector, fields, options, callback? + - selector, fields, skip, limit, callback? + - selector, fields, skip, limit, timeout, callback? + + + +Options + - **limit** {Number, default:0}, sets the limit of documents returned in the query. + - **sort** {Array | Object}, set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc. + - **fields** {Object}, the fields to return in the query. Object of fields to include or exclude (not both), {'a':1} + - **skip** {Number, default:0}, set to skip N documents ahead in your query (useful for pagination). + - **hint** {Object}, tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1} + - **explain** {Boolean, default:false}, explain the query instead of returning the data. + - **snapshot** {Boolean, default:false}, snapshot query. + - **timeout** {Boolean, default:false}, specify if the cursor can timeout. + - **tailable** {Boolean, default:false}, specify if the cursor is tailable. + - **batchSize** {Number, default:0}, set the batchSize for the getMoreCommand when iterating over the query results. + - **returnKey** {Boolean, default:false}, only return the index key. + - **maxScan** {Number}, Limit the number of items to scan. + - **min** {Number}, Set index bounds. + - **max** {Number}, Set index bounds. + - **showDiskLoc** {Boolean, default:false}, Show disk location of results. + - **comment** {String}, You can put a $comment field on a query to make looking in the profiler logs simpler. + - **raw** {Boolean, default:false}, Return all BSON documents as Raw Buffer documents. + - **read** {Boolean, default:false}, Tell the query to read from a secondary server. + +.. js:function:: find(query[, options], [callback]) + + :param object query: query object to locate the object to modify + :param object [options]: additional options during update. + :param function [callback]: optional callback for cursor. + :returns: cursor returns a cursor to the query + + +**Examples** + + + + A simple query using the find method on the collection. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('simple_query', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the testing + collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Peform a simple find and return all the documents + collection.find().toArray(function(err, docs) { + assert.equal(null, err); + assert.equal(3, docs.length); + + db.close(); + }); + }); + }); + }); + + + + A simple query showing the explain for a query + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('simple_explain_query', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the testing + collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Peform a simple find and return all the documents + collection.find({}, {explain:true}).toArray(function(err, docs) { + assert.equal(null, err); + assert.equal(1, docs.length); + + db.close(); + }); + }); + }); + }); + + + + A simple query showing skip and limit + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('simple_limit_skip_query', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the testing + collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Peform a simple find and return all the documents + collection.find({}, {skip:1, limit:1, fields:{b:1}}).toArray(function(err, docs) { + assert.equal(null, err); + assert.equal(1, docs.length); + assert.equal(null, docs[0].a); + assert.equal(2, docs[0].b); + + db.close(); + }); + }); + }); + }); + + +------- +findOne +------- + + +Finds a single document based on the query + + + +Various argument possibilities + - callback? + - selector, callback?, + - selector, fields, callback? + - selector, options, callback? + - selector, fields, options, callback? + - selector, fields, skip, limit, callback? + - selector, fields, skip, limit, timeout, callback? + + + +Options + - **limit** {Number, default:0}, sets the limit of documents returned in the query. + - **sort** {Array | Object}, set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc. + - **fields** {Object}, the fields to return in the query. Object of fields to include or exclude (not both), {'a':1} + - **skip** {Number, default:0}, set to skip N documents ahead in your query (useful for pagination). + - **hint** {Object}, tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1} + - **explain** {Boolean, default:false}, explain the query instead of returning the data. + - **snapshot** {Boolean, default:false}, snapshot query. + - **timeout** {Boolean, default:false}, specify if the cursor can timeout. + - **tailable** {Boolean, default:false}, specify if the cursor is tailable. + - **batchSize** {Number, default:0}, set the batchSize for the getMoreCommand when iterating over the query results. + - **returnKey** {Boolean, default:false}, only return the index key. + - **maxScan** {Number}, Limit the number of items to scan. + - **min** {Number}, Set index bounds. + - **max** {Number}, Set index bounds. + - **showDiskLoc** {Boolean, default:false}, Show disk location of results. + - **comment** {String}, You can put a $comment field on a query to make looking in the profiler logs simpler. + - **raw** {Boolean, default:false}, Return all BSON documents as Raw Buffer documents. + - **read** {Boolean, default:false}, Tell the query to read from a secondary server. + +.. js:function:: findOne(query[, options], [callback]) + + :param object query: query object to locate the object to modify + :param object [options]: additional options during update. + :param function [callback]: optional callback for cursor. + :returns: cursor returns a cursor to the query + + +**Examples** + + + + A simple query using findOne + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('simple_limit_skip_find_one_query', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the testing + collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Peform a simple find and return all the documents + collection.findOne({a:2}, {fields:{b:1}}, function(err, doc) { + assert.equal(null, err); + assert.equal(null, doc.a); + assert.equal(2, doc.b); + + db.close(); + }); + }); + }); + }); + + +----------- +createIndex +----------- + + +Creates an index on the collection. + + + +Options + - **unique** {Boolean, default:false}, creates an unique index. + - **sparse** {Boolean, default:false}, creates a sparse index. + - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. + - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value + - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. + - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. + +.. js:function:: createIndex(fieldOrSpec[, options], callback) + + :param object fieldOrSpec: fieldOrSpec that defines the index. + :param object [options]: additional options during update. + :param function callback: for results. + :returns: null + + +**Examples** + + + + A simple createIndex using a simple single field index + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('simple_index_test', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1}, {a:2}, {a:3}, {a:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.createIndex('a', function(err, indexName) { + assert.equal("a_1", indexName); + + // Peform a query, with explain to show we hit the query + collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { + assert.deepEqual([[2, 2]], explanation[0].indexBounds.a); + + db.close(); + }); + }); + }); + }); + }); + + + + A more complex createIndex using a compound unique index in the background and dropping duplicated documents + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('more_complex_index_test', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.createIndex({a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Show that duplicate records got dropped + collection.find({}).toArray(function(err, items) { + assert.equal(null, err); + assert.equal(4, items.length); + + // Peform a query, with explain to show we hit the query + collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { + assert.equal(null, err); + assert.ok(explanation[0].indexBounds.a != null); + assert.ok(explanation[0].indexBounds.b != null); + + db.close(); + }); + }) + }); + }); + }); + }); + + +----------- +ensureIndex +----------- + + +Ensures that an index exists, if it does not it creates it + + + +Options + - **unique** {Boolean, default:false}, creates an unique index. + - **sparse** {Boolean, default:false}, creates a sparse index. + - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. + - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value + - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. + - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. + - **v** {Number}, specify the format version of the indexes. + +.. js:function:: ensureIndex(fieldOrSpec[, options], callback) + + :param object fieldOrSpec: fieldOrSpec that defines the index. + :param object [options]: additional options during update. + :param function callback: for results. + :returns: null + + +**Examples** + + + + A more complex ensureIndex using a compound unique index in the background and dropping duplicated documents. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('more_complex_ensure_index_test', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.ensureIndex({a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Show that duplicate records got dropped + collection.find({}).toArray(function(err, items) { + assert.equal(null, err); + assert.equal(4, items.length); + + // Peform a query, with explain to show we hit the query + collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { + assert.equal(null, err); + assert.ok(explanation[0].indexBounds.a != null); + assert.ok(explanation[0].indexBounds.b != null); + + db.close(); + }); + }) + }); + }); + }); + }); + + +---------------- +indexInformation +---------------- + + +Retrieves this collections index info. + + + +Options + - **full** {Boolean, default:false}, returns the full raw index information. + +.. js:function:: indexInformation([options], callback) + + :param object [options]: additional options during update. + :param function callback: returns the index information. + :returns: null + + +**Examples** + + + + An examples showing the information returned by indexInformation + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('more_index_information_test', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.ensureIndex({a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Fetch basic indexInformation for collection + collection.indexInformation(function(err, indexInformation) { + assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); + assert.deepEqual([ [ 'a', 1 ], [ 'b', 1 ] ], indexInformation.a_1_b_1); + + // Fetch full index information + collection.indexInformation({full:true}, function(err, indexInformation) { + assert.deepEqual({ _id: 1 }, indexInformation[0].key); + assert.deepEqual({ a: 1, b: 1 }, indexInformation[1].key); + + db.close(); + }); + }); + }); + }); + }); + }); + + +--------- +dropIndex +--------- + + +Drops an index from this collection. + +.. js:function:: dropIndex(name, callback) + + :param string name: + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + An examples showing the creation and dropping of an index + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('create_and_drop_an_index', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.ensureIndex({a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Drop the index + collection.dropIndex("a_1_b_1", function(err, result) { + assert.equal(null, err); + + // Verify that the index is gone + collection.indexInformation(function(err, indexInformation) { + assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); + assert.equal(null, indexInformation.a_1_b_1); + + db.close(); + }); + }); + }); + }); + }); + }); + + +-------------- +dropAllIndexes +-------------- + + +Drops all indexes from this collection. + +.. js:function:: dropAllIndexes(callback) + + :param function callback: returns the results. + :returns: null + + +------- +reIndex +------- + + +Reindex all indexes on the collection +Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections. + +.. js:function:: reIndex(callback) + + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + An example showing how to force a reindex of a collection. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('create_and_drop_all_indexes', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4, c:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.ensureIndex({a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Force a reindex of the collection + collection.reIndex(function(err, result) { + assert.equal(null, err); + assert.equal(true, result); + + // Verify that the index is gone + collection.indexInformation(function(err, indexInformation) { + assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); + assert.deepEqual([ [ 'a', 1 ], [ 'b', 1 ] ], indexInformation.a_1_b_1); + + db.close(); + }); + }); + }); + }); + }); + }); + + +--------- +mapReduce +--------- + + +Run Map Reduce across a collection. + + + +Options + - **out** {Object, default:*{inline:1}*}, sets the output target for the map reduce job. *{inline:1} | {replace:'collectionName'} | {merge:'collectionName'} | {reduce:'collectionName'}* + - **query** {Object}, query filter object. + - **sort** {Object}, sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces. + - **limit** {Number}, number of objects to return from collection. + - **keeptemp** {Boolean, default:false}, keep temporary data. + - **finalize** {Function | String}, finalize function. + - **scope** {Object}, can pass in variables that can be access from map/reduce/finalize. + - **jsMode** {Boolean, default:false}, it is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X. + - **verbose** {Boolean, default:false}, provide statistics on job execution time. + +.. js:function:: mapReduce(map, reduce[, options], callback) + + :param function map: the mapping function. + :param function reduce: the reduce function. + :param objects [options]: options for the map reduce job. + :param function callback: returns the result of the map reduce job. + :returns: null + + +**Examples** + + + + A simple map reduce example + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a test collection + db.createCollection('test_map_reduce_functions', function(err, collection) { + + // Insert some documents to perform map reduce over + collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { + + // Map function + var map = function() { emit(this.user_id, 1); }; + // Reduce function + var reduce = function(k,vals) { return 1; }; + + // Peform the map reduce + collection.mapReduce(map, reduce, function(err, collection) { + // Mapreduce returns the temporary collection with the results + collection.findOne({'_id':1}, function(err, result) { + assert.equal(1, result.value); + + collection.findOne({'_id':2}, function(err, result) { + assert.equal(1, result.value); + + db.close(); + }); + }); + }); + }); + }); + }); + + + + A simple map reduce example using the inline output type on MongoDB > 1.7.6 + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Parse version of server if available + db.admin().serverInfo(function(err, result){ + + // Only run if the MongoDB version is higher than 1.7.6 + if(parseInt((result.version.replace(/\./g, ''))) >= 176) { + + // Create a test collection + db.createCollection('test_map_reduce_functions_inline', function(err, collection) { + + // Insert some test documents + collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { + + // Map function + var map = function() { emit(this.user_id, 1); }; + // Reduce function + var reduce = function(k,vals) { return 1; }; + + // Execute map reduce and return results inline + collection.mapReduce(map, reduce, {out : {inline: 1}}, function(err, results) { + assert.equal(2, results.length); + + db.close(); + }); + }); + }); + } else { + test.done(); + } + }); + }); + + + + Mapreduce different test with a provided scope containing a javascript function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a test collection + client.createCollection('test_map_reduce_functions_scope', function(err, collection) { + + // Insert some test documents + collection.insert([{'user_id':1, 'timestamp':new Date()} + , {'user_id':2, 'timestamp':new Date()}], {safe:true}, function(err, r) { + + // Map function + var map = function(){ + emit(test(this.timestamp.getYear()), 1); + } + + // Reduce function + var reduce = function(k, v){ + count = 0; + for(i = 0; i < v.length; i++) { + count += v[i]; + } + return count; + } + + // Javascript function available in the map reduce scope + var t = function(val){ return val+1; } + + // Execute the map reduce with the custom scope + collection.mapReduce(map, reduce, {scope:{test:new Code(t.toString())} + , out: {replace:'replacethiscollection'}}, function(err, collection) { + + // Find all entries in the map-reduce collection + collection.find().toArray(function(err, results) { + assert.equal(2, results[0].value) + + db.close(); + }); + }); + }); + }); + }); + + +----- +group +----- + + +Run a group command across a collection + +.. js:function:: group(keys, condition, initial, reduce, finalize, command, callback) + + :param object keys: an object, array or function expressing the keys to group by. + :param object condition: an optional condition that must be true for a row to be considered. + :param object initial: initial value of the aggregation counter object. + :param function reduce: the reduce function aggregates (reduces) the objects iterated + :param function finalize: an optional function to be run on each item in the result set just before the item is returned. + :param boolean command: specify if you wish to run using the internal group command or using eval, default is true. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A whole lot of different wayt to execute the group command + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a test collection + db.createCollection('test_group', function(err, collection) { + + // Peform a simple group by on an empty collection + collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }", function(err, results) { + assert.deepEqual([], results); + + // Trigger some inserts on the collection + collection.insert([{'a':2}, {'b':5}, {'a':1}], {safe:true}, function(err, ids) { + + // Perform a group count + collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }" + , function(err, results) { + assert.equal(3, results[0].count); + + // Pefrom a group count using the eval method + collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }" + , false, function(err, results) { + assert.equal(3, results[0].count); + + // Group with a conditional + collection.group([], {'a':{'$gt':1}}, {"count":0}, "function (obj, prev) { prev.count++; }" + , function(err, results) { + // Results + assert.equal(1, results[0].count); + + // Group with a conditional using the EVAL method + collection.group([], {'a':{'$gt':1}}, {"count":0}, "function (obj, prev) { prev.count++; }" + , false, function(err, results) { + // Results + assert.equal(1, results[0].count); + + // Insert some more test data + collection.insert([{'a':2}, {'b':3}], {safe:true}, function(err, ids) { + + // Do a Group by field a + collection.group(['a'], {}, {"count":0}, "function (obj, prev) { prev.count++; }" + , function(err, results) { + // Results + assert.equal(2, results[0].a); + assert.equal(2, results[0].count); + assert.equal(null, results[1].a); + assert.equal(2, results[1].count); + assert.equal(1, results[2].a); + assert.equal(1, results[2].count); + + // Do a Group by field a + collection.group({'a':true}, {}, {"count":0}, function (obj, prev) { prev.count++; } + , true, function(err, results) { + // Results + assert.equal(2, results[0].a); + assert.equal(2, results[0].count); + assert.equal(null, results[1].a); + assert.equal(2, results[1].count); + assert.equal(1, results[2].a); + assert.equal(1, results[2].count); + + // Correctly handle illegal function + collection.group([], {}, {}, "5 ++ 5", function(err, results) { + assert.ok(err instanceof Error); + assert.ok(err.message != null); + + // Use a function to select the keys used to group by + var keyf = function(doc) { return {a: doc.a}; }; + collection.group(keyf, {a: {$gt: 0}}, {"count": 0, "value": 0} + , function(obj, prev) { prev.count++; prev.value += obj.a; }, true, function(err, results) { + // Results + results.sort(function(a, b) { return b.count - a.count; }); + assert.equal(2, results[0].count); + assert.equal(2, results[0].a); + assert.equal(4, results[0].value); + assert.equal(1, results[1].count); + assert.equal(1, results[1].a); + assert.equal(1, results[1].value); + + // Correctly handle illegal function when using the EVAL method + collection.group([], {}, {}, "5 ++ 5", false, function(err, results) { + assert.ok(err instanceof Error); + assert.ok(err.message != null); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + +------- +options +------- + + +Returns the options of the collection. + +.. js:function:: options(callback) + + :param function callback: returns option results. + :returns: null + + +**Examples** + + + + An example returning the options for a collection. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a test collection that we are getting the options back from + db.createCollection('test_collection_options', {'capped':true, 'size':1024}, function(err, collection) { + assert.ok(collection instanceof Collection); + assert.equal('test_collection_options', collection.collectionName); + + // Let's fetch the collection options + collection.options(function(err, options) { + assert.equal(true, options.capped); + assert.equal(1024, options.size); + assert.equal("test_collection_options", options.create); + + db.close(); + }); + }); + }); + + +-------- +isCapped +-------- + + +Returns if the collection is a capped collection + +.. js:function:: isCapped(callback) + + :param function callback: returns if collection is capped. + :returns: null + + +**Examples** + + + + An example showing how to establish if it's a capped collection + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a test collection that we are getting the options back from + db.createCollection('test_collection_is_capped', {'capped':true, 'size':1024}, function(err, collection) { + assert.ok(collection instanceof Collection); + assert.equal('test_collection_is_capped', collection.collectionName); + + // Let's fetch the collection options + collection.isCapped(function(err, capped) { + assert.equal(true, capped); + + db.close(); + }); + }); + }); + + +----------- +indexExists +----------- + + +Checks if one or more indexes exist on the collection + +.. js:function:: indexExists(indexNames, callback) + + :param string indexNames: check if one or more indexes exist on the collection. + :param function callback: returns if the indexes exist. + :returns: null + + +**Examples** + + + + An example showing the use of the indexExists function for a single index name and a list of index names. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a test collection that we are getting the options back from + db.createCollection('test_collection_index_exists', function(err, collection) { + assert.equal(null, err); + + // Create an index on the collection + collection.createIndex('a', function(err, indexName) { + + // Let's test to check if a single index exists + collection.indexExists("a_1", function(err, result) { + assert.equal(true, result); + + // Let's test to check if multiple indexes are available + collection.indexExists(["a_1", "_id_"], function(err, result) { + assert.equal(true, result); + + // Check if a non existing index exists + collection.indexExists("c_1", function(err, result) { + assert.equal(false, result); + + db.close(); + }); + }); + }); + }); + }); + }); + + +------- +geoNear +------- + + +Execute the geoNear command to search for items in the collection + + + +Options + - **num** {Number}, max number of results to return. + - **maxDistance** {Number}, include results up to maxDistance from the point. + - **distanceMultiplier** {Number}, include a value to multiply the distances with allowing for range conversions. + - **query** {Object}, filter the results by a query. + - **spherical** {Boolean, default:false}, perform query using a spherical model. + - **uniqueDocs** {Boolean, default:false}, the closest location in a document to the center of the search region will always be returned MongoDB > 2.X. + - **includeLocs** {Boolean, default:false}, include the location data fields in the top level of the results MongoDB > 2.X. + +.. js:function:: geoNear(x, y[, options], callback) + + :param number x: point to search on the x axis, ensure the indexes are ordered in the same order. + :param number y: point to search on the y axis, ensure the indexes are ordered in the same order. + :param objects [options]: options for the map reduce job. + :param function callback: returns matching documents. + :returns: null + + +**Examples** + + + + Example of a simple geoNear query across some documents + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch the collection + db.collection("simple_geo_near_command", function(err, collection) { + + // Add a location based index + collection.ensureIndex({loc:"2d"}, function(err, result) { + + // Save a new location tagged document + collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {safe:true}, function(err, result) { + + // Use geoNear command to find document + collection.geoNear(50, 50, {query:{a:1}, num:1}, function(err, docs) { + assert.equal(1, docs.results.length); + + db.close(); + }); + }); + }); + }); + }); + + +----------------- +geoHaystackSearch +----------------- + + +Execute a geo search using a geo haystack index on a collection. + + + +Options + - **maxDistance** {Number}, include results up to maxDistance from the point. + - **search** {Object}, filter the results by a query. + - **limit** {Number}, max number of results to return. + +.. js:function:: geoHaystackSearch(x, y[, options], callback) + + :param number x: point to search on the x axis, ensure the indexes are ordered in the same order. + :param number y: point to search on the y axis, ensure the indexes are ordered in the same order. + :param objects [options]: options for the map reduce job. + :param function callback: returns matching documents. + :returns: null + + +**Examples** + + + + Example of a simple geoHaystackSearch query across some documents + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch the collection + db.collection("simple_geo_haystack_command", function(err, collection) { + + // Add a location based index + collection.ensureIndex({loc: "geoHaystack", type: 1}, {bucketSize: 1}, function(err, result) { + + // Save a new location tagged document + collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {safe:true}, function(err, result) { + + // Use geoNear command to find document + collection.geoHaystackSearch(50, 50, {search:{a:1}, limit:1, maxDistance:100}, function(err, docs) { + assert.equal(1, docs.results.length); + + db.close(); + }); + }); + }); + }); + }); + + +------- +indexes +------- + + +Retrieve all the indexes on the collection. + +.. js:function:: indexes(callback) + + :param function callback: returns index information. + :returns: null + + +**Examples** + + + + Example of retrieving a collections indexes + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Crete the collection for the distinct example + db.createCollection('simple_key_based_distinct', function(err, collection) { + + // Create a geo 2d index + collection.ensureIndex({loc:"2d"}, function(err, result) { + assert.equal(null, err); + + // Create a simple single field index + collection.ensureIndex({a:1}, function(err, result) { + assert.equal(null, err); + + // List all of the indexes on the collection + collection.indexes(function(err, indexes) { + assert.equal(3, indexes.length); + + db.close(); + }); + }) + }) + }); + }); + + +----- +stats +----- + + +Get all the collection statistics. + + + +Options + - **scale** {Number}, divide the returned sizes by scale value. + +.. js:function:: stats([options], callback) + + :param objects [options]: options for the map reduce job. + :param function callback: returns statistical information for the collection. + :returns: null + + +**Examples** + + + + Example of retrieving a collections stats + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Crete the collection for the distinct example + db.createCollection('collection_stats_test', function(err, collection) { + + // Insert some documents + collection.insert([{a:1}, {hello:'world'}], {safe:true}, function(err, result) { + + // Retrieve the statistics for the collection + collection.stats(function(err, stats) { + assert.equal(2, stats.count); + + db.close(); + }); + }); + }); + }); + diff --git a/_sources/api-generated/cursor.txt b/_sources/api-generated/cursor.txt new file mode 100644 index 00000000000..712ae5c09a9 --- /dev/null +++ b/_sources/api-generated/cursor.txt @@ -0,0 +1,947 @@ +======== +Cursor() +======== + +------------------ +Constructor +------------------ + + +Constructor for a cursor object that handles all the operations on query result +using find. This cursor object is unidirectional and cannot traverse backwards. Clients should not be creating a cursor directly, +but use find to acquire a cursor. + + + .. js:class:: Cursor() + + :param db db: the database object to work with. + :param collection collection: the collection to query. + :param object selector: the query selector. + :param object fields: an object containing what fields to include or exclude from objects returned. + :param number skip: number of documents to skip. + :param number limit: the number of results to return. -1 has a special meaning and is used by Db.eval. A value of 1 will also be treated as if it were -1. + :param string sort: the required sorting for the query. + :param object hint: force the query to use a specific index. + :param boolean explain: return the explaination of the query. + :param boolean snapshot: Snapshot mode assures no duplicates are returned. + :param boolean timeout: allow the query to timeout. + :param boolean tailable: allow the cursor to be tailable. + :param number batchSize: the number of the subset of results to request the database to return for every request. This should initially be greater than 1 otherwise the database will automatically close the cursor. The batch size can be set to 1 with cursorInstance.batchSize after performing the initial query to the database. + :param boolean raw: return all query documents as raw buffers (default false). + :param boolean read: specify override of read from source (primary/secondary). + :param boolean returnKey: only return the index key. + :param number maxScan: limit the number of items to scan. + :param number min: set index bounds. + :param number max: set index bounds. + :param boolean showDiskLoc: show disk location of results. + :param string comment: you can put a $comment field on a query to make looking in the profiler logs simpler. + + + +------------------ +Constants +------------------ + +.. csv-table:: + :header: "Constant Name", "Value", "Description" + :widths: 15, 10, 30 + + "Cursor.INIT", "0", "Init state" + "Cursor.OPEN", "1", "Cursor open" + "Cursor.CLOSED", "2", "Cursor closed" + +------ +rewind +------ + + +Resets this cursor to its initial state. All settings like the query string, +tailable, batchSizeValue, skipValue and limits are preserved. + +.. js:function:: rewind() + + :returns: cursor returns itself with rewind applied. + + +**Examples** + + + + An example showing the information returned by indexInformation + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + var docs = []; + + // Insert 100 documents with some data + for(var i = 0; i < 100; i++) { + var d = new Date().getTime() + i*1000; + docs[i] = {'a':i, createdAt:new Date(d)}; + } + + // Create collection + db.createCollection('Should_correctly_rewind_and_restart_cursor', function(err, collection) { + assert.equal(null, err); + + // insert all docs + collection.insert(docs, {safe:true}, function(err, result) { + assert.equal(null, err); + + // Grab a cursor using the find + var cursor = collection.find({}); + // Fetch the first object off the cursor + cursor.nextObject(function(err, item) { + assert.equal(0, item.a) + // Rewind the cursor, resetting it to point to the start of the query + cursor.rewind(); + + // Grab the first object again + cursor.nextObject(function(err, item) { + assert.equal(0, item.a) + + db.close(); + }) + }) + }) + }); + }); + + +------- +toArray +------- + + +Returns an array of documents. The caller is responsible for making sure that there +is enough memory to store the results. Note that the array only contain partial +results when this cursor had been previouly accessed. In that case, +cursor.rewind() can be used to reset the cursor. + +.. js:function:: toArray(callback) + + :param function callback: This will be called after executing this method successfully. The first paramter will contain the Error object if an error occured, or null otherwise. The second paramter will contain an array of BSON deserialized objects as a result of the query. + :returns: null + + +**Examples** + + + + An example showing the information returned by indexInformation + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection to hold our documents + db.createCollection('test_array', function(err, collection) { + + // Insert a test document + collection.insert({'b':[1, 2, 3]}, {safe:true}, function(err, ids) { + + // Retrieve all the documents in the collection + collection.find().toArray(function(err, documents) { + assert.equal(1, documents.length); + assert.deepEqual([1, 2, 3], documents[0].b); + + db.close(); + }); + }); + }); + }); + + +---- +each +---- + + +Iterates over all the documents for this cursor. As with **{cursor.toArray}**, +not all of the elements will be iterated if this cursor had been previouly accessed. +In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike +**{cursor.toArray}**, the cursor will only hold a maximum of batch size elements +at any given time if batch size is specified. Otherwise, the caller is responsible +for making sure that the entire result can fit the memory. + +.. js:function:: each(callback) + + :param function callback: this will be called for while iterating every document of the query result. The first paramter will contain the Error object if an error occured, or null otherwise. While the second paramter will contain the document. + :returns: null + + +**Examples** + + + + A simple example iterating over a query using the each function of the cursor. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection + db.createCollection('test_to_a_after_each', function(err, collection) { + assert.equal(null, err); + assert.ok(collection instanceof Collection); + + // Insert a document in the collection + collection.insert({'a':1}, {safe:true}, function(err, ids) { + + // Grab a cursor + collection.find(function(err, cursor) { + + // Execute the each command, triggers for each document + cursor.each(function(err, item) { + + // If the item is null then the cursor is exhausted/empty and closed + if(item == null) { + + // Show that the cursor is closed + cursor.toArray(function(err, items) { + assert.ok(err != null); + + // Let's close the db + db.close(); + }); + }; + }); + }); + }); + }); + }); + + +----- +count +----- + + +Determines how many result the query for this cursor will return + +.. js:function:: count(callback) + + :param function callback: this will be after executing this method. The first paramter will contain the Error object if an error occured, or null otherwise. While the second paramter will contain the number of results or null if an error occured. + :returns: null + + +**Examples** + + + + A simple example showing the count function of the cursor. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Creat collection + db.createCollection('cursor_count_collection', function(err, collection) { + assert.equal(null, err); + + // Insert some docs + collection.insert([{a:1}, {a:2}], {safe:true}, function(err, docs) { + assert.equal(null, err); + + // Do a find and get the cursor count + collection.find().count(function(err, count) { + assert.equal(null, err); + assert.equal(2, count); + + db.close(); + }) + }); + }); + }); + + +---- +sort +---- + + +Sets the sort parameter of this cursor to the given value. + +**This method has the following method signatures** + + + +(keyOrList, callback) +(keyOrList, direction, callback) + +.. js:function:: sort(keyOrList, direction, callback) + + :param string keyOrList: This can be a string or an array. If passed as a string, the string will be the field to sort. If passed an array, each element will represent a field to be sorted and should be an array that contains the format [string, direction]. + :param string direction: this determines how the results are sorted. "asc", "ascending" or 1 for asceding order while "desc", "desceding or -1 for descending order. Note that the strings are case insensitive. + :param function callback: this will be called after executing this method. The first parameter will contain an error object when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution. + :returns: cursor an instance of this object. + + +**Examples** + + + + A simple example showing the use of sort on the cursor. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection + db.createCollection('simple_sort_collection', function(err, collection) { + assert.equal(null, err); + + // Insert some documents we can sort on + collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + assert.equal(null, err); + + // Do normal ascending sort + collection.find().sort([['a', 1]]).nextObject(function(err, item) { + assert.equal(null, err); + assert.equal(1, item.a); + + // Do normal descending sort + collection.find().sort([['a', -1]]).nextObject(function(err, item) { + assert.equal(null, err); + assert.equal(3, item.a); + + db.close(); + }); + }); + }); + }); + }); + + +----- +limit +----- + + +Sets the limit parameter of this cursor to the given value. + +.. js:function:: limit(limit, callback) + + :param number limit: the new limit. + :param function callback: this will be called after executing this method. The first parameter will contain an error object when the limit given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution. + :returns: cursor an instance of this object. + + +**Examples** + + + + A simple example showing the use of limit on the cursor + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection + db.createCollection('simple_limit_collection', function(err, collection) { + assert.equal(null, err); + + // Insert some documents we can sort on + collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + assert.equal(null, err); + + // Limit to only one document returned + collection.find().limit(1).toArray(function(err, items) { + assert.equal(null, err); + assert.equal(1, items.length); + + db.close(); + }); + }); + }); + }); + + +---- +skip +---- + + +Sets the skip parameter of this cursor to the given value. + +.. js:function:: skip(skip, callback) + + :param number skip: the new skip value. + :param function callback: this will be called after executing this method. The first parameter will contain an error object when the skip value given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution. + :returns: cursor an instance of this object. + + +**Examples** + + + + A simple example showing the use of skip on the cursor + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection + db.createCollection('simple_skip_collection', function(err, collection) { + assert.equal(null, err); + + // Insert some documents we can sort on + collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + assert.equal(null, err); + + // Skip one document + collection.find().skip(1).nextObject(function(err, item) { + assert.equal(null, err); + assert.equal(2, item.a); + + db.close(); + }); + }); + }); + }); + + +--------- +batchSize +--------- + + +Sets the batch size parameter of this cursor to the given value. + +.. js:function:: batchSize(batchSize, callback) + + :param number batchSize: the new batch size. + :param function callback: this will be called after executing this method. The first parameter will contain an error object when the batchSize given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution. + :returns: cursor an instance of this object. + + +**Examples** + + + + A simple example showing the use of batchSize on the cursor, batchSize only regulates how many + documents are returned for each batch using the getMoreCommand against the MongoDB server + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection + db.createCollection('simple_batch_size_collection', function(err, collection) { + assert.equal(null, err); + + // Insert some documents we can sort on + collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + assert.equal(null, err); + + // Do normal ascending sort + collection.find().batchSize(1).nextObject(function(err, item) { + assert.equal(null, err); + assert.equal(1, item.a); + + db.close(); + }); + }); + }); + }); + + +---------- +nextObject +---------- + + +Gets the next document from the cursor. + +.. js:function:: nextObject(callback) + + :param function callback: this will be called after executing this method. The first parameter will contain an error object on error while the second parameter will contain a document from the returned result or null if there are no more results. + +**Examples** + + + + A simple example showing the use of nextObject. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection + db.createCollection('simple_next_object_collection', function(err, collection) { + assert.equal(null, err); + + // Insert some documents we can sort on + collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + assert.equal(null, err); + + // Do normal ascending sort + collection.find().nextObject(function(err, item) { + assert.equal(null, err); + assert.equal(1, item.a); + + db.close(); + }); + }); + }); + }); + + +------- +explain +------- + + +Gets a detailed information about how the query is performed on this cursor and how +long it took the database to process it. + +.. js:function:: explain(callback) + + :param function callback: this will be called after executing this method. The first parameter will always be null while the second parameter will be an object containing the details. + +**Examples** + + + + A simple example showing the use of the cursor explain function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection + db.createCollection('simple_explain_collection', function(err, collection) { + assert.equal(null, err); + + // Insert some documents we can sort on + collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + assert.equal(null, err); + + // Do normal ascending sort + collection.find().explain(function(err, explaination) { + assert.equal(null, err); + + db.close(); + }); + }); + }); + }); + + +------------- +streamRecords +------------- + + +Returns a stream object that can be used to listen to and stream records +(**Use the CursorStream object instead as this is deprected**) + + + +Options + - **fetchSize** {Number} the number of records to fetch in each batch (steam specific batchSize). + + + +Events + - **data** {function(item) {}} the data event triggers when a document is ready. + - **error** {function(err) {}} the error event triggers if an error happens. + - **end** {function() {}} the end event triggers when there is no more documents available. + +.. js:function:: streamRecords([options]) + + :param object [options]: additional options for streamRecords. + :returns: eventemitter returns a stream object. + + +**Examples** + + + + A simple example showing the use of the cursor streamRecords function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a lot of documents to insert + var docs = [] + for(var i = 0; i < 100; i++) { + docs.push({'a':i}) + } + + // Create a collection + db.createCollection('test_streamingRecords_function', function(err, collection) { + assert.equal(null, err); + + // Insert documents into collection + collection.insert(docs, {safe:true}, function(err, ids) { + // Peform a find to get a cursor + var stream = collection.find().streamRecords({fetchSize:1000}); + + // Execute find on all the documents + stream.on('end', function() { + db.close(); + }); + + stream.on('data', function(data) { + assert.ok(data != null); + }); + }); + }); + }); + + +------ +stream +------ + + +Returns a Node ReadStream interface for this cursor. + +.. js:function:: stream() + + :returns: cursorstream returns a stream object. + + +**Examples** + + + + A simple example showing the use of the cursor stream function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a lot of documents to insert + var docs = [] + for(var i = 0; i < 100; i++) { + docs.push({'a':i}) + } + + // Create a collection + db.createCollection('test_stream_function', function(err, collection) { + assert.equal(null, err); + + // Insert documents into collection + collection.insert(docs, {safe:true}, function(err, ids) { + // Peform a find to get a cursor + var stream = collection.find().stream(); + + // Execute find on all the documents + stream.on('close', function() { + db.close(); + }); + + stream.on('data', function(data) { + assert.ok(data != null); + }); + }); + }); + }); + + +----- +close +----- + + +Close the cursor. + +.. js:function:: close(callback) + + :param function callback: this will be called after executing this method. The first parameter will always contain null while the second parameter will contain a reference to this cursor. + :returns: null + + +**Examples** + + + + A simple example showing the use of the cursor close function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a lot of documents to insert + var docs = [] + for(var i = 0; i < 100; i++) { + docs.push({'a':i}) + } + + // Create a collection + db.createCollection('test_close_function_on_cursor', function(err, collection) { + assert.equal(null, err); + + // Insert documents into collection + collection.insert(docs, {safe:true}, function(err, ids) { + // Peform a find to get a cursor + var cursor = collection.find(); + + // Fetch the first object + cursor.nextObject(function(err, object) { + assert.equal(null, err); + + // Close the cursor, this is the same as reseting the query + cursor.close(function(err, result) { + assert.equal(null, err); + + db.close(); + }); + }); + }); + }); + }); + + +-------- +isClosed +-------- + + +Check if the cursor is closed or open. + +.. js:function:: isClosed() + + :returns: boolean returns the state of the cursor. + + +**Examples** + + + + A simple example showing the use of the cursor close function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a lot of documents to insert + var docs = [] + for(var i = 0; i < 100; i++) { + docs.push({'a':i}) + } + + // Create a collection + db.createCollection('test_is_close_function_on_cursor', function(err, collection) { + assert.equal(null, err); + + // Insert documents into collection + collection.insert(docs, {safe:true}, function(err, ids) { + // Peform a find to get a cursor + var cursor = collection.find(); + + // Fetch the first object + cursor.nextObject(function(err, object) { + assert.equal(null, err); + + // Close the cursor, this is the same as reseting the query + cursor.close(function(err, result) { + assert.equal(null, err); + assert.equal(true, cursor.isClosed()); + + db.close(); + }); + }); + }); + }); + }); + diff --git a/_sources/api-generated/cursorstream.txt b/_sources/api-generated/cursorstream.txt new file mode 100644 index 00000000000..43d777d35e3 --- /dev/null +++ b/_sources/api-generated/cursorstream.txt @@ -0,0 +1,245 @@ +============== +CursorStream() +============== + +------------------ +Constructor +------------------ + + +CursorStream + + + .. js:class:: CursorStream() + + :param cursor cursor: a cursor object that the stream wraps. + :returns: stream + + +Returns a stream interface for the **cursor**. + + + +Events + - **data** {function(item) {}} the data event triggers when a document is ready. + - **error** {function(err) {}} the error event triggers if an error happens. + - **end** {function() {}} the end event triggers when there is no more documents available. + + +----- +pause +----- + + +Pauses the stream. + +.. js:function:: pause() + + +**Examples** + + + + A simple example showing the use of the cursorstream pause function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a lot of documents to insert + var docs = [] + for(var i = 0; i < 1; i++) { + docs.push({'a':i}) + } + + // Create a collection + db.createCollection('test_cursorstream_pause', function(err, collection) { + assert.equal(null, err); + + // Insert documents into collection + collection.insert(docs, {safe:true}, function(err, ids) { + // Peform a find to get a cursor + var stream = collection.find().stream(); + + // For each data item + stream.on("data", function(item) { + // Check if cursor is paused + assert.equal(false, stream.paused); + // Pause stream + stream.pause(); + // Check if cursor is paused + assert.equal(true, stream.paused); + + // Restart the stream after 1 miliscecond + setTimeout(function() { + stream.resume(); + // Check if cursor is paused + assert.equal(false, stream.paused); + }, 1); + }); + + // When the stream is done + stream.on("close", function() { + db.close(); + }); + }); + }); + }); + + +------ +resume +------ + + +Resumes the stream. + +.. js:function:: resume() + + +**Examples** + + + + A simple example showing the use of the cursorstream resume function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a lot of documents to insert + var docs = [] + for(var i = 0; i < 1; i++) { + docs.push({'a':i}) + } + + // Create a collection + db.createCollection('test_cursorstream_resume', function(err, collection) { + assert.equal(null, err); + + // Insert documents into collection + collection.insert(docs, {safe:true}, function(err, ids) { + // Peform a find to get a cursor + var stream = collection.find().stream(); + + // For each data item + stream.on("data", function(item) { + // Check if cursor is paused + assert.equal(false, stream.paused); + // Pause stream + stream.pause(); + // Check if cursor is paused + assert.equal(true, stream.paused); + + // Restart the stream after 1 miliscecond + setTimeout(function() { + + // Resume the stream + stream.resume(); + + // Check if cursor is paused + assert.equal(false, stream.paused); + }, 1); + }); + + // When the stream is done + stream.on("close", function() { + db.close(); + }); + }); + }); + }); + + +------- +destroy +------- + + +Destroys the stream, closing the underlying +cursor. No more events will be emitted. + +.. js:function:: destroy() + + +**Examples** + + + + A simple example showing the use of the cursorstream resume function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a lot of documents to insert + var docs = [] + for(var i = 0; i < 1; i++) { + docs.push({'a':i}) + } + + // Create a collection + db.createCollection('test_cursorstream_destroy', function(err, collection) { + assert.equal(null, err); + + // Insert documents into collection + collection.insert(docs, {safe:true}, function(err, ids) { + // Peform a find to get a cursor + var stream = collection.find().stream(); + + // For each data item + stream.on("data", function(item) { + // Destroy stream + stream.destroy(); + }); + + // When the stream is done + stream.on("close", function() { + db.close(); + }); + }); + }); + }); + diff --git a/_sources/api-generated/db.txt b/_sources/api-generated/db.txt new file mode 100644 index 00000000000..bd849616b81 --- /dev/null +++ b/_sources/api-generated/db.txt @@ -0,0 +1,1979 @@ +==== +Db() +==== + +------------------ +Constructor +------------------ + + +Create a new Db instance. + + + .. js:class:: Db() + + :param string databaseName: name of the database. + :param object serverConfig: server config object. + :param object [options]: additional options for the collection. + + +Options + - **strict** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, execute insert with a getLastError command returning the result of the insert command. + - **native_parser** {Boolean, default:false}, use c++ bson parser. + - **forceServerObjectId** {Boolean, default:false}, force server to create _id fields instead of client. + - **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. + - **slaveOk** {Boolean, default:false}, allow reads from secondaries. + - **serializeFunctions** {Boolean, default:false}, serialize functions. + - **raw** {Boolean, default:false}, peform operations using raw bson buffers. + - **recordQueryStats** {Boolean, default:false}, record query statistics during execution. + - **reaper** {Boolean, default:false}, enables the reaper, timing out calls that never return. + - **reaperInterval** {Number, default:10000}, number of miliseconds between reaper wakups. + - **reaperTimeout** {Number, default:30000}, the amount of time before a callback times out. + - **retryMiliSeconds** {Number, default:5000}, number of miliseconds between retries. + - **numberOfRetries** {Number, default:5}, number of retries off connection. + + +------------------ +Constants +------------------ + +.. csv-table:: + :header: "Constant Name", "Value", "Description" + :widths: 15, 10, 30 + + "Db.DEFAULT_URL", "'mongodb://localhost:27017/default'", "Default URL" + +---- +open +---- + + +Initialize the database connection. + +.. js:function:: open(callback) + + :param function callback: returns index information. + :returns: null + + +**Examples** + + + + An example of a simple single server db connection + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + db.close(); + }); + + + + Simple replicaset connection setup, requires a running replicaset on the correct ports + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Replica configuration + var replSet = new ReplSetServers([ + new Server('localhost', 30000, { auto_reconnect: true } ), + new Server('localhost', 30001, { auto_reconnect: true } ), + new Server('localhost', 30002, { auto_reconnect: true } ) + ] + ); + + var db = new Db('integration_test_', replSet); + db.open(function(err, p_db) { + assert.equal(null, err); + p_db.close(); + }); + + +-- +db +-- + + +Create a new Db instance sharing the current socket connections. + +.. js:function:: db(dbName) + + :param string dbName: the name of the database we want to use. + :returns: db a db instance using the new database. + + +**Examples** + + + + Simple example connecting to two different databases sharing the socket connections below. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Reference a different database sharing the same connections + // for the data transfer + var secondDb = db.db("integration_tests_2"); + + // Fetch the collections + var multipleColl1 = db.collection("multiple_db_instances"); + var multipleColl2 = secondDb.collection("multiple_db_instances"); + + // Write a record into each and then count the records stored + multipleColl1.insert({a:1}, {safe:true}, function(err, result) { + multipleColl2.insert({a:1}, {safe:true}, function(err, result) { + + // Count over the results ensuring only on record in each collection + multipleColl1.count(function(err, count) { + assert.equal(1, count); + + multipleColl2.count(function(err, count) { + assert.equal(1, count); + + db.close(); + }); + }); + }); + }); + }); + + +----- +close +----- + + +Close the current db connection, including all the child db instances. Emits close event if no callback is provided. + +.. js:function:: close([callback]) + + :param function [callback]: returns the results. + :returns: null + + +**Examples** + + + + An example of a simple single server db connection and close function + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Close the connection with a callback that is optional + db.close(function(err, result) { + assert.equal(null, err); + + }); + }); + + +----- +admin +----- + + +Access the Admin database + +.. js:function:: admin([callback]) + + :param function [callback]: returns the results. + :returns: admin the admin db object. + + +**Examples** + + + + Example showing how to access the Admin database for admin level operations. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Use the admin database for the operation + db.admin(function(err, adminDb) { + assert.equal(null, err); + + db.close(); + }); + }); + + +--------------- +collectionsInfo +--------------- + + +Returns a cursor to all the collection information. + +.. js:function:: collectionsInfo([collectionName], callback) + + :param string [collectionName]: the collection name we wish to retrieve the information from. + :param function callback: returns option results. + :returns: null + + +**Examples** + + + + An example of retrieveing the information of all the collections. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Create a collection + db.createCollection('test_collections_info', function(err, r) { + assert.equal(null, err); + + // Return the information of a single collection name + db.collectionsInfo("test_collections_info").toArray(function(err, items) { + assert.equal(1, items.length); + + // Return the information of a all collections, using the callback format + db.collectionsInfo(function(err, cursor) { + + // Turn the cursor into an array of results + cursor.toArray(function(err, items) { + assert.ok(items.length > 0); + + db.close(); + }); + }) + }); + }); + }); + + +--------------- +collectionNames +--------------- + + +Get the list of all collection names for the specified db + +.. js:function:: collectionNames([collectionName], callback) + + :param string [collectionName]: the collection name we wish to filter by. + :param function callback: returns option results. + :returns: null + + +**Examples** + + + + An example of retrieveing the collection names for a database. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Create a collection + db.createCollection('test_collections_info', function(err, r) { + assert.equal(null, err); + + // Return the information of a single collection name + db.collectionNames("test_collections_info", function(err, items) { + assert.equal(1, items.length); + + // Return the information of a all collections, using the callback format + db.collectionNames(function(err, items) { + assert.ok(items.length > 0); + + db.close(); + }); + }); + }); + }); + + +---------- +collection +---------- + + +Fetch a specific collection (containing the actual collection information) + + + +Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + - **slaveOk** {Boolean, default:false}, Allow reads from secondaries. + - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. + - **raw** {Boolean, default:false}, perform all operations using raw bson objects. + - **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. + +.. js:function:: collection(collectionName[, options], [callback]) + + :param string collectionName: the collection name we wish to access. + :param object [options]: returns option results. + :param function [callback]: returns the results. + :returns: null + + +**Examples** + + + + An example of retrieving a collection from a db using the collection function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Grab a collection without a callback no safe mode + var col1 = db.collection('test_correctly_access_collections'); + + // Grab a collection with a callback but no safe operation + db.collection('test_correctly_access_collections', function(err, col2) { + assert.equal(null, err); + + // Grab a collection with a callback in safe mode, ensuring it exists (should fail as it's not created) + db.collection('test_correctly_access_collections', {safe:true}, function(err, col3) { + assert.ok(err != null); + + // Create the collection + db.createCollection('test_correctly_access_collections', function(err, result) { + + // Retry to get the collection, should work as it's now created + db.collection('test_correctly_access_collections', {safe:true}, function(err, col3) { + assert.equal(null, err); + + db.close(); + }); + }); + }); + }); + }); + + +----------- +collections +----------- + + +Fetch all collections for the current db. + +.. js:function:: collections(callback) + + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + An example of retrieving all collections for a db as Collection objects + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Create the collection + db.createCollection('test_correctly_access_collections', function(err, result) { + + // Retry to get the collection, should work as it's now created + db.collections(function(err, collections) { + assert.equal(null, err); + assert.ok(collections.length > 0); + + db.close(); + }); + }); + }); + + +---- +eval +---- + + +Evaluate javascript on the server + + + +Options + - **nolock** {Boolean, default:false}, Tell MongoDB not to block on the evaulation of the javascript. + +.. js:function:: eval(code[, parameters], [options], callback) + + :param code code: javascript to execute on server. + :param object [parameters]: the parameters for the call. + :param object [options]: the options + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A whole bunch of examples on how to use eval on the server. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Evaluate a function on the server with the parameter 3 passed in + db.eval('function (x) {return x;}', [3], function(err, result) { + assert.equal(3, result); + }); + + // Evaluate a function on the server with the parameter 3 passed in no lock aquired for eval + // on server + db.eval('function (x) {return x;}', [3], {nolock:true}, function(err, result) { + assert.equal(3, result); + }); + + // Evaluate a function on the server that writes to a server collection + db.eval('function (x) {db.test_eval.save({y:x});}', [5], function(err, result) { + // Locate the entry + client.collection('test_eval', function(err, collection) { + collection.findOne(function(err, item) { + assert.equal(5, item.y); + }); + }); + }); + + // Evaluate a function with 2 parameters passed in + db.eval('function (x, y) {return x + y;}', [2, 3], function(err, result) { + assert.equal(5, result); + }); + + // Evaluate a function with no parameters passed in + db.eval('function () {return 5;}', function(err, result) { + assert.equal(5, result); + }); + + // Evaluate a statement + db.eval('2 + 3;', function(err, result) { + assert.equal(5, result); + }); + + // Evaluate a statement using the code object + db.eval(new Code("2 + 3;"), function(err, result) { + assert.equal(5, result); + }); + + // Evaluate a statement using the code object including a scope + db.eval(new Code("return i;", {'i':2}), function(err, result) { + assert.equal(2, result); + }); + + // Evaluate a statement using the code object including a scope + db.eval(new Code("i + 3;", {'i':2}), function(err, result) { + assert.equal(5, result); + }); + + // Evaluate an illegal statement + db.eval("5 ++ 5;", function(err, result) { + assert.ok(err instanceof Error); + assert.ok(err.message != null); + // Let's close the db + test.done(); + }); + + db.close(); + test.done(); + }); + + +----------- +dereference +----------- + + +Dereference a dbref, against a db + +.. js:function:: dereference(dbRef, callback) + + :param dbref dbRef: db reference object we wish to resolve. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + An example of dereferencing values. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Get a second db + var secondDb = db.db('integration_tests_2'); + + // Create a dereference example + secondDb.createCollection('test_deref_examples', function(err, collection) { + + // Insert a document in the collection + collection.insert({'a':1}, {safe:true}, function(err, ids) { + + // Let's build a db reference and resolve it + var dbRef = new DBRef('test_deref_examples', ids[0]._id, 'integration_tests_2'); + + // Resolve it including a db resolve + db.dereference(dbRef, function(err, item) { + assert.equal(1, item.a); + + // Let's build a db reference and resolve it + var dbRef = new DBRef('test_deref_examples', ids[0]._id); + + // Simple local resolve + secondDb.dereference(dbRef, function(err, item) { + assert.equal(1, item.a); + + db.close(); + }); + }); + }); + }); + }); + + +------ +logout +------ + + +Logout user from server, fire off on all connections and remove all auth info + +.. js:function:: logout(callback) + + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + An example of using the logout command for the database. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Add a user to the database + db.addUser('user', 'name', function(err, result) { + assert.equal(null, err); + + // Authenticate + db.authenticate('user', 'name', function(err, result) { + assert.equal(true, result); + + // Logout the db + db.logout(function(err, result) { + assert.equal(true, result); + + db.close(); + }); + }); + }); + }); + + +------------ +authenticate +------------ + + +Authenticate a user against the server. + +.. js:function:: authenticate(username, password, callback) + + :param string username: username. + :param string password: password. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + An example of using the authenticate command. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Add a user to the database + db.addUser('user', 'name', function(err, result) { + assert.equal(null, err); + + // Authenticate + db.authenticate('user', 'name', function(err, result) { + assert.equal(true, result); + + db.close(); + }); + }); + }); + + +------- +addUser +------- + + +Add a user to the database. + +.. js:function:: addUser(username, password, callback) + + :param string username: username. + :param string password: password. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + An example of adding a user to the database. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Add a user to the database + db.addUser('user', 'name', function(err, result) { + assert.equal(null, err); + + db.close(); + }); + }); + + +---------- +removeUser +---------- + + +Remove a user from a database + +.. js:function:: removeUser(username, callback) + + :param string username: username. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + An example of dereferencing values. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Add a user to the database + db.addUser('user', 'name', function(err, result) { + assert.equal(null, err); + + // Authenticate + db.authenticate('user', 'name', function(err, result) { + assert.equal(true, result); + + // Logout the db + db.logout(function(err, result) { + assert.equal(true, result); + + // Remove the user from the db + db.removeUser('user', function(err, result) { + + // Authenticate + db.authenticate('user', 'name', function(err, result) { + assert.equal(false, result); + + db.close(); + }); + }); + }); + }); + }); + }); + + +---------------- +createCollection +---------------- + + +Creates a collection on a server pre-allocating space, need to create f.ex capped collections. + + + +Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + - **slaveOk** {Boolean, default:false}, Allow reads from secondaries. + - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. + - **raw** {Boolean, default:false}, perform all operations using raw bson objects. + - **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. + - **capped** {Boolean, default:false}, create a capped collection. + - **size** {Number}, the size of the capped collection in bytes. + - **max** {Number}, the maximum number of documents in the capped collection. + - **autoIndexId** {Boolean, default:false}, create an index on the _id field of the document, not created automatically on capped collections. + +.. js:function:: createCollection(collectionName[, options], callback) + + :param string collectionName: the collection name we wish to access. + :param object [options]: returns option results. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A simple example showing the creation of a collection. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Create a capped collection with a maximum of 1000 documents + db.createCollection("a_simple_collection", {capped:true, size:10000, max:1000, safe:true}, function(err, collection) { + assert.equal(null, err); + + // Insert a document in the capped collection + collection.insert({a:1}, {safe:true}, function(err, result) { + assert.equal(null, err); + + db.close(); + }); + }); + }); + + +------- +command +------- + + +Execute a command hash against MongoDB. This lets you acess any commands not available through the api on the server. + +.. js:function:: command(selector, callback) + + :param object selector: the command hash to send to the server, ex: {ping:1}. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A simple example creating, dropping a collection and then verifying that the collection is gone. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Execute ping against the server + db.command({ping:1}, function(err, result) { + assert.equal(null, err); + + db.close(); + }); + }); + + +-------------- +dropCollection +-------------- + + +Drop a collection from the database, removing it permanently. New accesses will create a new collection. + +.. js:function:: dropCollection(collectionName, callback) + + :param string collectionName: the name of the collection we wish to drop. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A simple example executing a command against the server. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Execute ping against the server + db.command({ping:1}, function(err, result) { + assert.equal(null, err); + + // Create a capped collection with a maximum of 1000 documents + db.createCollection("a_simple_create_drop_collection", {capped:true, size:10000, max:1000, safe:true}, function(err, collection) { + assert.equal(null, err); + + // Insert a document in the capped collection + collection.insert({a:1}, {safe:true}, function(err, result) { + assert.equal(null, err); + + // Drop the collection from this world + db.dropCollection("a_simple_create_drop_collection", function(err, result) { + assert.equal(null, err); + + // Verify that the collection is gone + db.collectionNames("a_simple_create_drop_collection", function(err, names) { + assert.equal(0, names.length); + + db.close(); + }); + }); + }); + }); + }); + }); + + +---------------- +renameCollection +---------------- + + +Rename a collection. + +.. js:function:: renameCollection(fromCollection, toCollection, callback) + + :param string fromCollection: the name of the current collection we wish to rename. + :param string toCollection: the new name of the collection. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A simple example creating, dropping a collection and then verifying that the collection is gone. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Create a collection + db.createCollection("simple_rename_collection", {safe:true}, function(err, collection) { + assert.equal(null, err); + + // Insert a document in the collection + collection.insert({a:1}, {safe:true}, function(err, result) { + assert.equal(null, err); + + // Rename the collection + db.renameCollection("simple_rename_collection", "simple_rename_collection_2", function(err, collection2) { + assert.equal(null, err); + + // Retrieve the number of documents from the collection + collection2.count(function(err, count) { + assert.equal(1, count); + + // Verify that the collection is gone + db.collectionNames("simple_rename_collection", function(err, names) { + assert.equal(0, names.length); + + // Verify that the new collection exists + db.collectionNames("simple_rename_collection_2", function(err, names) { + assert.equal(1, names.length); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + + +--------- +lastError +--------- + + +Return last error message for the given connection, note options can be combined. + + + +Options + - **fsync** {Boolean, default:false}, option forces the database to fsync all files before returning. + - **j** {Boolean, default:false}, awaits the journal commit before returning, > MongoDB 2.0. + - **w** {Number}, until a write operation has been replicated to N servers. + - **wtimeout** {Number}, number of miliseconds to wait before timing out. + + + +Connection Options + - **connection** {Connection}, fire the getLastError down a specific connection. + +.. js:function:: lastError([options][, connectionOptions], callback) + + :param object [options]: returns option results. + :param object [connectionOptions]: returns option results. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A simple example using lastError on a single connection with a pool of 1. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Create a collection + db.createCollection("simple_rename_collection", {safe:true}, function(err, collection) { + assert.equal(null, err); + + // Insert a document in the collection + collection.insert({a:1}, function(err, result) { + assert.equal(null, err); + + // Execute lastError + db.lastError(function(err, result) { + assert.equal(null, err); + assert.equal(null, result[0].err); + + // Pick a specific connection and execute lastError against it + var connection = db.serverConfig.checkoutWriter(); + // Execute lastError + db.lastError({}, {connection:connection}, function(err, result) { + assert.equal(null, err); + assert.equal(null, result[0].err); + + db.close(); + }); + }); + }); + }); + }); + + +-------------- +previousErrors +-------------- + + +Return all errors up to the last time db reset_error_history was called. + + + +Options + - **connection** {Connection}, fire the getLastError down a specific connection. + +.. js:function:: previousErrors([options], callback) + + :param object [options]: returns option results. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A simple example using previousError to return the list of all errors, might be deprecated in the future. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Create a collection + db.createCollection("simple_previous_error_coll", {safe:true}, function(err, collection) { + assert.equal(null, err); + + // Force a unique index + collection.ensureIndex({a:1}, {unique:true}, function(err, result) { + assert.equal(null, err); + + // Force some errors + collection.insert([{a:1}, {a:1}, {a:1}, {a:2}], function(err, result) { + + // Pick a specific connection and execute lastError against it + var connection = db.serverConfig.checkoutWriter(); + + // Execute previousErrors + db.previousErrors({connection:connection}, function(err, result) { + assert.equal(null, err); + assert.equal(1, result.length); + assert.ok(result[0].err != null); + + db.close(); + }); + }); + }); + }); + }); + + +----------------- +resetErrorHistory +----------------- + + +Resets the error history of the mongo instance. + + + +Options + - **connection** {Connection}, fire the getLastError down a specific connection. + +.. js:function:: resetErrorHistory([options], callback) + + :param object [options]: returns option results. + :param function callback: returns the results. + :returns: null + + +**Examples** + + + + A simple example using resetErrorHistory to clean up the history of errors. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + assert.equal(null, err); + + // Create a collection + db.createCollection("simple_reset_error_history_coll", {safe:true}, function(err, collection) { + assert.equal(null, err); + + // Force a unique index + collection.ensureIndex({a:1}, {unique:true}, function(err, result) { + assert.equal(null, err); + + // Force some errors + collection.insert([{a:1}, {a:1}, {a:1}, {a:2}], function(err, result) { + // Pick a specific connection and execute lastError against it + var connection = db.serverConfig.checkoutWriter(); + + // Reset the error history + db.resetErrorHistory({connection:connection}, function(err, result) { + + // Execute previousErrors and validate that there are no errors left + db.previousErrors({connection:connection}, function(err, result) { + assert.equal(null, err); + assert.equal(1, result.length); + assert.equal(null, result[0].err); + + db.close(); + }); + }); + }); + }); + }); + }); + + +----------- +createIndex +----------- + + +Creates an index on the collection. + + + +Options + - **unique** {Boolean, default:false}, creates an unique index. + - **sparse** {Boolean, default:false}, creates a sparse index. + - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. + - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value + - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. + - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. + +.. js:function:: createIndex(collectionName, fieldOrSpec[, options], callback) + + :param string collectionName: name of the collection to create the index on. + :param object fieldOrSpec: fieldOrSpec that defines the index. + :param object [options]: additional options during update. + :param function callback: for results. + :returns: null + + +**Examples** + + + + A more complex createIndex using a compound unique index in the background and dropping duplicated documents + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('more_complex_index_test', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + db.createIndex('more_complex_index_test', {a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Show that duplicate records got dropped + collection.find({}).toArray(function(err, items) { + assert.equal(null, err); + assert.equal(4, items.length); + + // Peform a query, with explain to show we hit the query + collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { + assert.equal(null, err); + assert.ok(explanation[0].indexBounds.a != null); + assert.ok(explanation[0].indexBounds.b != null); + + db.close(); + }); + }) + }); + }); + }); + }); + + +----------- +ensureIndex +----------- + + +Ensures that an index exists, if it does not it creates it + + + +Options + - **unique** {Boolean, default:false}, creates an unique index. + - **sparse** {Boolean, default:false}, creates a sparse index. + - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. + - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value + - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. + - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. + - **v** {Number}, specify the format version of the indexes. + +.. js:function:: ensureIndex(collectionName, fieldOrSpec[, options], callback) + + :param string collectionName: name of the collection to create the index on. + :param object fieldOrSpec: fieldOrSpec that defines the index. + :param object [options]: additional options during update. + :param function callback: for results. + :returns: null + + +**Examples** + + + + A more complex ensureIndex using a compound unique index in the background and dropping duplicated documents. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('more_complex_ensure_index_test', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + db.ensureIndex('more_complex_ensure_index_test', {a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Show that duplicate records got dropped + collection.find({}).toArray(function(err, items) { + assert.equal(null, err); + assert.equal(4, items.length); + + // Peform a query, with explain to show we hit the query + collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { + assert.equal(null, err); + assert.ok(explanation[0].indexBounds.a != null); + assert.ok(explanation[0].indexBounds.b != null); + + db.close(); + }); + }) + }); + }); + }); + }); + + +---------- +cursorInfo +---------- + + +Returns the information available on allocated cursors. + +.. js:function:: cursorInfo(callback) + + :param function callback: for results. + :returns: null + + +**Examples** + + + + A Simple example of returning current cursor information in MongoDB + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('cursor_information_collection', function(err, collection) { + assert.equal(null, err); + + // Create a bunch of documents so we can force the creation of a cursor + var docs = []; + for(var i = 0; i < 1000; i++) { + docs.push({a:'hello world hello world hello world hello world hello world hello world hello world hello world'}); + } + + // Insert a bunch of documents for the index + collection.insert(docs, {safe:true}, function(err, result) { + assert.equal(null, err); + + // Let's set a cursor + var cursor = collection.find({}, {batchSize:10}); + cursor.nextObject(function(err, item) { + assert.equal(null, err); + + // Let's grab the information about the cursors on the database + db.cursorInfo(function(err, cursorInformation) { + assert.ok(cursorInformation.totalOpen > 0); + + db.close(); + }); + }); + }); + }); + }); + + +--------- +dropIndex +--------- + + +Drop an index on a collection. + +.. js:function:: dropIndex(collectionName, indexName, callback) + + :param string collectionName: the name of the collection where the command will drop an index. + :param string indexName: name of the index to drop. + :param function callback: for results. + :returns: null + + +**Examples** + + + + An examples showing the creation and dropping of an index + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('create_and_drop_an_index', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.ensureIndex({a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Drop the index + db.dropIndex("create_and_drop_an_index", "a_1_b_1", function(err, result) { + assert.equal(null, err); + + // Verify that the index is gone + collection.indexInformation(function(err, indexInformation) { + assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); + assert.equal(null, indexInformation.a_1_b_1); + + db.close(); + }); + }); + }); + }); + }); + }); + + +------- +reIndex +------- + + +Reindex all indexes on the collection +Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections. + +.. js:function:: reIndex(collectionName, callback) + + :param string collectionName: the name of the collection. + :param function callback: returns the results. + +**Examples** + + + + An example showing how to force a reindex of a collection. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('create_and_drop_all_indexes', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4, c:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.ensureIndex({a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Force a reindex of the collection + db.reIndex('create_and_drop_all_indexes', function(err, result) { + assert.equal(null, err); + assert.equal(true, result); + + // Verify that the index is gone + collection.indexInformation(function(err, indexInformation) { + assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); + assert.deepEqual([ [ 'a', 1 ], [ 'b', 1 ] ], indexInformation.a_1_b_1); + + db.close(); + }); + }); + }); + }); + }); + }); + + +---------------- +indexInformation +---------------- + + +Retrieves this collections index info. + + + +Options + - **full** {Boolean, default:false}, returns the full raw index information. + +.. js:function:: indexInformation(collectionName[, options], callback) + + :param string collectionName: the name of the collection. + :param object [options]: additional options during update. + :param function callback: returns the index information. + :returns: null + + +**Examples** + + + + An example showing the information returned by indexInformation + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection we want to drop later + db.createCollection('more_index_information_test', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Create an index on the a field + collection.ensureIndex({a:1, b:1} + , {unique:true, background:true, dropDups:true}, function(err, indexName) { + + // Fetch basic indexInformation for collection + db.indexInformation('more_index_information_test', function(err, indexInformation) { + assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); + assert.deepEqual([ [ 'a', 1 ], [ 'b', 1 ] ], indexInformation.a_1_b_1); + + // Fetch full index information + collection.indexInformation({full:true}, function(err, indexInformation) { + assert.deepEqual({ _id: 1 }, indexInformation[0].key); + assert.deepEqual({ a: 1, b: 1 }, indexInformation[1].key); + + db.close(); + }); + }); + }); + }); + }); + }); + + +------------ +dropDatabase +------------ + + +Drop a database. + +.. js:function:: dropDatabase(callback) + + :param function callback: returns the index information. + :returns: null + + +**Examples** + + + + An examples showing the dropping of a database + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests_to_drop', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Create a collection + db.createCollection('more_index_information_test', function(err, collection) { + assert.equal(null, err); + + // Insert a bunch of documents for the index + collection.insert([{a:1, b:1}, {a:1, b:1} + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + assert.equal(null, err); + + // Let's drop the database + db.dropDatabase(function(err, result) { + assert.equal(null, err); + + // Get the admin database + db.admin().listDatabases(function(err, dbs) { + // Grab the databases + dbs = dbs.databases; + // Did we find the db + var found = false; + + // Check if we have the db in the list + for(var i = 0; i < dbs.length; i++) { + if(dbs[i].name == 'integration_tests_to_drop') found = true; + } + + // We should not find the databases + assert.equal(false, found); + + db.close(); + }); + }); + }); + }); + }); + + +---------- +Db.connect +---------- + + +Connect to MongoDB using a url as documented at + + + +www.mongodb.org/display/DOCS/Connections + +.. js:function:: Db.connect(url, options, callback) + + :param string url: connection url for MongoDB. + :param object options: additional options not covered by the url. + :param function callback: callback returns the initialized db. + :returns: null + + +**Examples** + + + + Example of a simple url connection string. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Connect to the server + Db.connect('mongodb://localhost:27017/integration_tests', function(err, db) { + assert.equal(null, err); + + db.close(); + }); + diff --git a/_sources/api-generated/grid.txt b/_sources/api-generated/grid.txt new file mode 100644 index 00000000000..c05703ea94c --- /dev/null +++ b/_sources/api-generated/grid.txt @@ -0,0 +1,189 @@ +====== +Grid() +====== + +------------------ +Constructor +------------------ + + +A class representation of a simple Grid interface. + + + .. js:class:: Grid() + + :param db db: A database instance to interact with. + :param string [fsName]: optional different root collection for GridFS. + :returns: grid + + + +--- +put +--- + + +Puts binary data to the grid + +.. js:function:: put(data[, options]) + + :param buffer data: buffer with Binary Data. + :param object [options]: the options for the files. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the put method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Create a new grid instance + var grid = new Grid(db, 'fs'); + // Some data to write + var originalData = new Buffer('Hello world'); + // Write data to grid + grid.put(originalData, {}, function(err, result) { + // Fetch the content + grid.get(result._id, function(err, data) { + assert.deepEqual(originalData.toString('hex'), data.toString('hex')); + + db.close(); + }); + }); + }); + + +--- +get +--- + + +Get binary data to the grid + +.. js:function:: get(id) + + :param objectid id: ObjectID for file. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the get method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Create a new grid instance + var grid = new Grid(db, 'fs'); + // Some data to write + var originalData = new Buffer('Hello world'); + // Write data to grid + grid.put(originalData, {}, function(err, result) { + // Fetch the content + grid.get(result._id, function(err, data) { + assert.deepEqual(originalData.toString('base64'), data.toString('base64')); + + // Should fail due to illegal objectID + grid.get('not an id', function(err, result) { + assert.ok(err != null); + + db.close(); + }); + }); + }); + }); + + +------ +delete +------ + + +Delete file from grid + +.. js:function:: delete(id) + + :param objectid id: ObjectID for file. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the delete method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Create a new grid instance + var grid = new Grid(client, 'fs'); + // Some data to write + var originalData = new Buffer('Hello world'); + // Write data to grid + grid.put(originalData, {}, function(err, result) { + + // Delete file + grid.delete(result._id, function(err, result2) { + assert.equal(null, err); + assert.equal(true, result2); + + // Fetch the content, showing that the file is gone + grid.get(result._id, function(err, data) { + assert.ok(err != null); + assert.equal(null, data); + + db.close(); + }); + }); + }); + }); + diff --git a/_sources/api-generated/gridstore.txt b/_sources/api-generated/gridstore.txt new file mode 100644 index 00000000000..de59e732600 --- /dev/null +++ b/_sources/api-generated/gridstore.txt @@ -0,0 +1,1760 @@ +=========== +GridStore() +=========== + +------------------ +Constructor +------------------ + + +A class representation of a file stored in GridFS. + + + .. js:class:: GridStore() + + :param db db: A database instance to interact with. + :param string fileIdObject: ObjectID or the name for the file. + :param string mode: set the mode for this file. + :param object options: optional properties to specify. Recognized keys: + :returns: gridstore + + +Modes + - **"r"** - read only. This is the default mode. + - **"w"** - write in truncate mode. Existing data will be overwriten. + - **w+"** - write in edit mode. + + + +Options + - **root** {String}, root collection to use. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. + - **chunk_type** {String}, mime type of the file. Defaults to **{GridStore.DEFAULT_CONTENT_TYPE}**. + - **chunk_size** {Number}, size for the chunk. Defaults to **{Chunk.DEFAULT_CHUNK_SIZE}**. + - **metadata** {Object}, arbitrary data the user wants to store. + + +------------------ +Constants +------------------ + +.. csv-table:: + :header: "Constant Name", "Value", "Description" + :widths: 15, 10, 30 + + "GridStore.DEFAULT_ROOT_COLLECTION", "'fs'", "The collection to be used for holding the files and chunks collection." + "GridStore.DEFAULT_CONTENT_TYPE", "'binary/octet-stream'", "Default file mime type" + "GridStore.IO_SEEK_SET", "0", "Seek mode where the given length is absolute." + "GridStore.IO_SEEK_CUR", "1", "Seek mode where the given length is an offset to the current read/write head." + "GridStore.IO_SEEK_END", "2", "Seek mode where the given length is an offset to the end of the file." + +------------------ +Properties +------------------ + + +Returns the current chunksize of the file. + +.. js:attribute:: chunkSize number [Getter|Setter] + + + +The md5 checksum for this file. + +.. js:attribute:: md5 number [Getter|Setter] + + +---- +open +---- + + +Opens the file from the database and initialize this object. Also creates a +new one if file does not exist. + +.. js:function:: open(callback) + + :param function callback: this will be called after executing this method. The first parameter will contain an **{Error}** object and the second parameter will be null if an error occured. Otherwise, the first parameter will be null and the second will contain the reference to this object. + :returns: null + + +**Examples** + + + + A simple example showing opening a file using a filename, writing to it and saving it. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Create a new instance of the gridstore + var gridStore = new GridStore(db, 'ourexamplefiletowrite.txt', 'w'); + + // Open the file + gridStore.open(function(err, gridStore) { + + // Write some data to the file + gridStore.write('bar', function(err, gridStore) { + assert.equal(null, err); + + // Close (Flushes the data to MongoDB) + gridStore.close(function(err, result) { + assert.equal(null, err); + + // Verify that the file exists + GridStore.exist(db, 'ourexamplefiletowrite.txt', function(err, result) { + assert.equal(null, err); + assert.equal(true, result); + + db.close(); + }); + }); + }); + }); + }); + + + + A simple example showing opening a file using an ObjectID, writing to it and saving it. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Create a new instance of the gridstore + var gridStore = new GridStore(db, fileId, 'w'); + + // Open the file + gridStore.open(function(err, gridStore) { + + // Write some data to the file + gridStore.write('bar', function(err, gridStore) { + assert.equal(null, err); + + // Close (Flushes the data to MongoDB) + gridStore.close(function(err, result) { + assert.equal(null, err); + + // Verify that the file exists + GridStore.exist(db, fileId, function(err, result) { + assert.equal(null, err); + assert.equal(true, result); + + db.close(); + }); + }); + }); + }); + }); + + +--------- +writeFile +--------- + + +Stores a file from the file system to the GridFS database. + +.. js:function:: writeFile(file, callback) + + :param string file: the file to store. + :param function callback: this will be called after this method is executed. The first parameter will be null and the the second will contain the reference to this object. + :returns: null + + +**Examples** + + + + A simple example showing how to write a file to Gridstore using file location path. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Read the filesize of file on disk (provide your own) + var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; + // Read the buffered data for comparision reasons + var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Write the file to gridFS + gridStore.writeFile('./test/gridstore/test_gs_weird_bug.png', function(err, doc) { + + // Read back all the written content and verify the correctness + GridStore.read(db, fileId, function(err, fileData) { + assert.equal(data.toString('hex'), fileData.toString('hex')) + assert.equal(fileSize, fileData.length); + + db.close(); + }); + }); + }); + }); + + + + A simple example showing how to write a file to Gridstore using a file handle. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Read the filesize of file on disk (provide your own) + var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; + // Read the buffered data for comparision reasons + var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); + + // Open a file handle for reading the file + var fd = fs.openSync('./test/gridstore/test_gs_weird_bug.png', 'r', 0666); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Write the file to gridFS using the file handle + gridStore.writeFile(fd, function(err, doc) { + + // Read back all the written content and verify the correctness + GridStore.read(db, fileId, function(err, fileData) { + assert.equal(data.toString('hex'), fileData.toString('hex')); + assert.equal(fileSize, fileData.length); + + db.close(); + }); + }); + }); + }); + + +----- +write +----- + + +Writes some data. This method will work properly only if initialized with mode "w" or "w+". + +.. js:function:: write(data[, close], callback) + + :param string data: the data to write. + :param boolean [close]: closes this file after writing if set to true. + :param function callback: this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. + :returns: null + + +**Examples** + + + + A simple example showing how to use the write command with strings and Buffers. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Write a text string + gridStore.write('Hello world', function(err, gridStore) { + + // Write a buffer + gridStore.write(new Buffer('Buffer Hello world'), function(err, gridStore) { + + // Close the + gridStore.close(function(err, result) { + + // Read back all the written content and verify the correctness + GridStore.read(db, fileId, function(err, fileData) { + assert.equal('Hello worldBuffer Hello world', fileData.toString()); + + db.close(); + }); + }); + }); + }); + }); + }); + + +----- +close +----- + + +Saves this file to the database. This will overwrite the old entry if it +already exists. This will work properly only if mode was initialized to +"w" or "w+". + +.. js:function:: close(callback) + + :param function callback: this will be called after executing this method. Passes an **{Error}** object to the first parameter and null to the second if an error occured. Otherwise, passes null to the first and a reference to this object to the second. + :returns: null + + +**Examples** + + + + A simple example showing how to use the write command with strings and Buffers. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Write a text string + gridStore.write('Hello world', function(err, gridStore) { + + // Close the + gridStore.close(function(err, result) { + assert.equal(err, null); + + db.close(); + }); + }); + }); + }); + + +--------------- +chunkCollection +--------------- + + +Retrieve this file's chunks collection. + +.. js:function:: chunkCollection(callback) + + :param function callback: this will be called after executing this method. An exception object will be passed to the first parameter when an error occured or null otherwise. A new **{Collection}** object will be passed to the second parameter if no error occured. + :returns: null + + +**Examples** + + + + A simple example showing how to access the chunks collection object. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Access the Chunk collection + gridStore.chunkCollection(function(err, collection) { + assert.equal(err, null); + assert.ok(collection instanceof Collection); + + db.close(); + }); + }); + }); + + +------ +unlink +------ + + +Deletes all the chunks of this file in the database. + +.. js:function:: unlink(callback) + + :param function callback: this will be called after this method executes. Passes null to the first and true to the second argument. + :returns: null + + +**Examples** + + + + A simple example showing how to use the instance level unlink command to delete a gridstore item. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Write a text string + gridStore.write('Hello world', function(err, gridStore) { + + // Close the + gridStore.close(function(err, result) { + assert.equal(err, null); + + // Open the file again and unlin it + new GridStore(db, fileId, 'r').open(function(err, gridStore) { + + // Unlink the file + gridStore.unlink(function(err, result) { + assert.equal(null, err); + + // Verify that the file no longer exists + GridStore.exist(db, fileId, function(err, result) { + assert.equal(null, err); + assert.equal(false, result); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + + +---------- +collection +---------- + + +Retrieves the file collection associated with this object. + +.. js:function:: collection(callback) + + :param function callback: this will be called after executing this method. An exception object will be passed to the first parameter when an error occured or null otherwise. A new **{Collection}** object will be passed to the second parameter if no error occured. + :returns: null + + +**Examples** + + + + A simple example showing how to access the files collection object. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Access the Chunk collection + gridStore.collection(function(err, collection) { + assert.equal(err, null); + assert.ok(collection instanceof Collection); + + db.close(); + }); + }); + }); + + +--------- +readlines +--------- + + +Reads the data of this file. + +.. js:function:: readlines([separator], callback) + + :param string [separator]: the character to be recognized as the newline separator. + :param function callback: This will be called after this method is executed. The first parameter will be null and the second parameter will contain an array of strings representing the entire data, each element representing a line including the separator character. + :returns: null + + +**Examples** + + + + A simple example showing reading back using readlines to split the text into lines by the seperator provided. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Write one line to gridStore + gridStore.puts("line one", function(err, gridStore) { + + // Write second line to gridStore + gridStore.puts("line two", function(err, gridStore) { + + // Write third line to gridStore + gridStore.puts("line three", function(err, gridStore) { + + // Flush file to disk + gridStore.close(function(err, result) { + + // Open file for reading + gridStore = new GridStore(db, fileId, 'r'); + gridStore.open(function(err, gridStore) { + + // Read all the lines and verify correctness + gridStore.readlines(function(err, lines) { + assert.deepEqual(["line one\n", "line two\n", "line three\n"], lines); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + }); + + +------ +rewind +------ + + +Deletes all the chunks of this file in the database if mode was set to "w" or +"w+" and resets the read/write head to the initial position. + +.. js:function:: rewind(callback) + + :param function callback: this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. + :returns: null + + +**Examples** + + + + A simple example showing how to rewind and overwrite the file. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Create a new file + var gridStore = new GridStore(db, fileId, "w"); + // Open the file + gridStore.open(function(err, gridStore) { + // Write to the file + gridStore.write("hello, world!", function(err, gridStore) { + // Flush the file to disk + gridStore.close(function(err, result) { + + // Reopen the file + gridStore = new GridStore(db, fileId, "w"); + gridStore.open(function(err, gridStore) { + // Write some more text to the file + gridStore.write('some text is inserted here', function(err, gridStore) { + + // Let's rewind to truncate the file + gridStore.rewind(function(err, gridStore) { + + // Write something from the start + gridStore.write('abc', function(err, gridStore) { + + // Flush the data to mongodb + gridStore.close(function(err, result) { + + // Verify that the new data was written + GridStore.read(db, fileId, function(err, data) { + assert.equal("abc", data); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + +---- +read +---- + + +Retrieves the contents of this file and advances the read/write head. Works with Buffers only. + +**There are 3 signatures for this method** + + + +(callback) +(length, callback) +(length, buffer, callback) + +.. js:function:: read([length][, buffer], callback) + + :param number [length]: the number of characters to read. Reads all the characters from the read/write head to the EOF if not specified. + :param string [buffer]: a string to hold temporary data. This is used for storing the string data read so far when recursively calling this method. + :param function callback: this will be called after this method is executed. null will be passed to the first parameter and a string containing the contents of the buffer concatenated with the contents read from this file will be passed to the second. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the read method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Read in the content of a file + var data = fs.readFileSync('./test/gridstore/iya_logo_final_bw.jpg'); + // Create a new file + var gs = new GridStore(db, "test", "w"); + // Open the file + gs.open(function(err, gs) { + // Write the file to GridFS + gs.write(data, function(err, gs) { + // Flush to the GridFS + gs.close(function(err, gs) { + + // Define the file we wish to read + var gs2 = new GridStore(db, "test", "r"); + // Open the file + gs2.open(function(err, gs) { + // Set the pointer of the read head to the start of the gridstored file + gs2.seek(0, function() { + // Read the entire file + gs2.read(function(err, data2) { + // Compare the file content against the orgiinal + assert.equal(data.toString('hex'), data2.toString('hex')); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + + +---- +tell +---- + + +Retrieves the position of the read/write head of this file. + +.. js:function:: tell(callback) + + :param function callback: This gets called after this method terminates. null is passed to the first parameter and the position is passed to the second. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the tell method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Create a new file + var gridStore = new GridStore(db, "test_gs_tell", "w"); + // Open the file + gridStore.open(function(err, gridStore) { + // Write a string to the file + gridStore.write("hello, world!", function(err, gridStore) { + // Flush the file to GridFS + gridStore.close(function(err, result) { + + // Open the file in read only mode + var gridStore2 = new GridStore(db, "test_gs_tell", "r"); + gridStore2.open(function(err, gridStore) { + + // Read the first 5 characters + gridStore.read(5, function(err, data) { + assert.equal("hello", data); + + // Get the current position of the read head + gridStore.tell(function(err, position) { + assert.equal(5, position); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + + +---- +seek +---- + + +Moves the read/write head to a new location. + + + +There are 3 signatures for this method + + + +Seek Location Modes + - **GridStore.IO_SEEK_SET**, **(default)** set the position from the start of the file. + - **GridStore.IO_SEEK_CUR**, set the position from the current position in the file. + - **GridStore.IO_SEEK_END**, set the position from the end of the file. + +.. js:function:: seek([position][, seekLocation], callback) + + :param number [position]: the position to seek to + :param number [seekLocation]: seek mode. Use one of the Seek Location modes. + :param function callback: this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the seek method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Create a file and open it + var gridStore = new GridStore(db, "test_gs_seek_with_buffer", "w"); + gridStore.open(function(err, gridStore) { + // Write some content to the file + gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) { + // Flush the file to GridFS + gridStore.close(function(result) { + + // Open the file in read mode + var gridStore2 = new GridStore(db, "test_gs_seek_with_buffer", "r"); + gridStore2.open(function(err, gridStore) { + // Seek to start + gridStore.seek(0, function(err, gridStore) { + // Read first character and verify + gridStore.getc(function(err, chr) { + assert.equal('h', chr); + }); + }); + }); + + // Open the file in read mode + var gridStore3 = new GridStore(db, "test_gs_seek_with_buffer", "r"); + gridStore3.open(function(err, gridStore) { + // Seek to 7 characters from the beginning off the file and verify + gridStore.seek(7, function(err, gridStore) { + gridStore.getc(function(err, chr) { + assert.equal('w', chr); + }); + }); + }); + + // Open the file in read mode + var gridStore5 = new GridStore(db, "test_gs_seek_with_buffer", "r"); + gridStore5.open(function(err, gridStore) { + // Seek to -1 characters from the end off the file and verify + gridStore.seek(-1, GridStore.IO_SEEK_END, function(err, gridStore) { + gridStore.getc(function(err, chr) { + assert.equal('!', chr); + }); + }); + }); + + // Open the file in read mode + var gridStore6 = new GridStore(db, "test_gs_seek_with_buffer", "r"); + gridStore6.open(function(err, gridStore) { + // Seek to -6 characters from the end off the file and verify + gridStore.seek(-6, GridStore.IO_SEEK_END, function(err, gridStore) { + gridStore.getc(function(err, chr) { + assert.equal('w', chr); + }); + }); + }); + + // Open the file in read mode + var gridStore7 = new GridStore(db, "test_gs_seek_with_buffer", "r"); + gridStore7.open(function(err, gridStore) { + + // Seek forward 7 characters from the current read position and verify + gridStore.seek(7, GridStore.IO_SEEK_CUR, function(err, gridStore) { + gridStore.getc(function(err, chr) { + assert.equal('w', chr); + + // Seek forward -1 characters from the current read position and verify + gridStore.seek(-1, GridStore.IO_SEEK_CUR, function(err, gridStore) { + gridStore.getc(function(err, chr) { + assert.equal('w', chr); + + // Seek forward -4 characters from the current read position and verify + gridStore.seek(-4, GridStore.IO_SEEK_CUR, function(err, gridStore) { + gridStore.getc(function(err, chr) { + assert.equal('o', chr); + + // Seek forward 3 characters from the current read position and verify + gridStore.seek(3, GridStore.IO_SEEK_CUR, function(err, gridStore) { + gridStore.getc(function(err, chr) { + assert.equal('o', chr); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + +--- +eof +--- + + +Verify if the file is at EOF. + +.. js:function:: eof() + + :returns: boolean true if the read/write head is at the end of this file. + + +**Examples** + + + + A simple example showing the usage of the eof method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Open the file in write mode + var gridStore = new GridStore(db, 'test_gs_empty_file_eof', "w"); + gridStore.open(function(err, gridStore) { + // Flush the empty file to GridFS + gridStore.close(function(err, gridStore) { + + // Open the file in read mode + var gridStore2 = new GridStore(db, 'test_gs_empty_file_eof', "r"); + gridStore2.open(function(err, gridStore) { + // Verify that we are at the end of the file + assert.equal(true, gridStore.eof()); + + db.close(); + }) + }); + }); + }); + + +---- +getc +---- + + +Retrieves a single character from this file. + +.. js:function:: getc(callback) + + :param function callback: this gets called after this method is executed. Passes null to the first parameter and the character read to the second or null to the second if the read/write head is at the end of the file. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the seek method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Create a file and open it + var gridStore = new GridStore(db, "test_gs_getc_file", "w"); + gridStore.open(function(err, gridStore) { + // Write some content to the file + gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) { + // Flush the file to GridFS + gridStore.close(function(result) { + + // Open the file in read mode + var gridStore2 = new GridStore(db, "test_gs_getc_file", "r"); + gridStore2.open(function(err, gridStore) { + + // Read first character and verify + gridStore.getc(function(err, chr) { + assert.equal('h', chr); + + db.close(); + }); + }); + }); + }); + }); + }); + + +---- +puts +---- + + +Writes a string to the file with a newline character appended at the end if +the given string does not have one. + +.. js:function:: puts(string, callback) + + :param string string: the string to write. + :param function callback: this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the puts method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Open a file for writing + var gridStore = new GridStore(db, "test_gs_puts_and_readlines", "w"); + gridStore.open(function(err, gridStore) { + + // Write a line to the file using the puts method + gridStore.puts("line one", function(err, gridStore) { + + // Flush the file to GridFS + gridStore.close(function(err, result) { + + // Read in the entire contents + GridStore.read(db, 'test_gs_puts_and_readlines', function(err, data) { + assert.equal("line one\n", data.toString()); + + db.close(); + }); + }); + }); + }); + }); + + +------ +stream +------ + + +Returns read stream based on this GridStore file + + + +Events + - **data** {function(item) {}} the data event triggers when a document is ready. + - **end** {function() {}} the end event triggers when there is no more documents available. + - **close** {function() {}} the close event triggers when the stream is closed. + - **error** {function(err) {}} the error event triggers if an error happens. + +.. js:function:: stream(autoclose) + + :param boolean autoclose: if true current GridStore will be closed when EOF and 'close' event will be fired + :returns: null + + +**Examples** + + + + A simple example showing the usage of the stream method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Open a file for reading + var gridStoreR = new GridStore(db, "test_gs_read_stream", "r"); + // Open a file for writing + var gridStoreW = new GridStore(db, "test_gs_read_stream", "w"); + // Read in the data of a file + var data = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png"); + + var readLen = 0; + var gotEnd = 0; + + // Open the file we are writting to + gridStoreW.open(function(err, gs) { + // Write the file content + gs.write(data, function(err, gs) { + // Flush the file to GridFS + gs.close(function(err, result) { + + // Open the read file + gridStoreR.open(function(err, gs) { + + // Create a stream to the file + var stream = gs.stream(true); + + // Register events + stream.on("data", function(chunk) { + // Record the length of the file + readLen += chunk.length; + }); + + stream.on("end", function() { + // Record the end was called + ++gotEnd; + }); + + stream.on("close", function() { + // Verify the correctness of the read data + assert.equal(data.length, readLen); + assert.equal(1, gotEnd); + + db.close(); + }); + }); + }); + }); + }); + }); + + +--------------- +GridStore.exist +--------------- + + +Checks if a file exists in the database. + +.. js:function:: GridStore.exist(db, name[, rootCollection], callback) + + :param db db: the database to query. + :param string name: the name of the file to look for. + :param string [rootCollection]: the root collection that holds the files and chunks collection. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. + :param function callback: this will be called after this method executes. Passes null to the first and passes true to the second if the file exists and false otherwise. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the Gridstore.exist method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Open a file for writing + var gridStore = new GridStore(db, null, "w"); + gridStore.open(function(err, gridStore) { + + // Writing some content to the file + gridStore.write("hello world!", function(err, gridStore) { + + // Flush the file to GridFS + gridStore.close(function(err, result) { + + // Check if the file exists using the id returned from the close function + GridStore.exist(db, result._id, function(err, result) { + assert.equal(true, result); + }) + + // Show that the file does not exist for a random ObjectID + GridStore.exist(db, new ObjectID(), function(err, result) { + assert.equal(false, result); + }); + + // Show that the file does not exist for a different file root + GridStore.exist(db, result._id, 'another_root', function(err, result) { + assert.equal(false, result); + + db.close(); + }); + }); + }); + }); + }); + + +-------------- +GridStore.list +-------------- + + +Gets the list of files stored in the GridFS. + +.. js:function:: GridStore.list(db[, rootCollection], callback) + + :param db db: the database to query. + :param string [rootCollection]: the root collection that holds the files and chunks collection. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. + :param function callback: this will be called after this method executes. Passes null to the first and passes an array of strings containing the names of the files. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the eof method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Open a file for writing + var gridStore = new GridStore(db, "foobar2", "w"); + gridStore.open(function(err, gridStore) { + + // Write some content to the file + gridStore.write("hello world!", function(err, gridStore) { + // Flush to GridFS + gridStore.close(function(err, result) { + + // List the existing files + GridStore.list(db, function(err, items) { + var found = false; + items.forEach(function(filename) { + if(filename == 'foobar2') found = true; + }); + + assert.ok(items.length >= 1); + assert.ok(found); + }); + + // List the existing files but return only the file ids + GridStore.list(db, {id:true}, function(err, items) { + var found = false; + items.forEach(function(id) { + assert.ok(typeof id == 'object'); + }); + + assert.ok(items.length >= 1); + }); + + // List the existing files in a specific root collection + GridStore.list(db, 'fs', function(err, items) { + var found = false; + items.forEach(function(filename) { + if(filename == 'foobar2') found = true; + }); + + assert.ok(items.length >= 1); + assert.ok(found); + }); + + // List the existing files in a different root collection where the file is not located + GridStore.list(client, 'my_fs', function(err, items) { + var found = false; + items.forEach(function(filename) { + if(filename == 'foobar2') found = true; + }); + + assert.ok(items.length >= 0); + assert.ok(!found); + + // Write another file to GridFS + var gridStore2 = new GridStore(db, "foobar3", "w"); + gridStore2.open(function(err, gridStore) { + // Write the content + gridStore2.write('my file', function(err, gridStore) { + // Flush to GridFS + gridStore.close(function(err, result) { + + // List all the available files and verify that our files are there + GridStore.list(db, function(err, items) { + var found = false; + var found2 = false; + + items.forEach(function(filename) { + if(filename == 'foobar2') found = true; + if(filename == 'foobar3') found2 = true; + }); + + assert.ok(items.length >= 2); + assert.ok(found); + assert.ok(found2); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + +-------------- +GridStore.read +-------------- + + +Reads the contents of a file. + + + +This method has the following signatures + + + +(db, name, callback) +(db, name, length, callback) +(db, name, length, offset, callback) +(db, name, length, offset, options, callback) + +.. js:function:: GridStore.read(db, name[, length], [offset], [options], callback) + + :param db db: the database to query. + :param string name: the name of the file. + :param number [length]: the size of data to read. + :param number [offset]: the offset from the head of the file of which to start reading from. + :param object [options]: the options for the file. + :param function callback: this will be called after this method executes. A string with an error message will be passed to the first parameter when the length and offset combination exceeds the length of the file while an Error object will be passed if other forms of error occured, otherwise, a string is passed. The second parameter will contain the data read if successful or null if an error occured. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the read method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Create a new file + var gridStore = new GridStore(db, null, "w"); + // Read in the content from a file, replace with your own + var data = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png"); + + // Open the file + gridStore.open(function(err, gridStore) { + // Write the binary file data to GridFS + gridStore.write(data, function(err, gridStore) { + // Flush the remaining data to GridFS + gridStore.close(function(err, result) { + + // Read in the whole file and check that it's the same content + GridStore.read(client, result._id, function(err, fileData) { + assert.equal(data.length, fileData.length); + + db.close(); + }); + }); + }); + }); + }); + + +------------------- +GridStore.readlines +------------------- + + +Reads the data of this file. + +.. js:function:: GridStore.readlines(db, name[, separator], [options], callback) + + :param db db: the database to query. + :param string name: the name of the file. + :param string [separator]: the character to be recognized as the newline separator. + :param object [options]: file options. + :param function callback: this will be called after this method is executed. The first parameter will be null and the second parameter will contain an array of strings representing the entire data, each element representing a line including the separator character. + :returns: null + + +**Examples** + + + + A simple example showing reading back using readlines to split the text into lines by the seperator provided. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Our file ID + var fileId = new ObjectID(); + + // Open a new file + var gridStore = new GridStore(db, fileId, 'w'); + + // Open the new file + gridStore.open(function(err, gridStore) { + + // Write one line to gridStore + gridStore.puts("line one", function(err, gridStore) { + + // Write second line to gridStore + gridStore.puts("line two", function(err, gridStore) { + + // Write third line to gridStore + gridStore.puts("line three", function(err, gridStore) { + + // Flush file to disk + gridStore.close(function(err, result) { + + // Read back all the lines + GridStore.readlines(db, fileId, function(err, lines) { + assert.deepEqual(["line one\n", "line two\n", "line three\n"], lines); + + db.close(); + }); + }); + }); + }); + }); + }); + }); + + +---------------- +GridStore.unlink +---------------- + + +Deletes the chunks and metadata information of a file from GridFS. + +.. js:function:: GridStore.unlink(db, names[, options]) + + :param db db: the database to interact with. + :param string names: the name/names of the files to delete. + :param object [options]: the options for the files. + :returns: null + + +**Examples** + + + + A simple example showing the usage of the GridStore.unlink method. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Open a new file for writing + var gridStore = new GridStore(db, "test_gs_unlink", "w"); + gridStore.open(function(err, gridStore) { + + // Write some content + gridStore.write("hello, world!", function(err, gridStore) { + + // Flush file to GridFS + gridStore.close(function(err, result) { + + // Verify the existance of the fs.files document + db.collection('fs.files', function(err, collection) { + collection.count(function(err, count) { + assert.equal(1, count); + }) + }); + + // Verify the existance of the fs.chunks chunk document + db.collection('fs.chunks', function(err, collection) { + collection.count(function(err, count) { + assert.equal(1, count); + + // Unlink the file (removing it) + GridStore.unlink(db, 'test_gs_unlink', function(err, gridStore) { + + // Verify that fs.files document is gone + db.collection('fs.files', function(err, collection) { + collection.count(function(err, count) { + assert.equal(0, count); + }) + }); + + // Verify that fs.chunks chunk documents are gone + db.collection('fs.chunks', function(err, collection) { + collection.count(function(err, count) { + assert.equal(0, count); + + db.close(); + }) + }); + }); + }) + }); + }); + }); + }); + }); + diff --git a/_sources/api-generated/index.txt b/_sources/api-generated/index.txt new file mode 100644 index 00000000000..7333d3cefcd --- /dev/null +++ b/_sources/api-generated/index.txt @@ -0,0 +1,15 @@ +================== +Driver API +================== + +.. toctree:: + :maxdepth: 2 + + admin + collection + db + cursor + cursorstream + gridstore + readstream + grid diff --git a/_sources/api-generated/readstream.txt b/_sources/api-generated/readstream.txt new file mode 100644 index 00000000000..5d908faeaeb --- /dev/null +++ b/_sources/api-generated/readstream.txt @@ -0,0 +1,253 @@ +============ +ReadStream() +============ + +------------------ +Constructor +------------------ + + +ReadStream + + + .. js:class:: ReadStream() + + :param boolean autoclose: automatically close file when the stream reaches the end. + :param gridstore cursor: a cursor object that the stream wraps. + :returns: readstream + + +Returns a stream interface for the **file**. + + + +Events + - **data** {function(item) {}} the data event triggers when a document is ready. + - **end** {function() {}} the end event triggers when there is no more documents available. + - **close** {function() {}} the close event triggers when the stream is closed. + - **error** {function(err) {}} the error event triggers if an error happens. + + +----- +pause +----- + + +Pauses this stream, then no farther events will be fired. + +.. js:function:: pause() + + +**Examples** + + + + A simple example showing the use of the readstream pause function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // File id + var fileId = new ObjectID(); + // Create a file + var file = new GridStore(db, fileId, "w"); + file.open(function(err, file) { + // Write some content and flush to disk + file.write('Hello world', function(err, file) { + file.close(function(err, result) { + + // Let's create a read file + file = new GridStore(db, fileId, "r"); + // Open the file + file.open(function(err, file) { + // Peform a find to get a cursor + var stream = file.stream(); + + // For each data item + stream.on("data", function(item) { + // Check if stream is paused + assert.equal(false, stream.paused); + // Pause stream + stream.pause(); + // Check if cursor is paused + assert.equal(true, stream.paused); + + // Restart the stream after 1 miliscecond + setTimeout(function() { + stream.resume(); + // Check if cursor is paused + assert.equal(false, stream.paused); + }, 1); + }); + + // For each data item + stream.on("end", function(item) {}); + // When the stream is done + stream.on("close", function() { + db.close(); + }); + }); + }); + }); + }); + }); + + +------- +destroy +------- + + +Destroys the stream, then no farther events will be fired. + +.. js:function:: destroy() + + +**Examples** + + + + A simple example showing the use of the readstream destroy function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // File id + var fileId = new ObjectID(); + // Create a file + var file = new GridStore(db, fileId, "w"); + file.open(function(err, file) { + // Write some content and flush to disk + file.write('Hello world', function(err, file) { + file.close(function(err, result) { + + // Let's create a read file + file = new GridStore(db, fileId, "r"); + // Open the file + file.open(function(err, file) { + // Peform a find to get a cursor + var stream = file.stream(); + + // For each data item + stream.on("data", function(item) { + // Destroy the stream + stream.destroy(); + }); + + // When the stream is done + stream.on("close", function() { + db.close(); + }); + }); + }); + }); + }); + }); + + +------ +resume +------ + + +Resumes this stream. + +.. js:function:: resume() + + +**Examples** + + + + A simple example showing the use of the readstream resume function. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // File id + var fileId = new ObjectID(); + // Create a file + var file = new GridStore(db, fileId, "w"); + file.open(function(err, file) { + // Write some content and flush to disk + file.write('Hello world', function(err, file) { + file.close(function(err, result) { + + // Let's create a read file + file = new GridStore(db, fileId, "r"); + // Open the file + file.open(function(err, file) { + // Peform a find to get a cursor + var stream = file.stream(); + + // For each data item + stream.on("data", function(item) { + // Check if stream is paused + assert.equal(false, stream.paused); + // Pause stream + stream.pause(); + // Check if cursor is paused + assert.equal(true, stream.paused); + + // Restart the stream after 1 miliscecond + setTimeout(function() { + stream.resume(); + // Check if cursor is paused + assert.equal(false, stream.paused); + }, 1); + }); + + // For each data item + stream.on("end", function(item) {}); + // When the stream is done + stream.on("close", function() { + db.close(); + }); + }); + }); + }); + }); + }); + diff --git a/_sources/changelog/changelog.txt b/_sources/changelog/changelog.txt new file mode 100644 index 00000000000..8cbff0f3712 --- /dev/null +++ b/_sources/changelog/changelog.txt @@ -0,0 +1,393 @@ +========= +Changelog +========= + +0.9.8-7 2012-02-06 +------------------ +* Simplified findOne to use the find command instead of the custom code (Issue #498). +* BSON JS parser not also checks for _bsonType variable in case BSON object is in weird scope (Issue #495). + +0.9.8-6 2012-02-04 +------------------ +* Removed the check for replicaset change code as it will never work with node.js. + +0.9.8-5 2012-02-02 +------------------ +* Added geoNear command to Collection. +* Added geoHaystackSearch command to Collection. +* Added indexes command to collection to retrieve the indexes on a Collection. +* Added stats command to collection to retrieve the statistics on a Collection. +* Added listDatabases command to admin object to allow retrieval of all available dbs. +* Changed createCreateIndexCommand to work better with options. +* Fixed dereference method on Db class to correctly dereference Db reference objects. +* Moved connect object onto Db class(Db.connect) as well as keeping backward compatibility. +* Removed writeBuffer method from gridstore, write handles switching automatically now. +* Changed readBuffer to read on Gridstore, Gridstore now only supports Binary Buffers no Strings anymore. +* Moved Long class to bson directory. + +0.9.8-4 2012-01-28 +------------------ +* Added reIndex command to collection and db level. +* Added support for $returnKey, $maxScan, $min, $max, $showDiskLoc, $comment to cursor and find/findOne methods. +* Added dropDups and v option to createIndex and ensureIndex. +* Added isCapped method to Collection. +* Added indexExists method to Collection. +* Added findAndRemove method to Collection. +* Fixed bug for replicaset connection when no active servers in the set. +* Fixed bug for replicaset connections when errors occur during connection. +* Merged in patch for BSON Number handling from Lee Salzman, did some small fixes and added test coverage. + +0.9.8-3 2012-01-21 +------------------ +* Workaround for issue with Object.defineProperty (Issue #484) +* ObjectID generation with date does not set rest of fields to zero (Issue #482) + +0.9.8-2 2012-01-20 +------------------ +* Fixed a missing this in the ReplSetServers constructor. + +0.9.8-1 2012-01-17 +------------------ +* FindAndModify bug fix for duplicate errors (Issue #481) + +0.9.8 2012-01-17 +---------------- +* Replicasets now correctly adjusts to live changes in the replicaset configuration on the servers, reconnecting correctly. + - Set the interval for checking for changes setting the replicaSetCheckInterval property when creating the ReplSetServers instance or on db.serverConfig.replicaSetCheckInterval. (default 1000 miliseconds) +* Fixes formattedOrderClause in collection.js to accept a plain hash as a parameter (Issue #469) https://github.com/tedeh +* Removed duplicate code for formattedOrderClause and moved to utils module +* Pass in poolSize for ReplSetServers to set default poolSize for new replicaset members +* Bug fix for BSON JS deserializer. Isolating the eval functions in separate functions to avoid V8 deoptimizations +* Correct handling of illegal BSON messages during deserialization +* Fixed Infinite loop when reading GridFs file with no chunks (Issue #471) +* Correctly update existing user password when using addUser (Issue #470) + +0.9.7.3-5 2012-01-04 +-------------------- +* Fix for RegExp serialization for 0.4.X where typeof /regexp/ == 'function' vs in 0.6.X typeof /regexp/ == 'object' +* Don't allow keepAlive and setNoDelay for 0.4.X as it throws errors + +0.9.7.3-4 2012-01-04 +-------------------- +* Chased down potential memory leak on findAndModify, Issue #467 (node.js removeAllListeners leaves the key in the _events object, node.js bug on eventlistener?, leads to extremely slow memory leak on listener object) +* Sanity checks for GridFS performance with benchmark added + +0.9.7.3-3 2012-01-04 +-------------------- +* Bug fixes for performance issues going form 0.9.6.X to 0.9.7.X on linux +* BSON bug fixes for performance + +0.9.7.3-2 2012-01-02 +-------------------- +* Fixed up documentation to reflect the preferred way of instantiating bson types +* GC bug fix for JS bson parser to avoid stop-and-go GC collection + +0.9.7.3-1 2012-01-02 +-------------------- +* Fix to make db.bson_serializer and db.bson_deserializer work as it did previously + +0.9.7.3 2011-12-30 +-------------------- +* Moved BSON_BINARY_SUBTYPE_DEFAULT from BSON object to Binary object and removed the BSON_BINARY_ prefixes +* Removed Native BSON types, C++ parser uses JS types (faster due to cost of crossing the JS-C++ barrier for each call) +* Added build fix for 0.4.X branch of Node.js where GetOwnPropertyNames is not defined in v8 +* Fix for wire protocol parser for corner situation where the message is larger than the maximum socket buffer in node.js (Issue #464, #461, #447) +* Connection pool status set to connected on poolReady, isConnected returns false on anything but connected status (Issue #455) + +0.9.7.2-5 2011-12-22 +-------------------- +* Brand spanking new Streaming Cursor support Issue #458 (https://github.com/christkv/node-mongodb-native/pull/458) thanks to Mr Aaron Heckmann + +0.9.7.2-4 2011-12-21 +-------------------- +* Refactoring of callback code to work around performance regression on linux +* Fixed group function to correctly use the command mode as default + +0.9.7.2-3 2011-12-18 +-------------------- +* Fixed error handling for findAndModify while still working for mongodb 1.8.6 (Issue #450). +* Allow for force send query to primary, pass option (read:'primary') on find command. + * ``find({a:1}, {read:'primary'}).toArray(function(err, items) {});`` + +0.9.7.2-2 2011-12-16 +-------------------- +* Fixes infinite streamRecords QueryFailure fix when using Mongos (Issue #442) + +0.9.7.2-1 2011-12-16 +-------------------- +* ~10% perf improvement for ObjectId#toHexString (Issue #448, https://github.com/aheckmann) +* Only using process.nextTick on errors emitted on callbacks not on all parsing, reduces number of ticks in the driver +* Changed parsing off bson messages to use process.nextTick to do bson parsing in batches if the message is over 10K as to yield more time to the event look increasing concurrency on big mongoreply messages with multiple documents + +0.9.7.2 2011-12-15 +------------------ +* Added SSL support for future version of mongodb (VERY VERY EXPERIMENTAL) + * pass in the ssl:true option to the server or replicaset server config to enable + * a bug either in mongodb or node.js does not allow for more than 1 connection pr db instance (poolSize:1). +* Added getTimestamp() method to objectID that returns a date object +* Added finalize function to collection.group + * function group (keys, condition, initial, reduce, finalize, command, callback) +* Reaper no longer using setTimeout to handle reaping. Triggering is done in the general flow leading to predictable behavior. + * reaperInterval, set interval for reaper (default 10000 miliseconds) + * reaperTimeout, set timeout for calls (default 30000 miliseconds) + * reaper, enable/disable reaper (default false) +* Work around for issues with findAndModify during high concurrency load, insure that the behavior is the same across the 1.8.X branch and 2.X branch of MongoDb +* Reworked multiple db's sharing same connection pool to behave correctly on error, timeout and close +* EnsureIndex command can be executed without a callback (Issue #438) +* Eval function no accepts options including nolock (Issue #432) + * eval(code, parameters, options, callback) (where options = {nolock:true}) + +0.9.7.1-4 2011-11-27 +-------------------- +* Replaced install.sh with install.js to install correctly on all supported os's + +0.9.7.1-3 2011-11-27 +-------------------- +* Fixes incorrect scope for ensureIndex error wrapping (Issue #419) https://github.com/ritch + +0.9.7.1-2 2011-11-27 +-------------------- +* Set statistical selection strategy as default for secondary choice. + +0.9.7.1-1 2011-11-27 +-------------------- +* Better handling of single server reconnect (fixes some bugs) +* Better test coverage of single server failure +* Correct handling of callbacks on replicaset servers when firewall dropping packets, correct reconnect + +0.9.7.1 2011-11-24 +------------------ +* Better handling of dead server for single server instances +* FindOne and find treats selector == null as {}, Issue #403 +* Possible to pass in a strategy for the replicaset to pick secondary reader node + * parameter strategy + * ping (default), pings the servers and picks the one with the lowest ping time + * statistical, measures each request and pick the one with the lowest mean and std deviation +* Set replicaset read preference replicaset.setReadPreference() + * Server.READ_PRIMARY (use primary server for reads) + * Server.READ_SECONDARY (from a secondary server (uses the strategy set)) + * tags, {object of tags} +* Added replay of commands issued to a closed connection when the connection is re-established +* Fix isConnected and close on unopened connections. Issue #409, fix by (https://github.com/sethml) +* Moved reaper to db.open instead of constructor (Issue #406) +* Allows passing through of socket connection settings to Server or ReplSetServer under the option socketOptions + * timeout = set seconds before connection times out (default 0) + * noDelay = Disables the Nagle algorithm (default true) + * keepAlive = Set if keepAlive is used (default 0, which means no keepAlive, set higher than 0 for keepAlive) + * encoding = ['ascii', 'utf8', or 'base64'] (default null) +* Fixes for handling of errors during shutdown off a socket connection +* Correctly applies socket options including timeout +* Cleanup of test management code to close connections correctly +* Handle parser errors better, closing down the connection and emitting an error +* Correctly emit errors from server.js only wrapping errors that are strings + +0.9.7 2011-11-10 +---------------- +* Added priority setting to replicaset manager +* Added correct handling of passive servers in replicaset +* Reworked socket code for simpler clearer handling +* Correct handling of connections in test helpers +* Added control of retries on failure + * control with parameters retryMiliSeconds and numberOfRetries when creating a db instance +* Added reaper that will timeout and cleanup queries that never return + * control with parameters reaperInterval and reaperTimeout when creating a db instance +* Refactored test helper classes for replicaset tests +* Allows raw (no bson parser mode for insert, update, remove, find and findOne) + * control raw mode passing in option raw:true on the commands + * will return buffers with the binary bson objects +* Fixed memory leak in cursor.toArray +* Fixed bug in command creation for mongodb server with wrong scope of call +* Added db(dbName) method to db.js to allow for reuse of connections against other databases +* Serialization of functions in an object is off by default, override with parameter + * serializeFunctions [true/false] on db level, collection level or individual insert/update/findAndModify +* Added Long.fromString to c++ class and fixed minor bug in the code (Test case for $gt operator on 64-bit integers, Issue #394) +* FindOne and find now share same code execution and will work in the same manner, Issue #399 +* Fix for tailable cursors, Issue #384 +* Fix for Cursor rewind broken, Issue #389 +* Allow Gridstore.exist to query using regexp, Issue #387, fix by (https://github.com/kaij) +* Updated documentation on https://github.com/christkv/node-mongodb-native +* Fixed toJSON methods across all objects for BSON, Binary return Base64 Encoded data + +0.9.6-22 2011-10-15 +------------------- +* Fixed bug in js bson parser that could cause wrong object size on serialization, Issue #370 +* Fixed bug in findAndModify that did not throw error on replicaset timeout, Issue #373 + +0.9.6-21 2011-10-05 +------------------- +* Reworked reconnect code to work correctly +* Handling errors in different parts of the code to ensure that it does not lock the connection +* Consistent error handling for Object.createFromHexString for JS and C++ + +0.9.6-20 2011-10-04 +------------------- +* Reworked bson.js parser to get rid off Array.shift() due to it allocating new memory for each call. Speedup varies between 5-15% depending on doc +* Reworked bson.cc to throw error when trying to serialize js bson types +* Added MinKey, MaxKey and Double support for JS and C++ parser +* Reworked socket handling code to emit errors on unparsable messages +* Added logger option for Db class, lets you pass in a function in the shape + { + log : function(message, object) {}, + error : function(errorMessage, errorObject) {}, + debug : function(debugMessage, object) {}, + } + + Usage is new Db(new Server(..), {logger: loggerInstance}) + +0.9.6-19 2011-09-29 +------------------- +* Fixing compatibility issues between C++ bson parser and js parser +* Added Symbol support to C++ parser +* Fixed socket handling bug for seldom misaligned message from mongodb +* Correctly handles serialization of functions using the C++ bson parser + +0.9.6-18 2011-09-22 +------------------- +* Fixed bug in waitForConnection that would lead to 100% cpu usage, Issue #352 + +0.9.6-17 2011-09-21 +------------------- +* Fixed broken exception test causing bamboo to hang +* Handling correctly command+lastError when both return results as in findAndModify, Issue #351 + +0.9.6-16 2011-09-14 +------------------- +* Fixing a bunch of issues with compatibility with MongoDB 2.0.X branch. Some fairly big changes in behavior from 1.8.X to 2.0.X on the server. +* Error Connection MongoDB V2.0.0 with Auth=true, Issue #348 + +0.9.6-15 2011-09-09 +------------------- +* Fixed issue where pools would not be correctly cleaned up after an error, Issue #345 +* Fixed authentication issue with secondary servers in Replicaset, Issue #334 +* Duplicate replica-set servers when omitting port, Issue #341 +* Fixing findAndModify to correctly work with Replicasets ensuring proper error handling, Issue #336 +* Merged in code from (https://github.com/aheckmann) that checks for global variable leaks + +0.9.6-14 2011-09-05 +------------------- +* Minor fixes for error handling in cursor streaming (https://github.com/sethml), Issue #332 +* Minor doc fixes +* Some more cursor sort tests added, Issue #333 +* Fixes to work with 0.5.X branch +* Fix Db not removing reconnect listener from serverConfig, (https://github.com/sbrekken), Issue #337 +* Removed node_events.h includes (https://github.com/jannehietamaki), Issue #339 +* Implement correct safe/strict mode for findAndModify. + +0.9.6-13 2011-08-24 +------------------- +* Db names correctly error checked for illegal characters + +0.9.6-12 2011-08-24 +------------------- +* Nasty bug in GridFS if you changed the default chunk size +* Fixed error handling bug in findOne + +0.9.6-11 2011-08-23 +------------------- +* Timeout option not correctly making it to the cursor, Issue #320, Fix from (https://github.com/year2013) +* Fixes for memory leaks when using buffers and C++ parser +* Fixes to make tests pass on 0.5.X +* Cleanup of bson.js to remove duplicated code paths +* Fix for errors occurring in ensureIndex, Issue #326 +* Removing require.paths to make tests work with the 0.5.X branch + +0.9.6-10 2011-08-11 +------------------- +* Specific type Double for capped collections (https://github.com/mbostock), Issue #312 +* Decorating Errors with all all object info from Mongo (https://github.com/laurie71), Issue #308 +* Implementing fixes for mongodb 1.9.1 and higher to make tests pass +* Admin validateCollection now takes an options argument for you to pass in full option +* Implemented keepGoing parameter for mongodb 1.9.1 or higher, Issue #310 +* Added test for read_secondary count issue, merged in fix from (https://github.com/year2013), Issue #317 + +0.9.6-9 +------- +* Bug fix for bson parsing the key '':'' correctly without crashing + +0.9.6-8 +------- +* Changed to using node.js crypto library MD5 digest +* Connect method support documented mongodb: syntax by (https://github.com/sethml) +* Support Symbol type for BSON, serializes to it's own type Symbol, Issue #302, #288 +* Code object without scope serializing to correct BSON type +* Lot's of fixes to avoid double callbacks (https://github.com/aheckmann) Issue #304 +* Long deserializes as Number for values in the range -2^53 to 2^53, Issue #305 (https://github.com/sethml) +* Fixed C++ parser to reflect JS parser handling of long deserialization +* Bson small optimizations + +0.9.6-7 2011-07-13 +------------------ +* JS Bson deserialization bug #287 + +0.9.6-6 2011-07-12 +------------------ +* FindAndModify not returning error message as other methods Issue #277 +* Added test coverage for $push, $pushAll and $inc atomic operations +* Correct Error handling for non 12/24 bit ids on Pure JS ObjectID class Issue #276 +* Fixed terrible deserialization bug in js bson code #285 +* Fix by andrewjstone to avoid throwing errors when this.primary not defined + +0.9.6-5 2011-07-06 +------------------ +* Rewritten BSON js parser now faster than the C parser on my core2duo laptop +* Added option full to indexInformation to get all index info Issue #265 +* Passing in ObjectID for new Gridstore works correctly Issue #272 + +0.9.6-4 2011-07-01 +------------------ +* Added test and bug fix for insert/update/remove without callback supplied + +0.9.6-3 2011-07-01 +------------------ +* Added simple grid class called Grid with put, get, delete methods +* Fixed writeBuffer/readBuffer methods on GridStore so they work correctly +* Automatic handling of buffers when using write method on GridStore +* GridStore now accepts a ObjectID instead of file name for write and read methods +* GridStore.list accepts id option to return of file ids instead of filenames +* GridStore close method returns document for the file allowing user to reference _id field + +0.9.6-2 2011-06-30 +------------------ +* Fixes for reconnect logic for server object (replays auth correctly) +* More testcases for auth +* Fixes in error handling for replicaset +* Fixed bug with safe parameter that would fail to execute safe when passing w or wtimeout +* Fixed slaveOk bug for findOne method +* Implemented auth support for replicaset and test cases +* Fixed error when not passing in rs_name + +0.9.6-1 2011-06-25 +------------------ +* Fixes for test to run properly using c++ bson parser +* Fixes for dbref in native parser (correctly handles ref without db component) +* Connection fixes for replicasets to avoid runtime conditions in cygwin (https://github.com/vincentcr) +* Fixes for timestamp in js bson parser (distinct timestamp type now) + +0.9.6 2011-06-21 +---------------- +* Worked around npm version handling bug +* Race condition fix for cygwin (https://github.com/vincentcr) + +0.9.5-1 2011-06-21 +------------------ +* Extracted Timestamp as separate class for bson js parser to avoid instanceof problems +* Fixed driver strict mode issue + +0.9.5 2011-06-20 +---------------- +* Replicaset support (failover and reading from secondary servers) +* Removed ServerPair and ServerCluster +* Added connection pool functionality +* Fixed serious bug in C++ bson parser where bytes > 127 would generate 2 byte sequences +* Allows for forcing the server to assign ObjectID's using the option {forceServerObjectId: true} + +0.6.8 +----- +* Removed multiple message concept from bson +* Changed db.open(db) to be db.open(err, db) + +0.1 2010-01-30 +-------------- +* Initial release support of driver using native node.js interface +* Supports gridfs specification +* Supports admin functionality \ No newline at end of file diff --git a/_sources/contents.txt b/_sources/contents.txt new file mode 100644 index 00000000000..d51c36a84aa --- /dev/null +++ b/_sources/contents.txt @@ -0,0 +1,16 @@ +======================= +MongoDB Manual Contents +======================= + +.. toctree:: + :maxdepth: 3 + + markdown-docs/database + markdown-docs/replicaset + markdown-docs/collections + markdown-docs/insert + markdown-docs/queries + markdown-docs/indexes + markdown-docs/gridfs + +- :ref:`genindex` diff --git a/_sources/getting-started.txt b/_sources/getting-started.txt new file mode 100644 index 00000000000..b99db507ace --- /dev/null +++ b/_sources/getting-started.txt @@ -0,0 +1,19 @@ +============================ +Getting Started With MongoDB +============================ + +About MongoDB and this Manual +----------------------------- + +- What's New in 2.2? +- Getting Involved in the MongoDB Project (contributions, bug reports, etc.) +- About this Documentation +- MongoDB Resources + +Introduction to MongoDB +----------------------- + +- What is MongoDB? +- Installation +- Drivers +- Basic Concepts diff --git a/_sources/index.txt b/_sources/index.txt new file mode 100644 index 00000000000..70035fd6d05 --- /dev/null +++ b/_sources/index.txt @@ -0,0 +1,42 @@ +================================= +The Node.JS MongoDB Driver Manual +================================= + +Usage +----- + +.. toctree:: + :maxdepth: 1 + + markdown-docs/index + +Tutorials +--------- + +.. toctree:: + :maxdepth: 3 + + api-articles/index + +API Documentation +----------------- + +.. toctree:: + :maxdepth: 2 + + api-generated/index + api-bson-generated/index + +Changelog +--------- + +.. toctree:: + :maxdepth: 1 + + changelog/changelog + +Indices +------- + +- :ref:`genindex` +- :ref:`search` \ No newline at end of file diff --git a/_sources/markdown-docs/collections.txt b/_sources/markdown-docs/collections.txt new file mode 100644 index 00000000000..f40e732d43c --- /dev/null +++ b/_sources/markdown-docs/collections.txt @@ -0,0 +1,213 @@ +=========== +Collections +=========== + + See also: + + + * `Database `_ + * `Queries `_ + + +------------------ +Collection objects +------------------ + + Collection object is a pointer to a specific collection in the `database `_ . If you want to `insert `_ new records or + `query `_ existing ones then you need to have a valid collection object. + + + + **NB** Collection names can't start or end with a period nor contain a dollar sign! ( ``.tes$t`` is not allowed) + + +-------------------- +Creating collections +-------------------- + + Collections can be created with ``createCollection`` + + + .. code-block:: javascript + + db.createCollection([[name[, options]], callback) + + + + where ``name`` is the name of the collection, options a set of configuration parameters and ``callback`` is a callback function. ``db`` is the database object. + + + + The first parameter for the callback is the error object (null if no error) and the second one is the pointer to the newly created collection. If strict mode is on and the table exists, the operation yields in error. With strict mode off (default) the function simple returns the pointer to the existing collection and does not truncate it. + + + .. code-block:: javascript + + db.createCollection("test", function(err, collection){ + collection.insert({"test":"value"}); + }); + + +---------------------------- +Creating collections options +---------------------------- + + Several options can be passed to the ``createCollection`` function with ``options`` parameter. + + + .. code-block:: javascript + + * `raw` - driver returns documents as bson binary Buffer objects, `default:false` + + + * ``collectionName`` is the name of the collection (not including the database name as a prefix) + * ``db`` is the pointer to the corresponding databse object + + + + Example of usage: + + + .. code-block:: javascript + + console.log("Collection name: "+collection.collectionName) + + +------------------------- +List existing collections +------------------------- + + Collections can be listed with ``collectionNames`` + + + .. code-block:: javascript + + db.collectionNames(callback); + + + + ``callback`` gets two parameters - an error object (if error occured) and an array of collection names as strings. + + + + Collection names also include database name, so a collection named ``posts`` in a database ``blog`` will be listed as ``blog.posts`` . + + + + Additionally there's system collections which should not be altered without knowing exactly what you are doing, these sollections can be identified with ``system`` prefix. For example ``posts.system.indexes`` . + + + + Example: + + + .. code-block:: javascript + + var mongodb = require("mongodb"), + mongoserver = new mongodb.Server("localhost"), + db_connector = new mongodb.Db("blog", mongoserver); + + db_connector.open(function(err, db){ + db.collectionNames(function(err, collections){ + console.log(collections); // ["blog.posts", "blog.system.indexes"] + }); + }); + + +---------------- +List collections +---------------- + + Collection objects can be listed with database method ``collections`` + + + .. code-block:: javascript + + db.collections(callback) + + + + Where ``callback`` gets two parameters - an error object (if an error occured) and an array of collection objects. + + +--------------------- +Selecting collections +--------------------- + + Existing collections can be opened with ``collection`` + + + .. code-block:: javascript + + db.collection([[name[, options]], callback); + + + + If strict mode is off, then a new collection is created if not already present. + + +----------------------------- +Selecting collections options +----------------------------- + + Several options can be passed to the ``collection`` function with ``options`` parameter. + + + .. code-block:: javascript + + * `raw` - driver returns documents as bson binary Buffer objects, `default:false` + + +-------------------- +Renaming collections +-------------------- + + A collection can be renamed with collection method ``rename`` + + + .. code-block:: javascript + + collection.rename(new_name, callback); + + +--------------------------------- +Removing records from collections +--------------------------------- + + Records can be erased from a collection with ``remove`` + + + .. code-block:: javascript + + collection.remove([[query[, options]], callback]); + + + + Where + + + * ``query`` is the query that records to be removed need to match. If not set all records will be removed + * ``options`` indicate advanced options. For example use ``{safe: true}`` when using callbacks + * ``callback`` callback function that gets two parameters - an error object (if an error occured) and the count of removed records + + +-------------------- +Removing collections +-------------------- + + A collection can be dropped with ``drop`` + + + .. code-block:: javascript + + collection.drop(callback); + + + + or with ``dropCollection`` + + + .. code-block:: javascript + + db.dropCollection(collection_name, callback) + diff --git a/_sources/markdown-docs/database.txt b/_sources/markdown-docs/database.txt new file mode 100644 index 00000000000..2a8156d7a18 --- /dev/null +++ b/_sources/markdown-docs/database.txt @@ -0,0 +1,189 @@ +======== +Database +======== + + The first thing to do in order to make queries to the database is to open one. This can be done with the ``Db`` constructor. + + + .. code-block:: javascript + + var mongodb = require("mongodb"), + mongoserver = new mongodb.Server(host, port, server_options), + db_connector = new mongodb.Db(name, mongoserver, db_options); + + db_connector.open(callback); + + + * ``host`` is a server hostname or IP + * ``port`` is a MongoDB port, use ``mongodb.Connection.DEFAULT_PORT`` for default (27017) + * ``server_options`` see *Server options* + * ``name`` is the databse name that needs to be opened, database will be created automatically if it doesn't yet exist + * ``db_options`` see *DB options* + + +-------------- +Server options +-------------- + + Several options can be passed to the ``Server`` constructor with ``options`` parameter. + + + * ``auto_reconnect`` - to reconnect automatically, ``default:false`` + * ``poolSize`` - specify the number of connections in the pool ``default:1`` + * ``socketOptions`` - a collection of pr socket settings + + +-------------- +Socket options +-------------- + + Several options can be set for the ``socketOptions`` . + + + * ``timeout`` = set seconds before connection times out ``default:0`` + * ``noDelay`` = Disables the Nagle algorithm ``default:true`` + * ``keepAlive`` = Set if keepAlive is used ``default:0`` , which means no keepAlive, set higher than 0 for keepAlive + * ``encoding`` = 'ascii'|'utf8'|'base64' ``default:null`` + + +---------- +DB options +---------- + + Several options can be passed to the ``Db`` constructor with ``options`` parameter. + + + * ``native_parser`` - if true, use native BSON parser + * ``strict`` - sets *strict mode* , if true then existing collections can't be "recreated" etc. + * ``pk`` - custom primary key factory to generate ``_id`` values (see Custom primary keys). + * ``forceServerObjectId`` - generation of objectid is delegated to the mongodb server instead of the driver. default is false + * ``retryMiliSeconds`` - specify the number of milliseconds between connection attempts ``default:5000`` + * ``numberOfRetries`` - specify the number of retries for connection attempts ``default:3`` + * ``reaper`` - enable/disable reaper (true/false) ``default:false`` + * ``reaperInterval`` - specify the number of milliseconds between each reaper attempt ``default:10000`` + * ``reaperTimeout`` - specify the number of milliseconds for timing out callbacks that don't return ``default:30000`` + * ``raw`` - driver expects Buffer raw bson document, ``default:false`` + + +------------------ +Opening a database +------------------ + + Database can be opened with Db method ``open`` . + + + .. code-block:: javascript + + db_connector.open(callback); + + + + ``callback`` is a callback function which gets 2 parameters - an error object (or null, if no errors occured) and a database object. + + + + Resulting database object can be used for creating and selecting `collections `_ . + + + .. code-block:: javascript + + db_connector.open(function(err, db){ + db.collection(...); + }); + + + * ``databaseName`` is the name of the database + * ``serverConfig`` includes information about the server ( ``serverConfig.host`` , ``serverConfig.port`` etc.) + * ``state`` indicates if the database is connected or not + * ``strict`` indicates if *strict mode* is on (true) or off (false, default) + * ``version`` indicates the version of the MongoDB database + + + * ``close`` to indicate that the connection to the database was closed + + + + For example + + + .. code-block:: javascript + + db.on("close", function(error){ + console.log("Connection to the database was closed!"); + }); + + + + NB! If ``auto_reconnect`` was set to true when creating the server, then the connection will be automatically reopened on next database operation. Nevertheless the ``close`` event will be fired. + + +----------------------------------------- +Sharing the connections over multiple dbs +----------------------------------------- + + To share the connection pool across multiple databases you database instance has method ``db`` + + + .. code-block:: javascript + + db_connector.db(name) + + + + this returns a new ``db`` instance that shares the connections off the previous instance but will send all commands to the database ``name`` . This allows for better control of resource usage in a multiple database scenario. + + +------------------- +Deleting a database +------------------- + + To delete a database you need a pointer to it first. Deletion can be done with method ``dropDatabase`` . + + + .. code-block:: javascript + + db_connector.open(function(err, db){ + db.dropDatabase() + }); + + +------------------- +Custom primary keys +------------------- + + Every record in the database has an unique primary key called ``_id`` . Default primary keys are 12 byte hashes but a custom key generator can be used for something else. If you set ``_id`` "by hand" when inserting records then you can use whatever you want, primary key factory generates ``_id`` values only for records without ones. + + + + Example 1: No need to generate primary key, as its already defined: + + + .. code-block:: javascript + + collection.insert({name:"Daniel", _id:"12345"}); + + + + Example 2: No primary key, so it needs to be generated before save: + + + .. code-block:: javascript + + collectionn.insert({name:"Daniel"}); + + + + Custom primary key factory is actually an object with method ``createPK`` which returns a primary key. The context (value for ``this`` ) for ``createPK`` is left untouched. + + + .. code-block:: javascript + + var CustomPKFactory = { + counter:0, + createPk: function() { + return ++this.counter; + } + } + + db_connector = new mongodb.Db(name, mongoserver, {pk: CustomPKFactory}); + diff --git a/_sources/markdown-docs/gridfs.txt b/_sources/markdown-docs/gridfs.txt new file mode 100644 index 00000000000..ec458b198b4 --- /dev/null +++ b/_sources/markdown-docs/gridfs.txt @@ -0,0 +1,235 @@ +========= +GridStore +========= + + GridFS is a scalable MongoDB *filesystem* for storing and retrieving large files. The default limit for a MongoDB record is 16MB, so to store data that is larger than this limit, GridFS can be used. GridFS shards the data into smaller chunks automatically. See `MongoDB documentation `_ for details. + + + + GridStore is a single file inside GridFS that can be managed by the script. + + +-------------- +Open GridStore +-------------- + + Opening a GridStore (a single file in GridFS) is a bit similar to opening a database. At first you need to create a GridStore object and then ``open`` it. + + + .. code-block:: javascript + + var gs = new mongodb.GridStore(db, filename, mode[, options]) + + + + Where + + + * ``db`` is the database object + * ``filename`` is the name of the file in GridFS that needs to be accessed/created + * ``mode`` indicated the operaion, can be one of: * "r" (Read): Looks for the file information in fs.files collection, or creates a new id for this object. * "w" (Write): Erases all chunks if the file already exist. * "w+" (Append): Finds the last chunk, and keeps writing after it. + * ``options`` can be used to specify some metadata for the file, for example ``content_type`` , ``metadata`` and ``chunk_size`` + + + + Example: + + + .. code-block:: javascript + + var gs = new mongodb.GridStore(db, "test.png", "w", { + "content_type": "image/png", + "metadata":{ + "author": "Daniel" + }, + "chunk_size": 1024*4 + }); + + + + When GridStore object is created, it needs to be opened. + + + .. code-block:: javascript + + gs.open(callback); + + + + ``callback`` gets two parameters - and error object (if error occured) and the GridStore object. + + + + Opened GridStore object has a set of useful properties + + + * ``gs.length`` - length of the file in bytes + * ``gs.contentType`` - the content type for the file + * ``gs.uploadDate`` - when the file was uploaded + * ``gs.metadata`` - metadata that was saved with the file + * ``gs.chunkSize`` - chunk size + + + + Example + + + .. code-block:: javascript + + gs.open(function(err, gs){ + console.log("this file was uploaded at "+gs.uploadDate); + }); + + +-------------------- +Writing to GridStore +-------------------- + + Writing can be done with ``write`` + + + .. code-block:: javascript + + gs.write(data, callback) + + + + where ``data`` is a ``Buffer`` or a string, callback gets two parameters - an error object (if error occured) and result value which indicates if the write was successful or not. + + + + While the GridStore is not closed, every write is appended to the opened GridStore. + + +--------------------------- +Writing a file to GridStore +--------------------------- + + This functions opens the gridstore, streams the contents of the file into gridstore, and closes the gridstore. + + + .. code-block:: javascript + + gs.writeFile( file, callback ) + + + + where + + + * ``file`` is a file descriptior, or a string file path + * ``callback`` is a function with two parameters - error object (if error occured) and the GridStore object. + + +---------------------- +Reading from GridStore +---------------------- + + Reading from GridStore can be done with ``read`` + + + .. code-block:: javascript + + gs.read([size], callback) + + + + where + + + * ``size`` is the length of the data to be read + * ``callback`` is a callback function with two parameters - error object (if an error occured) and data (binary string) + + +------------------------ +Streaming from GridStore +------------------------ + + You can stream data as it comes from the database using ``stream`` + + + .. code-block:: javascript + + gs.stream([autoclose=false]) + + + + where + + + * ``autoclose`` If true current GridStore will be closed when EOF and 'close' event will be fired + + + + The function returns `read stream `_ based on this GridStore file. It supports the events 'read', 'error', 'close' and 'end'. + + +------------------ +Delete a GridStore +------------------ + + GridStore files can be unlinked with ``unlink`` + + + .. code-block:: javascript + + mongodb.GridStore.unlink(db, name, callback) + + + + Where + + + * ``db`` is the databse object + * ``name`` is either the name of a GridStore object or an array of GridStore object names + * ``callback`` is the callback function + + +--------------------- +Closing the GridStore +--------------------- + + GridStore needs to be closed after usage. This can be done with ``close`` + + + .. code-block:: javascript + + gs.close(callback) + + +--------------------------------------- +Check the existance of a GridStore file +--------------------------------------- + + Checking if a file exists in GridFS can be done with ``exist`` + + + .. code-block:: javascript + + mongodb.GridStore.exist(db, filename, callback) + + + + Where + + + * ``db`` is the database object + * ``filename`` is the name of the file to be checked or a regular expression + * ``callback`` is a callback function with two parameters - an error object (if an error occured) and a boolean value indicating if the file exists or not + + +---------------------- +Seeking in a GridStore +---------------------- + + Seeking can be done with ``seek`` + + + .. code-block:: javascript + + gs.seek(position); + + + + This function moves the internal pointer to the specified position. + diff --git a/_sources/markdown-docs/index.txt b/_sources/markdown-docs/index.txt new file mode 100644 index 00000000000..fb4c72b563b --- /dev/null +++ b/_sources/markdown-docs/index.txt @@ -0,0 +1,10 @@ +.. toctree:: + :maxdepth: 1 + + collections + database + gridfs + indexes + insert + queries + replicaset diff --git a/_sources/markdown-docs/indexes.txt b/_sources/markdown-docs/indexes.txt new file mode 100644 index 00000000000..88da01ff89c --- /dev/null +++ b/_sources/markdown-docs/indexes.txt @@ -0,0 +1,143 @@ +======= +Indexes +======= + + Indexes are needed to make queries faster. For example if you need to find records by a field named *username* and the field has a related index set, then the query will be a lot faster compared to if the index was not present. + + + + See `MongoDB documentation `_ for details. + + +--------------------------------- +Create indexes with createIndex() +--------------------------------- + + ``createIndex`` adds a new index to a collection. For checking if the index was already set, use ``ensureIndex`` instead. + + + .. code-block:: javascript + + collection.createIndex(index[, options], callback) + + + + or + + + .. code-block:: javascript + + db.createIndex(collectionname, index[, options], callback) + + + + where + + + * ``index`` is the field or fields to be indexed. See *index field* + * ``options`` are options, for example ``{sparse: true}`` to include only records that have indexed field set or ``{unique: true}`` for unique indexes. If the ``options`` is a boolean value, then it indicates if it's an unique index or not. + * ``callback`` gets two parameters - an error object (if an error occured) and the name for the newly created index + + +--------------------------------- +Ensure indexes with ensureIndex() +--------------------------------- + + Same as ``createIndex`` with the difference that the index is checked for existence before adding to avoid duplicate indexes. + + +----------- +Index field +----------- + + Index field can be a simple string like ``"username"`` to index certain field (in this case, a field named as *username* ). + + + .. code-block:: javascript + + collection.ensureIndex("username",callback) + + + + It is possible to index fields inside nested objects, for example ``"user.firstname"`` to index field named *firstname* inside a document named *user* . + + + .. code-block:: javascript + + collection.ensureIndex("user.firstname",callback) + + + + It is also possible to create mixed indexes to include several fields at once. + + + .. code-block:: javascript + + collection.ensureIndex({firstname:1, lastname:1}, callback) + + + + or with tuples + + + .. code-block:: javascript + + collection.ensureIndex([["firstname", 1], ["lastname", 1]], callback) + + + + The number value indicates direction - if it's 1, then it is an ascending value, if it's -1 then it's descending. For example if you have documents with a field *date* and you want to sort these records in descending order then you might want to add corresponding index + + + .. code-block:: javascript + + collection.ensureIndex({date:-1}, callback) + + +------------------------------- +Remove indexes with dropIndex() +------------------------------- + + All indexes can be dropped at once with ``dropIndexes`` + + + .. code-block:: javascript + + collection.dropIndexes(callback) + + + + ``callback`` gets two parameters - an error object (if an error occured) and a boolean value true if operation succeeded. + + +--------------------------------------------- +Get index information with indexInformation() +--------------------------------------------- + + ``indexInformation`` can be used to fetch some useful information about collection indexes. + + + .. code-block:: javascript + + collection.indexInformation(callback) + + + + Where ``callback`` gets two parameters - an error object (if an error occured) and an index information object. + + + + The keys in the index object are the index names and the values are tuples of included fields. + + + + For example if a collection has two indexes - as a default an ascending index for the ``_id`` field and an additonal descending index for ``"username"`` field, then the index information object would look like the following + + + .. code-block:: javascript + + { + "_id":[["_id", 1]], + "username_-1":[["username", -1]] + } + diff --git a/_sources/markdown-docs/insert.txt b/_sources/markdown-docs/insert.txt new file mode 100644 index 00000000000..b96e5a0e61c --- /dev/null +++ b/_sources/markdown-docs/insert.txt @@ -0,0 +1,190 @@ +====================== +Inserting and updating +====================== + + See also: + + + * `Database `_ + * `Collections `_ + + +------ +Insert +------ + + Records can be inserted to a collection with ``insert`` + + + .. code-block:: javascript + + collection.insert(docs[, options, callback]) + + + + Where + + + * ``docs`` is a single document object or an array of documents + * ``options`` is an object of parameters, if you use a callback, set ``safe`` to true - this way the callback is executed *after* the record is saved to the database, if ``safe`` is false (default) callback is fired immediately and thus doesn't make much sense. + * ``callback`` - callback function to run after the record is inserted. Set ``safe`` to true in ``options`` when using callback. First parameter for callback is the error object (if an error occured) and the second is an array of records inserted. + + + + For example + + + .. code-block:: javascript + + var document = {name:"David", title:"About MongoDB"}; + collection.insert(document, {safe: true}, function(err, records){ + console.log("Record added as "+records[0]._id); + }); + + + + If trying to insert a record with an existing ``_id`` value, then the operation yields in error. + + + .. code-block:: javascript + + collection.insert({_id:1}, {safe:true}, function(err, doc){ + // no error, inserted new document, with _id=1 + collection.insert({_id:1}, {safe:true}, function(err, doc){ + // error occured since _id=1 already existed + }); + }); + + +---- +Save +---- + + Shorthand for insert/update is ``save`` - if ``_id`` value set, the record is updated if it exists or inserted if it does not; if the ``_id`` value is not set, then the record is inserted as a new one. + + + .. code-block:: javascript + + collection.save({_id:"abc", user:"David"},{safe:true}, callback) + + + + ``callback`` gets two parameters - an error object (if an error occured) and the record if it was inserted or ``1`` if the record was updated. + + +------ +Update +------ + + Updates can be done with ``update`` + + + .. code-block:: javascript + + collection.update(criteria, update[, options[, callback]]); + + + + Where + + + * ``criteria`` is a query object to find records that need to be updated (see `Queries `_ + * ``update`` is the replacement object + * ``options`` is an options object (see below) + * ``callback`` is the callback to be run after the records are updated. Has two parameters, the first is an error object (if error occured), the second is the count of records that were modified. + + + + There are several option values that can be used with an update + + + * ``safe`` - run callback only after the update is done, defaults to false + * ``multi`` - update all records that match the query object, default is false (only the first one found is updated) + * ``upsert`` - if true and no records match the query, insert ``update`` as a new record + * ``raw`` - driver returns updated document as bson binary Buffer, ``default:false`` + + + + If the replacement object is a document, the matching documents will be replaced (except the ``_id`` values if no ``_id`` is set). + + + .. code-block:: javascript + + collection.update({_id:"123"}, {author:"Jessica", title:"Mongo facts"}); + + + + The example above will replace the document contents of id=123 with the replacement object. + + + + To update only selected fields, ``$set`` operator needs to be used. Following replacement object replaces author value but leaves everything else intact. + + + .. code-block:: javascript + + collection.update({_id:"123"}, {$set: {author:"Jessica"}}); + + + + See `MongoDB documentation `_ for all possible operators. + + +--------------- +Find and Modify +--------------- + + To update and retrieve the contents for one single record you can use ``findAndModify`` . + + + .. code-block:: javascript + + collection.findAndModify(criteria, sort, update[, options, callback]) + + + + Where + + + * ``criteria`` is the query object to find the record + * ``sort`` indicates the order of the matches if there's more than one matching record. The first record on the result set will be used. See `Queries->find->options->sort `_ for the format. + * ``update`` is the replacement object + * ``options`` define the behavior of the function + * ``callback`` is the function to run after the update is done. Has two parameters - error object (if error occured) and the record that was updated. + + + + Options object can be used for the following options: + + + * ``remove`` - if set to true (default is false), removes the record from the collection. Callback function still gets the object but it doesn't exist in the collection any more. + * ``new`` - if set to true, callback function returns the modified record. Default is false (original record is returned) + * ``upsert`` - if set to true and no record matched to the query, replacement object is inserted as a new record + + + .. code-block:: javascript + + var mongodb = require('mongodb'), + server = new mongodb.Server("127.0.0.1", 27017, {}); + + new mongodb.Db('test', server, {}).open(function (error, client) { + if (error) throw error; + var collection = new mongodb.Collection(client, 'test_collection'); + collection.findAndModify( + {hello: 'world'}, // query + [['_id','asc']], // sort order + {$set: {hi: 'there'}}, // replacement, replaces only the field "hi" + {}, // options + function(err, object) { + if (err){ + console.warn(err.message); // returns error if no matching object found + }else{ + console.dir(object); + } + }); + }); + + + + + diff --git a/_sources/markdown-docs/queries.txt b/_sources/markdown-docs/queries.txt new file mode 100644 index 00000000000..fe1e25540bf --- /dev/null +++ b/_sources/markdown-docs/queries.txt @@ -0,0 +1,436 @@ +======= +Queries +======= + + See also: + + + * `Database `_ + * `Collections `_ + + +-------------------------- +Making queries with find() +-------------------------- + + `Collections `_ can be queried with ``find`` . + + + .. code-block:: javascript + + collection.find(query[[[, fields], options], callback]); + + + + Where + + + * ``query`` - is a query object, defining the conditions the documents need to apply + * ``fields`` - indicates which fields should be included in the response (default is all) + * ``options`` - defines extra logic (sorting options, paging etc.) + * ``raw`` - driver returns documents as bson binary Buffer objects, ``default:false`` + + + + The result for the query is actually a cursor object. This can be used directly or converted to an array. + + + .. code-block:: javascript + + var cursor = collection.find({}); + cursor.each(...); + + + + To indicate which fields must or must no be returned ``fields`` value can be used. For example the following ``fields`` value + + + .. code-block:: javascript + + { + "name": true, + "title": true + } + + + + retrieves fields ``name`` and ``title`` (and as a default also ``_id`` ) but not any others. + + +----------------------------------- +Find first occurence with findOne() +----------------------------------- + + ``findOne`` is a convinence method finding and returning the first match of a query while regular ``find`` returns a cursor object instead. Use it when you expect only one record, for example when querying with ``_id`` or another unique property. + + + .. code-block:: javascript + + collection.findOne([query], callback) + + + + Where + + + * ``query`` is a query object or an ``_id`` value + * ``callback`` has two parameters - an error object (if an error occured) and the document object. + + + + Example: + + + .. code-block:: javascript + + collection.findOne({_id: doc_id}, function(err, document) { + console.log(document.name); + }); + + +---------- +_id values +---------- + + Default ``_id`` values are 12 byte binary hashes. You can alter the format with custom Primary Key factories (see *Custom Primarky Keys* in `Database `_ . + + + + In order to treat these binary _id values as strings it would be wise to convert binary values to hex strings. This can be done with ``toHexString`` property. + + + .. code-block:: javascript + + var idHex = document._id.toHexString(); + + + + Hex strings can be reverted back to binary (for example to perform queries) with ``ObjectID.createFromHexString`` + + + .. code-block:: javascript + + {_id: ObjectID.createFromHexString(idHex)} + + + + When inserting new records it is possible to use custom ``_id`` values as well which do not need to be binary hashes, for example strings. + + + .. code-block:: javascript + + collection.insert({_id: "abc", ...}); + collection.findOne({_id: "abc"},...); + + + + This way it is not necessary to convert ``_id`` values to hex strings and back. + + +------------ +Query object +------------ + + The simplest query object is an empty one ``{}`` which matches every record in the database. + + + + To make a simple query where one field must match to a defined value, one can do it as simply as + + + .. code-block:: javascript + + {fieldname: "fieldvalue"} + + + + This query matches all the records that a) have fields called *fieldname* and b) its value is *"fieldvalue"* . + + + + For example if we have a collection of blog posts where the structure of the records is ``{title, author, contents}`` and we want to retrieve all the posts for a specific author then we can do it like this: + + + .. code-block:: javascript + + posts = pointer_to_collection; + posts.find({author:"Daniel"}).toArray(function(err, results){ + console.log(results); // output all records + }); + + + + If the queried field is inside an object then that can be queried also. For example if we have a record with the following structure: + + + .. code-block:: javascript + + { + user: { + name: "Daniel" + } + } + + + + Then we can query the "name" field like this: ``{"user.name":"Daniel"}`` + + + + If more than one fieldname is specified, then it's an AND query + + + .. code-block:: javascript + + { + key1: "value1", + name2: "value2" + } + + + + Whis query matches all records where *key1* is *"value1"* and *key2* is *"value2"* + + + + OR queries are a bit trickier but doable with the ``$or`` operator. Query operator takes an array which includes a set of query objects and at least one of these must match a document before it is retrieved + + + .. code-block:: javascript + + { + $or:[ + {author:"Daniel"}, + {author:"Jessica"} + ] + } + + + + This query match all the documents where author is Daniel or Jessica. + + + + To mix AND and OR queries, you just need to use $or as one of regular query fields. + + + .. code-block:: javascript + + { + title:"MongoDB", + $or:[ + {author:"Daniel"}, + {author:"Jessica"} + ] + } + + + + Conditional operators ``<`` , ``<=`` , ``>`` , ``>=`` and ``!=`` can't be used directly, as the query object format doesn't support it but the same can be achieved with their aliases ``$lt`` , ``$lte`` , ``$gt`` , ``$gte`` and ``$ne`` . When a field value needs to match a conditional, the value must be wrapped into a separate object. + + + .. code-block:: javascript + + {"fieldname":{$gte:100}} + + + + This query defines that *fieldname* must be greater than or equal to ``100`` . + + + + Conditionals can also be mixed to create ranges. + + + .. code-block:: javascript + + {"fieldname": {$lte:10, $gte:100}} + + + + Queried field values can also be matched with regular expressions + + + .. code-block:: javascript + + {author:/^Daniel/} + + + + In addition to OR and conditional there's some more operators: + + + * ``$in`` - specifies an array of possible matches, ``{"name":{$in:[1,2,3]}}`` + * ``$nin`` - specifies an array of unwanted matches + * ``$all`` - array value must match to the condition ``{"name":{$all:[1,2,3]}}`` + * ``$exists`` - checks for existence of a field ``{"name":{$exists:true}}`` + * ``$mod`` - check for a modulo ``{"name":{$mod:{3,2}}`` is the same as ``"name" % 3 == 2`` + * ``$size`` - checks the size of an array value ``{"name": {$size:2}}`` matches arrays *name* with 2 elements + + +--------------------------------- +Queries inside objects and arrays +--------------------------------- + + If you have a document with nested objects/arrays then the keys inside these nested objects can still be used for queries. + + + + For example with the following document + + + .. code-block:: javascript + + { + "_id": idvalue, + "author":{ + "firstname":"Daniel", + "lastname": "Defoe" + }, + "books":[ + { + "title":"Robinson Crusoe" + "year": 1714 + } + ] + } + + + + not only the ``_id`` field can be used as a query field - also the ``firstname`` and even ``title`` can be used. This can be done when using nested field names as strings, concated with periods. + + + .. code-block:: javascript + + collection.find({"author.firstname":"Daniel}) + + + + Works even inside arrays + + + .. code-block:: javascript + + collection.find({"books.year":1714}) + + +------------- +Query options +------------- + + Query options define the behavior of the query. + + + .. code-block:: javascript + + var options = { + "limit": 20, + "skip": 10, + "sort": title + } + + collection.find({}, options).toArray(...); + + + + Paging can be achieved with option parameters ``limit`` and ``skip`` + + + .. code-block:: javascript + + { + "limit": 20, + "skip" 10 + } + + + + retrieves 10 elements starting from 20 + + + + Sorting can be acieved with option parameter ``sort`` which takes an array of sort preferences + + + .. code-block:: javascript + + { + "sort": [['field1','asc'], ['field2','desc']] + } + + + + With single ascending field the array can be replaced with the name of the field. + + + .. code-block:: javascript + + { + "sort": "name" + } + + + + Option parameter ``explain`` turns the query into an explain query. + + +------- +Cursors +------- + + Cursor objects are the results for queries and can be used to fetch individual fields from the database. + + + + ``cursor.nextObject(function(err, doc){})`` retrieves the next record from database. If doc is null, then there weren't any more records. + + + + ``cursor.each(function(err, doc){})`` retrieves all matching records one by one. + + + + ``cursor.toArray(function(err, docs){})`` converts the cursor object into an array of all the matching records. Probably the most convenient way to retrieve results but be careful with large datasets as every record is loaded into memory. + + + .. code-block:: javascript + + collection.find().toArray(function(err, docs){ + console.log("retrieved records:"); + console.log(docs); + }); + + + + ``cursor.rewind()`` resets the internal pointer in the cursor to the beginning. + + +---------------- +Counting matches +---------------- + + Counting total number of found matches can be done against cursors with method ``count`` . + + + .. code-block:: javascript + + cursor.count(callback) + + + + Where + + + * ``callback`` is the callback function with two parameters - an error object (if an error occured) and the number on matches as an integer. + + + + Example + + + .. code-block:: javascript + + cursor.count(function(err, count){ + console.log("Total matches: "+count); + }); + diff --git a/_sources/markdown-docs/readme.txt b/_sources/markdown-docs/readme.txt new file mode 100644 index 00000000000..e0edbd1004b --- /dev/null +++ b/_sources/markdown-docs/readme.txt @@ -0,0 +1,19 @@ +==================== +node-mongodb-native +==================== + + Select a topic of interest for detailed description: + + + * `Database `_ + * `Collections `_ + * `Querying documents `_ + * `Inserting/updating documents `_ + * `GridStore `_ + * `Indexes `_ + * `Replicasets `_ + + + + This documentation is incomplete, the best source for documentation on all possible methods is `the source for node-mongodb-native `_ and `the MongoDB manual `_ . + diff --git a/_sources/markdown-docs/replicaset.txt b/_sources/markdown-docs/replicaset.txt new file mode 100644 index 00000000000..589641c22ef --- /dev/null +++ b/_sources/markdown-docs/replicaset.txt @@ -0,0 +1,83 @@ +=========== +Replicasets +=========== +------------ +Introduction +------------ + + Replica sets is the asynchronous master/slave replication added to Mongodb that takes care off all the failover and recovery for the member nodes. According to the mongodb documentation a replicaset is + + + * Two or more nodes that are copies of each other + * Automatic assignment of a primary(master) node if none is available + * Drivers that automatically detect the new master and send writes to it + + + + More information at `Replicasets `_ + + +------------ +Driver usage +------------ + + To create a new replicaset follow the instructions on the mongodb site to setup the config and the replicaset instances. Then using the driver. + + + .. code-block:: javascript + + var replSet = new ReplSetServers( [ + new Server( 127.0.0.1, 30000, { auto_reconnect: true } ), + new Server( 127.0.0.1, 30001, { auto_reconnect: true } ), + new Server( 127.0.0.1, 30002, { auto_reconnect: true } ) + ], + {rs_name:RS.name} + ); + + var db = new Db('integration_test_', replSet); + db.open(function(err, p_db) { + // Do you app stuff :) + }) + + + + The ReplSetSrvers object has the following parameters + + + .. code-block:: javascript + + var replSet = new ReplSetSrvers(servers, options) + + + + Where + + + * ``servers`` is an array of ``Server`` objects + * ``options`` can contain the following options + + +------------------ +Replicaset options +------------------ + + Several options can be passed to the ``Replicaset`` constructor with ``options`` parameter. + + + * ``rs_name`` is the name of the replicaset you configured when you started the server, you can have multiple replicasets running on your servers. + * ``read_secondary`` set's the driver to read from secondary servers (slaves) instead of only from the primary(master) server. + * ``socketOptions`` - a collection of pr socket settings + + +-------------- +Socket options +-------------- + + Several options can be set for the ``socketOptions`` . + + + * ``timeout`` = set seconds before connection times out ``default:0`` + * ``noDelay`` = Disables the Nagle algorithm ``default:true`` + * ``keepAlive`` = Set if keepAlive is used ``default:0`` , which means no keepAlive, set higher than 0 for keepAlive + * ``encoding`` = 'ascii'|'utf8'|'base64' ``default:null`` + diff --git a/_static/ajax-loader.gif b/_static/ajax-loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..61faf8cab23993bd3e1560bff0668bd628642330 GIT binary patch literal 673 zcmZ?wbhEHb6krfw_{6~Q|Nno%(3)e{?)x>&1u}A`t?OF7Z|1gRivOgXi&7IyQd1Pl zGfOfQ60;I3a`F>X^fL3(@);C=vM_KlFfb_o=k{|A33hf2a5d61U}gjg=>Rd%XaNQW zW@Cw{|b%Y*pl8F?4B9 zlo4Fz*0kZGJabY|>}Okf0}CCg{u4`zEPY^pV?j2@h+|igy0+Kz6p;@SpM4s6)XEMg z#3Y4GX>Hjlml5ftdH$4x0JGdn8~MX(U~_^d!Hi)=HU{V%g+mi8#UGbE-*ao8f#h+S z2a0-5+vc7MU$e-NhmBjLIC1v|)9+Im8x1yacJ7{^tLX(ZhYi^rpmXm0`@ku9b53aN zEXH@Y3JaztblgpxbJt{AtE1ad1Ca>{v$rwwvK(>{m~Gf_=-Ro7Fk{#;i~+{{>QtvI yb2P8Zac~?~=sRA>$6{!(^3;ZP0TPFR(G_-UDU(8Jl0?(IXu$~#4A!880|o%~Al1tN literal 0 HcmV?d00001 diff --git a/_static/basic.css b/_static/basic.css new file mode 100644 index 00000000000..f0379f359b5 --- /dev/null +++ b/_static/basic.css @@ -0,0 +1,540 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar input[type="text"] { + width: 170px; +} + +div.sphinxsidebar input[type="submit"] { + width: 30px; +} + +img { + border: 0; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable dl, table.indextable dd { + margin-top: 0; + margin-bottom: 0; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- general body styles --------------------------------------------------- */ + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.field-list ul { + padding-left: 1em; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.field-list td, table.field-list th { + border: 0 !important; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlighted { + background-color: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.refcount { + color: #060; +} + +.optional { + font-size: 1.3em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +tt.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +tt.descclassname { + background-color: transparent; +} + +tt.xref, a tt { + background-color: transparent; + font-weight: bold; +} + +h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/_static/comment-bright.png b/_static/comment-bright.png new file mode 100644 index 0000000000000000000000000000000000000000..551517b8c83b76f734ff791f847829a760ad1903 GIT binary patch literal 3500 zcmV;d4O8-oP)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RV2niQ93PPz|JOBU!-bqA3 zR5;6pl1pe^WfX zkSdl!omi0~*ntl;2q{jA^;J@WT8O!=A(Gck8fa>hn{#u{`Tyg)!KXI6l>4dj==iVKK6+%4zaRizy(5eryC3d2 z+5Y_D$4}k5v2=Siw{=O)SWY2HJwR3xX1*M*9G^XQ*TCNXF$Vj(kbMJXK0DaS_Sa^1 z?CEa!cFWDhcwxy%a?i@DN|G6-M#uuWU>lss@I>;$xmQ|`u3f;MQ|pYuHxxvMeq4TW;>|7Z2*AsqT=`-1O~nTm6O&pNEK?^cf9CX= zkq5|qAoE7un3V z^yy=@%6zqN^x`#qW+;e7j>th{6GV}sf*}g7{(R#T)yg-AZh0C&U;WA`AL$qz8()5^ zGFi2`g&L7!c?x+A2oOaG0c*Bg&YZt8cJ{jq_W{uTdA-<;`@iP$$=$H?gYIYc_q^*$ z#k(Key`d40R3?+GmgK8hHJcwiQ~r4By@w9*PuzR>x3#(F?YW_W5pPc(t(@-Y{psOt zz2!UE_5S)bLF)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RV2oe()A>y0J-2easEJ;K` zR5;6Jl3z%jbr{D#&+mQTbB>-f&3W<<%ayjKi&ZjBc2N<@)`~{dMXWB0(ajbV85_gJ zf(EU`iek}4Bt%55ix|sVMm1u8KvB#hnmU~_r<Ogd(A5vg_omvd-#L!=(BMVklxVqhdT zofSj`QA^|)G*lu58>#vhvA)%0Or&dIsb%b)st*LV8`ANnOipDbh%_*c7`d6# z21*z~Xd?ovgf>zq(o0?Et~9ti+pljZC~#_KvJhA>u91WRaq|uqBBKP6V0?p-NL59w zrK0w($_m#SDPQ!Z$nhd^JO|f+7k5xca94d2OLJ&sSxlB7F%NtrF@@O7WWlkHSDtor zzD?u;b&KN$*MnHx;JDy9P~G<{4}9__s&MATBV4R+MuA8TjlZ3ye&qZMCUe8ihBnHI zhMSu zSERHwrmBb$SWVr+)Yk2k^FgTMR6mP;@FY2{}BeV|SUo=mNk<-XSOHNErw>s{^rR-bu$@aN7= zj~-qXcS2!BA*(Q**BOOl{FggkyHdCJi_Fy>?_K+G+DYwIn8`29DYPg&s4$}7D`fv? zuyJ2sMfJX(I^yrf6u!(~9anf(AqAk&ke}uL0SIb-H!SaDQvd(}07*qoM6N<$g1Ha7 A2LJ#7 literal 0 HcmV?d00001 diff --git a/_static/comment.png b/_static/comment.png new file mode 100644 index 0000000000000000000000000000000000000000..92feb52b8824c6b0f59b658b1196c61de9162a95 GIT binary patch literal 3445 zcmV-*4T|!KP)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RV2nzr)JMUJvzW@LNr%6OX zR5;6Zk;`k`RTRfR-*ac2G}PGmXsUu>6ce?Lsn$m^3Q`48f|TwQ+_-Qh=t8Ra7nE)y zf@08(pjZ@22^EVjG*%30TJRMkBUC$WqZ73uoiv&J=APqX;!v%AH}`Vx`999MVjXwy z{f1-vh8P<=plv&cZ>p5jjX~Vt&W0e)wpw1RFRuRdDkwlKb01tp5 zP=trFN0gH^|L4jJkB{6sCV;Q!ewpg-D&4cza%GQ*b>R*=34#dW;ek`FEiB(vnw+U# zpOX5UMJBhIN&;D1!yQoIAySC!9zqJmmfoJqmQp}p&h*HTfMh~u9rKic2oz3sNM^#F zBIq*MRLbsMt%y{EHj8}LeqUUvoxf0=kqji62>ne+U`d#%J)abyK&Y`=eD%oA!36<)baZyK zXJh5im6umkS|_CSGXips$nI)oBHXojzBzyY_M5K*uvb0_9viuBVyV%5VtJ*Am1ag# zczbv4B?u8j68iOz<+)nDu^oWnL+$_G{PZOCcOGQ?!1VCefves~rfpaEZs-PdVYMiV z98ElaJ2}7f;htSXFY#Zv?__sQeckE^HV{ItO=)2hMQs=(_ Xn!ZpXD%P(H00000NkvXXu0mjf= 0 && !jQuery(node.parentNode).hasClass(className)) { + var span = document.createElement("span"); + span.className = className; + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this); + }); + } + } + return this.each(function() { + highlight(this); + }); +}; + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated == 'undefined') + return string; + return (typeof translated == 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated == 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash && $.browser.mozilla) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('#searchbox')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) == 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this == '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); diff --git a/_static/down-pressed.png b/_static/down-pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..6f7ad782782e4f8e39b0c6e15c7344700cdd2527 GIT binary patch literal 368 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*yM+OLB!qm#z$3ZNi+iKnkC`z>}Z23@f-Ava~9&<9T!#}JFtXD=!G zGdl{fK6ro2OGiOl+hKvH6i=D3%%Y^j`yIkRn!8O>@bG)IQR0{Kf+mxNd=_WScA8u_ z3;8(7x2){m9`nt+U(Nab&1G)!{`SPVpDX$w8McLTzAJ39wprG3p4XLq$06M`%}2Yk zRPPsbES*dnYm1wkGL;iioAUB*Or2kz6(-M_r_#Me-`{mj$Z%( literal 0 HcmV?d00001 diff --git a/_static/down.png b/_static/down.png new file mode 100644 index 0000000000000000000000000000000000000000..3003a88770de3977d47a2ba69893436a2860f9e7 GIT binary patch literal 363 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*yM+OLB!qm#z$3ZNi+iKnkC`z>}xaV3tUZ$qnrLa#kt978NlpS`ru z&)HFc^}^>{UOEce+71h5nn>6&w6A!ieNbu1wh)UGh{8~et^#oZ1# z>T7oM=FZ~xXWnTo{qnXm$ZLOlqGswI_m2{XwVK)IJmBjW{J3-B3x@C=M{ShWt#fYS9M?R;8K$~YwlIqwf>VA7q=YKcwf2DS4Zj5inDKXXB1zl=(YO3ST6~rDq)&z z*o>z)=hxrfG-cDBW0G$!?6{M<$@{_4{m1o%Ub!naEtn|@^frU1tDnm{r-UW|!^@B8 literal 0 HcmV?d00001 diff --git a/_static/file.png b/_static/file.png new file mode 100644 index 0000000000000000000000000000000000000000..d18082e397e7e54f20721af768c4c2983258f1b4 GIT binary patch literal 392 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP$HyOL$D9)yc9|lc|nKf<9@eUiWd>3GuTC!a5vdfWYEazjncPj5ZQX%+1 zt8B*4=d)!cdDz4wr^#OMYfqGz$1LDFF>|#>*O?AGil(WEs?wLLy{Gj2J_@opDm%`dlax3yA*@*N$G&*ukFv>P8+2CBWO(qz zD0k1@kN>hhb1_6`&wrCswzINE(evt-5C1B^STi2@PmdKI;Vst0PQB6!2kdN literal 0 HcmV?d00001 diff --git a/_static/jquery.js b/_static/jquery.js new file mode 100644 index 00000000000..7c243080233 --- /dev/null +++ b/_static/jquery.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/_static/logo-mongodb.png b/_static/logo-mongodb.png new file mode 100644 index 0000000000000000000000000000000000000000..859ec93813007aebf0eb2465c4ce488c8021701c GIT binary patch literal 13030 zcmVG0%c3tqfquPZRs9qnzq@= zd;fFO_u7|`bWjk{clcbAzPxwm`Q9_`x%crXib5Q5#L>eeg6jf~IC{7wVE@s!p?|F& zwv?DrhY4L}1fRz{`ROr(L?!vl8&IUxqG@yAL2oTsf*cM9;`8~=Pm9Tf)~;BD*1f+D z&0o3zm6nvCva(XNbj@do;PH@9EQU`4*{l}CBlu|T^2O-?)~-NmKTVb873+%7-1k;Ms{Y=As$% z-$Npi7%iLs7Sd`9(R-^uMgoBl$>egV&m#2R!lh{b;(2H$d{U$X3E^IfBB9PUl%JQ2 z*1x|P{r2+@$VaL2SXW%m!sTn6pSa%3)_#V}P%p7qf(U{@BuOHR#f&6S_XRU1!lx81 zTDcxAeS3zp{>#>FKr5fc|$N zAB7aH-}oC+Ddn!?r!Pa}M#rPc7SJ zLqySv{-Op_MA`mYpz%OO!HFY|{xKl48LX&5kA}+FshvJnMkrS}D2hh{u%wM;uZSDT z#!@zt>s5|8x?hml3^o)R7omzC(fmU~E|^SVqYT?b_@5mqeftJ1_vxV-Mj9Pl&vL|3 zZ9(R+IFP!j28H&Fm?u(;U#CcrU=)QMqyveCB4={g96_pQ{8uTT)I7@pjU$d~0Wt^J zV16z9QS_+hbCiu$a~xKO6JXf2Mrmnhtm(NUR=GPI$qmo6~^=wDEaem3;zMD>|#AIG}OFfvg&`8*L~kE-X51 zVB~npK?ai`sz6nA+F^_&Bg_A)Oc-cFUT;|!^-Ng{rT9^-pK-*|V*xVK>Oek?eNn&@ z!LRXsguO`zRlfMkVR25m|yae|O14VD}14WaOom(vChy$4ykderzk!qMvGxZpU z&4Cy@%qhWmkSj%2fd_RLDB{4w1E0MUZ9=7#wjRb4oFhzqqH+ zU(y4+?-2temL2AzGJ2DS^gq1)fv4j4B2@f=PTjH&QtYjT@1c=n$2+%MaKzDL2{Ige zC=QYH31}!M>7k zS*)a?yghc|J5@xARuMg^j8)3AN|0gOOc)@F6Vwy+xgXmMZ#uoe`?jml~IC{+0 zMI6#0L^7= zO^n0jaN1djqP(k&ObjEvR#q*QOUW2W?J1Ir0^#W2D9Hdhd^x`vq2NbT4$=uGC(yj9 zj8vsXR@L5QUO6@qa=>$9z8XpREf9w>j{cP(1JLj!{3s+L8ep$txtktUtuiv64K|oq zAy&?a5X3B(0oh3;X{Lx0H&ujkUPg}o4J2>{ne&PU2@yeAXmAm<$_Rg9X+>bv5VXq3 zqg6=fEj%ZXsyl51gO;b@M-e_C%}A74)xG$*w; z_dcE%LP~+OAJQ#Iwi-T%%Nq=-1td!?@sdlIcfO`|7PxD6JRzY%d;kof0iUUd!9);L z`8fkDm61oddKpno^*_ofKm8yDRrQDt05)~bLNw-$$fgQNcbS7m5aw}g#!Ne#Vf!2$VVZ&ScO{vpOyHmQYl+05(#|o=Qu$q@BKAP zU(eT<7?-Wz@Y@$~$y{TQ2^-2a!bq7vUXbQdtOaJQG7^<4qq88aG7^->tuC&Oa{CcG zJVb;)Ps|T-g4M$__z=w@BS)j*qh8}U@-ZZ{$%rP;S_q#ewDF_W_Z%1t%#G60^W+Kp zlP*Oy3_h+_DMBI}g#^px5)qCLVt@k^J(ZVVth;?DJF{3{R;p1el^Q>#uUf6ZpGrPK z@EG3!pHFB&AdFo+_vNt;hvTacKi&2YWRr7`=o9c!cCNPMz~SU$@K|_cL~uyGKwn>i zSDqI>_||N(+6uHKdXvd&#T=|u%H;tXrHWvc2j2tzHOh}?PaWC{uFTr@$1y$ofK#s^ zBNRkEP~-e@Krn$&rJKGAmC*r7AQC!HkhR)u&eLOSAkAzA8$ zAA&#gj7D={*G@6*W=|O!->gXkjoEAkegZJ$=*!lAwk=`z{-nbSg%qoTVn_;`%`UGW ztO@GdGqz=Xuh`}d!|VAv&vc?EbdgB-+Pvw*qW~|Hzx{FlC12Jl!jO;f;Nc7BA^iu+ z35N1o%$YiLVCRm_!c0aB5=+JC?8V#JAAG!Z=k;3|X&`C&fH^UMG3=$`Pj~L!qiwVg zwAL`T7fkpVVe#70f$-=?;=gMAfK^Boa{$O2BMkso0!Zh05ssPEs{@7GiwL z2*i`|gE$Z4znV;tu%VqPlSvc@63-`hXd4|E(`KlAzgLU{fl)ZrYKDPoaOl$l+qnZM+lLzl0l4x2f7 zNIw9p03Qc#cQ{aVWJupe4T5%_Id}7jCy=>$7ZD#hHO2C%`-3s*%Ir@7Ap9lqnUBD*_Xi(%~ zKtf7|bPZCHK)^p}GFg88@Y7$`F8grvuR2|+1pru{IRFj7(S5=z{pLLv-&tK+W@2ZJ z|G)>)#NC6#up;POtxWbo&o$1Z+<^wgCLLaDf1E`fThkV{&C zs@slHb*ly$10jkIgK`N5MjjWY9rW)!cObC<#ZD~gMIi32G90-|Hd`(3$M@nGyQ^Re z9sPCZiT?oDwrPt>Du9MxMiCqm@M37N|0`JPcp)ndc$Q}a*qwKec{WEzJ*l#BV05a@2!F*}A+R&Jhy#@>$*e#}{^g+BYfhr^jLdQND9wURqX8?FX z8F7y)N1vle(vqrLm61kOjh(Q(@<@M3M(zlEjvf^82|{Z&TaynQIlmL^rX2iABSvlX zRVg}xP1cRPk5E4Rs-^L-_CsS|?gQTq-W8uH?qFXX5U)!K)9e)|5u=^O>a7Z&z`Ql_TtC`q-*aqnZNb(xyrGPX5 z(jG|rAa$m%heBFP*OQ{vBx|+8C^7Zs9Jdv=%W)dppa-~w<+?&nh6=20>Xu{b3 zXxx~1R9sSqY&JV;6cH?mZ4=c%ER#5K05&5!dg^M@*$cOmBx0e*@o@1j+Oy0BwoFr@ zq=O1kmdbUos=SPhy2#$`au3Sf|8`Jz%7KgsRk`T}J4Jeyl;{V~T)4EIL?&xR@CfED zgI1+Vt@!kd&w7n|{ms?zcUzYS`TTk^g<|=_6>H;-M&pE(n>Vg3U$sMc_?nQvwf`a<<-dni@%6Y9k4_A+pKp+SdC=@uNVDRFV zA6-@`l#@SRy)4n~g?P9g14>Kuy=K0%thq=miGtZ!ihn37%)ik#wo}t%=g;+Q(Yozy zxTIo+ipL`aBC$9wv_W{>yd|qYgufST+p-Dz!`E|N3kw?0efRw(Fh(z86-O$qT+0Eq zM*@Ghhp+8dtlK!(Vzs0h3}rbp7cP^+4>%el(_}PEg~u*1&lG73(2Td=9TgfLv4SA@ zq4&(%kf%f{YX@K3L7%^!ekWz#2TSIE`j<#EK4C8|Hl*IXoq5evV(5i!CM?OwG81~X zPse6gZ=^>ZNW5@MA+P>rl{yAsqvKI(dM=v!#z0htohK9;+T)2<{VYZcl1N49)S2t4 zoB#LcA9?w@REb37s1{^A0$Chojy!vr9SI121*nkA!ZhWwFio<-RTDc5>&j-k4w)VK zi092M$-{52^b?E4W0gwP3+}(-w?p*X z1`$52$6CN7@gp$!)Q?sz-HL&RCnS+b{4At3knSnSVzx-4n#IfuZO|~fDrw~(5I8F= zqG7h(=2&;nEDUvhW9qC{05DwF?igUHw{PYC_P-x4<@IX6JVR!UF&> zuNxf&ZUC?$6PZgH9C}Jgs4BdSMCIm8ie4KdE9@|mvDXDO(2)eNpoCGyS_oG>+0#ss$1lGfAi!#MF*owj>`vawywmFp#a<#fA(T z{!$D8s$!}N46fg^9GDjC*;B_e4(;8QZZa9|oxAl2@BUQphDu-G3NhsCr|B0I95U2y zcl^f_z$Q$e`xFhZ7<}#O#q+t#7tZ=M>C~|#nM`iBTCLLHkdUbH)8_Pje#Gcjz?@8n z1i!Ul$$Tg``^!((99ODT{9k|mKB=&<;L~UN4;t96L+2*Y=8Ad*hlXJ_6s6y}owxJ1 zt=Df}yHXq&RA2dYpZ-xDx;zoW$``#har$$)Ss8n_Z2J1D%C{V^7!V_09UnS<-eRm~ zcE{K5+`3t?eBsP(M-J}&Q?Bqa!$hJ!b>vXr`O7{W7#I|Mk4kH|S<%nme|75cfj!r; zXYQp}-%!n7v}`>9Yz+S0P*!UF?86m_o4@^H4@Eh$L8=iTu>yvUeC6r+OF!tXQmZS* zARsVkN`r=xcWhSs`iCveU^20p%+?%8#XN$iVN^zyk33lEBM+@kWyC6BgV4a{kUp-W z3{GU>`}VDy{chj9HhAIkwF9LxSw-8DlTO}UzF^i)m~}6KdW6?v9Gk!STr>EE zQSl2`tmzLDh+zl?%(SiC#{q|V4IDO7^V*x!$1?yc)$1*rzW8kC$)kt91F3fx<5&dK zc|mUO`6csa+yMNK8#8WF7gjcHd&LhJe)iwUA!@5<6H>_Lv2aIPXFt8qkhIGrfpEsB?chRtMli%vf+$Z<(X|3>4b)rbe z)e3i;okRef7Xc6z(i0XiSe5}dqH33z9WC`ONYKX zbT=*KCXB&3+P*{q^@3jVQTo2f+_!b}e@}k@^~TQu?Uz6W$Fn#O`a!*Q^S3wf`WKAX z^YEvbxqssHxi4r7@(%y-_2=i{`a=U5ey=mAb$Mk5QxU=AMKanGNs)YtB*hP+3_R&* z{FE|C-P*Nk+|A)|eDT32zbyXlrvo|e@2I|4T@(?>dfjkd5H7hOY$R)rkJono<53mw zW+nk(1all5bGRu&-uIPJuAW6?rI4f0dY3G<=ksJ$u0>OOGcVsd;bNuL)Q^$^d?;oJapzkGN zHdpT5^;>Ri=dOVx#*FLE+&f^%h^7~llcM+hvF#?@LU*big@iR21dP^?x$oAEtG936 zxUvuGcZtrke31G4e6yjf;6TD3^+0tDZ_=zqedf0|?K|~s(WZTm^Jh;V0-Fa<45eVh zq?VSJ1VQQwAoIuf<>h1*UAuJtu+d=n10)>2&x$35(Nq?2^x!^8T+cq?(aoBNFaj8C zz+k4EtriQ4j)@VqZr{)JB9QACj1EsSg2oT)=Yp>0z(Z~Zf+>UA<~dJ#M=skh&B z6x+=BSEuigM3qvD23Uoc5mj@>hr1Nh*>lMv`&IaEuHk~C4$^IU;gME331DVHHe`>Z zt+OHFZ~_C^0y&v?@1D4R_0ko$d~npj1=yS^^sVbxFCbPBv&m=_Lz1%x zgLGgOR@IXBaFzr2#F1-fj-NONz%aPi8Ni-%Xy2aS_wCqz%0)U$B$4nNd(I1al~r1k=U`q zEE7PP@$tPojBnejF{%z^_-!l}dxrUhJ>7H>%Q+V}K4PhiEEL&nHm5Gjo+Lct4M1kk zx7@VnSv%X@WZiYfxhQ;b{y%u z8Z*gYK9xwM5o`yOwxA$KTUeL|fbzJX3MPzVQ1wq`q^I6tUstJogTNjQsjVx$Rv?4C z)hb1>uSy>1V9J5EfHW!tVCbq{n}r6;WMY$CDoz2wUZN*wym#z0jL89zU%zkq>A;5X zemRNEnlc34_m!C60E;$;>Ft$;v2Y-w@X;KD=YsZW@!x$evJ;ub-bE*hm#d z(*A_sZzb;EdkZ9PIS_#bm!#mSI8x8tCwUrLm{Daq?r%d?-;M(4JlQrj9yP&bVD7l+~IM_Z)T1M|BH~_B4<2n6U&^6J5Q0F+b_VF_&HE zZDKpdH)-B-@UWL&MWbGS6Xj-WQP;ShszJkE!s}#C$4`E4j_%gAtCvM0fx)f5F1EW` zk2U(9`(|&r_hM!-e!(H3E@2)1Y~Q19%C`*$Dy;*&MIKxMU7 z+Dbx=e?Z{cPrm-q_R*I=6#M#Vrtt*=qNuRIykg<(-#4yb^$pmNcRd=7GBJh72Ed943+xvj z8rTDSgt2472*BIDKk3BzODX5QMP%HUIzdq;sZ=DulB|4hB@da5R)g7OEvqTWu#>__ z>g^XS=SmXnS>}8Shh=$E8R2hc^O{Fh8=n`Vvm2~e%Jw-5t!I#cXGD(?;V`7r$Bt$n zJ-FA!z5oVoSuZ%Gqr(fM;mJrS5XglBVa1|sc4kI)R>s{_uxB22we3okZ}zq=-~BLS z{OGSQo=eL0q}u6qI^+Mo|2k>x@Mk~y{;Lfe!A48sV@Hsy+Dnz_i}L}jdN)sDOqXtP zz9!?n!-=JPZ0F8??K^dGSr9vO;%Mfz%NGltkktFB?k2J z@TX(n7}IYg@S?yORRi|v&b?=jA2@ve51CBj%}G^j!aKLyw~f}cZ5gRXmhw3atEG7b z#W@99eP+!;hTZvMqR4W!Y=`k+(GILOQhaoe%ILmH?4Ehd4j{Z-n&?O|{0>sAptcRg z1JC zFE|Qj{fhX$!w2^ypFH~KX#nnDu?eUYui>TMzVYkj3un(z<%E9O{NJlnUwd);fF7}5 zb!`#;{)%_ze3YJ=^0QbXIgQHC#IU=no)UEV;<*cuZm_SnY8yMCU8gRC^Ycw;_^7dH z$jC9yMSI%8fucalM@Bbm$lRZio|b#_+LcRCCrfp9l_$~`m7sakhojMxhd9CJ(oh(d z!Tq~xCXDSrO(GR_#FIWqEp+PK&GessP5ecxEjcd~@b4+aXtban-CNavvTMsA%4De$ z*Z^QOs9zWK($J?+L18Is*({<LFgsGI!Jz^K%3mV0;weLEO^7+#yB0qmk&83-K zZa;cx-;u)y_B_+~xgk$5*Zl(n`;Hzr>Giyv?D_k49b^qULZe?B8TsL<;dZ-IN!{OJ>rQl-L@ z8m(G17k@ggTu8olaQBY0UApz?$Wm7n)91hYdQMixd60<73aDRci5xwl2($fl@EnzrIu|j(UA`U*{4LqZYc1 ztG*1qIfg)J!!DKy>A=5mcSg(Ed+q!bdR4A z)JsQ>CC7SBztvG>Jqk9Su2!l6NP`vYH^6LTK&Or-Ht^H<2fNIq?PC3-A_JvXtF>Z= zvcU}6uz_0ICbpByz0bcms_F5=2U~#3ldPsA;qhz>Gp)3ByN>?sd&3(=Mk;-Mn@pR# z=(K-8Jv4jL>qz6Tv4JGJwqx5*2V1xA*gQBS%(v2O*XiwVe@O_QH)Y&{;-aE#yuWD3 z3(xs2Uj6YqYClaM#=ZNWPuA@IW7|(Vf$sp=r4wLcA^LsSiOU~- zzWwX`g5pzdp4oC?!}buhZRqb+W1{R-7~fYIuX;9Uf}*3kCC@=PC$%8L4~a_o=w?v{ zDj|(vf)P%Dk=d3!%b!Kx*fUI9KuyG|hPk#No4Ihw$fDAsn@8+g7t(08n(u%LZ4!&cjlj5fK4d5>wQu}rb;9Pa zKmXijvz>r;6gdNUUwK13d+~}HK1$V0=tn;u&-Iuuhuv<1Iu}A4|NHjTaVr%{Rm9RY zpUs5p&oOy>YTx>m?=D*X-g^lRBf|scEPj9Oz+o@GTzl=o@zu)3^A>&i$%om#<=cJ; zv)L3H-L(1hvlp$H*zKua(QZxv5+RFXrc8XaoK{zA z-SSJ~iLJjM{i#@Ab`bKy2*d3*TX%s_sHwVrWK*FKC1?xs%v=8Z#nG_vh|cXgc4=IjzQ_CI<}Fzj2ID*F z>kaE~gY+dO5^3J;o7eU(oj-$kb^O#92M!zA7Sw1y&4|E&l14Z&dECBnt?-La*B;)V z@W(E@&2kI?mc_RBFtZAUf-W+d_yvhb7>c);RJTZvp8?e@f@Sto1qHg2^OsVyb{|Z- zoRoYk$!fKq2Y}&&Z}L4X+Lz}c7Ct9ZNQbkw!PKZsEGTVuhdnp1NdGHHukE`|9EHi^ zoPf{2007JMR9Z3@R$fm*4BUq!sI&Vr#=IoZxP-w(!XACeFYAU(iY~Io;h*!Zo==sT)dl> ziVb}nl#A6I3@}GI0Iet_EF!E!mu^Eq73*dwE0f$CxJn^lZp)?QvwJ{Q+upWA=P)R5 z5U6*}trm;O{fIESeL3gPp8hR4>EvDj1y)6)8$~x6xM10bWzj^IaZo>9$*OSkjxG0gz zum*z}KHHrEEmj+9-ZZ>r+m?+6o2~X%R*O}PRkpxDwNHc4KsBEr_>|j19NykCa%EiwF(&gc3cnwP`GRK@{(#%zaDvvr~lMmfC zTo0j_C=MH)4<1OYo`%z9@vCSbX0{wqZ5=~LzS3&$dn?y~J=@DFK1S%e=>tbHD1M>qFd(2+6+_{6hRIfJzSa$sHhi|rn z%9{?-)2P!H3XdJyk5y|QtJSIw3<_=r_YdqhaA;GOL{~!!K(5DKTj_RVFB&!l6f}bp zbUm52TdG;EA!(*Hu-e3X}O;=?|13l z2KsbnMru|!+pcT;jw^K%Oh^9B4nsCIA4sEWa?-t^omn5^cLMeXwTR6q0m z*qbaSv(%!m95rbl-oZV7`s^+Mm^F-Nar-Yno&xoC6G)?Tv~;o4%!H+q5L8-OM%tZ= z2X_4->C`nYR1*;3lxTW=v0YzWOo9gGjaf_UsI55e10;`vuj)i~iJ^1w2wuL?U{1wn zi2Ep&7Kv1vPmz=barDRtN6jmIeDKmiyGph1_T`dd-6=kw&t7bH&=MJ|Jh|}OmHhnN z;|2M-6%h+Z4(`o7dGv5LNItG(9}&o$b|e^zCXq;jBw{Hk5D07(ccST|1zGtaJ%Q|N zot}776%iR_!W%kW47d_K!cqA+6%|^n5sezlAvwJqbVU9Ykw{?XdbMs;r$|j46j@ek z%r+aXCb2}uC(2)1#`Wr>oHYp~DADU(B5QiZKi6;nu0IBtnj@n0k2R;)xamL*Kpp7_>%melE_>n{Va74b1>(xgHGJGN&NH2>-B6AQt&>s1G zPL4fd5{bpUYnLxxNx607Ze&!G2J~hBWo!R$14&Ws7tENj)<>zzs2>@J=fS{mv z<#HeAStt8;Zolxu*BgJfm`tgV9|y8W2{PxRYN;VlUtF5*qwqBg1wu}eJz|n86x5%4 zcOGpN75(ReWgm`V*53p|AwCu8tq(r^Y8rEh>5RAEl?p|o2quCAFXsTbPHb4e>c1sA z-7x@IG1sGYr~6qabGPYmq;+fBTZ7L+$U@w!CLSp{91fLOBI)|K*N%3o0bwyfZdTNR;JL7Kg&)$h@*$2yK}@5M;ypF z;)nwoM;vj)fs7-LIFNC~5eG7kIO2!{8Alv(AmfOme;YmYh>yg*oAE~kq#=-!@TJGB zk48gEfP{l=@ey@fALH>}MAskh8N)9%-0&Fp|7e=87{W1^1#bKmLEpy^{ym+($52hb z#L?yb0x2!-nUQ~cNjCa11y}&x*?4f`QQZ#*dX$8jC!A)+I8^lkK5UZH_y67cKZ3r# zl}<*Q&nB|&k7OT^P1xQlK)yL02| zSrj)EpS+aDl8Q#Ub7EM(KS_76+(Ul&nSQj2kjVOND4j-lsb@M}uAH6;)7VkrOUcXm&b0$Oje(5W#zSq{#;Un{`W*_bh~4#m=Gh}z;i$S^0$*@a=HNp zZnH--Nb?{~p_wI))d@rCS!o1405jb>DUQ~gN6;O+k{;yO=sf$e@?!=Y-#e9N!Z_9p zSCx&mi@qn#!+rNtj~KcRBk0-l9lC!Q)uYJi3347?j{-N9YbHIxj-V%ziFCV|Iwsbz|4|ha zV}yrEeGxrA@pQR0>6Ze!Zt}l7$UbH@giQ(btic$g0j$|*1pQkK%`5@#{uEYz2`naH zp1;a^CXU4@j3kS#A;_xr>(sIy39Okik#1Y82ek&#jL2?x2iEfjR(XhJu(R8;mA)2G zhxQp*(t`n50;@cxU1@GohTTqfJ(%Yb-TJ757mz(DVr()-qQ=%@l1Zd__;0N)Ze)3g zY9fl|tQq)f9hrn-z#;Su##SpHg%MxiWu~m@^9DBnuzy1y)F5x=qB;UEk!2&rdzh%a z)q^d~ke9a9mBKxY?^QQR_m!84-<#8C&EFklXXt?luc6~0j`j-8W6j`kb!3WP=z5?B zA^z*&_z9>1@Tz(~g4Krs)c`8sAv&BAS$4I|gY*gTG669CzJ>*?hzAI=2%2A(+~=g{ z39toqb$I<<7o+8@0eP~Hc_p#(kkib;R&^HrMQuuCIdj;PNm4DIA3`%x2RFNjVT7R` zJaYv#WX?s^Og?fq$-vlJiC!j3xrchB(VuMldnN1M(WrJV^8l9PsUL0QCVBt`b595Q zo;m~Paquo)MXqZeX)I=7Y^JYRHh|pAy@<}|ss}F$ZhuOz(OCZK!QMw$h;b znB`qu>gN4Rt0F&UEhwJ8Za-M@6b_Msm?Ku3JU(GA^-9=`?YzYC24;-v9xMA?*TeBYP*afrzMytU@k#5583)x5O-P?M;tw5 o;Hh^70HcxFo{RxglK=n!07*qoM6N<$g1G`pLjV8( literal 0 HcmV?d00001 diff --git a/_static/minus.png b/_static/minus.png new file mode 100644 index 0000000000000000000000000000000000000000..da1c5620d10c047525a467a425abe9ff5269cfc2 GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1SHkYJtzcHoCO|{#XvD(5N2eUHAey{$X?>< z>&kweokM_|(Po{+Q=kw>iEBiObAE1aYF-J$w=>iB1I2R$WLpMkF=>bh=@O1TaS?83{1OVknK< z>&kweokM`jkU7Va11Q8%;u=xnoS&PUnpeW`?aZ|OK(QcC7sn8Z%gHvy&v=;Q4jejg zV8NnAO`-4Z@2~&zopr02WF_WB>pF literal 0 HcmV?d00001 diff --git a/_static/pygments.css b/_static/pygments.css new file mode 100644 index 00000000000..1a14f2ae1ab --- /dev/null +++ b/_static/pygments.css @@ -0,0 +1,62 @@ +.highlight .hll { background-color: #ffffcc } +.highlight { background: #eeffcc; } +.highlight .c { color: #408090; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #303030 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0040D0 } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .m { color: #208050 } /* Literal.Number */ +.highlight .s { color: #4070a0 } /* Literal.String */ +.highlight .na { color: #4070a0 } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.highlight .no { color: #60add5 } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #007020 } /* Name.Exception */ +.highlight .nf { color: #06287e } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #bb60d5 } /* Name.Variable */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #208050 } /* Literal.Number.Float */ +.highlight .mh { color: #208050 } /* Literal.Number.Hex */ +.highlight .mi { color: #208050 } /* Literal.Number.Integer */ +.highlight .mo { color: #208050 } /* Literal.Number.Oct */ +.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ +.highlight .sc { color: #4070a0 } /* Literal.String.Char */ +.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4070a0 } /* Literal.String.Double */ +.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ +.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #c65d09 } /* Literal.String.Other */ +.highlight .sr { color: #235388 } /* Literal.String.Regex */ +.highlight .s1 { color: #4070a0 } /* Literal.String.Single */ +.highlight .ss { color: #517918 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ +.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ +.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ +.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/_static/searchtools.js b/_static/searchtools.js new file mode 100644 index 00000000000..663be4c909b --- /dev/null +++ b/_static/searchtools.js @@ -0,0 +1,560 @@ +/* + * searchtools.js_t + * ~~~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilties for the full-text search. + * + * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words, hlwords is the list of normal, unstemmed + * words. the first one is used to find the occurance, the + * latter for highlighting it. + */ + +jQuery.makeSearchSummary = function(text, keywords, hlwords) { + var textLower = text.toLowerCase(); + var start = 0; + $.each(keywords, function() { + var i = textLower.indexOf(this.toLowerCase()); + if (i > -1) + start = i; + }); + start = Math.max(start - 120, 0); + var excerpt = ((start > 0) ? '...' : '') + + $.trim(text.substr(start, 240)) + + ((start + 240 - text.length) ? '...' : ''); + var rv = $('
').text(excerpt); + $.each(hlwords, function() { + rv = rv.highlightText(this, 'highlighted'); + }); + return rv; +} + + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + + +/** + * Search Module + */ +var Search = { + + _index : null, + _queued_query : null, + _pulse_status : -1, + + init : function() { + var params = $.getQueryParameters(); + if (params.q) { + var query = params.q[0]; + $('input[name="q"]')[0].value = query; + this.performSearch(query); + } + }, + + loadIndex : function(url) { + $.ajax({type: "GET", url: url, data: null, success: null, + dataType: "script", cache: true}); + }, + + setIndex : function(index) { + var q; + this._index = index; + if ((q = this._queued_query) !== null) { + this._queued_query = null; + Search.query(q); + } + }, + + hasIndex : function() { + return this._index !== null; + }, + + deferQuery : function(query) { + this._queued_query = query; + }, + + stopPulse : function() { + this._pulse_status = 0; + }, + + startPulse : function() { + if (this._pulse_status >= 0) + return; + function pulse() { + Search._pulse_status = (Search._pulse_status + 1) % 4; + var dotString = ''; + for (var i = 0; i < Search._pulse_status; i++) + dotString += '.'; + Search.dots.text(dotString); + if (Search._pulse_status > -1) + window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something + */ + performSearch : function(query) { + // create the required interface elements + this.out = $('#search-results'); + this.title = $('

' + _('Searching') + '

').appendTo(this.out); + this.dots = $('').appendTo(this.title); + this.status = $('

').appendTo(this.out); + this.output = $(' @@ -122,7 +122,7 @@

Navigation

  • index
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -187,7 +187,7 @@

    Navigation

  • next |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -200,7 +199,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -310,7 +310,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -297,7 +297,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -321,7 +321,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -237,7 +237,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -285,7 +285,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -457,7 +457,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -208,7 +208,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -104,7 +104,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • - diff --git a/api-articles/nodekoarticle1.html b/api-articles/nodekoarticle1.html index 227570a0642..89292f6419e 100644 --- a/api-articles/nodekoarticle1.html +++ b/api-articles/nodekoarticle1.html @@ -421,19 +421,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-articles/nodekoarticle2.html b/api-articles/nodekoarticle2.html index 331550f9682..9d2dac91cf9 100644 --- a/api-articles/nodekoarticle2.html +++ b/api-articles/nodekoarticle2.html @@ -349,19 +349,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/binary.html b/api-bson-generated/binary.html index cc892ac4a7c..35cc72be6cf 100644 --- a/api-bson-generated/binary.html +++ b/api-bson-generated/binary.html @@ -412,19 +412,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/bson.html b/api-bson-generated/bson.html index a3b83658d39..9e2c5613ea5 100644 --- a/api-bson-generated/bson.html +++ b/api-bson-generated/bson.html @@ -895,19 +895,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/code.html b/api-bson-generated/code.html index de5bc048216..86a9600e5c3 100644 --- a/api-bson-generated/code.html +++ b/api-bson-generated/code.html @@ -138,19 +138,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/double.html b/api-bson-generated/double.html index e67eed95578..32b18a2d23c 100644 --- a/api-bson-generated/double.html +++ b/api-bson-generated/double.html @@ -154,19 +154,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/index.html b/api-bson-generated/index.html index 54b178aacb3..680bb3fbe3c 100644 --- a/api-bson-generated/index.html +++ b/api-bson-generated/index.html @@ -244,19 +244,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/long.html b/api-bson-generated/long.html index 14f6b207e90..8b2a5c81ad6 100644 --- a/api-bson-generated/long.html +++ b/api-bson-generated/long.html @@ -921,19 +921,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/maxkey.html b/api-bson-generated/maxkey.html index 7a4b2f81445..1bbfa1851ee 100644 --- a/api-bson-generated/maxkey.html +++ b/api-bson-generated/maxkey.html @@ -130,19 +130,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/objectid.html b/api-bson-generated/objectid.html index e46e2f67106..4714bd18245 100644 --- a/api-bson-generated/objectid.html +++ b/api-bson-generated/objectid.html @@ -332,19 +332,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/symbol.html b/api-bson-generated/symbol.html index e28f3d99622..8e8167a8cd8 100644 --- a/api-bson-generated/symbol.html +++ b/api-bson-generated/symbol.html @@ -154,19 +154,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-bson-generated/timestamp.html b/api-bson-generated/timestamp.html index 0516976845d..60844325d0a 100644 --- a/api-bson-generated/timestamp.html +++ b/api-bson-generated/timestamp.html @@ -921,19 +921,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/admin.html b/api-generated/admin.html index 73eb0e69654..7c69484ea87 100644 --- a/api-generated/admin.html +++ b/api-generated/admin.html @@ -1069,19 +1069,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/collection.html b/api-generated/collection.html index 86a56196c2b..4c560344d94 100644 --- a/api-generated/collection.html +++ b/api-generated/collection.html @@ -2908,19 +2908,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/cursor.html b/api-generated/cursor.html index 565e956cf42..bd8efd8ddf2 100644 --- a/api-generated/cursor.html +++ b/api-generated/cursor.html @@ -1161,19 +1161,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/cursorstream.html b/api-generated/cursorstream.html index d4a71ed8148..ceecd3c6ea4 100644 --- a/api-generated/cursorstream.html +++ b/api-generated/cursorstream.html @@ -352,19 +352,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/db.html b/api-generated/db.html index 91f75742192..f2c77bdd611 100644 --- a/api-generated/db.html +++ b/api-generated/db.html @@ -2325,19 +2325,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/grid.html b/api-generated/grid.html index aa4827ef040..d3cec174349 100644 --- a/api-generated/grid.html +++ b/api-generated/grid.html @@ -328,19 +328,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/gridstore.html b/api-generated/gridstore.html index 6ad759c9e48..586d4cf50fa 100644 --- a/api-generated/gridstore.html +++ b/api-generated/gridstore.html @@ -2032,19 +2032,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/index.html b/api-generated/index.html index e74bfdac37b..5448cc51c4a 100644 --- a/api-generated/index.html +++ b/api-generated/index.html @@ -262,19 +262,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/api-generated/readstream.html b/api-generated/readstream.html index 487d087608b..a19e9738905 100644 --- a/api-generated/readstream.html +++ b/api-generated/readstream.html @@ -360,19 +360,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/contents.html b/contents.html index 380c4fd9572..7f2101516ce 100644 --- a/contents.html +++ b/contents.html @@ -7,7 +7,7 @@ - MongoDB Manual Contents — MongoDB Node.JS Driver 0.9.8.7 documentation + Node.JS MongoDB Driver Manual Contents — MongoDB Node.JS Driver 0.9.8.7 documentation @@ -46,8 +46,8 @@

    Navigation

    -
    -

    MongoDB Manual Contents

    +
    +

    Node.JS MongoDB Driver Manual Contents

    - diff --git a/genindex.html b/genindex.html index 5994a45344a..168c13eff08 100644 --- a/genindex.html +++ b/genindex.html @@ -162,7 +162,7 @@

    C

    -
    close() (built-in function), [1], [2] +
    close() (built-in function), [1], [2]
    @@ -204,7 +204,7 @@

    C

    -
    createIndex() (built-in function), [1] +
    createIndex() (built-in function), [1]
    @@ -292,7 +292,7 @@

    D

    -
    dropIndex() (built-in function), [1] +
    dropIndex() (built-in function), [1]
    @@ -306,7 +306,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -316,7 +316,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -454,7 +454,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -674,7 +674,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -954,19 +954,6 @@

    Navigation

    Created using Sphinx 1.1.2.
    - diff --git a/index.html b/index.html index fa2b8c0f23c..d86091620ca 100644 --- a/index.html +++ b/index.html @@ -207,24 +207,9 @@

    Navigation

    Created using Sphinx 1.1.2.
    - -ipt>try { mktoMunchkin("017-HGS-593"); } catch(e) {} - \ No newline at end of file diff --git a/markdown-docs/collections.html b/markdown-docs/collections.html index 155753993dc..32bde7e3f4b 100644 --- a/markdown-docs/collections.html +++ b/markdown-docs/collections.html @@ -318,19 +318,6 @@

    Navigation

    Created using Sphinx 1.1.2.
    - diff --git a/markdown-docs/database.html b/markdown-docs/database.html index bff9760f6c7..84a96d1d677 100644 --- a/markdown-docs/database.html +++ b/markdown-docs/database.html @@ -26,7 +26,7 @@ - + - diff --git a/markdown-docs/gridfs.html b/markdown-docs/gridfs.html index 1ce7dc1146b..c1e30815017 100644 --- a/markdown-docs/gridfs.html +++ b/markdown-docs/gridfs.html @@ -329,19 +329,6 @@

    Navigation

    Created using Sphinx 1.1.2.
    - diff --git a/markdown-docs/index.html b/markdown-docs/index.html index 95a47b6e7a1..f10e493106d 100644 --- a/markdown-docs/index.html +++ b/markdown-docs/index.html @@ -115,19 +115,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/markdown-docs/indexes.html b/markdown-docs/indexes.html index d71daa41233..e1ec98a4ad8 100644 --- a/markdown-docs/indexes.html +++ b/markdown-docs/indexes.html @@ -245,19 +245,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/markdown-docs/insert.html b/markdown-docs/insert.html index 9e51766d323..09c2691d20d 100644 --- a/markdown-docs/insert.html +++ b/markdown-docs/insert.html @@ -293,19 +293,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/markdown-docs/queries.html b/markdown-docs/queries.html index 018975c097f..bee649819f7 100644 --- a/markdown-docs/queries.html +++ b/markdown-docs/queries.html @@ -465,19 +465,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/markdown-docs/replicaset.html b/markdown-docs/replicaset.html index 1595f366d13..d3c85c34dbc 100644 --- a/markdown-docs/replicaset.html +++ b/markdown-docs/replicaset.html @@ -216,19 +216,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/objects.inv b/objects.inv index ce80cd0a090f94b88ce724b37a7e1491bd6cde7c..0f8d45c9b6fe79a7136ca8cd017705cfce25ad0a 100644 GIT binary patch delta 1078 zcmV-61j+la39$)~ihqyWHW0na$ClK+x?lGJiY zp4?A&1&AJ_*I$no^;Qi;W!v_~`nTh@O}*hWDd27~UqhaJ(|_+WPP9(mCZuAMR7)|z zvq2F9^w&&Ms7>D_le=drifOK7IcG*Y%iN00Fe&CBtq3idXbcN5OY3hrOGjMPuoAQ(W!0RJ5|eE=>|eO*HnU1g)mUX)D_*>n zuw{yo{`CQj0e|)1#{c=-9Y%~%EVTxHIIU2OY9rNI#`TuvX3dJNiHhR8Vg}wbem#mF zznH);ug490mgzUZW!l&qxxpw!5q0ZDI?bdIc;slLoG$C(xvY~P3h!*#Sv&cQF8ceNlT z+@DrPU-<)qZsS46nKq&LH1ZMlV0d)871crH zvhra(Ee0sNCtAIP0@1vKs2g+8`pcGxxPH?2q^f`hr zzx^!MZhvz@G*sNU9Vm8t#JZgMgpCgR*!*ihn}d^FBXn>$pF1o-E>VL7yK;1Knb}+o z&T5Z+yEL=PaRBO91rQ5sdMjPT5IT&1{&zSGV6!Cq7dZ5&$FbwN4epcqsDIho)t(w^I(THRR}T?m$_iAXFX4k~ zrW82@5&e9#T26lgqMAO^K|R{0uN#Eisbpi%XjiSkNs0XHX3t7J{9_4^x`j_CMFc2D zIHs|YNg>IcGeOi4Od21K0f1xZ9l~!2kdN delta 1076 zcmV-41k3xe39ku|ihpz4I1Ih#S7@fa+MOPH$<2<_Cf(HT*zN30clJPukj#W4wfu1H zPJjGDlww7yY>9ME9*Y1$01v<;b4i(?u#dE%*PO(_qsjZII85?-VY)Rre-nL?)N+XK z%THGsh#sZqueC-cs)49v+ZL?8)nc1U;48`CYB66!8a?XkgntvQqxTUh*d*3cOmJ^d z!~lJlND7te+h}t2AVoG!mCWbN=u$JaA~8&geq~;YAC(p4atGfvs24(PI|_ z`0aVSVaqap1YD+#{wLhB3$3=nMs^WT6Db7lFd7)gvpF;_t5}Bw$dyouE|n9f7V$7 zt3|gvL4Pn%%Go-Q?Djk@W99-j+UdIV*KQDd2f1n|gOm8B!3^XQ35T~SBgfWyAA+&W z7sQa5=m98oNCVR=O2dkr@WgUlt*Z6}ZRqS%{%vRT`PAc4Oo}y7oA@WQnjk~7qmlnY z_J6@)0G~P8Kf$4gE{+}0ZGa!uM@`o*+0;$$fxq= zOb|5$?br$Rp#=5;eCBz&PZJl3j~K~|2+odh3#)WkRUh(L@|Gf_xH6K_bvouT@_#e4 zoqyXj1%>nF6qe6sp>^9hlZYM|Y@AO6dR@oMej7kz+bSn|XYWM2w!VYeB|13G?)7LS z%6lAb8^63I3)q{g;=RaBy@H};PxrWG4Nf^DKckC5&{@Q%G1L3v_y9ZLUbE1Vk2NGx zQSBA5HCEHmTTWSV-Ip9>xL<>hJ1hU5w%3tfNE>q)7_rm|^}StQ)I6EK;ZhGhDlK$k uI`@&F^Bu+U~=?U80($er+wbj8oq?`2PXoYty(uf*p+j diff --git a/search.html b/search.html index f08a2b05870..9c2123761fd 100644 --- a/search.html +++ b/search.html @@ -112,19 +112,6 @@

    Navigation

    Created using Sphinx 1.1.2. - diff --git a/searchindex.js b/searchindex.js index 539d043dca4..f5d58ba2cd8 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{notEquals:[27,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[27,1,1,""],DBRef:[3,0,1,""],ensureIndex:[9,1,1,""],Binary:[24,0,1,""],streamRecords:[17,1,1,""],deserializeStream:[1,1,1,""],findOne:[18,1,1,""],valueOf:[28,1,1,""],chunkCollection:[4,1,1,""],Long:[13,0,1,""],nextObject:[17,1,1,""],validateCollection:[14,1,1,""],removeUser:[9,1,1,""],profilingInfo:[14,1,1,""],dropIndex:[9,1,1,""],findAndRemove:[18,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[27,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[14,1,1,""],getNumBitsAbs:[27,1,1,""],cursorInfo:[9,1,1,""],"generationTime number [Getter|Setter]":[7,2,1,""],Timestamp:[27,0,1,""],batchSize:[17,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[9,0,1,""],dropCollection:[9,1,1,""],Collection:[18,0,1,""],shiftRight:[27,1,1,""],writeFile:[4,1,1,""],Grid:[25,0,1,""],Double:[15,0,1,""],getTimestamp:[7,1,1,""],toString:[27,1,1,""],profilingLevel:[14,1,1,""],collectionNames:[9,1,1,""],toNumber:[27,1,1,""],indexInformation:[9,1,1,""],isOdd:[27,1,1,""],getHighBits:[27,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[14,0,1,""],dropDatabase:[9,1,1,""],Symbol:[28,0,1,""],previousErrors:[9,1,1,""],mapReduce:[18,1,1,""],shiftLeft:[27,1,1,""],shiftRightUnsigned:[27,1,1,""],Cursor:[17,0,1,""],MaxKey:[10,0,1,""],CursorStream:[29,0,1,""],findAndModify:[18,1,1,""],greaterThan:[27,1,1,""],renameCollection:[9,1,1,""],buildInfo:[14,1,1,""],resetErrorHistory:[9,1,1,""],isClosed:[17,1,1,""],getLowBitsUnsigned:[27,1,1,""],toHexString:[7,1,1,""],indexExists:[18,1,1,""],getLowBits:[27,1,1,""],toArray:[17,1,1,""],reIndex:[9,1,1,""],listDatabases:[14,1,1,""],ObjectID:[7,0,1,""],isNegative:[27,1,1,""],geoHaystackSearch:[18,1,1,""],addUser:[9,1,1,""],lessThanOrEqual:[27,1,1,""],isZero:[27,1,1,""],collectionsInfo:[9,1,1,""],lessThan:[27,1,1,""],isCapped:[18,1,1,""],ReadStream:[6,0,1,""],createCollection:[9,1,1,""],createIndex:[9,1,1,""],dropAllIndexes:[18,1,1,""],lastError:[9,1,1,""],geoNear:[18,1,1,""],greaterThanOrEqual:[27,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromHexString:[7,1,1,""]},Timestamp:{fromBits:[27,1,1,""],fromNumber:[27,1,1,""],fromInt:[27,1,1,""],fromString:[27,1,1,""]},Db:{connect:[9,1,1,""]},Long:{fromBits:[13,1,1,""],fromNumber:[13,1,1,""],fromInt:[13,1,1,""],fromString:[13,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{returnkei:[17,18],maxscan:[17,18],readfilesync:4,prefix:16,crete:18,createindex:[21,5,9,8,18],world_safe2:18,world_safe1:18,test_map_reduce_functions_inlin:18,deviat:[],under:[],everi:[0,17,23,19],test_gs_seek_with_buff:4,simple_next_object_collect:17,upload:19,correct:[30,7,1,4,9],"10k":[],seper:4,direct:[5,17,30],second:[17,12,2,16,18,4,31,7,23,9],aggreg:18,even:[0,18],attemp:18,neg:[27,13],calcul:1,"new":[0,1,2,16,4,5,6,7,9,12,13,14,17,18,19,23,24,25,27,29,30,31],metadata:[19,31,4],unpars:[],rootcollect:4,never:9,here:[30,31,4],io_seek_set:4,anymor:[],loos:30,getlowbit:[20,13,27],findandmodifi:[18,21,12],vincentcr:[],schemaless:30,total:[0,18],sarah:18,would:[0,9,18,27,13,5,31],aaron:[],overhead:30,recommend:[30,18],type:[10,11,1,18,19,3,14,4,28,15,30,24,31,26],tell:[9,18,4,21,30,31],relat:5,notic:[30,31],warn:[18,9,12],exce:4,hold:[30,1,4,17],must:[0,27,13,18],err:[0,14,6,17,12,2,19,16,18,4,29,25,30,31,23,9],aheckmann:[],setup:[2,31,9],work:[0,9,4,30,31,17],rework:[],root:[31,4,25],overrid:[9,17,18],simple_geo_haystack_command:18,indic:[0,12,11,16,5,19,30,23],want:[0,9,18,16,4,5,15,30,31,23],david:12,unsign:[27,13],end:[6,17,18,19,16,4,29,30,31],replicaset:[11,9,2,30,22,8],quot:17,how:[11,9,18,14,4,26,30,31,17],"_id_":[9,18],recoveri:2,rewind:[0,4,21,17],milisecond:[9,7],config:[2,9],updat:[24,11,9,18,12,21,30,31,22,8],maxdist:18,recogn:4,after:[6,17,12,19,29,4,1,31],listdatabas:[14,9,21],befor:[0,9,18,2,5,30,31,23],wrong:[],gs2:4,descriptior:19,parallel:30,attempt:[30,14,23],third:4,exclud:[17,18],perform:[0,14,9,18,27,13,17],errorobject:[],order:[0,17,12,18,5,23],oper:[0,14,17,12,16,13,27,5,18,30,31,23,9],cursorinfo:[9,21],over:[23,9,17,8,18],becaus:[27,13],readbuff:31,vari:[],digest:31,uuid:[24,1],fit:[30,17],fix:31,better:[30,23],complex:[30,9,18],loggerinst:[],persist:[30,18],split:[27,13,4],them:30,thei:[30,27,13,31],safe:[12,9,18,16,14,29,30,17],update_a_simple_docu:18,"instanceof":[9,18,14,4,17],choic:[],changelog:11,bonu:30,timeout:[2,17,23,18],each:[0,6,17,18,2,27,13,4,29,21,31,23,9],debug:[],went:18,a_simple_collect:9,mean:[2,30,31,17,23],resum:[29,6,21],nin:0,extract:[],newli:[5,16,14],content:[24,0,6,25,12,19,4,30,31,8],daniel:[0,23,19],reader:[],got:[30,9,18],more_index_information_test:[9,18],navig:31,worthwhil:31,default_port:23,situat:[],md5:[24,1,4],filter:[9,18],pagin:18,regress:[],onto:[],rang:[0,18],unlik:17,alreadi:[17,12,19,16,4,5,30,23],unlin:4,getnumbitsab:[20,13,27],primari:[0,9,18,2,30,23,8,17],hexstr:7,rewritten:[],top:[27,13,18],travers:17,startindex:1,tonumb:[20,13,27],ton:[30,31],similarli:30,listen:17,consol:[0,1,12,19,16,30,31,23],namespac:3,eventlisten:[],took:17,incur:30,removeus:[14,9,21],silli:30,target:[31,18],provid:[9,18,27,13,4,30,31],cursorstream:[11,29,17,21],matter:30,iron:30,thu:12,websocket:30,abov:[30,31,12],mind:30,raw:[0,9,18,16,12,31,23,17],manner:31,increment:30,seek:[21,19,31,4,8],dbref:[11,3,20,9,30],ensureindex:[21,5,9,8,18],simple_limit_collect:17,data2:4,simplifi:31,insur:[],plenti:31,usernam:[5,14,9],object:[0,1,2,16,4,5,6,7,8,9,11,12,14,17,18,19,23,24,25,26,29,30,31],deleg:23,regular:[0,19],tradit:30,simplic:31,don:[23,18],doc:[0,14,1,17,12,18,4,29,30,9],flow:[],doe:[12,9,18,16,13,4,30,31,27],bson_data_d:1,radix:[27,13],random:4,speedup:[],syntax:[],test_stream_funct:17,identifi:[30,16,31],absolut:[27,13,31,4],acquir:17,field2:0,explain:[0,9,17,21,18],field1:0,theme:30,busi:30,rich:30,io_seek_cur:4,cachefunct:1,nasti:[],test_cursorstream_destroi:29,stop:[],collectionsinfo:[9,21],bson_data_numb:1,report:30,bar:4,patch:[],previouli:17,fileidobject:4,steam:17,fieldnam:0,fair:31,indexnam:[9,18],num:18,structur:[0,31,30],previouserror:[9,21],respons:[0,17],fail:[30,25,14,9,18],said:31,databas:[0,25,14,17,12,11,16,18,4,26,19,30,31,22,23,8,9],test_gs_empty_file_eof:4,gridstor:[24,11,14,6,17,18,19,7,4,29,26,1,21,25,31,22,8,9],simplest:[0,31],awai:31,lotsofdoc:30,accord:2,newnam:18,getlasterror:[9,18],howev:17,against:[0,14,9,18,27,13,4,7,17],logic:0,com:30,assur:17,can:[0,17,12,2,19,16,13,27,5,31,18,30,7,23,9],simple_explain_collect:17,foobar2:4,path:[19,4],assum:[27,13],duplic:[5,9,17,18],three:[30,31,4],been:[31,17,9],much:[30,31,12],basic:[11,9,26,18,30,31],life:31,regul:17,search:[11,30,18],argument:[24,14,6,17,18,29,3,13,4,28,1,15,31,25,7,27,9],child:9,"catch":18,laurie71:[],another_root:4,peform:[29,9,6,17,18],dissect:31,properti:[0,7,19,4,20,21],weren:0,"typeof":[1,4],succes:18,sever:[12,2,16,5,30,23],grown:30,test_is_close_function_on_cursor:17,receiv:31,make:[0,17,12,18,5,30,31,23,8],drawback:31,descend:[5,17],isneg:[20,13,27],complet:18,reset_error_histori:9,hang:[],hand:23,fairli:[],tune:31,scenario:23,geohaystack:18,test_close_function_on_cursor:17,client:[9,12,14,4,18,25,30,17],thi:[24,0,14,6,17,12,19,27,13,4,5,31,18,30,7,23,9],everyth:12,settimeout:[29,6,18],left:[27,13,9,23,18],protocol:30,just:[0,31,30,18],laptop:[],ordin:[9,18],farther:6,yet:23,languag:30,previous:[],collectionn:23,had:17,els:[18,14,23,12],save:[9,18,19,12,4,21,23,8],applic:[30,31],which:[0,2,19,16,13,4,27,31,23],preserv:17,background:[9,18],test_ev:9,apart:[30,31],measur:[],specif:[0,9,18,16,7,4,30,17],arbitrari:4,negat:[20,13,27],collection2:[9,18],collection1:18,underli:29,www:9,right:[30,27,13,31],old:4,deal:30,manual:[11,8],interv:[],deserializestream:[20,1],dead:[],intern:[0,27,13,19,18],successfulli:17,txt:4,timestampd:7,multipli:[20,13,27,18],christkv:30,condit:[0,18],localhost:[30,16,31,9],a_simple_create_drop_collect:9,collection_stats_test:18,promot:30,repositori:30,post:[0,16,13,27],plug:30,obj:18,slightli:30,simul:[27,13,31],commit:9,book:0,simple_previous_error_col:9,bson_data_symbol:1,"float":[30,27,13],encod:[2,30,23],bound:[9,17,18],down:9,wrap:[29,0,6,15,28],storag:[30,31],wai:[0,18,12,27,13,30,31],support:[0,31,30,19],serverinfo:18,avail:[6,9,18,2,14,4,29,30,31,17],test_rename_collection3:18,test_rename_collection2:18,constantli:30,lowest:[],head:[31,4],medium:14,form:4,forc:[9,14,17,18],"true":[0,14,1,17,12,2,19,16,18,4,29,5,6,25,30,31,23,9],reset:[0,9,4,17],new_nam:16,geospati:[9,18],maximum:[30,17,9],until:[30,14,9],deprect:17,fundament:30,sampl:30,emit:[30,29,9,18],featur:31,fromstr:[20,13,27],exist:[0,14,9,12,19,16,18,4,5,21,30,31,23,8],subtype_user_defin:24,check:[0,14,6,17,18,19,27,13,4,29,5,1,30,8,9],test_collection_opt:18,bson_binary_subtype_md5:[24,1],test_to_a_after_each:17,floor:7,when:[0,1,17,12,2,19,16,18,4,29,6,30,31,23],refactor:[],simple_limit_skip_find_one_queri:18,test:[14,9,12,19,16,18,4,30,31,17],miliscecond:[29,6],node:[2,11,17,30],insensit:17,consid:18,sql:30,cachefunctionscrc32:1,dropdup:[9,18],"_id":[0,9,12,18,4,5,31,23,8,25],longer:4,ignor:[30,1,18],time:[11,9,7,2,18,26,30,23,17],push:[30,29,17,9],backward:17,concept:30,skip:[0,17,21,18],global:[],primer:[11,31,26],row:18,millisecond:23,middl:18,depend:[],dropindex:[21,5,9,8,18],sourc:17,string:[24,0,14,1,17,18,19,3,13,4,28,27,5,31,25,30,7,16,9],feasibl:31,test_cursorstream_resum:29,contenttyp:19,level:[9,14,4,18],did:9,dig:30,eventemitt:17,iter:[17,18],item:[6,9,18,14,4,29,30,17],quick:[30,31],div:[20,13,27],round:30,databasenam:[9,23],wtimeout:[9,18],addtoset:30,sign:[16,13,27],slow_onli:14,cost:[],port:[9,23],comparis:4,checkoutwrit:9,repli:[30,14,18],current:[14,9,19,3,13,4,30,31,27],subtype_uuid:24,deriv:[27,13],gener:[31,7,9,23,18],wait:[9,18],box:30,bson_data_regexp:1,shift:[27,13],queue:30,behav:[],more_complex_ensure_index_test:[9,18],extrem:[],weird:[],checkkei:1,extra:0,modul:[],prefer:[0,30],toarrai:[0,9,18,14,21,30,17],instal:30,includeloc:18,perf:[],memori:[0,17,26,11,30,31],regep:30,live:[30,31],handler:31,value2:0,value1:0,criteria:12,scope:[30,1,9,18],prev:18,maxkei:[10,11,20,1],multiplecoll1:9,finit:[27,13],examin:30,content_typ:[19,31],cap:[30,9,18],uniqu:[0,18,9,23,5],test_correctly_access_collect:9,whatev:23,bson_binary_subtype_funct:[24,1],mongo:[11,9,26,12,30,31],stream:[6,17,19,29,4,1,21,30,31,8],predict:[],bson_data_long:1,createcollect:[9,18,16,29,21,30,17],occur:[0,17,12,19,16,4,5,23,8],alwai:[30,27,13,17,18],multipl:[18,2,27,13,23,8],ping:[14,9,21],fieldvalu:0,write:[24,1,9,2,19,4,20,6,21,30,31,8,25],foreach:[4,18],pure:[24,14,6,9,18,29,7,4,1,25,17],map:[30,18],product:[27,13],max:[9,17,18],dive:[30,31],date:[1,17,7,14,5,18,30],docstartindex:1,data:[24,11,6,17,18,19,26,4,29,1,25,30,31,9],grow:30,sbrekken:[],inform:[17,18,2,19,14,4,5,30,23,8,9],"switch":[],reaper:[9,23],combin:[4,9],keepgoingexampl:18,filedata:4,increas:[],still:[0,12],pointer:[0,16,4,23,19],test_map_reduce_funct:18,group:[31,21,18],gte:0,indexexist:[21,18],jim:18,nodelai:[2,23],platform:30,mbostock:[],requir:[24,14,6,17,12,29,16,18,4,1,31,25,30,7,23,9],main:[30,31],non:18,simple_skip_collect:17,col2:9,col3:9,initi:[9,18,4,30,31,17],col1:9,verifi:[9,7,14,4,18],now:[30,31,9],nor:16,introduct:[2,11,30,8,26],mapreduc:[21,18],name:[24,0,14,1,17,12,2,19,3,18,4,23,5,31,16,9],drop:[9,18,16,14,5,21],revert:0,crypto:[],separ:[0,4],failov:2,replai:[],replac:[0,18,4,30,12],individu:0,a_1_b_1:[9,18],poolreadi:[],serverclust:[],happen:[29,6,4,17],shown:[30,31],accomplish:31,space:[1,9],profil:[14,17,18],stuff:[2,11,31,30,26],factori:[0,23,18],resultset:30,"_event":[],mime:4,sethml:[],replacethiscollect:18,org:9,"byte":[24,0,1,9,7,19,30,31,23],care:[2,0,30],question:[27,13],test_gs_tel:4,synchron:30,thing:[30,31,23],place:[27,13],year2013:[],frequent:[27,13],first:[0,14,17,12,19,16,18,4,31,30,7,23,8,9],origin:[18,12],bson_binary_:[],directli:[0,17,30],onc:[5,30],arrai:[24,0,14,1,17,12,2,19,16,18,4,30,8,9],"0x7f":1,reopen:[4,23],"long":[11,1,17,7,13,20,30],open:[14,6,17,12,2,19,16,18,4,29,21,25,30,31,23,8,9],predefin:1,size:[0,1,17,18,19,27,13,4,31,9],given:[24,9,18,27,13,4,31,17],breviti:[30,31],workaround:[],paramt:17,collectionnam:[9,18,16,14,5,21,31],conveni:[0,27,13],subtype_md5:24,especi:30,copi:2,specifi:[24,0,9,18,19,4,30,31,23,17],test_arrai:17,keepgo:18,than:[0,17,12,18,2,19,27,13,31,23],png:[19,4],tedeh:[],were:[17,12],posit:[24,19,27,13,4,31],pre:[14,1,9,18],sai:31,ani:[0,9,12,30,31,17],simple_rename_collection_2:9,bitwis:[30,27,13],alias:0,destroi:[29,6,21],note:[27,13,17,9],take:[2,0,31,1,30],createfromhexstr:[0,20,7],begin:[0,4],sure:[31,17],normal:17,buffer:[24,0,1,17,12,19,16,18,4,25,31,23,9],clearer:[],getyear:18,renam:[9,18,16,21,30,8],byte_valu:24,later:[31,9,18],indexbound:[9,18],test_gs_read_stream:4,runtim:[],parseint:18,axi:18,show:[24,6,9,18,29,4,1,25,30,17],atom:[30,18],objectid3:7,objectid2:7,concurr:[],corner:[],onli:[0,14,17,12,2,18,4,5,30,31,23,9],slow:[14,9,18],dice:30,setprofilinginfo:14,activ:[],written:[24,18,27,13,4,31],analyt:30,overwritten:31,min_valu:[27,13],variou:[14,18],get:[11,14,6,17,12,19,16,18,4,5,26,29,31,21,25,30,7,23,8,9],secondari:[2,9,17,18],ssl:[],cannot:[9,18,27,13,30,17],shiftrightunsign:[20,13,27],geo:18,nolock:9,doabl:0,seldom:[],yield:[16,18,9,12],isarrai:1,where:[24,0,1,9,12,2,19,16,18,4,5,30,31],highbit:[27,13],desced:17,wiki:30,testcas:[],infinit:[27,13],detect:2,heckmann:[],fs_chunk:31,integration_tests_2:9,wayt:18,enough:17,between:[30,9,23],"import":[30,31],across:[23,18],spars:[5,9,18],test_group:18,come:[19,27,13,18],simple_find_and_modify_operations_:18,region:18,gwt:[27,13],tutori:[11,31],mani:[30,17],fromnumb:[20,13,27],reindex:[9,21,18],iscap:[21,18],db_option:23,period:[0,16],pop:30,createcreateindexcommand:[],fs_file:31,lessthan:[20,13,27],reaperinterv:[9,23],cursor_information_collect:9,cursorinst:17,coupl:[24,30,18],aciev:0,rebuilt:[9,18],derefer:[9,21],lowbit:[27,13],geonear:[21,18],"1mb":31,those:[27,13],"case":[17,18,27,13,5,30,31],myself:30,bson_seri:[],tostr:[24,25,7,27,13,4,20,18,31],trick:31,invok:31,idhex:0,firstext:14,simple_sort_collect:17,advantag:30,eras:[19,16],ascii:[2,24,23],acess:9,develop:30,author:[0,19,12],same:[0,17,18,27,13,4,5,7,9],binari:[24,0,14,6,17,11,19,16,12,4,29,20,1,18,25,30,7,9],document:[0,14,1,17,11,2,19,16,12,4,29,5,6,18,30,31,23,9],createpk:23,exhaust:17,finish:[31,18],closest:[27,13,18],utf8:[2,30,4,23],nest:[0,5],oid:3,driver:[0,12,2,11,16,26,21,30,31,23,8],gotend:4,improv:[],defo:0,bson_data_boolean:1,crud:[11,30,26],without:[1,9,27,13,23,16],model:18,dereferenc:9,upsert:[18,12],ourexamplefiletowrit:4,execut:[9,12,14,4,18,30,17],rest:18,hint:[17,18],db_connector:[16,23],except:[30,4,12],littl:30,blog:[0,16],default_chunk_s:4,haystack:18,found2:4,around:30,read:[24,6,17,18,2,19,4,20,21,30,31,8,9],grid:[24,11,31,25,21],spank:[],world:[6,9,18,12,4,1,31,25],lasterror:[9,21],reap:[],mod:[0,27,13],saniti:[],poolsiz:[6,9,18,14,4,29,25,30,23,17],integ:[0,13,1,27,30],server:[24,14,1,17,12,2,29,16,18,4,6,31,25,30,7,23,8,9],either:[19,31,30],output:[0,18],greaterthanorequ:[20,13,27],manag:[19,30],bson_binary_subtype_byte_arrai:[24,1],eventloop:31,"_bsontyp":[],intact:12,generationtim:7,setnodelai:[],slice:30,writedata:31,node_ev:[],confirm:30,legal:18,evolv:30,profilinginfo:[14,21],bson_data_binari:1,broken:[],aquir:9,bson_binary_subtype_default:[24,1],regexp:[30,1],"throw":[30,31,12],pointer_to_collect:0,firstnam:[0,5],numbit:[27,13],bson_data_code_w_scop:1,gump:18,act:31,luck:31,readstream:[11,6,17,21],addus:[14,9,21],test_collections_info:9,your:[2,30,31,4,18],loc:18,log:[0,1,17,18,19,16,12,14,30,31,23],hex:[0,25,4,7],overwrit:[14,4],errormessag:[],strict:[16,9,23,18],interfac:[29,6,17,30,25],low:[30,27,13,31],lot:[17,18,5,29,30,31],tupl:5,shamelessli:30,replsetsrv:2,faster:5,pull:[30,14],dirti:30,possibl:[0,9,12,18,5,30],"default":[24,0,1,17,12,2,19,16,18,4,5,31,30,7,23,9],remove_subset_of_documents_saf:18,dropdatabas:[14,9,21,23],bson_data_min_kei:1,expect:[0,23],gone:[25,9,4,18],creat:[24,0,14,1,17,18,2,19,16,7,4,29,5,6,25,30,31,23,8,9],certain:[5,30],intro:30,file:[6,25,19,4,31,8,9],calculateobjects:[20,1],again:[4,17],field:[0,17,12,18,5,30,8,9],valid:[24,1,17,7,16,14,9],longlib:13,you:[0,1,17,12,2,19,16,18,5,30,31,23,9],pefrom:18,sequenc:[],symbol:[11,20,1,30,28],opt_radix:[27,13],pool:[9,23],reduc:[27,13,18],lessthanorequ:[20,13,27],directori:[],descript:[24,9,1,4,17],tricki:30,potenti:[],alright:30,cpu:31,unset:30,represent:[10,24,25,7,3,13,4,28,15,27],all:[0,14,1,17,12,2,19,16,18,4,5,30,31,23,9],forget:30,numberupd:18,dollar:16,simple_rename_collect:9,follow:[0,17,12,2,4,5,30,31],fetchsiz:17,disk:[31,6,4,18,17],subtype_default:24,nextobject:[0,17,21,9],init:17,setprofilinglevel:[14,21],evaul:9,util:[],test_rename_collect:18,failur:30,veri:[30,31],list:[9,18,16,14,4,21,30,31,8],resav:18,adjust:31,findandremov:[21,18],small:31,retun:1,zero:[27,13],pass:[1,17,18,2,16,7,4,31,23,9],what:[30,16,31,17],abc:[0,4,12],xor:[20,13,27],sub:[24,18],sum:[27,13],delet:[9,18,19,4,21,30,31,23,8,25],version:[31,9,23,18],cruso:0,method:[24,0,17,18,11,16,7,4,26,30,31,23,25],full:[9,18],hash:[0,31,9,23],variat:30,getmorecommand:[17,18],foobar3:4,modifi:[30,18,8,12],valu:[0,1,16,4,5,7,8,9,12,13,14,15,17,18,19,20,23,24,28,27,30,31],isodd:[20,13,27],ahead:[30,31,18],showdiskloc:[17,18],amount:[30,27,13,9],pick:[30,31,9],narrow:18,evalfunct:1,via:30,shorthand:12,c_1:18,deprec:9,default_root_collect:4,establish:[6,9,18,14,4,29,25,17],select:[16,18,23,8,12],test_collection_is_cap:18,distinct:[21,18],regist:4,two:[0,9,12,2,19,16,13,4,5,31,30,7,27],coverag:[],bson_binary_subtype_user_defin:[24,1],taken:30,minor:[],more:[0,6,17,12,2,27,13,4,29,18,30,31,9],flag:18,stick:30,particular:30,cach:1,none:2,outlin:[30,31],histori:9,remain:[31,4],scan:[17,18],share:[9,8,23],shard:19,accept:18,simple_document_insert_collection_no_saf:18,default_url:9,robinson:0,cours:30,newlin:4,divid:[27,13,18],rather:18,anoth:[0,4,30,7],simpl:[24,0,6,17,11,29,16,18,4,5,26,1,25,30,31,9],perman:9,resourc:23,variant:30,reflect:[],unlink:[19,31,4,21],associ:[31,4],keyorlist:17,github:30,defineproperti:[],save_a_simple_document_modify_it_and_resave_it:18,caus:30,callback:[0,14,17,12,19,16,18,4,5,30,31,23,9],spheric:18,doc_id:0,bson_data_oid:1,trade:31,through:[30,9,18],reconnect:23,paramet:[0,17,12,2,19,16,14,4,5,30,31,23,9],style:30,mongorepli:[],call:[0,9,4,31,23,17],asbuff:1,dbname:9,rapidli:30,bypass:30,simple_limit_skip_queri:18,might:[5,31,9,30],alter:[0,16],good:[30,31],"return":[0,6,3,4,1,7,9,10,12,13,14,15,16,17,18,19,23,24,25,28,27,29,30,31],timestamp:[11,1,7,27,18,20],more_complex_index_test:[9,18],distancemultipli:18,compound:[9,18],readlen:4,uploadd:19,instruct:2,authent:[14,9,21],easili:[27,13],achiev:0,skipvalu:17,found:[0,9,18,4,12],truncat:[16,31,4],hard:30,realli:30,connect:[11,6,17,18,2,14,4,26,29,21,25,30,31,23,8,9],barrier:[],event:[6,9,19,4,29,30,31,23,17],read_primari:[],pullal:30,foreground:[9,18],core2duo:[],advanc:[11,26,16,4,30,31],asc:[0,17,12],reason:4,base:[7,19,18,4,30,31],connectionopt:9,put:[24,17,18,4,20,21,31,25],seconddb:9,gethighbit:[20,13,27],tailabl:[17,18],omit:[30,3,31],dir:12,assign:2,notifi:[30,31,18],articl:[11,31,26],lastnam:[0,5],number:[24,0,14,1,17,18,27,13,4,5,15,31,30,7,23,9],done:[0,6,9,18,19,12,14,29,30,31,23],construct:[27,13],autoclos:[19,31,6,4],create_and_drop_an_index:[9,18],miss:[],differ:[9,7,27,13,4,5,18,30,31,25],chunk_typ:4,script:19,interact:[30,31,4,25],least:[0,18],custompkfactori:23,settim:7,statement:[30,31,9],illeg:[25,14,9,18],master:2,store:[1,9,19,4,30,31,17],otherid:7,option:[24,0,14,1,17,12,2,19,3,18,4,23,5,21,25,30,31,16,8,9],reseterrorhistori:[9,21],native_pars:[6,9,18,14,4,29,25,23,17],getter:[4,7],pars:[1,18],literarili:30,std:[],kind:31,bson_data_nul:1,whenev:[9,18],remov:[14,9,18,16,12,4,5,21,30,8],reus:1,str:[27,13],consumpt:31,luckili:[30,31],"null":[0,1,17,18,2,16,14,4,29,25,23,9],built:30,equival:[30,18],valueof:[20,15,28],fromcollect:9,also:[0,17,12,16,4,5,30,31],build:[30,31,14,9],choos:[30,18],reach:[31,6],most:[0,31,30],cygwin:[],selector:[9,17,18],"16mb":19,filesystem:19,cover:9,part:[30,7],clean:9,frombit:[20,13,27],find:[0,6,17,12,19,18,14,5,29,21,30,8,9],firewal:[],pretti:30,test_gs_weird_bug:4,numberofdocu:1,batch_document_insert_collection_saf:18,hit:[9,18],express:[0,30,19,18],fieldtoupd:30,test_map_reduce_functions_scop:18,nativ:[30,23],restart:[29,6],statist:[14,9,18],wrote:30,set:[0,14,1,17,12,2,19,16,18,4,5,31,30,7,23,9],see:[0,12,19,16,13,27,5,30,31,23],close:[6,9,18,19,14,4,29,21,25,30,31,23,8,17],my_f:4,misalign:[],someth:[4,23],altern:18,signatur:[4,17],complement:[27,13],javascript:[1,9,18,27,13,30],salzman:[],succeed:5,both:18,last:[19,9,30],create_and_drop_all_index:[9,18],context:23,logout:[14,9,21],whole:[30,9,4,18],createdat:17,load:0,simpli:0,jsmode:18,point:[17,18,27,13,30,31],instanti:30,shutdown:[],linux:[],backend:30,faithfulli:[27,13],user_id:18,due:[30,25],empti:[24,0,18,4,17],strategi:30,test_streamingrecords_funct:17,fire:[6,9,12,19,4,30,31,23],admindb:[14,9],imag:[19,31],understand:30,func:[1,18],look:[17,18,19,4,5,30,31],straight:[30,31],batch:[30,17,18],"while":[0,4,19,17],getownpropertynam:[],behavior:[0,27,13,30,12],error:[0,14,6,17,12,19,16,18,4,5,29,30,23,9],fun:31,robin:30,loop:[],test_gs_unlink:4,readi:[29,6,4,30,17],key2:0,key1:0,jpg:4,itself:17,test_deref_exampl:9,rid:[],simple_key_based_distinct_sub_query_filt:18,chase:[],decor:[],simple_document_insert_with_function_saf:18,geohaystacksearch:[21,18],p_db:[2,9],higher:[2,31,23,18],optim:18,operaion:19,numberofretri:[9,23],iya_logo_final_bw:4,temporari:[4,18],user:[24,0,1,9,12,14,4,5],hello2:18,keyf:18,recreat:23,lower:[9,18],entri:[9,31,4,18],explan:[9,18],getlowbitsunsign:[20,13,27],a_1:18,shape:[],update_a_simple_document_multi:18,bson_data_timestamp:1,cur:31,keeptemp:18,appli:[0,17,30],input:[27,13,18],subsequ:[9,18],format:[0,9,18,12,14,17],big:[30,31],checksum:4,shiftright:[20,13,27],rs_name:2,replsetserv:[24,14,1,17,18,2,29,7,4,6,25,9],success:[19,4,17],resolv:9,collect:[0,2,3,4,5,8,9,11,12,14,16,17,18,19,21,22,23,25,26,29,30,31],bson_data_cod:1,popular:30,bamboo:[],serverpair:[],often:[27,13],creation:[30,14,9,18],some:[24,0,6,17,18,19,4,5,25,30,31,9],back:[0,13,18,27,14,4,30],understood:30,dropallindex:[21,18],scale:[30,31,18],slaveok:[9,18],chunksiz:[19,31,4],retri:[30,9,23],larg:[0,9,18,19,30,31],intial:18,previou:[31,23],run:[11,9,12,26,2,18,30,31],simple_reset_error_history_col:9,step:31,simple_explain_queri:18,subtract:[20,13,27],recordquerystat:9,block:[31,9,18],plan:31,within:[27,13],simple_index_test:18,ensur:[9,18,5,30,31,8],chang:[30,27,13,31,18],test_collection_index_exist:18,bson_deseri:[],textual:[27,13],custom:[0,31,23,8,18],includ:[0,17,18,16,4,5,30,23,9],forward:4,files:4,properli:4,uniquedoc:18,ascend:[0,17,5],link:[11,31,30,26],simple_count_exampl:18,line:[31,4],info:[31,14,9,18],concaten:[27,13,4],consist:[],caller:17,forceserverobjectid:[9,23],readlin:[4,21],similar:19,constant:[24,1,9,4,20,21,17],multiplecoll2:9,parser:[1,9,23],doesn:[0,23,12],repres:[17,28,27,13,4,15,30],isconnect:[],titl:[0,18,22,12],unidirect:17,wakup:9,nice:30,deseri:[30,20,1,17],jannehietamaki:[],mongodb:[0,1,2,16,4,5,6,7,8,9,11,12,14,17,18,19,23,24,25,29,30,31],eval:[9,1,17,21,18],profilinglevel:[14,21],algorithm:[2,27,13,23],cursorinform:9,tradeoff:31,far:4,hello:[24,6,9,18,12,4,1,30,31,25],code:[24,14,6,9,18,29,7,4,1,25,30,31,17],partial:[17,18],worldbuff:4,queri:[0,14,17,11,16,12,4,5,26,18,30,22,23,8,9],idvalu:0,replicasetcheckinterv:[],base64:[2,23,25],update_a_simple_document_upsert:18,send:[2,30,9,23],io_seek_end:4,"256k":31,sens:12,reapertimeout:[9,23],passiv:[],result2:25,writebuff:[],untouch:23,relev:30,gettim:[17,7],fieldorspec:[9,18],fewer:18,"try":[30,31,18,12],race:[],refer:[9,30,3,4,17],smaller:19,fortun:30,natur:30,jump:[30,31],video:31,download:30,odd:[27,13],append:[19,4,30],compat:[],index:[11,1,17,18,16,5,21,22,8,9],compar:[7,27,13,4,5,20],descriptor:31,access:[9,18,19,14,4,28,15,17],experiment:[],asced:17,lee:[],bson_data_int:1,batchsizevalu:17,cursor_count_collect:17,let:[6,9,18,4,30,31,17],filedescriptor:31,becom:30,sinc:[30,27,13,31,12],subtype_byte_arrai:24,nexttick:[],convert:[0,30],convers:[30,18],larger:[19,31],implement:[30,27,13],configur:[2,30,16,9],read_secondari:2,app:2,api:[11,20,31,9,21],from:[24,0,14,1,17,12,2,19,16,13,4,31,18,25,30,7,27,8,9],batchsiz:[9,17,21,18],doubl:[11,20,15,30],next:[0,31,1,17,23],chr:4,sort:[0,17,12,18,5,21],benchmark:[],name2:0,socketopt:[2,23],sollect:16,account:18,retriev:[0,14,9,12,19,18,4,30,31,17],scalabl:19,multiple_db_inst:9,annot:31,unopen:[],fetch:[0,9,17,18,5,30,25],queryfailur:[],control:[30,31,23],objectid:[24,0,14,6,17,11,29,3,18,4,20,1,31,25,30,7,23,9],process:[27,13,17],lock:[31,9],username_:5,high:[30,27,13,9,18],tag:18,serial:[20,1,9,18],pingresult:14,integration_test_:[2,9],instead:[0,9,18,2,5,31,23,17],npm:30,await:9,formattedorderclaus:[],originaldata:25,alloc:[1,9],seriou:[],remove_all_documents_no_saf:18,correspond:[5,16,13,27],element:[0,4,30,17],issu:[30,18],writ:4,allow:[9,18,16,14,30,31,23,17],subtyp:24,deoptim:[],doc2:30,doc3:30,move:[19,4,30],doc4:30,autoindexid:9,server_opt:23,effici:[30,31,18],bunch:[9,18],perfect:30,crash:[],greater:[0,27,13,17],handl:[17,18,27,13,4,30,31],databs:[19,16,23],auth:9,renamecollect:[9,21],precess:30,numberofremoveddoc:18,writefil:[19,31,4,21],convin:0,anyth:[],edit:[31,4],deserializeddoc:1,exampledb:[30,31],subset:[17,18],opensync:4,chunk:[19,31,4],bson_binary_subtype_uuid:[24,1],default_content_typ:4,pushal:30,our:[30,31,4,17],special:[30,27,13,31,17],out:[11,9,26,2,18,30,31,23],variabl:[30,18],trickier:[0,30],categori:31,suitabl:31,leverag:30,ref:[],math:7,jessica:[0,12],insid:[19,0,31,8,5],dropcollect:[16,9,21],manipul:18,releas:[],princess:18,unwant:0,could:30,shiftleft:[20,13,27],keep:[19,9,30,18],length:[24,14,1,9,7,19,18,4,20,31,17],lte:0,primarki:0,minkei:1,debugmessag:[],iszero:[20,13,27],should_correctly_rewind_and_restart_cursor:17,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:9,prioriti:[],start:[24,0,1,17,18,2,16,4,30,31],system:[16,31,4],messag:[9,18,14,4,12],timestamplib:27,bson_data_max_kei:1,termin:4,"final":[30,18],deconstruct:31,test_gs_getc_fil:4,exactli:16,gridstorew:4,bson_data_object:1,replset:[2,9],mongoserv:[16,23],tocollect:9,charact:[24,7,4,18],test_gs_puts_and_readlin:4,result:[0,14,6,17,12,19,27,13,4,31,18,25,30,7,23,9],counter:[23,18],terribl:[],corrupt:14,have:[0,9,18,2,16,4,5,30,31],tabl:[30,16],need:[0,1,9,12,19,16,13,27,5,30,31,23],turn:[0,14,9],buildinfo:[14,21],min:[9,17,18],mix:[0,5],andrewjston:[],milli:14,test_other_drop:18,orgiin:4,singl:[24,0,9,18,19,12,4],fileid:[31,6,4],statsync:4,whi:0,serverconfig:[9,23],why:30,overwriten:4,url:9,integration_tests_to_drop:9,request:17,face:30,test_collect:12,snapshot:[17,18],determin:[30,17],streamrecord:[30,17,21],fact:[30,12],text:[27,13,31,4],serializefunct:[1,9,18],verbos:18,nagl:[2,23],anywai:[9,18],setter:[4,7],locat:[30,9,18,4,17],should:[0,14,9,18,16,13,31,25,7,27,17],test_cursorstream_paus:29,local:[3,9],doc1:30,ritch:[],gettimestamp:[20,7],donewithwrit:31,enabl:[9,23],simple_batch_size_collect:17,tohexstr:[0,20,7],integr:[30,31],contain:[24,1,17,18,2,16,4,30,31,9],grab:[14,17,9],modulo:[0,20,13,27],packet:[],fromint:[20,13,27],statu:30,wire:30,correctli:[30,18],state:[30,17,23],crude:30,world2:18,kei:[0,1,17,18,4,5,30,31,23,8,9],buckets:18,simple_queri:18,isol:[],job:18,entir:[31,4,17],auto_reconnect:[6,9,18,2,14,4,29,25,30,31,23,17],crc32:1,addit:[0,1,9,18,27,13,31,17],admin:[11,14,9,21,18],equal:[24,0,14,6,17,18,29,27,13,4,20,1,25,30,7,9],etc:[0,23,18],instanc:[14,1,9,18,2,7,4,25,30,31,23,17],greaterthan:[20,13,27],subtype_funct:24,comment:[17,18],toint:[20,13,27],removealllisten:[],save_a_simple_docu:18,addition:16,compon:[],json:[11,20,13,27,30],treat:[0,17],pkfactori:[9,18],immedi:12,bit:[0,1,19,27,13,30,31],assert:[24,14,6,9,18,29,7,4,1,25,17],present:[5,16],replic:[2,9],multi:[18,12],plain:[],cursor:[0,6,17,18,11,14,29,21,30,8,9],defin:[24,0,1,9,18,12,27,13,4,30,23],setreadprefer:[],bson_data_arrai:1,layer:30,helper:[],site:2,tojson:[20,13,27],getc:[4,21],cross:[],member:2,world_no_saf:18,probabl:0,difficult:31,incorrect:[],slave:2,hostnam:23,keepal:[2,23],upon:17,retriv:14,serializewithbufferandindex:[20,1],chunk_siz:[19,4],off:[9,2,16,14,4,30,23,17],center:18,nevertheless:23,well:[0,31,30],exampl:[24,0,14,6,17,11,19,16,12,4,29,5,26,1,31,18,25,30,7,23,9],command:[9,18,14,4,21,30,23,17],simple_geo_near_command:18,validatecollect:[14,21],latest:30,distanc:18,paus:[29,6,21],less:[30,27,13],"boolean":[6,17,18,19,27,13,4,5,1,31,9],additon:5,tcp:30,indexinform:[9,18,5,21,8,17],web:30,seekloc:[31,4],add:[14,9,7,27,13,5,20,18,30],cleanup:31,logger:[],match:[0,14,18,12,16,13,30,27,8],simple_key_based_distinct:18,piec:[30,27,13,31],know:16,password:[14,9],recurs:[13,27,1,4],isclos:[17,21],desc:[0,17],bson_data_str:1,insert:[0,14,1,17,11,16,12,4,21,29,18,30,22,23,8,9],resid:30,like:[0,9,18,27,13,5,31,17],fsync:[9,18],chunkcollect:[4,21],necessari:0,"0xff":1,async:30,page:[0,30,11],dispatch:30,suppli:31,gridf:[11,25,26,19,4,31],flush:[31,6,4],proper:[],fileinfo:31,librari:31,lead:[27,13],leak:[],avoid:[5,14,30],octet:4,thank:[],leav:12,mode:[9,18,19,16,4,31,23,17],slight:30,journal:9,usag:[24,11,1,25,2,19,16,4,30,31,23,8],collection_nam:16,host:23,although:31,offset:[24,31,4],java:[27,13],simpler:[30,17,18],about:[9,12,5,30,31,23,17],actual:[0,31,9,30,23],socket:[2,30,9,8,23],http:30,dbinstanc:31,notequ:[20,13,27],constructor:[10,24,14,1,17,18,2,29,3,13,4,28,27,20,6,15,21,25,7,23,9],fals:[0,14,6,17,12,19,16,18,4,29,1,25,31,23,9],disabl:[2,23],own:4,automat:[6,17,2,19,30,31,23,9],dataset:[0,30],bson:[10,0,14,6,17,11,29,3,12,4,28,23,20,1,15,18,25,24,7,16,9],merg:18,val:18,pictur:31,transfer:9,mykei:30,trigger:[29,6,4,18,17],concat:0,"var":[24,0,14,1,17,12,2,19,16,18,4,29,6,31,25,30,7,23,9],fsname:25,"function":[24,0,14,1,17,12,2,19,16,13,4,27,6,31,18,25,30,29,23,9],brand:[],waitforconnect:[],overflow:[27,13],inlin:18,bug:31,count:[0,17,12,16,18,4,21,8,9],made:31,wise:0,whether:[27,13],wish:[24,1,9,18,14,4,31],displai:9,asynchron:[2,30],record:[0,17,12,19,16,18,4,5,30,23,8,9],below:[30,27,13,9,12],limit:[0,17,18,19,21,30],otherwis:[1,17,27,13,4,30,31],problem:14,evalu:[1,9],"int":[27,13],dure:[30,9,18],year:0,filenam:[19,31,4],replica:[2,9],retrymilisecond:[9,23],inc:30,tick:[],detail:[5,17,19],deepequ:[25,9,18,4,17],other:[0,26,2,11,27,13,4,30,31],bool:7,futur:[30,9],branch:[],stat:[21,18],findon:[0,9,18,21,30,8],"class":[10,24,14,6,17,18,29,3,13,4,28,1,15,31,25,30,7,27,9],stai:18,eof:[19,31,4,21],integration_test:[6,9,18,14,4,29,25,17],kaij:[]},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","Indexes","ReadStream()","ObjectID()","MongoDB Manual Contents","Db()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Long()","Admin()","Double()","Collections","Cursor()","Collection()","GridStore","Binary JSON API","Driver API","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Symbol()","CursorStream()","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/db","api-bson-generated/maxkey","index","markdown-docs/insert","api-bson-generated/long","api-generated/admin","api-bson-generated/double","markdown-docs/collections","api-generated/cursor","api-generated/collection","markdown-docs/gridfs","api-bson-generated/index","api-generated/index","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","api-bson-generated/symbol","api-generated/cursorstream","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]})jectID()","MongoDB Manual Contents","Db()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Long()","Admin()","Double()","Changelog","Cursor()","Collection()","GridStore","Binary JSON API","Driver API","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Symbol()","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/db","api-bson-generated/maxkey","index","markdown-docs/insert","api-bson-generated/long","api-generated/admin","api-bson-generated/double","changelog/changelog","api-generated/cursor","api-generated/collection","markdown-docs/gridfs","api-bson-generated/index","api-generated/index","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","api-bson-generated/symbol","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file +Search.setIndex({objects:{"":{notEquals:[27,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[27,1,1,""],DBRef:[3,0,1,""],ensureIndex:[16,1,1,""],reIndex:[16,1,1,""],Binary:[24,0,1,""],deserializeStream:[1,1,1,""],findOne:[14,1,1,""],valueOf:[28,1,1,""],chunkCollection:[4,1,1,""],collectionNames:[16,1,1,""],Long:[12,0,1,""],nextObject:[8,1,1,""],validateCollection:[19,1,1,""],removeUser:[16,1,1,""],profilingInfo:[19,1,1,""],dropIndex:[16,1,1,""],findAndRemove:[14,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[27,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[19,1,1,""],getNumBitsAbs:[27,1,1,""],cursorInfo:[16,1,1,""],"generationTime number [Getter|Setter]":[17,2,1,""],Timestamp:[27,0,1,""],batchSize:[8,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[16,0,1,""],dropCollection:[16,1,1,""],Collection:[14,0,1,""],shiftRight:[27,1,1,""],writeFile:[4,1,1,""],toString:[27,1,1,""],Double:[13,0,1,""],getTimestamp:[17,1,1,""],Grid:[25,0,1,""],profilingLevel:[19,1,1,""],streamRecords:[8,1,1,""],indexInformation:[16,1,1,""],isOdd:[27,1,1,""],getHighBits:[27,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[19,0,1,""],dropDatabase:[16,1,1,""],Symbol:[28,0,1,""],previousErrors:[16,1,1,""],shiftRightUnsigned:[27,1,1,""],shiftLeft:[27,1,1,""],mapReduce:[14,1,1,""],Cursor:[8,0,1,""],MaxKey:[9,0,1,""],CursorStream:[29,0,1,""],findAndModify:[14,1,1,""],greaterThan:[27,1,1,""],renameCollection:[16,1,1,""],buildInfo:[19,1,1,""],resetErrorHistory:[16,1,1,""],isClosed:[8,1,1,""],getLowBitsUnsigned:[27,1,1,""],toHexString:[17,1,1,""],indexExists:[14,1,1,""],getLowBits:[27,1,1,""],toArray:[8,1,1,""],toNumber:[27,1,1,""],listDatabases:[19,1,1,""],ObjectID:[17,0,1,""],isNegative:[27,1,1,""],geoHaystackSearch:[14,1,1,""],addUser:[16,1,1,""],lessThanOrEqual:[27,1,1,""],isZero:[27,1,1,""],collectionsInfo:[16,1,1,""],lessThan:[27,1,1,""],isCapped:[14,1,1,""],ReadStream:[6,0,1,""],createCollection:[16,1,1,""],createIndex:[16,1,1,""],dropAllIndexes:[14,1,1,""],lastError:[16,1,1,""],geoNear:[14,1,1,""],greaterThanOrEqual:[27,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromHexString:[17,1,1,""]},Timestamp:{fromBits:[27,1,1,""],fromNumber:[27,1,1,""],fromInt:[27,1,1,""],fromString:[27,1,1,""]},Db:{connect:[16,1,1,""]},Long:{fromBits:[12,1,1,""],fromNumber:[12,1,1,""],fromInt:[12,1,1,""],fromString:[12,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{returnkei:[8,14],maxscan:[8,14],readfilesync:4,prefix:15,crete:14,createindex:[21,5,16,7,14],world_safe2:14,world_safe1:14,test_map_reduce_functions_inlin:14,deviat:[],under:[],everi:[0,8,23,18],test_gs_seek_with_buff:4,simple_next_object_collect:8,upload:18,correct:[30,16,1,4,17],"10k":[],seper:4,direct:[5,8,30],second:[16,11,2,15,17,4,14,31,23,8],aggreg:14,even:[0,14],attemp:14,neg:[27,12],"256k":31,"new":[0,1,2,15,4,5,6,8,11,12,14,16,17,18,19,23,24,25,27,29,30,31],metadata:[18,31,4],manipul:14,rootcollect:4,never:16,here:[30,31,4],io_seek_set:4,integration_tests_to_drop:16,anymor:[],robin:30,getlowbit:[20,12,27],findandmodifi:[14,21,11],vincentcr:[],schemaless:30,total:[0,14],sarah:14,would:[0,16,14,27,12,5,31],init:8,overhead:30,recommend:[30,14],type:[9,10,1,14,18,3,19,4,28,13,30,24,31,26],tell:[16,14,4,21,30,31],relat:5,notic:[30,31],warn:[14,16,11],exce:4,hold:[30,1,4,8],must:[0,27,12,14],err:[0,6,16,11,2,18,15,19,4,29,14,25,30,31,23,8],aheckmann:[],setup:[2,31,16],work:[0,8,4,30,31,16],rework:[],root:[31,4,25],overrid:[14,16,8],simple_geo_haystack_command:14,indic:[0,11,10,15,5,18,30,23],want:[0,16,14,15,4,5,13,30,31,23],david:11,unsign:[27,12],end:[6,8,14,18,15,4,29,30,31],replicaset:[10,16,2,30,22,7],quot:8,how:[10,8,14,19,4,26,30,31,16],"_id_":[16,14],recoveri:2,rewind:[0,4,21,8],milisecond:[16,17],config:[2,16],updat:[24,10,16,14,11,21,30,31,22,7],maxdist:14,recogn:4,after:[6,8,11,18,29,4,1,31],listdatabas:[19,16,21],befor:[0,16,14,2,5,30,31,23],wrong:[],gs2:4,descriptior:18,parallel:30,attempt:[30,19,23],third:4,exclud:[8,14],perform:[0,19,16,14,27,12,8],errorobject:[],order:[0,8,11,14,5,23],oper:[0,19,16,11,15,12,27,5,14,30,31,23,8],cursorinfo:[16,21],over:[23,14,16,7,8],becaus:[27,12],readbuff:31,vari:[],digest:31,uuid:[24,1],fit:[30,8],fix:31,better:[30,23],complex:[30,16,14],loggerinst:[],persist:[30,14],split:[27,12,4],them:30,thei:[30,27,12,31],safe:[11,16,14,15,19,29,30,8],update_a_simple_docu:14,"instanceof":[14,19,4,8,16],choic:[],changelog:10,bonu:30,timeout:[2,8,23,14],each:[0,6,16,14,2,27,12,4,29,21,31,23,8],debug:[],went:14,a_simple_collect:16,mean:[2,30,31,8,23],resum:[29,6,21],nin:0,extract:[],newli:[5,15,19],auto_reconnect:[6,8,14,2,19,4,29,25,30,31,23,16],content:[24,0,6,25,11,18,4,30,31,7],daniel:[0,23,18],reader:[],got:[30,16,14],more_index_information_test:[16,14],navig:31,worthwhil:31,findandremov:[21,14],situat:[],md5:[24,1,4],filter:[16,14],pagin:14,regress:[],onto:[],rang:[0,14],instruct:2,alreadi:[8,11,18,15,4,5,30,23],unlin:4,getnumbitsab:[20,12,27],primari:[0,16,14,2,30,23,7,8],hexstr:17,rewritten:[],top:[27,12,14],travers:8,startindex:1,tonumb:[20,12,27],ton:[30,31],similarli:30,listen:8,consol:[0,1,11,18,15,30,31,23],namespac:3,eventlisten:[],took:8,incur:30,removeus:[19,16,21],silli:30,target:[31,14],provid:[16,14,27,12,4,30,31],zero:[27,12],matter:30,iron:30,geohaystack:14,websocket:30,abov:[30,31,11],mind:30,raw:[0,16,14,15,11,31,23,8],manner:31,increment:30,seek:[21,18,31,4,7],dbref:[10,3,20,16,30],ensureindex:[21,5,16,7,14],simple_limit_collect:8,data2:4,simplifi:31,insur:[],plenti:31,usernam:[5,19,16],object:[0,1,2,15,4,5,6,7,8,10,11,14,16,17,18,19,23,24,25,26,29,30,31],what:[30,15,31,8],regular:[0,18],tradit:30,simplic:31,don:[23,14],doc:[0,1,16,11,19,4,29,14,30,8],flow:[],doe:[16,11,15,12,4,14,30,31,27],bson_data_d:1,radix:[27,12],random:4,speedup:[],syntax:[],test_stream_funct:8,identifi:[30,15,31],absolut:[27,12,31,4],acquir:8,field2:0,explain:[0,14,16,21,8],field1:0,theme:30,busi:30,rich:30,io_seek_cur:4,cachefunct:1,nasti:[],test_cursorstream_destroi:29,stop:[],collectionsinfo:[16,21],bson_data_numb:1,report:30,bar:4,patch:[],previouli:8,fileidobject:4,steam:8,fieldnam:0,fair:31,indexnam:[16,14],num:14,tocollect:16,previouserror:[16,21],respons:[0,8],fail:[30,25,19,16,14],said:31,databas:[0,25,16,11,10,15,19,4,26,14,18,30,31,22,23,7,8],test_gs_empty_file_eof:4,gridstor:[24,10,6,16,17,18,19,4,21,26,1,14,25,29,22,31,7,8],simplest:[0,31],awai:31,lotsofdoc:30,accord:2,newnam:14,simple_key_based_distinct:14,getlasterror:[16,14],howev:8,against:[0,19,16,17,27,12,4,14,8],logic:0,com:30,assur:8,asced:8,simple_explain_collect:8,getmorecommand:[8,14],path:[18,4],assum:[27,12],duplic:[5,14,16,8],three:[30,31,4],been:[31,16,8],much:[30,31,11],basic:[10,16,26,14,30,31],life:31,regul:8,isodd:[20,12,27],ani:[0,16,11,30,31,8],child:16,"catch":14,laurie71:[],another_root:4,dissect:31,properti:[0,17,18,4,20,21],weren:0,"typeof":[1,4],succes:14,sever:[11,2,15,5,30,23],grown:30,test_is_close_function_on_cursor:8,receiv:31,make:[0,8,11,14,5,30,31,23,7],drawback:31,descend:[5,8],isneg:[20,12,27],complet:14,reset_error_histori:16,hang:[],hand:23,fairli:[],tune:31,scenario:23,thu:11,test_close_function_on_cursor:8,client:[11,8,14,19,4,25,30,16],thi:[24,0,6,16,8,17,12,27,11,4,5,14,18,30,31,23,19],everyth:11,settimeout:[29,6,14],left:[27,12,16,23,14],protocol:30,just:[0,31,30,14],laptop:[],ordin:[16,14],farther:6,yet:23,languag:30,previous:[],octet:4,collectionn:23,had:8,els:[19,23,14,11],save:[16,14,18,11,4,21,23,7],applic:[30,31],milli:19,preserv:8,background:[16,14],test_ev:16,apart:[30,31],measur:[],specif:[0,8,17,15,14,4,30,16],arbitrari:4,negat:[20,12,27],collection2:[16,14],collection1:14,underli:29,www:16,right:[30,27,12,31],old:4,deal:30,manual:[10,7],interv:[],deserializestream:[20,1],dead:[],intern:[0,27,12,18,14],successfulli:8,txt:4,timestampd:17,multipli:[20,12,27,14],christkv:30,condit:[0,14],localhost:[30,15,31,16],a_simple_create_drop_collect:16,collection_stats_test:14,promot:30,repositori:30,post:[0,15,12,27],plug:30,obj:14,slightli:30,simul:[27,12,31],commit:16,simple_previous_error_col:16,bson_data_symbol:1,"float":[30,27,12],simple_skip_collect:8,bound:[14,16,8],down:16,wrap:[29,0,6,13,28],storag:[30,31],wai:[0,14,11,27,12,30,31],support:[0,31,30,18],serverinfo:14,avail:[6,8,14,2,19,4,29,30,31,16],test_rename_collection3:14,call:[0,8,4,31,23,16],constantli:30,lowest:[],head:[31,4],medium:19,form:4,forc:[19,16,14,8],"true":[0,1,16,11,2,18,15,19,4,29,5,6,14,25,30,31,23,8],reset:[0,4,8,16],new_nam:15,highbit:[27,12],maximum:[30,16,8],until:[30,19,16],deprect:8,fundament:30,sampl:30,emit:[30,29,16,14],featur:31,fromstr:[20,12,27],exist:[0,16,11,18,15,19,4,21,5,14,30,31,23,7],subtype_user_defin:24,check:[0,6,16,8,14,18,27,12,4,29,5,1,30,7,19],test_collection_opt:14,bson_binary_subtype_md5:[24,1],test_to_a_after_each:8,floor:17,when:[0,1,8,11,2,18,15,14,4,29,6,30,31,23],refactor:[],simple_limit_skip_find_one_queri:14,test:[8,11,18,15,19,4,14,30,31,16],miliscecond:[29,6],node:[2,10,8,7,30],insensit:8,consid:14,sql:30,cachefunctionscrc32:1,errormessag:[],streamrecord:[30,8,21],faster:5,ignor:[30,1,14],time:[10,16,14,2,17,26,30,23,8],push:[30,29,16,8],backward:8,concept:30,skip:[0,8,21,14],global:[],primer:[10,31,26],row:14,millisecond:23,middl:14,depend:[],dropindex:[21,5,16,7,14],sourc:8,string:[24,0,1,16,8,17,18,3,12,4,28,27,5,14,25,30,31,15,19],feasibl:31,test_cursorstream_resum:29,contenttyp:18,level:[19,4,14,16],did:16,dig:30,eventemitt:8,iter:[8,14],item:[6,8,14,19,4,29,30,16],quick:[30,31],div:[20,12,27],round:30,databasenam:[16,23],wtimeout:[16,14],addtoset:30,sign:[15,12,27],slow_onli:19,cost:[],port:[16,23],comparis:4,checkoutwrit:16,repli:[30,19,14],current:[19,16,18,3,12,4,30,31,27],subtype_uuid:24,deriv:[27,12],gener:[31,14,16,23,17],wait:[16,14],box:30,bson_data_regexp:1,shift:[27,12],queue:30,behav:[],more_complex_ensure_index_test:[16,14],extrem:[],weird:[],checkkei:1,extra:0,modul:[],prefer:[0,30],toarrai:[0,16,14,19,21,30,8],instal:30,includeloc:14,perf:[],memori:[0,8,26,10,30,31],regep:30,live:[30,31],handler:31,value2:0,value1:0,criteria:11,scope:[30,1,16,14],prev:14,maxkei:[9,10,20,1],multiplecoll1:16,finit:[27,12],examin:30,content_typ:[18,31],cap:[30,16,14],uniqu:[0,14,16,23,5],descriptor:31,whatev:23,bson_binary_subtype_funct:[24,1],mongo:[10,16,26,11,30,31],stream:[6,8,18,29,4,1,21,30,31,7],predict:[],bson_data_long:1,createcollect:[16,14,15,29,21,30,8],occur:[0,8,11,18,15,4,5,23,7],alwai:[30,27,12,8,14],multipl:[14,2,27,12,23,7],ping:[19,16,21],fieldvalu:0,write:[24,1,16,2,18,4,20,6,21,30,31,7,25],foreach:[4,14],pure:[24,6,16,17,29,19,4,1,14,25,8],map:[30,14],product:[27,12],max:[14,16,8],dive:[30,31],date:[1,8,14,19,5,30,17],docstartindex:1,data:[24,10,6,8,14,18,26,4,29,1,25,30,31,16],grow:30,sbrekken:[],inform:[16,14,2,18,19,4,5,30,23,7,8],"switch":[],reaper:[16,23],combin:[4,16],anoth:[0,4,30,17],filedata:4,gettimestamp:[20,17],still:[0,11],pointer:[0,15,4,23,18],test_map_reduce_funct:14,group:[31,21,14],gte:0,indexexist:[21,14],jim:14,nodelai:[2,23],platform:30,mbostock:[],requir:[24,6,16,8,11,29,15,17,4,1,14,25,30,31,23,19],main:[30,31],non:14,encod:[2,30,23],col2:16,col3:16,initi:[8,14,4,30,31,16],col1:16,verifi:[16,19,4,14,17],now:[30,31,16],nor:15,introduct:[2,10,30,7,26],mapreduc:[21,14],name:[24,0,1,16,11,2,18,3,19,4,23,5,14,31,15,8],drop:[16,14,15,19,5,21],revert:0,crypto:[],separ:[0,4],failov:2,replai:[],replac:[0,14,4,30,11],individu:0,a_1_b_1:[16,14],poolreadi:[],serverclust:[],happen:[29,6,4,8],shown:[30,31],accomplish:31,space:[1,16],profil:[19,8,14],tohexstr:[0,20,17],factori:[0,23,14],variant:30,"_event":[],mime:4,sethml:[],replacethiscollect:14,org:16,"byte":[24,0,1,16,17,18,30,31,23],care:[2,0,30],question:[27,12],test_gs_tel:4,synchron:30,thing:[30,31,23],place:[27,12],year2013:[],frequent:[27,12],first:[0,19,16,11,18,15,17,4,14,30,31,23,7,8],origin:[14,11],bson_binary_:[],directli:[0,8,30],onc:[5,30],arrai:[24,0,1,16,11,2,18,15,19,4,14,30,7,8],"0x7f":1,reopen:[4,23],"long":[10,1,8,17,12,20,30],open:[6,16,11,2,18,15,19,4,21,29,14,25,30,31,23,7,8],predefin:1,size:[0,1,8,14,18,27,12,4,31,16],given:[24,8,14,27,12,4,31,16],breviti:[30,31],workaround:[],paramt:8,collectionnam:[16,14,15,19,5,21,31],conveni:[0,27,12],subtype_md5:24,especi:30,copi:2,specifi:[24,0,8,14,18,4,30,31,23,16],test_rename_collection2:14,test_arrai:8,keepgo:14,than:[0,8,11,14,2,18,27,12,31,23],png:[18,4],tedeh:[],were:[8,11],posit:[24,18,27,12,4,31],pre:[1,16,14,19],sai:31,argument:[24,6,16,8,17,29,3,12,4,28,1,13,14,25,31,27,19],simple_rename_collection_2:16,bitwis:[30,27,12],alias:0,destroi:[29,6,21],note:[27,12,16,8],take:[2,0,31,1,30],createfromhexstr:[0,20,17],begin:[0,4],sure:[31,8],normal:8,buffer:[24,0,1,16,11,18,15,14,4,25,31,23,8],clearer:[],getyear:14,renam:[16,14,15,21,30,7],byte_valu:24,later:[31,16,14],indexbound:[16,14],test_gs_read_stream:4,runtim:[],parseint:14,axi:14,show:[24,6,8,14,29,4,1,25,30,16],atom:[30,14],objectid3:17,objectid2:17,concurr:[],corner:[],onli:[0,16,11,2,19,4,5,14,30,31,23,8],slow:[19,16,14],dice:30,setprofilinginfo:19,activ:[],state:[30,8,23],analyt:30,overwritten:31,min_valu:[27,12],variou:[19,14],get:[10,6,16,8,17,18,15,11,4,21,5,26,29,14,25,30,31,23,7,19],secondari:[2,14,16,8],ssl:[],cannot:[16,14,27,12,30,8],shiftrightunsign:[20,12,27],geo:14,nolock:16,doabl:0,seldom:[],yield:[15,14,16,11],isarrai:1,where:[24,0,1,16,11,2,18,15,14,4,5,30,31],geospati:[16,14],desced:8,wiki:30,testcas:[],infinit:[27,12],detect:2,heckmann:[],fs_chunk:31,integration_tests_2:16,wayt:14,enough:8,between:[30,16,23],"import":[30,31],across:[23,14],spars:[5,16,14],test_group:14,come:[18,27,12,14],simple_find_and_modify_operations_:14,region:14,gwt:[27,12],tutori:[10,31],mani:[30,8],fromnumb:[20,12,27],reindex:[16,21,14],iscap:[21,14],period:[0,15],pop:30,createcreateindexcommand:[],fs_file:31,lessthan:[20,12,27],reaperinterv:[16,23],cursor_information_collect:16,cursorinst:8,coupl:[24,30,14],aciev:0,rebuilt:[16,14],derefer:[16,21],lowbit:[27,12],geonear:[21,14],"1mb":31,those:[27,12],"case":[8,14,27,12,5,30,31],myself:30,bson_seri:[],tostr:[24,25,14,27,12,4,20,17,31],trick:31,invok:31,idhex:0,firstext:19,simple_sort_collect:8,advantag:30,eras:[18,15],ascii:[2,24,23],acess:16,develop:30,author:[0,18,11],same:[0,16,17,27,12,4,5,14,8],binari:[24,0,25,6,16,8,17,10,15,11,4,29,20,1,14,18,30,19],document:[0,1,16,8,10,2,18,15,11,4,29,5,6,14,30,31,23,19],createpk:23,exhaust:8,finish:[31,14],closest:[27,12,14],utf8:[2,30,4,23],nest:[0,5],oid:3,driver:[0,11,2,10,15,26,21,30,31,23,7],gotend:4,improv:[],defo:0,bson_data_boolean:1,choos:[30,14],without:[1,16,27,12,23,15],model:14,dereferenc:16,upsert:[14,11],ourexamplefiletowrit:4,execut:[11,8,14,19,4,30,16],rest:14,hint:[8,14],db_connector:[15,23],except:[30,4,11],littl:30,blog:[0,15],default_chunk_s:4,haystack:14,found2:4,around:30,read:[24,6,8,14,2,18,4,20,21,30,31,7,16],grid:[24,10,31,25,21],spank:[],world:[6,16,11,14,4,1,31,25],lasterror:[16,21],reap:[],mod:[0,27,12],saniti:[],poolsiz:[6,8,14,19,4,29,25,30,23,16],integ:[0,12,1,27,30],server:[24,1,16,8,17,2,29,15,11,4,6,14,25,30,31,23,7,19],either:[18,31,30],output:[0,14],greaterthanorequ:[20,12,27],manag:[18,30],bson_binary_subtype_byte_arrai:[24,1],eventloop:31,ascend:[0,8,5],intact:11,generationtim:17,setnodelai:[],slice:30,writedata:31,node_ev:[],confirm:30,legal:14,evolv:30,profilinginfo:[19,21],bson_data_binari:1,broken:[],aquir:16,bson_binary_subtype_default:[24,1],regexp:[30,1],"throw":[30,31,11],pointer_to_collect:0,firstnam:[0,5],numbit:[27,12],bson_data_code_w_scop:1,gump:14,act:31,luck:31,other:[0,26,2,10,27,12,4,30,31],readstream:[10,6,8,21],addus:[19,16,21],test_collections_info:16,your:[2,30,31,4,14],loc:14,log:[0,1,8,11,18,15,19,14,30,31,23],hex:[0,25,4,17],overwrit:[19,4],dropdup:[16,14],start:[24,0,1,8,14,2,15,4,30,31],interfac:[29,6,8,30,25],low:[30,27,12,31],lot:[8,14,5,29,30,31],tupl:5,shamelessli:30,replsetsrv:2,longer:4,pull:[30,19],dirti:30,possibl:[0,16,11,14,5,30],"default":[24,0,1,16,17,2,18,15,11,4,5,14,30,31,23,8],remove_subset_of_documents_saf:14,bson_data_min_kei:1,connect:[10,6,16,14,2,19,4,26,29,21,25,30,31,23,7,8],gone:[25,14,4,16],creat:[24,0,1,16,17,2,18,15,19,4,29,5,6,14,25,30,31,23,7,8],certain:[5,30],intro:30,file:[6,25,18,4,31,7,16],calculateobjects:[20,1],again:[4,8],field:[0,8,11,14,5,30,7,16],valid:[24,1,8,17,15,19,16],longlib:12,you:[0,1,16,11,2,18,15,14,5,30,31,23,8],pefrom:14,sequenc:[],symbol:[10,20,1,30,28],opt_radix:[27,12],pool:[16,23],reduc:[27,12,14],lessthanorequ:[20,12,27],directori:[],descript:[24,1,4,8,16],tricki:30,potenti:[],alright:30,cpu:31,unset:30,represent:[9,24,25,17,3,12,4,28,13,27],all:[0,1,16,11,2,18,15,19,4,5,14,30,31,23,8],forget:30,numberupd:14,dollar:15,simple_rename_collect:16,follow:[0,8,11,2,4,5,30,31],fetchsiz:8,disk:[31,6,4,14,8],subtype_default:24,nextobject:[0,16,21,8],aaron:[],setprofilinglevel:[19,21],evaul:16,util:[],test_rename_collect:14,failur:30,veri:[30,31],list:[16,14,15,19,4,21,30,31,7],resav:14,adjust:31,default_port:23,small:31,retun:1,cursorstream:[10,29,8,21],pass:[1,16,17,2,15,14,4,31,23,8],deleg:23,abc:[0,4,11],xor:[20,12,27],sub:[24,14],sum:[27,12],delet:[16,14,18,4,21,30,31,23,7,25],version:[31,16,23,14],cruso:0,method:[24,0,8,10,15,17,4,26,14,30,31,23,25],full:[16,14],hash:[0,31,16,23],variat:30,foobar2:4,foobar3:4,modifi:[30,14,7,11],valu:[0,1,15,4,5,7,8,11,12,13,14,16,17,18,19,20,23,24,28,27,30,31],search:[10,30,14],ahead:[30,31,14],showdiskloc:[8,14],amount:[30,27,12,16],pick:[30,31,16],narrow:14,evalfunct:1,via:30,shorthand:11,c_1:14,deprec:16,default_root_collect:4,establish:[6,8,14,19,4,29,25,16],select:[15,14,23,7,11],test_collection_is_cap:14,distinct:[21,14],regist:4,two:[0,12,16,17,2,18,15,11,4,5,30,31,27],coverag:[],bson_binary_subtype_user_defin:[24,1],taken:30,minor:[],more:[0,6,16,11,2,27,12,4,29,14,30,31,8],flag:14,stick:30,particular:30,cach:1,none:2,outlin:[30,31],histori:16,remain:[31,4],scan:[8,14],share:[16,7,23],shard:18,accept:14,simple_document_insert_collection_no_saf:14,default_url:16,robinson:0,cours:30,newlin:4,divid:[27,12,14],rather:14,keepgoingexampl:14,simpl:[24,0,6,16,10,29,15,14,4,5,26,1,25,30,31,8],perman:16,resourc:23,resultset:30,reflect:[],unlink:[18,31,4,21],associ:[31,4],keyorlist:8,github:30,defineproperti:[],save_a_simple_document_modify_it_and_resave_it:14,caus:30,callback:[0,16,11,18,15,19,4,5,14,30,31,23,8],spheric:14,doc_id:0,bson_data_oid:1,trade:31,through:[30,16,14],reconnect:23,paramet:[0,16,11,2,18,15,19,4,5,30,31,23,8],style:30,mongorepli:[],asbuff:1,relev:30,rapidli:30,bypass:30,simple_limit_skip_queri:14,might:[5,31,16,30],alter:[0,15],good:[30,31],"return":[0,6,3,4,1,8,9,11,12,13,14,15,16,17,18,19,23,24,25,28,27,29,30,31],timestamp:[10,1,14,27,17,20],more_complex_index_test:[16,14],distancemultipli:14,compound:[16,14],readlen:4,uploadd:18,unlik:8,authent:[19,16,21],easili:[27,12],achiev:0,skipvalu:8,found:[0,11,4,14,16],truncat:[15,31,4],hard:30,realli:30,expect:[0,23],barrier:[],event:[6,8,18,4,29,30,31,23,16],read_primari:[],pullal:30,foreground:[16,14],core2duo:[],advanc:[10,26,15,4,30,31],asc:[0,8,11],reason:4,base:[14,18,17,4,30,31],connectionopt:16,put:[24,8,14,4,20,21,31,25],seconddb:16,gethighbit:[20,12,27],tailabl:[8,14],omit:[30,3,31],dir:11,assign:2,notifi:[30,31,14],articl:[10,31,26],lastnam:[0,5],number:[24,0,1,16,8,17,27,12,4,5,13,14,30,31,23,19],done:[0,6,16,14,11,18,19,29,30,31,23],construct:[27,12],autoclos:[18,31,6,4],create_and_drop_an_index:[16,14],miss:[],differ:[16,14,27,12,4,5,30,17,31,25],chunk_typ:4,script:18,interact:[30,31,4,25],least:[0,14],custompkfactori:23,settim:17,statement:[30,31,16],illeg:[25,19,16,14],master:2,store:[1,8,18,4,30,31,16],otherid:17,option:[24,0,1,16,11,2,18,3,19,4,23,21,5,14,25,30,31,15,7,8],reseterrorhistori:[16,21],native_pars:[6,8,14,19,4,29,25,23,16],getter:[4,17],pars:[1,14],literarili:30,std:[],kind:31,bson_data_nul:1,whenev:[16,14],remov:[16,11,15,19,4,21,5,14,30,7],reus:1,str:[27,12],consumpt:31,luckili:[30,31],"null":[0,1,16,14,2,15,19,4,29,25,23,8],built:30,equival:[30,14],valueof:[20,13,28],fromcollect:16,also:[0,8,11,15,4,5,30,31],build:[30,31,19,16],validatecollect:[19,21],reach:[31,6],most:[0,31,30],cygwin:[],selector:[14,16,8],"16mb":18,cover:16,part:[30,17],clean:16,frombit:[20,12,27],find:[0,6,16,11,18,19,21,5,29,14,30,7,8],firewal:[],pretti:30,test_gs_weird_bug:4,numberofdocu:1,batch_document_insert_collection_saf:14,hit:[16,14],express:[0,30,18,14],fieldtoupd:30,test_map_reduce_functions_scop:14,nativ:[30,23],restart:[29,6],statist:[19,16,14],wrote:30,set:[0,1,16,8,17,2,18,15,11,4,5,14,30,31,23,19],see:[0,11,18,15,12,27,5,30,31,23],close:[6,8,14,18,19,4,29,21,25,30,31,23,7,16],my_f:4,misalign:[],someth:[4,23],altern:14,signatur:[4,8],complement:[27,12],javascript:[1,16,14,27,12,30],salzman:[],succeed:5,both:14,last:[18,16,30],create_and_drop_all_index:[16,14],context:23,let:[6,8,14,4,30,31,16],corrupt:19,whole:[30,14,4,16],createdat:8,load:0,simpli:0,jsmode:14,point:[8,14,27,12,30,31],instanti:30,shutdown:[],linux:[],backend:30,faithfulli:[27,12],user_id:14,due:[30,25],empti:[24,0,14,4,8],strategi:30,test_streamingrecords_funct:8,fire:[6,16,11,18,4,30,31,23],admindb:[19,16],imag:[18,31],understand:30,func:[1,14],look:[8,14,18,4,5,30,31],straight:[30,31],batch:[30,8,14],"while":[0,4,18,8],getownpropertynam:[],behavior:[0,27,12,30,11],error:[0,6,16,11,18,15,19,4,5,29,14,30,23,8],fun:31,loos:30,loop:[],test_gs_unlink:4,readi:[29,6,4,30,8],key2:0,key1:0,jpg:4,itself:8,test_deref_exampl:16,rid:[],simple_key_based_distinct_sub_query_filt:14,chase:[],decor:[],simple_document_insert_with_function_saf:14,geohaystacksearch:[21,14],p_db:[2,16],higher:[2,31,23,14],optim:14,operaion:18,numberofretri:[16,23],piec:[30,27,12,31],temporari:[4,14],user:[24,0,1,16,11,19,4,5],hello2:14,keyf:14,recreat:23,lower:[16,14],entri:[31,14,4,16],explan:[16,14],getlowbitsunsign:[20,12,27],a_1:14,shape:[],update_a_simple_document_multi:14,password:[19,16],cur:31,keeptemp:14,read_secondari:2,input:[27,12,14],subsequ:[16,14],format:[0,16,14,11,19,8],big:[30,31],checksum:4,shiftright:[20,12,27],rs_name:2,replsetserv:[24,1,16,17,2,29,19,4,6,14,25,8],fsync:[16,14],resolv:16,collect:[0,2,3,4,5,7,8,10,11,19,15,16,14,18,21,22,23,25,26,29,30,31],bson_data_cod:1,popular:30,bamboo:[],serverpair:[],often:[27,12],creation:[30,19,16,14],some:[24,0,6,16,14,18,4,5,25,30,31,8],back:[0,19,14,27,12,4,30],understood:30,dropallindex:[21,14],scale:[30,31,14],slaveok:[16,14],chunksiz:[18,31,4],retri:[30,16,23],larg:[0,16,14,18,30,31],intial:14,previou:[31,23],run:[10,16,11,26,2,14,30,31],simple_reset_error_history_col:16,step:31,simple_explain_queri:14,subtract:[20,12,27],recordquerystat:16,block:[31,16,14],plan:31,within:[27,12],simple_index_test:14,ensur:[16,14,5,30,31,7],chang:[30,27,12,31,14],test_collection_index_exist:14,bson_deseri:[],textual:[27,12],custom:[0,31,23,7,14],includ:[0,8,14,15,4,5,30,23,16],forward:4,files:4,properli:4,uniquedoc:14,"_bsontyp":[],link:[10,31,30,26],simple_count_exampl:14,line:[31,4],info:[31,19,16,14],concaten:[27,12,4],consist:[],caller:8,forceserverobjectid:[16,23],readlin:[4,21],similar:18,constant:[24,1,8,4,20,21,16],multiplecoll2:16,parser:[1,16,23],doesn:[0,23,11],repres:[8,28,27,12,4,13,30],isconnect:[],titl:[0,14,22,11],unidirect:8,wakup:16,nice:30,deseri:[30,20,1,8],jannehietamaki:[],mongodb:[0,1,2,15,4,5,6,7,8,10,11,14,16,17,18,19,23,24,25,29,30,31],eval:[21,1,16,14,8],profilinglevel:[19,21],algorithm:[2,27,12,23],cursorinform:16,tradeoff:31,leak:[],far:4,hello:[24,6,16,11,14,4,1,30,31,25],code:[24,6,16,17,29,19,4,1,14,25,30,31,8],partial:[8,14],worldbuff:4,queri:[0,19,16,10,15,11,4,5,26,14,30,22,23,7,8],idvalu:0,replicasetcheckinterv:[],base64:[2,23,25],update_a_simple_document_upsert:14,send:[2,30,16,23],io_seek_end:4,sens:11,reapertimeout:[16,23],passiv:[],result2:25,writebuff:[],untouch:23,dbname:16,gettim:[8,17],fieldorspec:[16,14],fewer:14,"try":[30,31,14,11],race:[],refer:[30,3,4,8,16],smaller:18,fortun:30,natur:30,jump:[30,31],video:31,download:30,odd:[27,12],append:[18,4,30],compat:[],index:[10,1,16,14,15,5,21,22,7,8],compar:[17,27,12,4,5,20],test_correctly_access_collect:16,access:[8,14,18,19,4,28,13,16],experiment:[],can:[0,12,16,17,2,18,15,11,27,5,14,30,31,23,8],lee:[],bson_data_int:1,batchsizevalu:8,cursor_count_collect:8,logout:[19,16,21],filedescriptor:31,becom:30,sinc:[30,27,12,31,11],subtype_byte_arrai:24,nexttick:[],convert:[0,30],convers:[30,14],larger:[18,31],implement:[30,27,12],configur:[2,30,15,16],appli:[0,8,30],app:2,api:[10,20,31,16,21],from:[24,0,25,1,16,8,17,2,12,15,11,4,14,18,30,31,27,7,19],batchsiz:[14,16,21,8],doubl:[10,20,13,30],next:[0,31,1,8,23],chr:4,sort:[0,8,11,14,5,21],benchmark:[],name2:0,socketopt:[2,23],sollect:15,account:14,retriev:[0,8,11,18,19,4,14,30,31,16],scalabl:18,multiple_db_inst:16,annot:31,unopen:[],fetch:[0,25,8,14,5,30,16],queryfailur:[],control:[30,31,23],objectid:[24,0,6,16,17,10,3,19,4,29,20,1,14,25,30,31,23,8],process:[27,12,8],lock:[31,16],calcul:1,username_:5,high:[30,27,12,16,14],tag:14,serial:[20,1,16,14],pingresult:19,integration_test_:[2,16],instead:[0,16,14,2,5,31,23,8],npm:30,await:16,formattedorderclaus:[],originaldata:25,alloc:[1,16],seriou:[],remove_all_documents_no_saf:14,correspond:[5,15,12,27],element:[0,4,30,8],issu:[30,14],writ:4,allow:[16,14,15,19,30,31,23,8],subtyp:24,deoptim:[],doc2:30,doc3:30,move:[18,4,30],doc4:30,own:4,server_opt:23,effici:[30,31,14],bunch:[16,14],perfect:30,crash:[],greater:[0,27,12,8],handl:[8,14,27,12,4,30,31],databs:[18,15,23],auth:16,renamecollect:[16,21],precess:30,numberofremoveddoc:14,writefil:[18,31,4,21],convin:0,anyth:[],edit:[31,4],deserializeddoc:1,exampledb:[30,31],subset:[8,14],opensync:4,chunk:[18,31,4],bson_binary_subtype_uuid:[24,1],default_content_typ:4,pushal:30,our:[30,31,4,8],special:[30,27,12,31,8],out:[10,16,26,2,14,30,31,23],variabl:[30,14],trickier:[0,30],categori:31,suitabl:31,merg:14,ref:[],math:17,jessica:[0,11],insid:[18,0,31,7,5],dropcollect:[15,16,21],unpars:[],releas:[],princess:14,unwant:0,could:30,shiftleft:[20,12,27],keep:[18,16,30,14],length:[24,1,16,17,18,19,4,20,14,31,8],lte:0,transfer:16,minkei:1,debugmessag:[],iszero:[20,12,27],should_correctly_rewind_and_restart_cursor:8,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:16,prioriti:[],strict:[15,16,23,14],system:[15,31,4],messag:[19,11,4,14,16],bson_data_max_kei:1,termin:4,"final":[30,14],deconstruct:31,test_gs_getc_fil:4,exactli:15,gridstorew:4,bson_data_object:1,replset:[2,16],mongoserv:[15,23],structur:[0,31,30],charact:[24,14,4,17],test_gs_puts_and_readlin:4,result:[0,25,6,16,8,11,12,27,17,4,14,18,30,31,23,19],counter:[23,14],terribl:[],peform:[29,6,16,14,8],have:[0,16,14,2,15,4,5,30,31],tabl:[30,15],need:[0,1,16,11,18,15,12,27,5,30,31,23],turn:[0,19,16],buildinfo:[19,21],min:[14,16,8],mix:[0,5],andrewjston:[],which:[0,2,18,15,12,4,27,31,23],test_other_drop:14,orgiin:4,singl:[24,0,16,11,18,14,4],fileid:[31,6,4],statsync:4,whi:0,serverconfig:[16,23],why:30,overwriten:4,url:16,timestamplib:27,request:8,face:30,test_collect:11,snapshot:[8,14],determin:[30,8],"_id":[0,16,11,14,4,5,31,23,7,25],fact:[30,11],text:[27,12,31,4],serializefunct:[1,16,14],verbos:14,nagl:[2,23],anywai:[16,14],setter:[4,17],locat:[30,14,4,8,16],should:[0,12,16,17,15,19,14,25,31,27,8],test_cursorstream_paus:29,local:[3,16],doc1:30,ritch:[],increas:[],donewithwrit:31,enabl:[16,23],simple_batch_size_collect:8,stuff:[2,10,31,30,26],integr:[30,31],contain:[24,1,8,14,2,15,4,30,31,16],grab:[19,16,8],modulo:[0,20,12,27],packet:[],statu:30,wire:30,correctli:[30,14],written:[24,14,27,12,4,31],crude:30,world2:14,kei:[0,1,16,14,4,5,30,31,23,7,8],buckets:14,simple_queri:14,isol:[],job:14,entir:[31,4,8],db_option:23,crc32:1,addit:[0,1,16,14,27,12,31,8],admin:[10,19,16,21,14],equal:[24,0,6,16,8,17,29,27,12,4,20,1,14,25,30,19],etc:[0,23,14],instanc:[1,16,17,2,19,4,14,25,30,31,23,8],greaterthan:[20,12,27],subtype_funct:24,comment:[8,14],toint:[20,12,27],removealllisten:[],save_a_simple_docu:14,addition:15,compon:[],json:[10,20,12,27,30],treat:[0,8],pkfactori:[16,14],immedi:11,bit:[0,1,18,27,12,30,31],assert:[24,6,16,17,29,19,4,1,14,25,8],present:[5,15],replic:[2,16],multi:[14,11],plain:[],cursor:[0,6,16,10,19,21,29,14,30,7,8],defin:[24,0,1,16,11,27,12,4,14,30,23],setreadprefer:[],bson_data_arrai:1,layer:30,helper:[],site:2,tojson:[20,12,27],getc:[4,21],cross:[],member:2,world_no_saf:14,inc:30,difficult:31,incorrect:[],slave:2,hostnam:23,keepal:[2,23],upon:8,retriv:19,serializewithbufferandindex:[20,1],chunk_siz:[18,4],off:[8,2,15,19,4,30,23,16],center:14,nevertheless:23,well:[0,31,30],exampl:[24,0,25,6,16,8,17,10,15,11,4,29,5,26,1,14,18,30,31,23,19],command:[8,14,19,4,21,30,23,16],simple_geo_near_command:14,filesystem:18,latest:30,distanc:14,paus:[29,6,21],less:[30,27,12],"boolean":[6,16,14,18,27,12,4,5,1,31,8],additon:5,tcp:30,indexinform:[16,14,5,21,7,8],web:30,seekloc:[31,4],add:[12,16,14,27,19,5,20,30,17],cleanup:31,logger:[],match:[0,19,11,15,12,14,30,27,7],crud:[10,30,26],iya_logo_final_bw:4,know:15,bson_data_timestamp:1,recurs:[12,27,1,4],isclos:[8,21],desc:[0,8],bson_data_str:1,insert:[0,1,16,8,10,15,11,4,21,29,14,30,22,23,7,19],resid:30,like:[0,16,14,27,12,5,31,8],success:[18,4,8],chunkcollect:[4,21],necessari:0,"0xff":1,async:30,page:[0,30,10],dispatch:30,suppli:31,gridf:[10,25,26,18,4,31],flush:[31,6,4],proper:[],fileinfo:31,librari:31,lead:[27,12],dropdatabas:[19,16,21,23],avoid:[5,19,30],fromint:[20,12,27],thank:[],leav:11,mode:[8,14,18,15,4,31,23,16],slight:30,journal:16,usag:[24,10,1,25,2,18,15,4,30,31,23,7],collection_nam:15,host:23,although:31,offset:[24,31,4],java:[27,12],simpler:[30,8,14],about:[16,11,5,30,31,23,8],actual:[0,31,16,30,23],socket:[2,30,16,7,23],http:30,dbinstanc:31,notequ:[20,12,27],constructor:[9,24,1,16,8,17,2,29,3,12,4,28,21,20,6,13,27,14,25,23,19],fals:[0,6,16,11,18,15,19,4,29,1,14,25,31,23,8],disabl:[2,23],autoindexid:16,automat:[6,16,2,18,30,31,23,8],dataset:[0,30],bson:[9,0,6,16,8,17,10,3,11,4,28,23,29,20,1,13,14,25,24,15,19],leverag:30,val:14,pictur:31,primarki:0,mykei:30,trigger:[29,6,4,14,8],concat:0,"var":[24,0,1,16,8,17,2,18,15,11,4,29,6,14,25,30,31,23,19],fsname:25,"function":[24,0,1,16,8,11,2,18,15,12,4,27,6,31,14,25,30,29,23,19],brand:[],waitforconnect:[],overflow:[27,12],inlin:14,bug:31,count:[0,16,11,15,14,4,21,7,8],made:31,wise:0,whether:[27,12],wish:[24,1,16,14,19,4,31],displai:16,asynchron:[2,30],record:[0,16,11,18,15,14,4,5,30,23,7,8],below:[30,27,12,16,11],limit:[0,8,14,18,21,30],otherwis:[1,8,27,12,4,30,31],problem:19,evalu:[1,16],"int":[27,12],dure:[30,16,14],year:0,filenam:[18,31,4],replica:[2,16],retrymilisecond:[16,23],probabl:0,tick:[],detail:[5,8,18],deepequ:[25,14,4,8,16],book:0,bool:17,futur:[30,16],branch:[],stat:[21,14],findon:[0,16,14,21,30,7],"class":[9,24,6,16,8,17,29,3,12,4,28,1,13,14,25,30,31,27,19],stai:14,eof:[18,31,4,21],integration_test:[6,8,14,19,4,29,25,16],kaij:[]},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","Indexes","ReadStream()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Long()","Double()","Collection()","Collections","Db()","ObjectID()","GridStore","Admin()","Binary JSON API","Driver API","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Symbol()","CursorStream()","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","markdown-docs/indexes","api-generated/readstream","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","api-bson-generated/long","api-bson-generated/double","api-generated/collection","markdown-docs/collections","api-generated/db","api-bson-generated/objectid","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","api-bson-generated/symbol","api-generated/cursorstream","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file From f7cf5cc37db513f6b6a9a0f99c9b6f22fa822b08 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Wed, 8 Feb 2012 17:02:18 +0100 Subject: [PATCH 07/56] Updated docs --- changelog/changelog.html | 23 +++++------------------ genindex.html | 14 +++++++------- index.html | 3 ++- objects.inv | Bin 1201 -> 1201 bytes searchindex.js | 2 +- 5 files changed, 15 insertions(+), 27 deletions(-) diff --git a/changelog/changelog.html b/changelog/changelog.html index f13f071352a..00374e7e370 100644 --- a/changelog/changelog.html +++ b/changelog/changelog.html @@ -7,7 +7,7 @@ - Changelog — MongoDB Node.JS Driver 1.0.0 documentation + Changelog — MongoDB Node.JS Driver 0.9.8.7 documentation @@ -15,7 +15,7 @@ - + @@ -769,7 +769,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • - diff --git a/genindex.html b/genindex.html index 168c13eff08..962e1cb6402 100644 --- a/genindex.html +++ b/genindex.html @@ -162,7 +162,7 @@

    C

    -
    close() (built-in function), [1], [2] +
    close() (built-in function), [1], [2]
    @@ -204,7 +204,7 @@

    C

    -
    createIndex() (built-in function), [1] +
    createIndex() (built-in function), [1]
    @@ -292,7 +292,7 @@

    D

    -
    dropIndex() (built-in function), [1] +
    dropIndex() (built-in function), [1]
    @@ -306,7 +306,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -316,7 +316,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -454,7 +454,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -674,7 +674,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    diff --git a/index.html b/index.html index d86091620ca..2e8b1558a7e 100644 --- a/index.html +++ b/index.html @@ -117,7 +117,8 @@

    API Documentation

    Changelog

    -
    diff --git a/objects.inv b/objects.inv index 0f8d45c9b6fe79a7136ca8cd017705cfce25ad0a..fcb74c321225e83b5267a22b5e5bc295837d0eec 100644 GIT binary patch delta 1078 zcmV-61j+lc39$)~ihpz4I1Ih#S7@fa+MOPH$<2<_Cf(HT*zN30clJPukj#W4wfu1H zPJjGDlww7yY>9ME9*Y1$01v<;b4i(?u#dE%*PO(_qsjZII85?-VY)Rre-nL?)N+XK z%THGsh#sZqueC-cs)49v+ZL?8)nc1U;48`CYB66!8a?XkgntvQqxTUh*d*3cOmJ^d z!~lJlND7te+h}t2AVoG!mCWbN=u$JaA~8&geq~;YAC(p4atGfvs24(PI|_ z`0aVSVaqap1YD+#{wLhB3$3=nMs^WT6Db7lFd7)gvpF;_t5}Bw$dyouE|n9f7V$7 zt3|gvL4Pn%%Go-Q?Djk@W99-j+UdIV*KQDd2f1n|gOm8B!3^XQ35T~SBgfWyAA+&W z7sQa5=m98oNCVR=O2dkr@WgUlt*Z6}ZRqS%{%vRT`PAc4Oo}y7oA@WQnjk~7qmlnY z_J6@)0G~P8Kf$4gE{+}0ZGa!uM@`o*+0;$$fxq= zOb|5$?br$Rp#=5;eCBz&PZJl3j~K~|2+odh3#)WkRUh(L@|Gf_xH6K_bvouT@_#e4 zoqyXj1%>nF6qe6sp>^9hlZYM|Y@AO6dR@oMej7kz+bSn|XYWM2w!VYeB|13G?)7LS z%6lAb8^63I3)q{g;=RaBy@H};PxrWG4Nf^DKckC5&{@Q%G1L3v_y9ZLUbE1Vk2NGx zQSBA5HCEHmTTWSV-Ip9>xL<>hJ1hU5w%3tfNE>q)7_rm|^}StQ)I6EK;ZhGhDlc?m wI`@&F^Bu+U~=?U80($er+wbj8oq?`2PXoYty*XxQ4a$ClK+x?lGJiY zp4?A&1&AJ_*I$no^;Qi;W!v_~`nTh@O}*hWDd27~UqhaJ(|_+WPP9(mCZuAMR7)|z zvq2F9^w&&Ms7>D_le=drifOK7IcG*Y%iN00Fe&CBtq3idXbcN5OY3hrOGjMPuoAQ(W!0RJ5|eE=>|eO*HnU1g)mUX)D_*>n zuw{yo{`CQj0e|)1#{c=-9Y%~%EVTxHIIU2OY9rNI#`TuvX3dJNiHhR8Vg}wbem#mF zznH);ug490mgzUZW!l&qxxpw!5q0ZDI?bdIc;slLoG$C(xvY~P3h!*#Sv&cQF8ceNlT z+@DrPU-<)qZsS46nKq&LH1ZMlV0d)871crH zvhra(Ee0sNCtAIP0@1vKs2g+8`pcGxxPH?2q^f`hr zzx^!MZhvz@G*sNU9Vm8t#JZgMgpCgR*!*ihn}d^FBXn>$pF1o-E>VL7yK;1Knb}+o z&T5Z+yEL=PaRBO91rQ5sdMjPT5IT&1{&zSGV6!Cq7dZ5&$FbwN4epcqsDIho)t(w^I(THRR}T?m$_iAXFX4k~ zrW82@5&e9#T26lgqMAO^K|R{0uN#Eisbpi%XjiSkNs0XHX3t7J{9_4^x`j_CMFc2D zIHs|YNg>IcGeOi4Od21K0f1xa0{U!vFvP diff --git a/searchindex.js b/searchindex.js index f5d58ba2cd8..9c9efc2a2ea 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{notEquals:[27,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[27,1,1,""],DBRef:[3,0,1,""],ensureIndex:[16,1,1,""],reIndex:[16,1,1,""],Binary:[24,0,1,""],deserializeStream:[1,1,1,""],findOne:[14,1,1,""],valueOf:[28,1,1,""],chunkCollection:[4,1,1,""],collectionNames:[16,1,1,""],Long:[12,0,1,""],nextObject:[8,1,1,""],validateCollection:[19,1,1,""],removeUser:[16,1,1,""],profilingInfo:[19,1,1,""],dropIndex:[16,1,1,""],findAndRemove:[14,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[27,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[19,1,1,""],getNumBitsAbs:[27,1,1,""],cursorInfo:[16,1,1,""],"generationTime number [Getter|Setter]":[17,2,1,""],Timestamp:[27,0,1,""],batchSize:[8,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[16,0,1,""],dropCollection:[16,1,1,""],Collection:[14,0,1,""],shiftRight:[27,1,1,""],writeFile:[4,1,1,""],toString:[27,1,1,""],Double:[13,0,1,""],getTimestamp:[17,1,1,""],Grid:[25,0,1,""],profilingLevel:[19,1,1,""],streamRecords:[8,1,1,""],indexInformation:[16,1,1,""],isOdd:[27,1,1,""],getHighBits:[27,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[19,0,1,""],dropDatabase:[16,1,1,""],Symbol:[28,0,1,""],previousErrors:[16,1,1,""],shiftRightUnsigned:[27,1,1,""],shiftLeft:[27,1,1,""],mapReduce:[14,1,1,""],Cursor:[8,0,1,""],MaxKey:[9,0,1,""],CursorStream:[29,0,1,""],findAndModify:[14,1,1,""],greaterThan:[27,1,1,""],renameCollection:[16,1,1,""],buildInfo:[19,1,1,""],resetErrorHistory:[16,1,1,""],isClosed:[8,1,1,""],getLowBitsUnsigned:[27,1,1,""],toHexString:[17,1,1,""],indexExists:[14,1,1,""],getLowBits:[27,1,1,""],toArray:[8,1,1,""],toNumber:[27,1,1,""],listDatabases:[19,1,1,""],ObjectID:[17,0,1,""],isNegative:[27,1,1,""],geoHaystackSearch:[14,1,1,""],addUser:[16,1,1,""],lessThanOrEqual:[27,1,1,""],isZero:[27,1,1,""],collectionsInfo:[16,1,1,""],lessThan:[27,1,1,""],isCapped:[14,1,1,""],ReadStream:[6,0,1,""],createCollection:[16,1,1,""],createIndex:[16,1,1,""],dropAllIndexes:[14,1,1,""],lastError:[16,1,1,""],geoNear:[14,1,1,""],greaterThanOrEqual:[27,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromHexString:[17,1,1,""]},Timestamp:{fromBits:[27,1,1,""],fromNumber:[27,1,1,""],fromInt:[27,1,1,""],fromString:[27,1,1,""]},Db:{connect:[16,1,1,""]},Long:{fromBits:[12,1,1,""],fromNumber:[12,1,1,""],fromInt:[12,1,1,""],fromString:[12,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{returnkei:[8,14],maxscan:[8,14],readfilesync:4,prefix:15,crete:14,createindex:[21,5,16,7,14],world_safe2:14,world_safe1:14,test_map_reduce_functions_inlin:14,deviat:[],under:[],everi:[0,8,23,18],test_gs_seek_with_buff:4,simple_next_object_collect:8,upload:18,correct:[30,16,1,4,17],"10k":[],seper:4,direct:[5,8,30],second:[16,11,2,15,17,4,14,31,23,8],aggreg:14,even:[0,14],attemp:14,neg:[27,12],"256k":31,"new":[0,1,2,15,4,5,6,8,11,12,14,16,17,18,19,23,24,25,27,29,30,31],metadata:[18,31,4],manipul:14,rootcollect:4,never:16,here:[30,31,4],io_seek_set:4,integration_tests_to_drop:16,anymor:[],robin:30,getlowbit:[20,12,27],findandmodifi:[14,21,11],vincentcr:[],schemaless:30,total:[0,14],sarah:14,would:[0,16,14,27,12,5,31],init:8,overhead:30,recommend:[30,14],type:[9,10,1,14,18,3,19,4,28,13,30,24,31,26],tell:[16,14,4,21,30,31],relat:5,notic:[30,31],warn:[14,16,11],exce:4,hold:[30,1,4,8],must:[0,27,12,14],err:[0,6,16,11,2,18,15,19,4,29,14,25,30,31,23,8],aheckmann:[],setup:[2,31,16],work:[0,8,4,30,31,16],rework:[],root:[31,4,25],overrid:[14,16,8],simple_geo_haystack_command:14,indic:[0,11,10,15,5,18,30,23],want:[0,16,14,15,4,5,13,30,31,23],david:11,unsign:[27,12],end:[6,8,14,18,15,4,29,30,31],replicaset:[10,16,2,30,22,7],quot:8,how:[10,8,14,19,4,26,30,31,16],"_id_":[16,14],recoveri:2,rewind:[0,4,21,8],milisecond:[16,17],config:[2,16],updat:[24,10,16,14,11,21,30,31,22,7],maxdist:14,recogn:4,after:[6,8,11,18,29,4,1,31],listdatabas:[19,16,21],befor:[0,16,14,2,5,30,31,23],wrong:[],gs2:4,descriptior:18,parallel:30,attempt:[30,19,23],third:4,exclud:[8,14],perform:[0,19,16,14,27,12,8],errorobject:[],order:[0,8,11,14,5,23],oper:[0,19,16,11,15,12,27,5,14,30,31,23,8],cursorinfo:[16,21],over:[23,14,16,7,8],becaus:[27,12],readbuff:31,vari:[],digest:31,uuid:[24,1],fit:[30,8],fix:31,better:[30,23],complex:[30,16,14],loggerinst:[],persist:[30,14],split:[27,12,4],them:30,thei:[30,27,12,31],safe:[11,16,14,15,19,29,30,8],update_a_simple_docu:14,"instanceof":[14,19,4,8,16],choic:[],changelog:10,bonu:30,timeout:[2,8,23,14],each:[0,6,16,14,2,27,12,4,29,21,31,23,8],debug:[],went:14,a_simple_collect:16,mean:[2,30,31,8,23],resum:[29,6,21],nin:0,extract:[],newli:[5,15,19],auto_reconnect:[6,8,14,2,19,4,29,25,30,31,23,16],content:[24,0,6,25,11,18,4,30,31,7],daniel:[0,23,18],reader:[],got:[30,16,14],more_index_information_test:[16,14],navig:31,worthwhil:31,findandremov:[21,14],situat:[],md5:[24,1,4],filter:[16,14],pagin:14,regress:[],onto:[],rang:[0,14],instruct:2,alreadi:[8,11,18,15,4,5,30,23],unlin:4,getnumbitsab:[20,12,27],primari:[0,16,14,2,30,23,7,8],hexstr:17,rewritten:[],top:[27,12,14],travers:8,startindex:1,tonumb:[20,12,27],ton:[30,31],similarli:30,listen:8,consol:[0,1,11,18,15,30,31,23],namespac:3,eventlisten:[],took:8,incur:30,removeus:[19,16,21],silli:30,target:[31,14],provid:[16,14,27,12,4,30,31],zero:[27,12],matter:30,iron:30,geohaystack:14,websocket:30,abov:[30,31,11],mind:30,raw:[0,16,14,15,11,31,23,8],manner:31,increment:30,seek:[21,18,31,4,7],dbref:[10,3,20,16,30],ensureindex:[21,5,16,7,14],simple_limit_collect:8,data2:4,simplifi:31,insur:[],plenti:31,usernam:[5,19,16],object:[0,1,2,15,4,5,6,7,8,10,11,14,16,17,18,19,23,24,25,26,29,30,31],what:[30,15,31,8],regular:[0,18],tradit:30,simplic:31,don:[23,14],doc:[0,1,16,11,19,4,29,14,30,8],flow:[],doe:[16,11,15,12,4,14,30,31,27],bson_data_d:1,radix:[27,12],random:4,speedup:[],syntax:[],test_stream_funct:8,identifi:[30,15,31],absolut:[27,12,31,4],acquir:8,field2:0,explain:[0,14,16,21,8],field1:0,theme:30,busi:30,rich:30,io_seek_cur:4,cachefunct:1,nasti:[],test_cursorstream_destroi:29,stop:[],collectionsinfo:[16,21],bson_data_numb:1,report:30,bar:4,patch:[],previouli:8,fileidobject:4,steam:8,fieldnam:0,fair:31,indexnam:[16,14],num:14,tocollect:16,previouserror:[16,21],respons:[0,8],fail:[30,25,19,16,14],said:31,databas:[0,25,16,11,10,15,19,4,26,14,18,30,31,22,23,7,8],test_gs_empty_file_eof:4,gridstor:[24,10,6,16,17,18,19,4,21,26,1,14,25,29,22,31,7,8],simplest:[0,31],awai:31,lotsofdoc:30,accord:2,newnam:14,simple_key_based_distinct:14,getlasterror:[16,14],howev:8,against:[0,19,16,17,27,12,4,14,8],logic:0,com:30,assur:8,asced:8,simple_explain_collect:8,getmorecommand:[8,14],path:[18,4],assum:[27,12],duplic:[5,14,16,8],three:[30,31,4],been:[31,16,8],much:[30,31,11],basic:[10,16,26,14,30,31],life:31,regul:8,isodd:[20,12,27],ani:[0,16,11,30,31,8],child:16,"catch":14,laurie71:[],another_root:4,dissect:31,properti:[0,17,18,4,20,21],weren:0,"typeof":[1,4],succes:14,sever:[11,2,15,5,30,23],grown:30,test_is_close_function_on_cursor:8,receiv:31,make:[0,8,11,14,5,30,31,23,7],drawback:31,descend:[5,8],isneg:[20,12,27],complet:14,reset_error_histori:16,hang:[],hand:23,fairli:[],tune:31,scenario:23,thu:11,test_close_function_on_cursor:8,client:[11,8,14,19,4,25,30,16],thi:[24,0,6,16,8,17,12,27,11,4,5,14,18,30,31,23,19],everyth:11,settimeout:[29,6,14],left:[27,12,16,23,14],protocol:30,just:[0,31,30,14],laptop:[],ordin:[16,14],farther:6,yet:23,languag:30,previous:[],octet:4,collectionn:23,had:8,els:[19,23,14,11],save:[16,14,18,11,4,21,23,7],applic:[30,31],milli:19,preserv:8,background:[16,14],test_ev:16,apart:[30,31],measur:[],specif:[0,8,17,15,14,4,30,16],arbitrari:4,negat:[20,12,27],collection2:[16,14],collection1:14,underli:29,www:16,right:[30,27,12,31],old:4,deal:30,manual:[10,7],interv:[],deserializestream:[20,1],dead:[],intern:[0,27,12,18,14],successfulli:8,txt:4,timestampd:17,multipli:[20,12,27,14],christkv:30,condit:[0,14],localhost:[30,15,31,16],a_simple_create_drop_collect:16,collection_stats_test:14,promot:30,repositori:30,post:[0,15,12,27],plug:30,obj:14,slightli:30,simul:[27,12,31],commit:16,simple_previous_error_col:16,bson_data_symbol:1,"float":[30,27,12],simple_skip_collect:8,bound:[14,16,8],down:16,wrap:[29,0,6,13,28],storag:[30,31],wai:[0,14,11,27,12,30,31],support:[0,31,30,18],serverinfo:14,avail:[6,8,14,2,19,4,29,30,31,16],test_rename_collection3:14,call:[0,8,4,31,23,16],constantli:30,lowest:[],head:[31,4],medium:19,form:4,forc:[19,16,14,8],"true":[0,1,16,11,2,18,15,19,4,29,5,6,14,25,30,31,23,8],reset:[0,4,8,16],new_nam:15,highbit:[27,12],maximum:[30,16,8],until:[30,19,16],deprect:8,fundament:30,sampl:30,emit:[30,29,16,14],featur:31,fromstr:[20,12,27],exist:[0,16,11,18,15,19,4,21,5,14,30,31,23,7],subtype_user_defin:24,check:[0,6,16,8,14,18,27,12,4,29,5,1,30,7,19],test_collection_opt:14,bson_binary_subtype_md5:[24,1],test_to_a_after_each:8,floor:17,when:[0,1,8,11,2,18,15,14,4,29,6,30,31,23],refactor:[],simple_limit_skip_find_one_queri:14,test:[8,11,18,15,19,4,14,30,31,16],miliscecond:[29,6],node:[2,10,8,7,30],insensit:8,consid:14,sql:30,cachefunctionscrc32:1,errormessag:[],streamrecord:[30,8,21],faster:5,ignor:[30,1,14],time:[10,16,14,2,17,26,30,23,8],push:[30,29,16,8],backward:8,concept:30,skip:[0,8,21,14],global:[],primer:[10,31,26],row:14,millisecond:23,middl:14,depend:[],dropindex:[21,5,16,7,14],sourc:8,string:[24,0,1,16,8,17,18,3,12,4,28,27,5,14,25,30,31,15,19],feasibl:31,test_cursorstream_resum:29,contenttyp:18,level:[19,4,14,16],did:16,dig:30,eventemitt:8,iter:[8,14],item:[6,8,14,19,4,29,30,16],quick:[30,31],div:[20,12,27],round:30,databasenam:[16,23],wtimeout:[16,14],addtoset:30,sign:[15,12,27],slow_onli:19,cost:[],port:[16,23],comparis:4,checkoutwrit:16,repli:[30,19,14],current:[19,16,18,3,12,4,30,31,27],subtype_uuid:24,deriv:[27,12],gener:[31,14,16,23,17],wait:[16,14],box:30,bson_data_regexp:1,shift:[27,12],queue:30,behav:[],more_complex_ensure_index_test:[16,14],extrem:[],weird:[],checkkei:1,extra:0,modul:[],prefer:[0,30],toarrai:[0,16,14,19,21,30,8],instal:30,includeloc:14,perf:[],memori:[0,8,26,10,30,31],regep:30,live:[30,31],handler:31,value2:0,value1:0,criteria:11,scope:[30,1,16,14],prev:14,maxkei:[9,10,20,1],multiplecoll1:16,finit:[27,12],examin:30,content_typ:[18,31],cap:[30,16,14],uniqu:[0,14,16,23,5],descriptor:31,whatev:23,bson_binary_subtype_funct:[24,1],mongo:[10,16,26,11,30,31],stream:[6,8,18,29,4,1,21,30,31,7],predict:[],bson_data_long:1,createcollect:[16,14,15,29,21,30,8],occur:[0,8,11,18,15,4,5,23,7],alwai:[30,27,12,8,14],multipl:[14,2,27,12,23,7],ping:[19,16,21],fieldvalu:0,write:[24,1,16,2,18,4,20,6,21,30,31,7,25],foreach:[4,14],pure:[24,6,16,17,29,19,4,1,14,25,8],map:[30,14],product:[27,12],max:[14,16,8],dive:[30,31],date:[1,8,14,19,5,30,17],docstartindex:1,data:[24,10,6,8,14,18,26,4,29,1,25,30,31,16],grow:30,sbrekken:[],inform:[16,14,2,18,19,4,5,30,23,7,8],"switch":[],reaper:[16,23],combin:[4,16],anoth:[0,4,30,17],filedata:4,gettimestamp:[20,17],still:[0,11],pointer:[0,15,4,23,18],test_map_reduce_funct:14,group:[31,21,14],gte:0,indexexist:[21,14],jim:14,nodelai:[2,23],platform:30,mbostock:[],requir:[24,6,16,8,11,29,15,17,4,1,14,25,30,31,23,19],main:[30,31],non:14,encod:[2,30,23],col2:16,col3:16,initi:[8,14,4,30,31,16],col1:16,verifi:[16,19,4,14,17],now:[30,31,16],nor:15,introduct:[2,10,30,7,26],mapreduc:[21,14],name:[24,0,1,16,11,2,18,3,19,4,23,5,14,31,15,8],drop:[16,14,15,19,5,21],revert:0,crypto:[],separ:[0,4],failov:2,replai:[],replac:[0,14,4,30,11],individu:0,a_1_b_1:[16,14],poolreadi:[],serverclust:[],happen:[29,6,4,8],shown:[30,31],accomplish:31,space:[1,16],profil:[19,8,14],tohexstr:[0,20,17],factori:[0,23,14],variant:30,"_event":[],mime:4,sethml:[],replacethiscollect:14,org:16,"byte":[24,0,1,16,17,18,30,31,23],care:[2,0,30],question:[27,12],test_gs_tel:4,synchron:30,thing:[30,31,23],place:[27,12],year2013:[],frequent:[27,12],first:[0,19,16,11,18,15,17,4,14,30,31,23,7,8],origin:[14,11],bson_binary_:[],directli:[0,8,30],onc:[5,30],arrai:[24,0,1,16,11,2,18,15,19,4,14,30,7,8],"0x7f":1,reopen:[4,23],"long":[10,1,8,17,12,20,30],open:[6,16,11,2,18,15,19,4,21,29,14,25,30,31,23,7,8],predefin:1,size:[0,1,8,14,18,27,12,4,31,16],given:[24,8,14,27,12,4,31,16],breviti:[30,31],workaround:[],paramt:8,collectionnam:[16,14,15,19,5,21,31],conveni:[0,27,12],subtype_md5:24,especi:30,copi:2,specifi:[24,0,8,14,18,4,30,31,23,16],test_rename_collection2:14,test_arrai:8,keepgo:14,than:[0,8,11,14,2,18,27,12,31,23],png:[18,4],tedeh:[],were:[8,11],posit:[24,18,27,12,4,31],pre:[1,16,14,19],sai:31,argument:[24,6,16,8,17,29,3,12,4,28,1,13,14,25,31,27,19],simple_rename_collection_2:16,bitwis:[30,27,12],alias:0,destroi:[29,6,21],note:[27,12,16,8],take:[2,0,31,1,30],createfromhexstr:[0,20,17],begin:[0,4],sure:[31,8],normal:8,buffer:[24,0,1,16,11,18,15,14,4,25,31,23,8],clearer:[],getyear:14,renam:[16,14,15,21,30,7],byte_valu:24,later:[31,16,14],indexbound:[16,14],test_gs_read_stream:4,runtim:[],parseint:14,axi:14,show:[24,6,8,14,29,4,1,25,30,16],atom:[30,14],objectid3:17,objectid2:17,concurr:[],corner:[],onli:[0,16,11,2,19,4,5,14,30,31,23,8],slow:[19,16,14],dice:30,setprofilinginfo:19,activ:[],state:[30,8,23],analyt:30,overwritten:31,min_valu:[27,12],variou:[19,14],get:[10,6,16,8,17,18,15,11,4,21,5,26,29,14,25,30,31,23,7,19],secondari:[2,14,16,8],ssl:[],cannot:[16,14,27,12,30,8],shiftrightunsign:[20,12,27],geo:14,nolock:16,doabl:0,seldom:[],yield:[15,14,16,11],isarrai:1,where:[24,0,1,16,11,2,18,15,14,4,5,30,31],geospati:[16,14],desced:8,wiki:30,testcas:[],infinit:[27,12],detect:2,heckmann:[],fs_chunk:31,integration_tests_2:16,wayt:14,enough:8,between:[30,16,23],"import":[30,31],across:[23,14],spars:[5,16,14],test_group:14,come:[18,27,12,14],simple_find_and_modify_operations_:14,region:14,gwt:[27,12],tutori:[10,31],mani:[30,8],fromnumb:[20,12,27],reindex:[16,21,14],iscap:[21,14],period:[0,15],pop:30,createcreateindexcommand:[],fs_file:31,lessthan:[20,12,27],reaperinterv:[16,23],cursor_information_collect:16,cursorinst:8,coupl:[24,30,14],aciev:0,rebuilt:[16,14],derefer:[16,21],lowbit:[27,12],geonear:[21,14],"1mb":31,those:[27,12],"case":[8,14,27,12,5,30,31],myself:30,bson_seri:[],tostr:[24,25,14,27,12,4,20,17,31],trick:31,invok:31,idhex:0,firstext:19,simple_sort_collect:8,advantag:30,eras:[18,15],ascii:[2,24,23],acess:16,develop:30,author:[0,18,11],same:[0,16,17,27,12,4,5,14,8],binari:[24,0,25,6,16,8,17,10,15,11,4,29,20,1,14,18,30,19],document:[0,1,16,8,10,2,18,15,11,4,29,5,6,14,30,31,23,19],createpk:23,exhaust:8,finish:[31,14],closest:[27,12,14],utf8:[2,30,4,23],nest:[0,5],oid:3,driver:[0,11,2,10,15,26,21,30,31,23,7],gotend:4,improv:[],defo:0,bson_data_boolean:1,choos:[30,14],without:[1,16,27,12,23,15],model:14,dereferenc:16,upsert:[14,11],ourexamplefiletowrit:4,execut:[11,8,14,19,4,30,16],rest:14,hint:[8,14],db_connector:[15,23],except:[30,4,11],littl:30,blog:[0,15],default_chunk_s:4,haystack:14,found2:4,around:30,read:[24,6,8,14,2,18,4,20,21,30,31,7,16],grid:[24,10,31,25,21],spank:[],world:[6,16,11,14,4,1,31,25],lasterror:[16,21],reap:[],mod:[0,27,12],saniti:[],poolsiz:[6,8,14,19,4,29,25,30,23,16],integ:[0,12,1,27,30],server:[24,1,16,8,17,2,29,15,11,4,6,14,25,30,31,23,7,19],either:[18,31,30],output:[0,14],greaterthanorequ:[20,12,27],manag:[18,30],bson_binary_subtype_byte_arrai:[24,1],eventloop:31,ascend:[0,8,5],intact:11,generationtim:17,setnodelai:[],slice:30,writedata:31,node_ev:[],confirm:30,legal:14,evolv:30,profilinginfo:[19,21],bson_data_binari:1,broken:[],aquir:16,bson_binary_subtype_default:[24,1],regexp:[30,1],"throw":[30,31,11],pointer_to_collect:0,firstnam:[0,5],numbit:[27,12],bson_data_code_w_scop:1,gump:14,act:31,luck:31,other:[0,26,2,10,27,12,4,30,31],readstream:[10,6,8,21],addus:[19,16,21],test_collections_info:16,your:[2,30,31,4,14],loc:14,log:[0,1,8,11,18,15,19,14,30,31,23],hex:[0,25,4,17],overwrit:[19,4],dropdup:[16,14],start:[24,0,1,8,14,2,15,4,30,31],interfac:[29,6,8,30,25],low:[30,27,12,31],lot:[8,14,5,29,30,31],tupl:5,shamelessli:30,replsetsrv:2,longer:4,pull:[30,19],dirti:30,possibl:[0,16,11,14,5,30],"default":[24,0,1,16,17,2,18,15,11,4,5,14,30,31,23,8],remove_subset_of_documents_saf:14,bson_data_min_kei:1,connect:[10,6,16,14,2,19,4,26,29,21,25,30,31,23,7,8],gone:[25,14,4,16],creat:[24,0,1,16,17,2,18,15,19,4,29,5,6,14,25,30,31,23,7,8],certain:[5,30],intro:30,file:[6,25,18,4,31,7,16],calculateobjects:[20,1],again:[4,8],field:[0,8,11,14,5,30,7,16],valid:[24,1,8,17,15,19,16],longlib:12,you:[0,1,16,11,2,18,15,14,5,30,31,23,8],pefrom:14,sequenc:[],symbol:[10,20,1,30,28],opt_radix:[27,12],pool:[16,23],reduc:[27,12,14],lessthanorequ:[20,12,27],directori:[],descript:[24,1,4,8,16],tricki:30,potenti:[],alright:30,cpu:31,unset:30,represent:[9,24,25,17,3,12,4,28,13,27],all:[0,1,16,11,2,18,15,19,4,5,14,30,31,23,8],forget:30,numberupd:14,dollar:15,simple_rename_collect:16,follow:[0,8,11,2,4,5,30,31],fetchsiz:8,disk:[31,6,4,14,8],subtype_default:24,nextobject:[0,16,21,8],aaron:[],setprofilinglevel:[19,21],evaul:16,util:[],test_rename_collect:14,failur:30,veri:[30,31],list:[16,14,15,19,4,21,30,31,7],resav:14,adjust:31,default_port:23,small:31,retun:1,cursorstream:[10,29,8,21],pass:[1,16,17,2,15,14,4,31,23,8],deleg:23,abc:[0,4,11],xor:[20,12,27],sub:[24,14],sum:[27,12],delet:[16,14,18,4,21,30,31,23,7,25],version:[31,16,23,14],cruso:0,method:[24,0,8,10,15,17,4,26,14,30,31,23,25],full:[16,14],hash:[0,31,16,23],variat:30,foobar2:4,foobar3:4,modifi:[30,14,7,11],valu:[0,1,15,4,5,7,8,11,12,13,14,16,17,18,19,20,23,24,28,27,30,31],search:[10,30,14],ahead:[30,31,14],showdiskloc:[8,14],amount:[30,27,12,16],pick:[30,31,16],narrow:14,evalfunct:1,via:30,shorthand:11,c_1:14,deprec:16,default_root_collect:4,establish:[6,8,14,19,4,29,25,16],select:[15,14,23,7,11],test_collection_is_cap:14,distinct:[21,14],regist:4,two:[0,12,16,17,2,18,15,11,4,5,30,31,27],coverag:[],bson_binary_subtype_user_defin:[24,1],taken:30,minor:[],more:[0,6,16,11,2,27,12,4,29,14,30,31,8],flag:14,stick:30,particular:30,cach:1,none:2,outlin:[30,31],histori:16,remain:[31,4],scan:[8,14],share:[16,7,23],shard:18,accept:14,simple_document_insert_collection_no_saf:14,default_url:16,robinson:0,cours:30,newlin:4,divid:[27,12,14],rather:14,keepgoingexampl:14,simpl:[24,0,6,16,10,29,15,14,4,5,26,1,25,30,31,8],perman:16,resourc:23,resultset:30,reflect:[],unlink:[18,31,4,21],associ:[31,4],keyorlist:8,github:30,defineproperti:[],save_a_simple_document_modify_it_and_resave_it:14,caus:30,callback:[0,16,11,18,15,19,4,5,14,30,31,23,8],spheric:14,doc_id:0,bson_data_oid:1,trade:31,through:[30,16,14],reconnect:23,paramet:[0,16,11,2,18,15,19,4,5,30,31,23,8],style:30,mongorepli:[],asbuff:1,relev:30,rapidli:30,bypass:30,simple_limit_skip_queri:14,might:[5,31,16,30],alter:[0,15],good:[30,31],"return":[0,6,3,4,1,8,9,11,12,13,14,15,16,17,18,19,23,24,25,28,27,29,30,31],timestamp:[10,1,14,27,17,20],more_complex_index_test:[16,14],distancemultipli:14,compound:[16,14],readlen:4,uploadd:18,unlik:8,authent:[19,16,21],easili:[27,12],achiev:0,skipvalu:8,found:[0,11,4,14,16],truncat:[15,31,4],hard:30,realli:30,expect:[0,23],barrier:[],event:[6,8,18,4,29,30,31,23,16],read_primari:[],pullal:30,foreground:[16,14],core2duo:[],advanc:[10,26,15,4,30,31],asc:[0,8,11],reason:4,base:[14,18,17,4,30,31],connectionopt:16,put:[24,8,14,4,20,21,31,25],seconddb:16,gethighbit:[20,12,27],tailabl:[8,14],omit:[30,3,31],dir:11,assign:2,notifi:[30,31,14],articl:[10,31,26],lastnam:[0,5],number:[24,0,1,16,8,17,27,12,4,5,13,14,30,31,23,19],done:[0,6,16,14,11,18,19,29,30,31,23],construct:[27,12],autoclos:[18,31,6,4],create_and_drop_an_index:[16,14],miss:[],differ:[16,14,27,12,4,5,30,17,31,25],chunk_typ:4,script:18,interact:[30,31,4,25],least:[0,14],custompkfactori:23,settim:17,statement:[30,31,16],illeg:[25,19,16,14],master:2,store:[1,8,18,4,30,31,16],otherid:17,option:[24,0,1,16,11,2,18,3,19,4,23,21,5,14,25,30,31,15,7,8],reseterrorhistori:[16,21],native_pars:[6,8,14,19,4,29,25,23,16],getter:[4,17],pars:[1,14],literarili:30,std:[],kind:31,bson_data_nul:1,whenev:[16,14],remov:[16,11,15,19,4,21,5,14,30,7],reus:1,str:[27,12],consumpt:31,luckili:[30,31],"null":[0,1,16,14,2,15,19,4,29,25,23,8],built:30,equival:[30,14],valueof:[20,13,28],fromcollect:16,also:[0,8,11,15,4,5,30,31],build:[30,31,19,16],validatecollect:[19,21],reach:[31,6],most:[0,31,30],cygwin:[],selector:[14,16,8],"16mb":18,cover:16,part:[30,17],clean:16,frombit:[20,12,27],find:[0,6,16,11,18,19,21,5,29,14,30,7,8],firewal:[],pretti:30,test_gs_weird_bug:4,numberofdocu:1,batch_document_insert_collection_saf:14,hit:[16,14],express:[0,30,18,14],fieldtoupd:30,test_map_reduce_functions_scop:14,nativ:[30,23],restart:[29,6],statist:[19,16,14],wrote:30,set:[0,1,16,8,17,2,18,15,11,4,5,14,30,31,23,19],see:[0,11,18,15,12,27,5,30,31,23],close:[6,8,14,18,19,4,29,21,25,30,31,23,7,16],my_f:4,misalign:[],someth:[4,23],altern:14,signatur:[4,8],complement:[27,12],javascript:[1,16,14,27,12,30],salzman:[],succeed:5,both:14,last:[18,16,30],create_and_drop_all_index:[16,14],context:23,let:[6,8,14,4,30,31,16],corrupt:19,whole:[30,14,4,16],createdat:8,load:0,simpli:0,jsmode:14,point:[8,14,27,12,30,31],instanti:30,shutdown:[],linux:[],backend:30,faithfulli:[27,12],user_id:14,due:[30,25],empti:[24,0,14,4,8],strategi:30,test_streamingrecords_funct:8,fire:[6,16,11,18,4,30,31,23],admindb:[19,16],imag:[18,31],understand:30,func:[1,14],look:[8,14,18,4,5,30,31],straight:[30,31],batch:[30,8,14],"while":[0,4,18,8],getownpropertynam:[],behavior:[0,27,12,30,11],error:[0,6,16,11,18,15,19,4,5,29,14,30,23,8],fun:31,loos:30,loop:[],test_gs_unlink:4,readi:[29,6,4,30,8],key2:0,key1:0,jpg:4,itself:8,test_deref_exampl:16,rid:[],simple_key_based_distinct_sub_query_filt:14,chase:[],decor:[],simple_document_insert_with_function_saf:14,geohaystacksearch:[21,14],p_db:[2,16],higher:[2,31,23,14],optim:14,operaion:18,numberofretri:[16,23],piec:[30,27,12,31],temporari:[4,14],user:[24,0,1,16,11,19,4,5],hello2:14,keyf:14,recreat:23,lower:[16,14],entri:[31,14,4,16],explan:[16,14],getlowbitsunsign:[20,12,27],a_1:14,shape:[],update_a_simple_document_multi:14,password:[19,16],cur:31,keeptemp:14,read_secondari:2,input:[27,12,14],subsequ:[16,14],format:[0,16,14,11,19,8],big:[30,31],checksum:4,shiftright:[20,12,27],rs_name:2,replsetserv:[24,1,16,17,2,29,19,4,6,14,25,8],fsync:[16,14],resolv:16,collect:[0,2,3,4,5,7,8,10,11,19,15,16,14,18,21,22,23,25,26,29,30,31],bson_data_cod:1,popular:30,bamboo:[],serverpair:[],often:[27,12],creation:[30,19,16,14],some:[24,0,6,16,14,18,4,5,25,30,31,8],back:[0,19,14,27,12,4,30],understood:30,dropallindex:[21,14],scale:[30,31,14],slaveok:[16,14],chunksiz:[18,31,4],retri:[30,16,23],larg:[0,16,14,18,30,31],intial:14,previou:[31,23],run:[10,16,11,26,2,14,30,31],simple_reset_error_history_col:16,step:31,simple_explain_queri:14,subtract:[20,12,27],recordquerystat:16,block:[31,16,14],plan:31,within:[27,12],simple_index_test:14,ensur:[16,14,5,30,31,7],chang:[30,27,12,31,14],test_collection_index_exist:14,bson_deseri:[],textual:[27,12],custom:[0,31,23,7,14],includ:[0,8,14,15,4,5,30,23,16],forward:4,files:4,properli:4,uniquedoc:14,"_bsontyp":[],link:[10,31,30,26],simple_count_exampl:14,line:[31,4],info:[31,19,16,14],concaten:[27,12,4],consist:[],caller:8,forceserverobjectid:[16,23],readlin:[4,21],similar:18,constant:[24,1,8,4,20,21,16],multiplecoll2:16,parser:[1,16,23],doesn:[0,23,11],repres:[8,28,27,12,4,13,30],isconnect:[],titl:[0,14,22,11],unidirect:8,wakup:16,nice:30,deseri:[30,20,1,8],jannehietamaki:[],mongodb:[0,1,2,15,4,5,6,7,8,10,11,14,16,17,18,19,23,24,25,29,30,31],eval:[21,1,16,14,8],profilinglevel:[19,21],algorithm:[2,27,12,23],cursorinform:16,tradeoff:31,leak:[],far:4,hello:[24,6,16,11,14,4,1,30,31,25],code:[24,6,16,17,29,19,4,1,14,25,30,31,8],partial:[8,14],worldbuff:4,queri:[0,19,16,10,15,11,4,5,26,14,30,22,23,7,8],idvalu:0,replicasetcheckinterv:[],base64:[2,23,25],update_a_simple_document_upsert:14,send:[2,30,16,23],io_seek_end:4,sens:11,reapertimeout:[16,23],passiv:[],result2:25,writebuff:[],untouch:23,dbname:16,gettim:[8,17],fieldorspec:[16,14],fewer:14,"try":[30,31,14,11],race:[],refer:[30,3,4,8,16],smaller:18,fortun:30,natur:30,jump:[30,31],video:31,download:30,odd:[27,12],append:[18,4,30],compat:[],index:[10,1,16,14,15,5,21,22,7,8],compar:[17,27,12,4,5,20],test_correctly_access_collect:16,access:[8,14,18,19,4,28,13,16],experiment:[],can:[0,12,16,17,2,18,15,11,27,5,14,30,31,23,8],lee:[],bson_data_int:1,batchsizevalu:8,cursor_count_collect:8,logout:[19,16,21],filedescriptor:31,becom:30,sinc:[30,27,12,31,11],subtype_byte_arrai:24,nexttick:[],convert:[0,30],convers:[30,14],larger:[18,31],implement:[30,27,12],configur:[2,30,15,16],appli:[0,8,30],app:2,api:[10,20,31,16,21],from:[24,0,25,1,16,8,17,2,12,15,11,4,14,18,30,31,27,7,19],batchsiz:[14,16,21,8],doubl:[10,20,13,30],next:[0,31,1,8,23],chr:4,sort:[0,8,11,14,5,21],benchmark:[],name2:0,socketopt:[2,23],sollect:15,account:14,retriev:[0,8,11,18,19,4,14,30,31,16],scalabl:18,multiple_db_inst:16,annot:31,unopen:[],fetch:[0,25,8,14,5,30,16],queryfailur:[],control:[30,31,23],objectid:[24,0,6,16,17,10,3,19,4,29,20,1,14,25,30,31,23,8],process:[27,12,8],lock:[31,16],calcul:1,username_:5,high:[30,27,12,16,14],tag:14,serial:[20,1,16,14],pingresult:19,integration_test_:[2,16],instead:[0,16,14,2,5,31,23,8],npm:30,await:16,formattedorderclaus:[],originaldata:25,alloc:[1,16],seriou:[],remove_all_documents_no_saf:14,correspond:[5,15,12,27],element:[0,4,30,8],issu:[30,14],writ:4,allow:[16,14,15,19,30,31,23,8],subtyp:24,deoptim:[],doc2:30,doc3:30,move:[18,4,30],doc4:30,own:4,server_opt:23,effici:[30,31,14],bunch:[16,14],perfect:30,crash:[],greater:[0,27,12,8],handl:[8,14,27,12,4,30,31],databs:[18,15,23],auth:16,renamecollect:[16,21],precess:30,numberofremoveddoc:14,writefil:[18,31,4,21],convin:0,anyth:[],edit:[31,4],deserializeddoc:1,exampledb:[30,31],subset:[8,14],opensync:4,chunk:[18,31,4],bson_binary_subtype_uuid:[24,1],default_content_typ:4,pushal:30,our:[30,31,4,8],special:[30,27,12,31,8],out:[10,16,26,2,14,30,31,23],variabl:[30,14],trickier:[0,30],categori:31,suitabl:31,merg:14,ref:[],math:17,jessica:[0,11],insid:[18,0,31,7,5],dropcollect:[15,16,21],unpars:[],releas:[],princess:14,unwant:0,could:30,shiftleft:[20,12,27],keep:[18,16,30,14],length:[24,1,16,17,18,19,4,20,14,31,8],lte:0,transfer:16,minkei:1,debugmessag:[],iszero:[20,12,27],should_correctly_rewind_and_restart_cursor:8,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:16,prioriti:[],strict:[15,16,23,14],system:[15,31,4],messag:[19,11,4,14,16],bson_data_max_kei:1,termin:4,"final":[30,14],deconstruct:31,test_gs_getc_fil:4,exactli:15,gridstorew:4,bson_data_object:1,replset:[2,16],mongoserv:[15,23],structur:[0,31,30],charact:[24,14,4,17],test_gs_puts_and_readlin:4,result:[0,25,6,16,8,11,12,27,17,4,14,18,30,31,23,19],counter:[23,14],terribl:[],peform:[29,6,16,14,8],have:[0,16,14,2,15,4,5,30,31],tabl:[30,15],need:[0,1,16,11,18,15,12,27,5,30,31,23],turn:[0,19,16],buildinfo:[19,21],min:[14,16,8],mix:[0,5],andrewjston:[],which:[0,2,18,15,12,4,27,31,23],test_other_drop:14,orgiin:4,singl:[24,0,16,11,18,14,4],fileid:[31,6,4],statsync:4,whi:0,serverconfig:[16,23],why:30,overwriten:4,url:16,timestamplib:27,request:8,face:30,test_collect:11,snapshot:[8,14],determin:[30,8],"_id":[0,16,11,14,4,5,31,23,7,25],fact:[30,11],text:[27,12,31,4],serializefunct:[1,16,14],verbos:14,nagl:[2,23],anywai:[16,14],setter:[4,17],locat:[30,14,4,8,16],should:[0,12,16,17,15,19,14,25,31,27,8],test_cursorstream_paus:29,local:[3,16],doc1:30,ritch:[],increas:[],donewithwrit:31,enabl:[16,23],simple_batch_size_collect:8,stuff:[2,10,31,30,26],integr:[30,31],contain:[24,1,8,14,2,15,4,30,31,16],grab:[19,16,8],modulo:[0,20,12,27],packet:[],statu:30,wire:30,correctli:[30,14],written:[24,14,27,12,4,31],crude:30,world2:14,kei:[0,1,16,14,4,5,30,31,23,7,8],buckets:14,simple_queri:14,isol:[],job:14,entir:[31,4,8],db_option:23,crc32:1,addit:[0,1,16,14,27,12,31,8],admin:[10,19,16,21,14],equal:[24,0,6,16,8,17,29,27,12,4,20,1,14,25,30,19],etc:[0,23,14],instanc:[1,16,17,2,19,4,14,25,30,31,23,8],greaterthan:[20,12,27],subtype_funct:24,comment:[8,14],toint:[20,12,27],removealllisten:[],save_a_simple_docu:14,addition:15,compon:[],json:[10,20,12,27,30],treat:[0,8],pkfactori:[16,14],immedi:11,bit:[0,1,18,27,12,30,31],assert:[24,6,16,17,29,19,4,1,14,25,8],present:[5,15],replic:[2,16],multi:[14,11],plain:[],cursor:[0,6,16,10,19,21,29,14,30,7,8],defin:[24,0,1,16,11,27,12,4,14,30,23],setreadprefer:[],bson_data_arrai:1,layer:30,helper:[],site:2,tojson:[20,12,27],getc:[4,21],cross:[],member:2,world_no_saf:14,inc:30,difficult:31,incorrect:[],slave:2,hostnam:23,keepal:[2,23],upon:8,retriv:19,serializewithbufferandindex:[20,1],chunk_siz:[18,4],off:[8,2,15,19,4,30,23,16],center:14,nevertheless:23,well:[0,31,30],exampl:[24,0,25,6,16,8,17,10,15,11,4,29,5,26,1,14,18,30,31,23,19],command:[8,14,19,4,21,30,23,16],simple_geo_near_command:14,filesystem:18,latest:30,distanc:14,paus:[29,6,21],less:[30,27,12],"boolean":[6,16,14,18,27,12,4,5,1,31,8],additon:5,tcp:30,indexinform:[16,14,5,21,7,8],web:30,seekloc:[31,4],add:[12,16,14,27,19,5,20,30,17],cleanup:31,logger:[],match:[0,19,11,15,12,14,30,27,7],crud:[10,30,26],iya_logo_final_bw:4,know:15,bson_data_timestamp:1,recurs:[12,27,1,4],isclos:[8,21],desc:[0,8],bson_data_str:1,insert:[0,1,16,8,10,15,11,4,21,29,14,30,22,23,7,19],resid:30,like:[0,16,14,27,12,5,31,8],success:[18,4,8],chunkcollect:[4,21],necessari:0,"0xff":1,async:30,page:[0,30,10],dispatch:30,suppli:31,gridf:[10,25,26,18,4,31],flush:[31,6,4],proper:[],fileinfo:31,librari:31,lead:[27,12],dropdatabas:[19,16,21,23],avoid:[5,19,30],fromint:[20,12,27],thank:[],leav:11,mode:[8,14,18,15,4,31,23,16],slight:30,journal:16,usag:[24,10,1,25,2,18,15,4,30,31,23,7],collection_nam:15,host:23,although:31,offset:[24,31,4],java:[27,12],simpler:[30,8,14],about:[16,11,5,30,31,23,8],actual:[0,31,16,30,23],socket:[2,30,16,7,23],http:30,dbinstanc:31,notequ:[20,12,27],constructor:[9,24,1,16,8,17,2,29,3,12,4,28,21,20,6,13,27,14,25,23,19],fals:[0,6,16,11,18,15,19,4,29,1,14,25,31,23,8],disabl:[2,23],autoindexid:16,automat:[6,16,2,18,30,31,23,8],dataset:[0,30],bson:[9,0,6,16,8,17,10,3,11,4,28,23,29,20,1,13,14,25,24,15,19],leverag:30,val:14,pictur:31,primarki:0,mykei:30,trigger:[29,6,4,14,8],concat:0,"var":[24,0,1,16,8,17,2,18,15,11,4,29,6,14,25,30,31,23,19],fsname:25,"function":[24,0,1,16,8,11,2,18,15,12,4,27,6,31,14,25,30,29,23,19],brand:[],waitforconnect:[],overflow:[27,12],inlin:14,bug:31,count:[0,16,11,15,14,4,21,7,8],made:31,wise:0,whether:[27,12],wish:[24,1,16,14,19,4,31],displai:16,asynchron:[2,30],record:[0,16,11,18,15,14,4,5,30,23,7,8],below:[30,27,12,16,11],limit:[0,8,14,18,21,30],otherwis:[1,8,27,12,4,30,31],problem:19,evalu:[1,16],"int":[27,12],dure:[30,16,14],year:0,filenam:[18,31,4],replica:[2,16],retrymilisecond:[16,23],probabl:0,tick:[],detail:[5,8,18],deepequ:[25,14,4,8,16],book:0,bool:17,futur:[30,16],branch:[],stat:[21,14],findon:[0,16,14,21,30,7],"class":[9,24,6,16,8,17,29,3,12,4,28,1,13,14,25,30,31,27,19],stai:14,eof:[18,31,4,21],integration_test:[6,8,14,19,4,29,25,16],kaij:[]},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","Indexes","ReadStream()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Long()","Double()","Collection()","Collections","Db()","ObjectID()","GridStore","Admin()","Binary JSON API","Driver API","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Symbol()","CursorStream()","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","markdown-docs/indexes","api-generated/readstream","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","api-bson-generated/long","api-bson-generated/double","api-generated/collection","markdown-docs/collections","api-generated/db","api-bson-generated/objectid","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","api-bson-generated/symbol","api-generated/cursorstream","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file +Search.setIndex({objects:{"":{notEquals:[27,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[27,1,1,""],DBRef:[3,0,1,""],ensureIndex:[9,1,1,""],Binary:[24,0,1,""],streamRecords:[17,1,1,""],deserializeStream:[1,1,1,""],findOne:[18,1,1,""],valueOf:[28,1,1,""],chunkCollection:[4,1,1,""],Long:[13,0,1,""],nextObject:[17,1,1,""],validateCollection:[14,1,1,""],removeUser:[9,1,1,""],profilingInfo:[14,1,1,""],dropIndex:[9,1,1,""],findAndRemove:[18,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[27,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[14,1,1,""],getNumBitsAbs:[27,1,1,""],cursorInfo:[9,1,1,""],"generationTime number [Getter|Setter]":[7,2,1,""],Timestamp:[27,0,1,""],batchSize:[17,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[9,0,1,""],dropCollection:[9,1,1,""],Collection:[18,0,1,""],shiftRight:[27,1,1,""],writeFile:[4,1,1,""],Grid:[25,0,1,""],Double:[15,0,1,""],getTimestamp:[7,1,1,""],toString:[27,1,1,""],profilingLevel:[14,1,1,""],collectionNames:[9,1,1,""],toNumber:[27,1,1,""],indexInformation:[9,1,1,""],isOdd:[27,1,1,""],getHighBits:[27,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[14,0,1,""],dropDatabase:[9,1,1,""],Symbol:[28,0,1,""],previousErrors:[9,1,1,""],mapReduce:[18,1,1,""],shiftLeft:[27,1,1,""],shiftRightUnsigned:[27,1,1,""],Cursor:[17,0,1,""],MaxKey:[10,0,1,""],CursorStream:[29,0,1,""],findAndModify:[18,1,1,""],greaterThan:[27,1,1,""],renameCollection:[9,1,1,""],buildInfo:[14,1,1,""],resetErrorHistory:[9,1,1,""],isClosed:[17,1,1,""],getLowBitsUnsigned:[27,1,1,""],toHexString:[7,1,1,""],indexExists:[18,1,1,""],getLowBits:[27,1,1,""],toArray:[17,1,1,""],reIndex:[9,1,1,""],listDatabases:[14,1,1,""],ObjectID:[7,0,1,""],isNegative:[27,1,1,""],geoHaystackSearch:[18,1,1,""],addUser:[9,1,1,""],lessThanOrEqual:[27,1,1,""],isZero:[27,1,1,""],collectionsInfo:[9,1,1,""],lessThan:[27,1,1,""],isCapped:[18,1,1,""],ReadStream:[6,0,1,""],createCollection:[9,1,1,""],createIndex:[9,1,1,""],dropAllIndexes:[18,1,1,""],lastError:[9,1,1,""],geoNear:[18,1,1,""],greaterThanOrEqual:[27,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromHexString:[7,1,1,""]},Timestamp:{fromBits:[27,1,1,""],fromNumber:[27,1,1,""],fromInt:[27,1,1,""],fromString:[27,1,1,""]},Db:{connect:[9,1,1,""]},Long:{fromBits:[13,1,1,""],fromNumber:[13,1,1,""],fromInt:[13,1,1,""],fromString:[13,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{returnkei:[30,17,18],maxscan:[30,17,18],readfilesync:4,prefix:[16,30],crete:18,createindex:[9,18,30,5,21,8],world_safe2:18,world_safe1:18,test_map_reduce_functions_inlin:18,deviat:30,under:30,everi:[0,17,23,19],test_gs_seek_with_buff:4,simple_next_object_collect:17,upload:19,correct:[1,9,7,30,4,31],"10k":30,seper:4,direct:[5,17,31],second:[17,12,2,16,18,4,32,30,7,23,9],aggreg:18,even:[0,18],attemp:18,neg:[27,13],calcul:1,"new":[0,1,2,16,4,5,6,7,9,12,13,14,30,17,18,19,23,24,25,27,29,31,32],metadata:[19,32,4],unpars:30,rootcollect:4,never:[30,9],here:[31,32,4],io_seek_set:4,anymor:30,loos:31,getlowbit:[20,13,27],findandmodifi:[30,18,21,12],vincentcr:30,schemaless:31,total:[0,18],sarah:18,would:[0,9,18,27,13,5,32,30],aaron:30,overhead:31,recommend:[31,18],type:[10,11,1,18,19,3,14,4,28,15,31,24,32,30,26],tell:[9,18,4,21,31,32],relat:5,notic:[31,32],warn:[18,9,12],exce:4,hold:[31,1,4,17],must:[0,27,13,18],err:[0,14,6,17,12,2,19,16,18,4,29,30,25,31,32,23,9],aheckmann:30,setup:[2,32,9],work:[0,9,30,4,31,32,17],rework:30,root:[32,4,25],overrid:[9,17,30,18],simple_geo_haystack_command:18,indic:[0,12,11,16,5,19,31,23],want:[0,9,18,16,4,5,15,31,32,23],david:12,unsign:[27,13],end:[6,17,18,19,16,4,29,31,32],replicaset:[11,9,2,30,31,22,8],quot:17,how:[11,9,18,14,4,26,31,32,17],"_id_":[9,18],recoveri:2,rewind:[0,30,4,21,17],milisecond:[30,9,7],config:[2,30,9],updat:[24,11,9,18,30,12,21,31,32,22,8],maxdist:18,recogn:4,after:[6,17,12,19,30,29,4,1,32],listdatabas:[30,14,9,21],befor:[0,9,18,2,30,5,31,32,23],wrong:30,gs2:4,descriptior:19,parallel:31,attempt:[31,14,23],third:4,exclud:[17,18],perform:[0,14,9,18,27,13,30,17],errorobject:30,order:[0,17,12,18,5,23],oper:[0,14,17,12,16,13,30,27,5,18,31,32,23,9],cursorinfo:[9,21],over:[9,18,30,23,8,17],becaus:[27,13],readbuff:[30,32],vari:30,digest:[30,32],uuid:[24,1],fit:[31,17],fix:[30,32],better:[31,30,23],complex:[31,9,18],loggerinst:30,persist:[31,18],split:[27,13,4],them:31,thei:[31,27,13,32,30],safe:[12,9,18,16,14,29,31,30,17],update_a_simple_docu:18,"instanceof":[9,18,30,14,4,17],choic:30,changelog:[11,30],bonu:31,timeout:[2,30,17,23,18],each:[0,6,17,18,2,27,13,4,30,29,21,32,23,9],debug:30,went:18,a_simple_collect:9,mean:[17,2,30,31,32,23],resum:[29,6,21],reset_error_histori:9,extract:30,newli:[5,16,14],content:[24,0,6,25,12,19,4,31,32,8],daniel:[0,23,19],reader:30,got:[31,9,18],more_index_information_test:[9,18],navig:32,worthwhil:32,default_port:23,situat:30,md5:[24,30,1,4],filter:[9,18],pagin:18,regress:30,onto:30,rang:[0,30,18],unlik:17,alreadi:[17,12,19,16,4,5,31,23],unlin:4,getnumbitsab:[20,13,27],primari:[0,9,18,2,30,31,23,8,17],hexstr:7,rewritten:30,top:[27,13,18],travers:17,startindex:1,tonumb:[20,13,27],ton:[31,32],similarli:31,listen:[30,17],consol:[0,1,12,19,16,31,32,23],namespac:3,eventlisten:30,took:17,incur:31,removeus:[14,9,21],silli:31,target:[32,18],provid:[9,18,27,13,4,31,32],cursorstream:[11,29,17,21],matter:31,iron:31,thu:12,websocket:31,abov:[31,32,12],mind:31,raw:[0,9,18,16,12,30,32,23,17],manner:[30,32],increment:31,seek:[21,19,32,4,8],dbref:[11,9,3,20,31,30],ensureindex:[9,18,30,5,21,8],simple_limit_collect:17,data2:4,simplifi:[30,32],insur:30,plenti:32,usernam:[5,14,9],object:[0,1,2,16,4,5,6,7,8,9,11,12,14,30,17,18,19,23,24,25,26,29,31,32],deleg:23,regular:[0,19],tradit:31,simplic:32,don:[30,23,18],doc:[0,14,1,17,12,30,18,4,29,31,9],flow:30,doe:[12,9,18,16,13,4,30,31,32,27],bson_data_d:1,radix:[27,13],random:4,speedup:30,syntax:30,test_stream_funct:17,identifi:[31,16,32],absolut:[27,13,32,4],acquir:17,field2:0,explain:[0,9,17,21,18],field1:0,theme:31,busi:31,rich:31,io_seek_cur:4,cachefunct:1,nasti:30,test_cursorstream_destroi:29,stop:30,collectionsinfo:[9,21],bson_data_numb:1,report:31,bar:4,patch:30,previouli:17,fileidobject:4,steam:17,fieldnam:0,fair:32,indexnam:[9,18],num:18,structur:[0,32,31],previouserror:[9,21],respons:[0,17],fail:[25,18,30,14,31,9],said:32,databas:[0,25,14,17,12,11,16,18,4,26,30,19,31,32,22,23,8,9],test_gs_empty_file_eof:4,gridstor:[24,11,14,6,17,18,19,30,7,4,29,26,1,21,25,32,22,8,9],simplest:[0,32],awai:32,lotsofdoc:31,accord:2,newnam:18,getlasterror:[9,18],howev:17,against:[0,14,9,18,27,13,4,7,30,17],logic:[0,30],com:[31,30],assur:17,can:[0,17,12,2,19,16,13,30,27,5,32,18,31,7,23,9],simple_explain_collect:17,foobar2:4,path:[19,30,4],assum:[27,13],duplic:[5,9,17,30,18],three:[31,32,4],been:[32,17,9],much:[31,32,12],basic:[11,9,26,18,31,32],life:32,regul:17,search:[11,31,18],argument:[24,14,6,17,18,29,3,13,4,28,1,15,32,30,25,7,27,9],child:9,"catch":18,laurie71:30,another_root:4,peform:[29,9,6,17,18],dissect:32,properti:[0,7,19,30,4,20,21],weren:0,"typeof":[30,1,4],succes:18,sever:[12,2,16,5,31,23],grown:31,test_is_close_function_on_cursor:17,receiv:32,make:[0,17,12,30,18,5,31,32,23,8],drawback:32,descend:[5,17],isneg:[20,13,27],complet:18,nin:0,hang:30,hand:23,fairli:30,tune:32,scenario:23,geohaystack:18,test_close_function_on_cursor:17,client:[9,12,14,4,18,25,31,17],thi:[24,0,14,6,17,12,19,27,13,4,5,30,32,18,31,7,23,9],everyth:12,settimeout:[29,30,6,18],left:[27,13,9,23,18],protocol:[31,30],just:[0,32,31,18],laptop:30,ordin:[9,18],farther:6,yet:23,languag:31,previous:30,collectionn:23,had:17,els:[18,14,23,12],save:[9,18,19,12,4,21,23,8],applic:[31,32],which:[0,2,19,16,13,4,27,30,32,23],preserv:17,background:[9,18],test_ev:9,apart:[31,32],measur:30,specif:[0,9,18,16,7,4,31,30,17],arbitrari:4,negat:[20,13,27],collection2:[9,18],collection1:18,underli:29,www:9,right:[31,27,13,32],old:4,deal:31,manual:[11,8],interv:30,deserializestream:[20,1],dead:30,intern:[0,27,13,19,18],successfulli:17,txt:4,timestampd:7,multipli:[20,13,27,18],christkv:[31,30],condit:[0,30,18],localhost:[31,16,32,9],a_simple_create_drop_collect:9,collection_stats_test:18,promot:31,repositori:31,post:[0,16,13,27],plug:31,obj:18,slightli:31,simul:[27,13,32],commit:9,book:0,simple_previous_error_col:9,bson_data_symbol:1,"float":[31,27,13],encod:[2,31,30,23],bound:[9,17,18],down:[30,9],wrap:[0,6,28,30,29,15],storag:[31,32],wai:[0,18,12,27,13,31,32,30],support:[0,30,32,31,19],serverinfo:18,avail:[6,9,18,2,30,14,4,29,31,32,17],test_rename_collection3:18,test_rename_collection2:18,constantli:31,lowest:30,head:[32,4],medium:14,form:[30,4],forc:[9,14,17,30,18],"true":[0,14,1,17,12,2,19,16,18,4,29,5,6,30,25,31,32,23,9],reset:[0,9,4,17],new_nam:16,geospati:[9,18],maximum:[31,30,17,9],until:[31,14,9],deprect:17,fundament:31,sampl:31,emit:[31,30,29,9,18],featur:32,fromstr:[20,13,27,30],exist:[0,14,9,12,19,16,18,4,5,30,21,31,32,23,8],subtype_user_defin:24,check:[0,14,6,17,18,19,27,13,4,29,5,1,31,30,8,9],test_collection_opt:18,bson_binary_subtype_md5:[24,1],test_to_a_after_each:17,floor:7,when:[0,1,17,12,2,19,16,18,4,29,6,30,31,32,23],refactor:30,simple_limit_skip_find_one_queri:18,test:[14,9,12,19,16,18,4,31,32,30,17],miliscecond:[29,6],node:[11,17,2,30,31,8],insensit:17,consid:18,sql:31,cachefunctionscrc32:1,dropdup:[30,9,18],"_id":[0,9,12,30,18,4,5,32,23,8,25],longer:[30,4],ignor:[31,1,18],time:[11,9,7,2,30,18,26,31,23,17],push:[31,30,29,17,9],backward:[30,17],concept:[31,30],skip:[0,17,21,18],global:30,primer:[11,32,26],row:18,millisecond:23,middl:18,depend:30,dropindex:[21,5,9,8,18],sourc:17,string:[24,0,14,1,17,18,19,3,13,4,28,27,5,32,30,25,31,7,16,9],feasibl:32,test_cursorstream_resum:29,contenttyp:19,level:[9,14,4,30,18],did:[30,9],dig:31,eventemitt:17,iter:[17,18],item:[6,9,18,30,14,4,29,31,17],quick:[31,32],div:[20,13,27],round:31,databasenam:[9,23],wtimeout:[30,9,18],addtoset:31,sign:[16,13,27],slow_onli:14,cost:30,port:[30,9,23],comparis:4,checkoutwrit:9,repli:[31,14,18],current:[14,9,19,3,13,4,31,32,27],subtype_uuid:24,deriv:[27,13],gener:[9,7,30,18,32,23],wait:[9,18],box:31,bson_data_regexp:1,shift:[27,13,30],queue:31,behav:30,more_complex_ensure_index_test:[9,18],extrem:30,weird:30,checkkei:1,extra:0,modul:30,prefer:[0,30,31],toarrai:[0,9,18,30,14,21,31,17],instal:[31,30],includeloc:18,perf:30,memori:[0,17,26,11,30,31,32],regep:31,live:[31,30,32],handler:32,value2:0,value1:0,criteria:12,scope:[31,30,1,9,18],prev:18,maxkei:[10,11,20,1,30],multiplecoll1:9,finit:[27,13],examin:31,content_typ:[19,32],cap:[31,30,9,18],uniqu:[0,18,9,23,5],test_correctly_access_collect:9,whatev:23,bson_binary_subtype_funct:[24,1],mongo:[11,9,26,30,12,31,32],stream:[6,17,19,30,29,4,1,21,31,32,8],predict:30,bson_data_long:1,createcollect:[9,18,16,29,21,31,17],occur:[0,17,12,19,16,4,5,30,23,8],alwai:[31,27,13,17,18],multipl:[18,2,27,13,30,23,8],ping:[30,14,9,21],fieldvalu:0,write:[24,1,9,2,19,30,4,20,6,21,31,32,8,25],foreach:[4,18],pure:[24,14,6,9,18,29,30,7,4,1,25,17],map:[31,18],product:[27,13],max:[9,17,30,18],dive:[31,32],date:[1,17,7,30,14,5,18,31],docstartindex:1,data:[24,11,6,17,18,19,30,26,4,29,1,25,31,32,9],grow:31,sbrekken:30,inform:[17,18,2,19,14,4,5,31,23,8,9],"switch":30,reaper:[30,9,23],combin:[4,9],keepgoingexampl:18,filedata:4,increas:30,still:[0,30,12],pointer:[0,16,4,23,19],test_map_reduce_funct:18,group:[30,32,21,18],gte:0,indexexist:[30,21,18],jim:18,nodelai:[2,30,23],platform:31,mbostock:30,requir:[24,14,6,17,12,29,16,18,4,1,32,30,25,31,7,23,9],main:[31,32],non:[30,18],simple_skip_collect:17,col2:9,col3:9,initi:[9,18,30,4,31,32,17],col1:9,verifi:[9,7,14,4,18],now:[31,30,32,9],nor:16,introduct:[2,11,31,8,26],mapreduc:[21,18],name:[24,0,14,1,17,12,2,19,3,18,4,23,5,30,32,16,9],drop:[9,18,16,14,5,21,30],revert:0,crypto:30,separ:[0,30,4],failov:[2,30],replai:30,replac:[0,18,30,12,4,31],individu:[0,30],a_1_b_1:[9,18],poolreadi:30,serverclust:30,happen:[29,6,4,17],shown:[31,32],accomplish:32,space:[1,9],profil:[14,17,18],stuff:[2,11,32,31,26],factori:[0,23,18],resultset:31,"_event":30,mime:4,sethml:30,replacethiscollect:18,org:9,"byte":[24,0,1,9,7,19,30,31,32,23],care:[2,0,31],question:[27,13],test_gs_tel:4,synchron:31,thing:[31,32,23],place:[27,13],year2013:30,frequent:[27,13],first:[0,14,17,12,19,16,18,4,32,31,7,23,8,9],origin:[18,12],bson_binary_:30,directli:[0,17,31],onc:[5,31],arrai:[24,0,14,1,17,12,2,19,16,18,4,31,30,8,9],"0x7f":1,reopen:[4,23],"long":[11,1,17,7,30,13,20,31],open:[14,6,17,12,2,19,16,18,4,30,29,21,25,31,32,23,8,9],predefin:1,size:[0,1,17,18,19,27,13,4,32,30,9],given:[24,9,18,27,13,4,32,17],breviti:[31,32],workaround:30,paramt:17,collectionnam:[9,18,16,14,5,21,32],conveni:[0,27,13],subtype_md5:24,especi:31,copi:2,specifi:[24,0,9,18,19,4,31,32,23,17],test_arrai:17,keepgo:[30,18],than:[0,17,12,18,2,19,27,13,30,32,23],png:[19,4],tedeh:30,were:[17,12],posit:[24,19,27,13,4,32],pre:[14,1,9,18],sai:32,ani:[0,9,12,31,32,17],simple_rename_collection_2:9,bitwis:[31,27,13],alias:0,destroi:[29,6,21],note:[27,13,17,9],take:[0,1,2,30,31,32],createfromhexstr:[0,20,30,7],begin:[0,4],sure:[32,17],normal:17,buffer:[24,0,1,17,12,19,16,18,4,30,25,32,23,9],clearer:30,getyear:18,renam:[9,18,16,21,31,8],byte_valu:24,later:[32,9,18],indexbound:[9,18],test_gs_read_stream:4,runtim:30,parseint:18,axi:18,show:[24,6,9,18,29,4,1,25,31,17],atom:[31,30,18],objectid3:7,objectid2:7,concurr:30,corner:30,onli:[0,14,17,12,2,30,18,4,5,31,32,23,9],slow:[30,14,9,18],dice:31,setprofilinginfo:14,activ:30,written:[24,18,27,13,4,32],analyt:31,overwritten:32,min_valu:[27,13],variou:[14,18],get:[11,14,6,17,12,19,16,18,32,4,5,26,29,30,21,25,31,7,23,8,9],secondari:[2,9,17,30,18],ssl:30,cannot:[9,18,27,13,31,17],shiftrightunsign:[20,13,27],geo:18,nolock:[30,9],doabl:0,seldom:30,yield:[16,18,9,30,12],isarrai:1,where:[24,0,1,9,12,2,19,16,18,4,5,31,32,30],highbit:[27,13],desced:17,wiki:31,testcas:30,infinit:[27,13,30],detect:2,heckmann:30,fs_chunk:32,integration_tests_2:9,wayt:18,enough:17,between:[31,30,9,23],"import":[31,32],across:[30,23,18],spars:[5,9,18],test_group:18,come:[19,27,13,18],simple_find_and_modify_operations_:18,region:18,gwt:[27,13],tutori:[11,32],mani:[31,17],fromnumb:[20,13,27],reindex:[30,9,21,18],iscap:[30,21,18],db_option:23,period:[0,16],pop:31,createcreateindexcommand:30,fs_file:32,lessthan:[20,13,27],reaperinterv:[30,9,23],cursor_information_collect:9,cursorinst:17,coupl:[24,31,18],aciev:0,rebuilt:[9,18],derefer:[30,9,21],lowbit:[27,13],geonear:[30,21,18],"1mb":32,those:[27,13],"case":[17,18,27,13,5,31,32,30],myself:31,bson_seri:30,tostr:[24,25,7,27,13,4,20,18,32],trick:32,invok:32,idhex:0,firstext:14,simple_sort_collect:17,advantag:31,eras:[19,16],ascii:[2,24,30,23],acess:9,develop:31,author:[0,19,12],same:[0,17,18,27,13,4,5,7,30,9],binari:[24,0,14,6,17,11,19,16,12,4,29,20,1,18,25,31,7,30,9],document:[0,14,1,17,11,2,19,16,12,4,29,5,30,6,18,31,32,23,9],createpk:23,exhaust:17,finish:[32,18],closest:[27,13,18],utf8:[2,31,30,4,23],nest:[0,5],oid:3,driver:[0,12,2,11,16,26,30,21,31,32,23,8],gotend:4,improv:30,defo:0,bson_data_boolean:1,crud:[11,31,26],without:[1,9,27,13,23,30,16],model:18,dereferenc:9,upsert:[18,12],ourexamplefiletowrit:4,execut:[9,12,30,14,4,18,31,17],rest:[30,18],hint:[17,18],db_connector:[16,23],except:[31,30,4,12],littl:31,blog:[0,16],default_chunk_s:4,haystack:18,found2:4,around:[31,30],read:[24,6,17,18,2,19,30,4,20,21,31,32,8,9],grid:[24,11,25,30,21,32],spank:30,world:[6,9,18,12,4,1,32,25],lasterror:[30,9,21],reap:30,mod:[0,27,13],saniti:30,poolsiz:[6,9,18,30,14,4,29,25,31,23,17],integ:[0,1,27,13,31,30],server:[24,14,1,17,12,2,29,16,18,4,6,32,30,25,31,7,23,8,9],either:[19,30,32,31],output:[0,18],greaterthanorequ:[20,13,27],manag:[19,30,31],bson_binary_subtype_byte_arrai:[24,1],eventloop:32,"_bsontyp":30,intact:12,generationtim:7,setnodelai:30,slice:31,writedata:32,node_ev:30,confirm:31,legal:18,evolv:31,profilinginfo:[14,21],bson_data_binari:1,broken:30,aquir:9,bson_binary_subtype_default:[24,30,1],regexp:[31,30,1],"throw":[31,30,32,12],pointer_to_collect:0,firstnam:[0,5],numbit:[27,13],bson_data_code_w_scop:1,gump:18,act:32,luck:32,readstream:[11,6,17,21],addus:[30,14,9,21],test_collections_info:9,your:[2,31,32,4,18],loc:18,log:[0,1,17,18,19,16,12,14,30,31,32,23],hex:[0,25,4,7],overwrit:[14,4],errormessag:30,strict:[16,30,9,23,18],interfac:[6,17,30,29,31,25],low:[31,27,13,32],lot:[17,18,30,5,29,31,32],tupl:5,shamelessli:31,replsetsrv:2,faster:[5,30],pull:[31,30,14],dirti:31,possibl:[0,9,12,30,18,5,31],"default":[24,0,1,17,12,2,19,16,18,4,5,32,30,31,7,23,9],remove_subset_of_documents_saf:18,dropdatabas:[14,9,21,23],bson_data_min_kei:1,expect:[0,23],gone:[25,9,4,18],creat:[24,0,14,1,17,18,2,19,16,7,4,29,5,6,30,25,31,32,23,8,9],certain:[5,31],intro:31,file:[6,25,19,30,4,32,8,9],calculateobjects:[20,1],again:[4,17],field:[0,17,12,30,18,5,31,8,9],valid:[24,1,17,7,16,14,9],longlib:13,you:[0,1,17,12,2,19,16,18,5,30,31,32,23,9],pefrom:18,sequenc:30,symbol:[11,1,28,30,20,31],opt_radix:[27,13],pool:[30,9,23],reduc:[27,13,30,18],lessthanorequ:[20,13,27],directori:30,descript:[24,9,1,4,17],tricki:31,potenti:30,alright:31,cpu:[30,32],unset:31,represent:[10,24,25,7,3,13,4,28,15,27],all:[0,14,1,17,12,2,19,16,18,4,5,30,31,32,23,9],forget:31,numberupd:18,dollar:16,simple_rename_collect:9,follow:[0,17,12,2,4,5,31,32],fetchsiz:17,disk:[32,6,4,18,17],subtype_default:24,nextobject:[0,17,21,9],init:17,setprofilinglevel:[14,21],evaul:9,util:30,test_rename_collect:18,failur:[31,30],veri:[31,30,32],list:[9,18,16,14,4,21,31,32,30,8],resav:18,adjust:[30,32],findandremov:[30,21,18],small:[30,32],retun:1,zero:[27,13,30],pass:[1,17,18,2,16,7,4,30,32,23,9],what:[31,16,32,17],abc:[0,4,12],xor:[20,13,27],sub:[24,18],sum:[27,13],delet:[9,18,19,30,4,21,31,32,23,8,25],version:[30,32,9,23,18],cruso:0,method:[24,0,17,18,11,16,7,4,26,30,31,32,23,25],full:[30,9,18],hash:[0,30,32,9,23],variat:31,getmorecommand:[17,18],foobar3:4,modifi:[31,18,8,12],valu:[0,1,16,4,5,7,8,9,12,13,14,15,30,17,18,19,20,23,24,28,27,31,32],isodd:[20,13,27],ahead:[31,32,18],showdiskloc:[30,17,18],amount:[31,27,13,9],pick:[31,30,32,9],narrow:18,evalfunct:1,via:31,shorthand:12,c_1:18,deprec:9,default_root_collect:4,establish:[6,9,18,30,14,4,29,25,17],select:[18,16,12,23,30,8],test_collection_is_cap:18,distinct:[30,21,18],regist:4,two:[0,9,12,2,19,16,13,4,5,32,31,7,27],coverag:30,bson_binary_subtype_user_defin:[24,1],taken:31,minor:30,more:[0,6,17,12,2,27,13,4,29,18,31,32,30,9],flag:18,stick:31,particular:31,cach:1,none:2,outlin:[31,32],histori:9,remain:[32,4],scan:[17,18],share:[30,9,8,23],shard:19,accept:[30,18],simple_document_insert_collection_no_saf:18,default_url:9,robinson:0,cours:31,newlin:4,divid:[27,13,18],rather:18,anoth:[0,4,31,7],simpl:[24,0,6,17,11,29,16,18,4,5,26,1,25,31,32,30,9],perman:9,resourc:23,variant:31,reflect:30,unlink:[19,32,4,21],associ:[32,4],keyorlist:17,github:[31,30],defineproperti:30,save_a_simple_document_modify_it_and_resave_it:18,caus:[31,30],callback:[0,14,17,12,19,16,18,4,5,30,31,32,23,9],spheric:18,doc_id:0,bson_data_oid:1,trade:32,through:[31,30,9,18],reconnect:[30,23],paramet:[0,17,12,2,19,16,14,4,5,30,31,32,23,9],style:31,mongorepli:30,call:[0,9,30,4,32,23,17],asbuff:1,dbname:[30,9],rapidli:31,bypass:31,simple_limit_skip_queri:18,might:[5,32,9,31],alter:[0,16],good:[31,32],"return":[0,6,3,4,1,7,9,10,12,13,14,15,16,17,18,19,23,24,25,28,27,29,30,31,32],timestamp:[11,1,7,27,18,20,30],more_complex_index_test:[9,18],distancemultipli:18,compound:[9,18],readlen:4,uploadd:19,instruct:2,authent:[30,14,9,21],easili:[27,13],achiev:0,skipvalu:17,found:[0,9,18,4,12],truncat:[16,32,4],hard:31,realli:31,connect:[11,6,17,18,2,30,14,4,26,29,21,25,31,32,23,8,9],barrier:30,event:[6,9,19,30,4,29,31,32,23,17],read_primari:30,pullal:31,foreground:[9,18],core2duo:30,advanc:[11,26,16,4,31,32],asc:[0,17,12],reason:4,base:[7,19,18,4,31,32],connectionopt:9,put:[24,17,18,30,4,20,21,32,25],seconddb:9,gethighbit:[20,13,27],tailabl:[30,17,18],omit:[31,3,32,30],dir:12,assign:[2,30],notifi:[31,32,18],articl:[11,32,26],lastnam:[0,5],number:[24,0,14,1,17,18,27,13,4,5,15,32,30,31,7,23,9],done:[0,6,9,18,19,30,12,14,29,31,32,23],construct:[27,13],autoclos:[19,32,6,4],create_and_drop_an_index:[9,18],miss:30,differ:[9,7,27,13,4,5,18,31,32,30,25],chunk_typ:4,script:19,interact:[31,32,4,25],least:[0,18],custompkfactori:23,settim:7,statement:[31,32,9],illeg:[25,14,9,30,18],master:2,store:[1,9,19,4,31,32,17],otherid:7,option:[24,0,14,1,17,12,2,19,3,18,4,23,5,30,21,25,31,32,16,8,9],reseterrorhistori:[9,21],native_pars:[6,9,18,14,4,29,25,23,17],getter:[4,7],pars:[30,1,18],literarili:31,std:30,kind:32,bson_data_nul:1,whenev:[9,18],remov:[14,9,18,16,12,4,5,21,31,30,8],reus:[30,1],str:[27,13],consumpt:32,luckili:[31,32],"null":[0,1,17,18,2,16,14,4,29,30,25,23,9],built:31,equival:[31,18],valueof:[20,15,28],fromcollect:9,also:[0,17,12,16,4,5,31,32,30],build:[31,30,14,32,9],validatecollect:[30,14,21],reach:[32,6],most:[0,32,31],cygwin:30,selector:[9,17,30,18],"16mb":19,filesystem:19,cover:9,part:[31,30,7],clean:[30,9],frombit:[20,13,27],find:[0,6,17,12,19,30,18,14,5,29,21,31,8,9],firewal:30,pretti:31,test_gs_weird_bug:4,numberofdocu:1,batch_document_insert_collection_saf:18,hit:[9,18],express:[0,31,19,18],fieldtoupd:31,test_map_reduce_functions_scop:18,nativ:[31,30,23],restart:[29,6],statist:[30,14,9,18],wrote:31,set:[0,14,1,17,12,2,19,16,18,4,5,32,30,31,7,23,9],see:[0,12,19,16,13,27,5,31,32,23],close:[6,9,18,19,30,14,4,29,21,25,31,32,23,8,17],my_f:4,misalign:30,someth:[4,23],altern:18,signatur:[4,17],complement:[27,13],javascript:[1,9,18,27,13,31],salzman:30,succeed:5,both:[30,18],last:[19,9,31],create_and_drop_all_index:[9,18],context:23,logout:[14,9,21],whole:[31,9,4,18],createdat:17,load:[0,30],simpli:0,jsmode:18,point:[17,18,27,13,31,32],instanti:[31,30],shutdown:30,linux:30,backend:31,faithfulli:[27,13],user_id:18,due:[31,30,25],empti:[24,0,18,4,17],strategi:[31,30],test_streamingrecords_funct:17,fire:[6,9,12,19,4,31,32,23],admindb:[14,9],imag:[19,32],understand:31,func:[1,18],look:[17,18,19,30,4,5,31,32],straight:[31,32],batch:[31,30,17,18],"while":[0,30,4,19,17],getownpropertynam:30,behavior:[0,12,27,13,31,30],error:[0,14,6,17,12,19,16,18,4,5,29,30,31,23,9],fun:32,robin:31,loop:30,test_gs_unlink:4,readi:[29,6,4,31,17],key2:0,key1:0,jpg:4,itself:17,test_deref_exampl:9,rid:30,simple_key_based_distinct_sub_query_filt:18,chase:30,decor:30,simple_document_insert_with_function_saf:18,geohaystacksearch:[30,21,18],p_db:[2,9],higher:[2,30,32,23,18],optim:[30,18],operaion:19,numberofretri:[30,9,23],iya_logo_final_bw:4,temporari:[4,18],user:[24,0,1,9,12,30,14,4,5],hello2:18,keyf:18,recreat:23,lower:[9,18],entri:[9,32,4,18],explan:[9,18],getlowbitsunsign:[20,13,27],a_1:18,shape:30,update_a_simple_document_multi:18,bson_data_timestamp:1,cur:32,keeptemp:18,appli:[0,30,17,31],input:[27,13,18],subsequ:[9,18],format:[0,9,18,12,14,17],big:[31,30,32],checksum:4,shiftright:[20,13,27],rs_name:[2,30],replsetserv:[24,14,1,17,18,2,29,30,7,4,6,25,9],success:[19,4,17],resolv:9,collect:[0,2,3,4,5,8,9,11,12,14,30,17,18,19,21,22,23,25,26,29,16,31,32],bson_data_cod:1,popular:31,bamboo:30,serverpair:30,often:[27,13],creation:[31,30,14,9,18],some:[24,0,6,17,18,19,30,4,5,25,31,32,9],back:[0,13,18,27,14,4,31],understood:31,dropallindex:[21,18],scale:[31,32,18],slaveok:[30,9,18],chunksiz:[19,32,4],retri:[31,30,9,23],larg:[0,9,18,19,31,32],intial:18,previou:[32,23],run:[11,9,12,26,2,30,18,31,32],simple_reset_error_history_col:9,step:32,simple_explain_queri:18,subtract:[20,13,27],recordquerystat:9,block:[32,9,18],plan:32,within:[27,13],simple_index_test:18,ensur:[9,18,30,5,31,32,8],chang:[18,27,13,31,32,30],test_collection_index_exist:18,bson_deseri:30,textual:[27,13],custom:[0,18,30,32,23,8],includ:[0,17,18,16,4,5,30,31,23,9],forward:4,files:4,properli:[30,4],uniquedoc:18,ascend:[0,17,5],link:[11,32,31,26],simple_count_exampl:18,line:[32,4],info:[30,14,32,9,18],concaten:[27,13,4],consist:30,caller:17,forceserverobjectid:[30,9,23],readlin:[4,21],similar:19,constant:[24,1,9,4,20,21,17],multiplecoll2:9,parser:[30,1,9,23],doesn:[0,23,12],repres:[17,28,27,13,4,15,31],isconnect:30,titl:[0,18,22,12],unidirect:17,wakup:9,nice:31,deseri:[31,20,1,17,30],jannehietamaki:30,mongodb:[0,1,2,16,4,5,6,7,8,9,11,12,14,30,17,18,19,23,24,25,29,31,32],eval:[1,9,18,30,21,17],profilinglevel:[14,21],algorithm:[2,27,13,23,30],cursorinform:9,tradeoff:32,far:4,hello:[24,6,9,18,12,4,1,31,32,25],code:[24,14,6,9,18,29,30,7,4,1,25,31,32,17],partial:[17,18],worldbuff:4,queri:[0,14,17,11,16,12,4,5,26,30,18,31,22,23,8,9],idvalu:0,replicasetcheckinterv:30,base64:[2,30,23,25],update_a_simple_document_upsert:18,send:[2,31,30,9,23],io_seek_end:4,"256k":32,sens:12,reapertimeout:[30,9,23],passiv:30,result2:25,writebuff:30,untouch:23,relev:31,gettim:[17,7],fieldorspec:[9,18],fewer:18,"try":[31,30,18,32,12],race:30,refer:[9,3,4,31,30,17],smaller:19,fortun:31,natur:31,jump:[31,32],video:32,download:31,odd:[27,13],append:[19,4,31],compat:30,index:[11,1,17,18,16,5,21,22,30,8,9],compar:[7,27,13,4,5,20],descriptor:32,access:[9,18,19,14,4,28,15,17],experiment:30,asced:17,lee:30,bson_data_int:1,batchsizevalu:17,cursor_count_collect:17,let:[6,9,18,30,4,31,32,17],filedescriptor:32,becom:31,sinc:[31,27,13,32,12],subtype_byte_arrai:24,nexttick:30,convert:[0,31],convers:[31,18],larger:[19,30,32],implement:[31,27,13,30],configur:[2,31,16,9,30],read_secondari:[2,30],app:2,api:[11,20,32,9,21],from:[24,0,14,1,17,12,2,19,16,13,4,30,32,18,25,31,7,27,8,9],batchsiz:[9,17,21,18],doubl:[11,20,15,30,31],next:[0,32,1,17,23],chr:4,sort:[0,17,12,30,18,5,21],benchmark:30,name2:0,socketopt:[2,30,23],sollect:16,account:18,retriev:[0,14,9,12,19,30,18,4,31,32,17],scalabl:19,multiple_db_inst:9,annot:32,unopen:30,fetch:[0,9,17,18,5,31,25],queryfailur:30,control:[31,30,32,23],objectid:[24,0,14,6,17,11,29,3,18,4,20,1,32,30,25,31,7,23,9],process:[27,13,17,30],lock:[30,32,9],username_:5,high:[9,18,27,13,31,30],tag:[30,18],serial:[20,1,9,30,18],pingresult:14,integration_test_:[2,9],instead:[0,9,18,2,30,5,32,23,17],npm:[31,30],await:9,formattedorderclaus:30,originaldata:25,alloc:[30,1,9],seriou:30,remove_all_documents_no_saf:18,correspond:[5,16,13,27],element:[0,4,31,17],issu:[31,30,18],writ:4,allow:[9,18,16,14,30,31,32,23,17],subtyp:24,deoptim:30,doc2:31,doc3:31,move:[19,30,4,31],doc4:31,autoindexid:9,server_opt:23,effici:[31,32,18],bunch:[30,9,18],perfect:31,crash:30,greater:[0,27,13,17],handl:[17,18,27,13,4,31,32,30],databs:[19,16,23],auth:[30,9],renamecollect:[9,21],precess:31,numberofremoveddoc:18,writefil:[19,32,4,21],convin:0,anyth:30,edit:[32,4],deserializeddoc:1,exampledb:[31,32],subset:[17,18],opensync:4,chunk:[19,30,32,4],bson_binary_subtype_uuid:[24,1],default_content_typ:4,pushal:[31,30],our:[31,32,4,17],special:[31,27,13,32,17],out:[11,9,26,2,30,18,31,32,23],variabl:[31,30,18],trickier:[0,31],categori:32,suitabl:32,leverag:31,ref:30,math:7,jessica:[0,12],insid:[19,0,32,8,5],dropcollect:[16,9,21],manipul:18,releas:30,princess:18,unwant:0,could:[31,30],shiftleft:[20,13,27],keep:[19,30,9,31,18],length:[24,14,1,9,7,19,18,4,20,32,17],lte:0,primarki:0,minkei:[30,1],debugmessag:30,iszero:[20,13,27],should_correctly_rewind_and_restart_cursor:17,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:9,prioriti:30,start:[24,0,1,17,18,2,16,4,31,32],system:[16,32,4],messag:[12,9,18,30,14,4],timestamplib:27,bson_data_max_kei:1,termin:4,"final":[31,30,18],deconstruct:32,test_gs_getc_fil:4,exactli:16,gridstorew:4,bson_data_object:1,replset:[2,9],mongoserv:[16,23],tocollect:9,charact:[24,30,7,4,18],test_gs_puts_and_readlin:4,result:[0,14,6,17,12,19,27,13,4,30,32,18,25,31,7,23,9],counter:[23,18],terribl:30,corrupt:14,have:[0,9,18,2,16,4,5,31,32],tabl:[31,16],need:[0,1,9,12,19,16,13,27,5,31,32,23],turn:[0,14,9],buildinfo:[14,21],min:[9,17,30,18],mix:[0,5],andrewjston:30,milli:14,test_other_drop:18,orgiin:4,singl:[24,0,9,18,19,30,12,4],fileid:[32,6,4],statsync:4,whi:0,serverconfig:[30,9,23],why:31,overwriten:4,url:9,integration_tests_to_drop:9,request:[30,17],face:31,test_collect:12,snapshot:[17,18],determin:[31,17],streamrecord:[31,30,17,21],fact:[31,12],text:[27,13,32,4],serializefunct:[30,1,9,18],verbos:18,nagl:[2,30,23],anywai:[9,18],setter:[4,7],locat:[31,9,18,4,17],should:[0,14,9,18,16,13,32,25,7,27,17],test_cursorstream_paus:29,local:[3,9],doc1:31,ritch:30,gettimestamp:[20,30,7],donewithwrit:32,enabl:[30,9,23],simple_batch_size_collect:17,tohexstr:[0,20,30,7],integr:[31,32],contain:[24,1,17,18,2,16,4,31,32,9],grab:[14,17,9],modulo:[0,20,13,27],packet:30,fromint:[20,13,27],statu:[31,30],wire:[31,30],correctli:[31,30,18],state:[31,17,23],crude:31,world2:18,kei:[0,1,17,18,30,4,5,31,32,23,8,9],buckets:18,simple_queri:18,isol:30,job:18,entir:[32,4,17],auto_reconnect:[6,9,18,2,14,4,29,25,31,32,23,17],crc32:1,addit:[0,1,9,18,27,13,32,17],admin:[11,9,18,30,14,21],equal:[24,0,14,6,17,18,29,27,13,4,20,1,25,31,7,9],etc:[0,23,18],instanc:[14,1,9,18,2,30,7,4,25,31,32,23,17],greaterthan:[20,13,27],subtype_funct:24,comment:[30,17,18],toint:[20,13,27],removealllisten:30,save_a_simple_docu:18,addition:16,compon:30,json:[11,20,13,27,31],treat:[0,30,17],pkfactori:[9,18],immedi:12,bit:[0,1,19,27,13,31,32,30],assert:[24,14,6,9,18,29,7,4,1,25,17],present:[5,16],replic:[2,9],multi:[18,12],plain:30,cursor:[0,6,17,18,11,30,14,29,21,31,8,9],defin:[24,0,1,9,18,12,27,13,4,30,31,23],setreadprefer:30,bson_data_arrai:1,layer:31,helper:30,site:2,tojson:[20,13,27,30],getc:[4,21],cross:30,member:[2,30],world_no_saf:18,probabl:0,difficult:32,incorrect:30,slave:2,hostnam:23,keepal:[2,30,23],upon:17,retriv:14,serializewithbufferandindex:[20,1],chunk_siz:[19,4],off:[9,2,16,14,4,30,31,23,17],center:18,nevertheless:23,well:[0,30,32,31],exampl:[24,0,14,6,17,11,19,16,12,4,29,5,26,1,32,18,25,31,7,23,9],command:[9,18,30,14,4,21,31,23,17],simple_geo_near_command:18,choos:[31,18],latest:31,distanc:18,paus:[29,6,21],less:[31,27,13],"boolean":[6,17,18,19,27,13,4,5,1,32,9],additon:5,tcp:31,indexinform:[9,18,30,5,21,8,17],web:31,seekloc:[32,4],add:[14,9,7,27,13,5,20,18,31],cleanup:[30,32],logger:30,match:[0,14,18,12,16,13,31,27,8],simple_key_based_distinct:18,piec:[31,27,13,32],know:16,password:[30,14,9],recurs:[13,27,1,4],isclos:[17,21],desc:[0,17],bson_data_str:1,insert:[0,14,1,17,11,16,12,4,21,30,29,18,31,22,23,8,9],resid:31,like:[0,9,18,27,13,5,32,17],fsync:[9,18],chunkcollect:[4,21],necessari:0,"0xff":1,async:31,page:[0,31,11],dispatch:31,suppli:[30,32],gridf:[11,25,26,19,30,4,32],flush:[32,6,4],proper:30,fileinfo:32,librari:[30,32],lead:[27,13,30],leak:30,avoid:[5,30,14,31],octet:4,thank:30,leav:[30,12],mode:[9,18,19,16,4,30,32,23,17],slight:31,journal:9,usag:[24,11,1,25,2,19,16,4,30,31,32,23,8],collection_nam:16,host:23,although:32,offset:[24,32,4],java:[27,13],simpler:[31,30,17,18],about:[9,12,5,31,32,23,17],actual:[0,32,9,31,23],socket:[9,2,30,31,23,8],http:[31,30],dbinstanc:32,notequ:[20,13,27],constructor:[1,2,3,4,6,7,9,10,13,14,15,30,17,18,20,21,23,24,25,28,27,29],fals:[0,14,6,17,12,19,16,18,4,29,1,30,25,32,23,9],disabl:[2,30,23],own:[30,4],automat:[6,17,2,19,30,31,32,23,9],dataset:[0,31],bson:[0,6,3,4,1,7,9,10,11,12,14,15,30,17,18,20,23,24,25,28,29,16],merg:[30,18],val:18,pictur:32,transfer:9,mykei:31,trigger:[6,17,18,30,4,29],concat:0,"var":[24,0,14,1,17,12,2,19,16,18,4,29,6,32,25,31,7,23,9],fsname:25,"function":[24,0,14,1,17,12,2,19,16,13,4,27,30,6,32,18,25,31,29,23,9],brand:30,waitforconnect:30,overflow:[27,13],inlin:18,bug:[30,32],count:[0,17,12,16,18,4,21,30,8,9],made:32,wise:0,whether:[27,13],wish:[24,1,9,18,14,4,32],displai:9,asynchron:[2,31],record:[0,17,12,19,16,18,4,5,31,23,8,9],below:[31,27,13,9,12],limit:[0,17,18,19,21,31],otherwis:[1,17,27,13,4,31,32],problem:[30,14],evalu:[1,9],"int":[27,13],dure:[31,30,9,18],year:0,filenam:[19,30,32,4],replica:[2,30,9],retrymilisecond:[30,9,23],inc:[31,30],tick:30,detail:[5,17,19],deepequ:[25,9,18,4,17],other:[0,26,2,11,27,13,4,31,32,30],bool:7,futur:[31,30,9],branch:30,stat:[30,21,18],findon:[0,9,18,30,21,31,8],"class":[10,24,14,6,17,18,29,3,13,4,28,1,15,32,30,25,31,7,27,9],stai:18,eof:[19,32,4,21],integration_test:[6,9,18,14,4,29,25,17],kaij:30},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","Indexes","ReadStream()","ObjectID()","Node.JS MongoDB Driver Manual Contents","Db()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Long()","Admin()","Double()","Collections","Cursor()","Collection()","GridStore","Binary JSON API","Driver API","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Symbol()","CursorStream()","Changelog","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/db","api-bson-generated/maxkey","index","markdown-docs/insert","api-bson-generated/long","api-generated/admin","api-bson-generated/double","markdown-docs/collections","api-generated/cursor","api-generated/collection","markdown-docs/gridfs","api-bson-generated/index","api-generated/index","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","api-bson-generated/symbol","api-generated/cursorstream","changelog/changelog","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file From fc1680a06426bb735386858f926640bb32219f69 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Mon, 13 Feb 2012 15:28:23 +0100 Subject: [PATCH 08/56] Updated docs --- .buildinfo | 2 +- _sources/api-bson-generated/index.txt | 1 + _sources/api-bson-generated/minkey.txt | 17 + _sources/api-bson-generated/objectid.txt | 65 ++++ _sources/api-generated/db.txt | 46 ++- _sources/changelog/changelog.txt | 8 + _sources/contents.txt | 24 +- api-articles/index.html | 24 +- api-articles/nodekoarticle1.html | 24 +- api-articles/nodekoarticle2.html | 24 +- api-bson-generated/binary.html | 57 +++- api-bson-generated/bson.html | 62 +++- api-bson-generated/code.html | 51 ++- api-bson-generated/double.html | 52 +++- api-bson-generated/index.html | 29 +- api-bson-generated/long.html | 86 +++++- api-bson-generated/maxkey.html | 51 ++- api-bson-generated/minkey.html | 148 +++++++++ api-bson-generated/objectid.html | 125 +++++++- api-bson-generated/symbol.html | 42 ++- api-bson-generated/timestamp.html | 86 +++++- api-generated/admin.html | 63 +++- api-generated/collection.html | 78 ++++- api-generated/cursor.html | 66 +++- api-generated/cursorstream.html | 54 +++- api-generated/db.html | 125 +++++++- api-generated/grid.html | 54 +++- api-generated/gridstore.html | 74 ++++- api-generated/index.html | 24 +- api-generated/readstream.html | 54 +++- changelog/changelog.html | 353 +++++++++++---------- contents.html | 377 ++++++++++++++++++----- genindex.html | 48 ++- index.html | 25 +- markdown-docs/collections.html | 60 ++-- markdown-docs/database.html | 57 ++-- markdown-docs/gridfs.html | 49 ++- markdown-docs/index.html | 24 +- markdown-docs/indexes.html | 55 ++-- markdown-docs/insert.html | 54 ++-- markdown-docs/queries.html | 58 ++-- markdown-docs/replicaset.html | 54 ++-- objects.inv | Bin 1201 -> 1218 bytes search.html | 24 +- searchindex.js | 2 +- 45 files changed, 2120 insertions(+), 736 deletions(-) create mode 100644 _sources/api-bson-generated/minkey.txt create mode 100644 api-bson-generated/minkey.html diff --git a/.buildinfo b/.buildinfo index 44f3981af55..c99c1eba670 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 435b277086116c382570a258c5eb5982 +config: c17150b5838a3e308c3c7bec6e59b487 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/_sources/api-bson-generated/index.txt b/_sources/api-bson-generated/index.txt index dae82f1f4a5..264a61efc7d 100644 --- a/_sources/api-bson-generated/index.txt +++ b/_sources/api-bson-generated/index.txt @@ -9,6 +9,7 @@ Binary JSON API binary code double + minkey maxkey symbol timestamp diff --git a/_sources/api-bson-generated/minkey.txt b/_sources/api-bson-generated/minkey.txt new file mode 100644 index 00000000000..68fd1efdba2 --- /dev/null +++ b/_sources/api-bson-generated/minkey.txt @@ -0,0 +1,17 @@ +======== +MinKey() +======== + +------------------ +Constructor +------------------ + + +A class representation of the BSON MinKey type. + + + .. js:class:: MinKey() + + :returns: minkey + + diff --git a/_sources/api-bson-generated/objectid.txt b/_sources/api-bson-generated/objectid.txt index 1189d4d59b1..36b1cb228b9 100644 --- a/_sources/api-bson-generated/objectid.txt +++ b/_sources/api-bson-generated/objectid.txt @@ -182,6 +182,41 @@ Returns the generation time in seconds that this ID was generated. assert.equal(timestampDate.toString(), objectId.getTimestamp().toString()); +----------------------- +ObjectID.createFromTime +----------------------- + + +Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. + +.. js:function:: ObjectID.createFromTime(time) + + :param number time: an integer number representing a number of seconds. + :returns: objectid return the created ObjectID + + +**Examples** + + + + Show the usage of the Objectid createFromTime function + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var objectId = ObjectID.createFromTime(1); + assert.equal("000000010000000000000000", objectId.toHexString()); + + ---------------------------- ObjectID.createFromHexString ---------------------------- @@ -194,3 +229,33 @@ Creates an ObjectID from a hex string representation of an ObjectID. :param string hexString: create a ObjectID from a passed in 24 byte hexstring. :returns: objectid return the created ObjectID + +**Examples** + + + + Convert a ObjectID into a hex string representation and then back to an ObjectID + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + // Create a new ObjectID + var objectId = new ObjectID(); + // Convert the object id to a hex string + var originalHex = objectId.toHexString(); + // Create a new ObjectID using the createFromHexString function + var newObjectId = new ObjectID.createFromHexString(originalHex) + // Convert the new ObjectID back into a hex string using the toHexString function + var newHex = newObjectId.toHexString(); + // Compare the two hex strings + assert.equal(originalHex, newHex); + diff --git a/_sources/api-generated/db.txt b/_sources/api-generated/db.txt index bd849616b81..9a08020dc18 100644 --- a/_sources/api-generated/db.txt +++ b/_sources/api-generated/db.txt @@ -187,8 +187,9 @@ close Close the current db connection, including all the child db instances. Emits close event if no callback is provided. -.. js:function:: close([callback]) +.. js:function:: close([forceClose][, callback]) + :param boolean [forceClose]: connection can never be reused. :param function [callback]: returns the results. :returns: null @@ -197,6 +198,47 @@ Close the current db connection, including all the child db instances. Emits clo + An example that shows how to force close a db connection so it cannot be reused. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + + // Fetch a collection + db.collection('shouldCorrectlyFailOnRetryDueToAppCloseOfDb', function(err, collection) { + + // Insert a document + collection.insert({a:1}, {safe:true}, function(err, result) { + assert.equal(null, err); + + // Force close the connection + db.close(true, function(err, result) { + + // Attemp to insert should fail now with correct message 'db closed by application' + collection.insert({a:2}, {safe:true}, function(err, result) { + assert.equal('db closed by application', err.message); + }); + }); + }); + }); + }); + + + An example of a simple single server db connection and close function .. code-block:: javascript @@ -1971,7 +2013,7 @@ www.mongodb.org/display/DOCS/Connections assert = require('assert'); // Connect to the server - Db.connect('mongodb://localhost:27017/integration_tests', function(err, db) { + Db.connect('mongodb://localhost:27017/integration_tests' + (useSSL == true ? '?ssl=true' : ''), function(err, db) { assert.equal(null, err); db.close(); diff --git a/_sources/changelog/changelog.txt b/_sources/changelog/changelog.txt index 8cbff0f3712..145adc2ec29 100644 --- a/_sources/changelog/changelog.txt +++ b/_sources/changelog/changelog.txt @@ -2,6 +2,14 @@ Changelog ========= +0.9.9 2012-02-13 +---------------- +* Added createFromTime method on ObjectID to allow for queries against _id more easily using the timestamp. +* Db.close(true) now makes connection unusable as it's been force closed by app. +* Fixed mapReduce and group functions to correctly send slaveOk on queries. +* Fixes for find method to correctly work with find(query, fields, callback) (Issue #506). +* A fix for connection error handling when using the SSL on MongoDB. + 0.9.8-7 2012-02-06 ------------------ * Simplified findOne to use the find command instead of the custom code (Issue #498). diff --git a/_sources/contents.txt b/_sources/contents.txt index a6d64bb56ce..52a2786da8e 100644 --- a/_sources/contents.txt +++ b/_sources/contents.txt @@ -5,12 +5,22 @@ Node.JS MongoDB Driver Manual Contents .. toctree:: :maxdepth: 3 - markdown-docs/database - markdown-docs/replicaset - markdown-docs/collections - markdown-docs/insert - markdown-docs/queries - markdown-docs/indexes - markdown-docs/gridfs + api-generated/db + api-generated/collection + api-generated/admin + api-generated/cursor + api-generated/cursorstream + api-generated/grid + api-generated/gridstore + api-generated/readstream + api-bson-generated/bson + api-bson-generated/objectid + api-bson-generated/binary + api-bson-generated/code + api-bson-generated/double + api-bson-generated/long + api-bson-generated/timestamp + api-bson-generated/maxkey + api-bson-generated/symbol - :ref:`genindex` diff --git a/api-articles/index.html b/api-articles/index.html index f93d4090605..fa85562d9e6 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -85,13 +85,23 @@

    Page Contents

    Core Documentation

    diff --git a/api-bson-generated/bson.html b/api-bson-generated/bson.html index 9e2c5613ea5..3f7966295f1 100644 --- a/api-bson-generated/bson.html +++ b/api-bson-generated/bson.html @@ -24,7 +24,9 @@ - + + + @@ -849,14 +857,38 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    ReadStream()

    +

    Next page

    +

    ObjectID()

    @@ -887,6 +925,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-bson-generated/code.html b/api-bson-generated/code.html index 86a9600e5c3..2effbd47734 100644 --- a/api-bson-generated/code.html +++ b/api-bson-generated/code.html @@ -24,7 +24,9 @@ - + + + @@ -92,14 +100,27 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Binary()

    +

    Next page

    +

    Double()

    @@ -130,6 +157,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-bson-generated/double.html b/api-bson-generated/double.html index 32b18a2d23c..fe14a686965 100644 --- a/api-bson-generated/double.html +++ b/api-bson-generated/double.html @@ -24,7 +24,9 @@ - + + + @@ -108,14 +116,28 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    DBRef()

    +

    Next page

    +

    Long()

    @@ -146,6 +174,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-bson-generated/index.html b/api-bson-generated/index.html index 680bb3fbe3c..7d5b4c58b48 100644 --- a/api-bson-generated/index.html +++ b/api-bson-generated/index.html @@ -52,6 +52,7 @@

    Binary JSON APItoHexString
  • equals
  • getTimestamp
  • +
  • ObjectID.createFromTime
  • ObjectID.createFromHexString
  • @@ -74,6 +75,10 @@

    Binary JSON APIvalueOf +
  • MinKey() +
  • MaxKey() @@ -199,13 +204,23 @@

    Page Contents

    Core Documentation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • @@ -875,14 +883,62 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Double()

    +

    Next page

    +

    Timestamp()

    @@ -913,6 +975,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-bson-generated/maxkey.html b/api-bson-generated/maxkey.html index 1bbfa1851ee..4c58a5f30ae 100644 --- a/api-bson-generated/maxkey.html +++ b/api-bson-generated/maxkey.html @@ -24,7 +24,9 @@ - + + + @@ -84,14 +92,27 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Timestamp()

    +

    Next page

    +

    Symbol()

    @@ -122,6 +149,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-bson-generated/minkey.html b/api-bson-generated/minkey.html new file mode 100644 index 00000000000..ecdd9c5708e --- /dev/null +++ b/api-bson-generated/minkey.html @@ -0,0 +1,148 @@ + + + + + + + + + MinKey() — MongoDB Node.JS Driver 0.9.8.7 documentation + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +

    MinKey()

    +
    +

    Constructor

    +

    A class representation of the BSON MinKey type.

    +
    +
    +
    +class MinKey()
    +
    +++ + + + +
    Returns:minkey
    +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    + +

    Page Contents

    + + + +

    Core Documentation

    + + + + +

    This Page

    + +
    +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/api-bson-generated/objectid.html b/api-bson-generated/objectid.html index 4714bd18245..5bc41a3b43b 100644 --- a/api-bson-generated/objectid.html +++ b/api-bson-generated/objectid.html @@ -24,7 +24,9 @@ - + + + @@ -237,6 +245,47 @@

    getTimestamp +

    ObjectID.createFromTime

    +

    Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.

    +
    +
    +ObjectID.createFromTime(time)
    +
    +++ + + + + + +
    Arguments:
      +
    • time (number) – an integer number representing a number of seconds.
    • +
    +
    Returns:

    objectid return the created ObjectID

    +
    +
    + +

    Examples

    +
    +

    Show the usage of the Objectid createFromTime function

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var objectId = ObjectID.createFromTime(1);
    +assert.equal("000000010000000000000000", objectId.toHexString());
    +
    +
    +
    + + @@ -279,6 +354,7 @@

    Page Contents

  • toHexString
  • equals
  • getTimestamp
  • +
  • ObjectID.createFromTime
  • ObjectID.createFromHexString
  • @@ -286,14 +362,33 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    BSON()

    +

    Next page

    +

    Binary()

    @@ -324,6 +425,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-bson-generated/symbol.html b/api-bson-generated/symbol.html index 8e8167a8cd8..f081bf69ac6 100644 --- a/api-bson-generated/symbol.html +++ b/api-bson-generated/symbol.html @@ -24,7 +24,8 @@ - + + @@ -108,14 +112,28 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    MaxKey()

    @@ -146,6 +167,9 @@

    Navigation

  • index
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-bson-generated/timestamp.html b/api-bson-generated/timestamp.html index 60844325d0a..1fe1a2a7930 100644 --- a/api-bson-generated/timestamp.html +++ b/api-bson-generated/timestamp.html @@ -24,7 +24,9 @@ - + + + @@ -875,14 +883,62 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Long()

    +

    Next page

    +

    MaxKey()

    @@ -913,6 +975,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-generated/admin.html b/api-generated/admin.html index 7c69484ea87..47b09f5dec6 100644 --- a/api-generated/admin.html +++ b/api-generated/admin.html @@ -24,7 +24,9 @@ - + + + @@ -1023,14 +1031,39 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Collection()

    +

    Next page

    +

    Cursor()

    @@ -1061,6 +1100,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-generated/collection.html b/api-generated/collection.html index 4c560344d94..4657c3dd8bd 100644 --- a/api-generated/collection.html +++ b/api-generated/collection.html @@ -24,7 +24,9 @@ - + + + @@ -2862,14 +2870,54 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Db()

    +

    Next page

    +

    Admin()

    @@ -2900,6 +2954,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-generated/cursor.html b/api-generated/cursor.html index bd8efd8ddf2..a8cbeaef5ff 100644 --- a/api-generated/cursor.html +++ b/api-generated/cursor.html @@ -24,7 +24,9 @@ - + + + @@ -1115,14 +1123,42 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Admin()

    +

    Next page

    +

    CursorStream()

    @@ -1153,6 +1195,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-generated/cursorstream.html b/api-generated/cursorstream.html index ceecd3c6ea4..ab2eff2ca8f 100644 --- a/api-generated/cursorstream.html +++ b/api-generated/cursorstream.html @@ -24,7 +24,9 @@ - + + + @@ -306,14 +314,30 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Cursor()

    +

    Next page

    +

    Grid()

    @@ -344,6 +374,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-generated/db.html b/api-generated/db.html index f2c77bdd611..489a0d98649 100644 --- a/api-generated/db.html +++ b/api-generated/db.html @@ -24,7 +24,9 @@ - + + + @@ -259,12 +267,13 @@

    close

    Close the current db connection, including all the child db instances. Emits close event if no callback is provided.

    -close([callback])
    +close([forceClose][, callback])
    @@ -278,7 +287,44 @@

    close

    Examples

    -

    An example of a simple single server db connection and close function

    +

    An example that shows how to force close a db connection so it cannot be reused.

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 1}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +
    +  // Fetch a collection
    +  db.collection('shouldCorrectlyFailOnRetryDueToAppCloseOfDb', function(err, collection) {
    +
    +    // Insert a document
    +    collection.insert({a:1}, {safe:true}, function(err, result) {
    +      assert.equal(null, err);
    +
    +      // Force close the connection
    +      db.close(true, function(err, result) {
    +
    +        // Attemp to insert should fail now with correct message 'db closed by application'
    +        collection.insert({a:2}, {safe:true}, function(err, result) {
    +          assert.equal('db closed by application', err.message);
    +        });
    +      });
    +    });
    +  });
    +});
    +
    +
    +

    An example of a simple single server db connection and close function

    @@ -2317,6 +2412,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-generated/grid.html b/api-generated/grid.html index d3cec174349..9f14235e081 100644 --- a/api-generated/grid.html +++ b/api-generated/grid.html @@ -24,7 +24,9 @@ - + + + @@ -282,14 +290,30 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    CursorStream()

    +

    Next page

    +

    GridStore()

    @@ -320,6 +350,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-generated/gridstore.html b/api-generated/gridstore.html index 586d4cf50fa..ffc88c6ef67 100644 --- a/api-generated/gridstore.html +++ b/api-generated/gridstore.html @@ -24,7 +24,9 @@ - + + + @@ -1986,14 +1994,50 @@

    Page Contents

    Core Documentation

    - +

    Previous page

    +

    Grid()

    +

    Next page

    +

    ReadStream()

    @@ -2024,6 +2074,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/api-generated/index.html b/api-generated/index.html index 5448cc51c4a..a609c222b54 100644 --- a/api-generated/index.html +++ b/api-generated/index.html @@ -217,13 +217,23 @@

    Page Contents

    Core Documentation

    @@ -352,6 +382,12 @@

    Navigation

  • index
  • +
  • + next |
  • +
  • + previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/changelog/changelog.html b/changelog/changelog.html index 00374e7e370..bbf4fda1543 100644 --- a/changelog/changelog.html +++ b/changelog/changelog.html @@ -45,20 +45,30 @@

    Navigation

    Changelog

    -

    0.9.8-7 2012-02-06

    +

    0.9.9 2012-02-13

    +
      +
    • Added createFromTime method on ObjectID to allow for queries against _id more easily using the timestamp.
    • +
    • Db.close(true) now makes connection unusable as it’s been force closed by app.
    • +
    • Fixed mapReduce and group functions to correctly send slaveOk on queries.
    • +
    • Fixes for find method to correctly work with find(query, fields, callback) (Issue #506).
    • +
    • A fix for connection error handling when using the SSL on MongoDB.
    • +
    +
    +
    +

    0.9.8-7 2012-02-06

    • Simplified findOne to use the find command instead of the custom code (Issue #498).
    • BSON JS parser not also checks for _bsonType variable in case BSON object is in weird scope (Issue #495).
    -
    -

    0.9.8-6 2012-02-04

    +
    +

    0.9.8-6 2012-02-04

    • Removed the check for replicaset change code as it will never work with node.js.
    -
    -

    0.9.8-5 2012-02-02

    +
    +

    0.9.8-5 2012-02-02

    @@ -306,7 +306,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -316,7 +316,7 @@

    E

    @@ -306,7 +305,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -316,7 +315,7 @@

    E

    - + @@ -259,7 +258,7 @@

    Object Document Modeling Libraries

    - +
    Arguments:
      +
    • [forceClose] (boolean) – connection can never be reused.
    • [callback] (function) – returns the results.
    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -454,7 +454,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -560,6 +560,10 @@

    M

    +
    MinKey() (class) +
    + +
    modulo() (built-in function), [1]
    @@ -606,12 +610,16 @@

    O

    -
    open() (built-in function), [1] +
    ObjectID.createFromTime() (ObjectID method)
    +
    open() (built-in function), [1] +
    + +
    options() (built-in function)
    @@ -674,7 +682,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -911,13 +919,23 @@

    Page Contents

    Core Documentation

    @@ -304,12 +288,6 @@

    Navigation

  • index
  • -
  • - next |
  • -
  • - previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/markdown-docs/database.html b/markdown-docs/database.html index 84a96d1d677..5d1656031f7 100644 --- a/markdown-docs/database.html +++ b/markdown-docs/database.html @@ -24,9 +24,7 @@ - - - + @@ -238,23 +230,24 @@

    Page Contents

    Core Documentation

    - -

    Previous page

    -

    Node.JS MongoDB Driver Manual Contents

    -

    Next page

    -

    Replicasets

    @@ -291,12 +278,6 @@

    Navigation

  • index
  • -
  • - next |
  • -
  • - previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/markdown-docs/gridfs.html b/markdown-docs/gridfs.html index c1e30815017..d93bd45b1c1 100644 --- a/markdown-docs/gridfs.html +++ b/markdown-docs/gridfs.html @@ -24,8 +24,7 @@ - - + @@ -266,25 +262,24 @@

    Page Contents

    Core Documentation

    - -

    Previous page

    -

    Indexes

    @@ -318,9 +310,6 @@

    Navigation

  • index
  • -
  • - previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/markdown-docs/index.html b/markdown-docs/index.html index f10e493106d..5eec23017df 100644 --- a/markdown-docs/index.html +++ b/markdown-docs/index.html @@ -70,13 +70,23 @@

    Page Contents

    Core Documentation

    @@ -231,12 +220,6 @@

    Navigation

  • index
  • -
  • - next |
  • -
  • - previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/markdown-docs/insert.html b/markdown-docs/insert.html index 09c2691d20d..50d42cbb9d8 100644 --- a/markdown-docs/insert.html +++ b/markdown-docs/insert.html @@ -24,9 +24,7 @@ - - - + @@ -229,20 +221,24 @@

    Page Contents

    Core Documentation

    - -

    Previous page

    -

    Collections

    -

    Next page

    -

    Queries

    @@ -279,12 +269,6 @@

    Navigation

  • index
  • -
  • - next |
  • -
  • - previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/markdown-docs/queries.html b/markdown-docs/queries.html index bee649819f7..ae5480adc01 100644 --- a/markdown-docs/queries.html +++ b/markdown-docs/queries.html @@ -24,9 +24,7 @@ - - - + @@ -397,24 +389,24 @@

    Page Contents

    Core Documentation

    - -

    Previous page

    -

    Inserting and updating

    -

    Next page

    -

    Indexes

    @@ -451,12 +437,6 @@

    Navigation

  • index
  • -
  • - next |
  • -
  • - previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/markdown-docs/replicaset.html b/markdown-docs/replicaset.html index d3c85c34dbc..728eb95a196 100644 --- a/markdown-docs/replicaset.html +++ b/markdown-docs/replicaset.html @@ -24,9 +24,7 @@ - - - + @@ -152,20 +144,24 @@

    Page Contents

    Core Documentation

    - -

    Previous page

    -

    Database

    -

    Next page

    -

    Collections

    @@ -202,12 +192,6 @@

    Navigation

  • index
  • -
  • - next |
  • -
  • - previous |
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • diff --git a/objects.inv b/objects.inv index fcb74c321225e83b5267a22b5e5bc295837d0eec..aec6cfd66846385b6d6d2b3b402141b45f12fb12 100644 GIT binary patch delta 1097 zcmV-P1h)IJ3Bn1Gh<{nZj@vd6z3*2DXs&jVLod16>rHmkjUCtt3bg2f5=Sz#6seMw zV;BAS4k@o?DY8Y#>QYI+u6K&`_PEz2> znBdx=hynU*CMh(gZ<5K~vlPWNSF)Tlqpf9Li_9=7hK;$Melk{2${l>wpav{kBbv4* zm6AE*OcYNdmshO_EtzNy3oy&tc{xix95t*2ZAe+QE2P9^+YS2{u5O#vN=wyRW!qZ3 zI4e>LRVg}wbe*NeJ&SKQRye>DsvrNAM4%61&$PI=@6j5F;(rG4zz$Lxmb#m5W zdf8+wW^Y%B7Ne>p&M?k{ClQyhO2LlFT0bZymG<8J-hY7?Lk^_uBdiZ`?Pj&MIUac? zDDo7`57$dXat?0joC*Xf;r=w@?eYf%-Nu2AGi^fgY2+j9eIfQEJYAL__PDVQJ~5WY zv;6Kyn*$kc!oP-0DyoARY2}Xbv>2g~fz#?G6o}>>M0w0X>n~d(;_6A?ld1w59A>Iy zHRIehLw^X*62`~4BJu`gNq_rURNv)-XsFm8J(BEhU$!xG0rNievG~`np$7-KLFi~l zKi{wbxkTX-yp^Sk%gknTaF%jg0+C3*xoJ*~m?iqfc5WrSxn$I+%pFQ|>)I`(Hb zd9Pl3hqKiOUxj9cfH?P?{xQ}$&a@2KduSQ5?|*2SljQVm&s}hz%)NSRU$AOu=-`pr zT0KOxsal|XeF<+=Go{EOi0J2=)pGh15Y^U^4yw^Eecd4BPAT(Uqnot?J0bxGUo+AGTGuwHc=b*6XTxwKTv(UMeTuHpCpP*!vDazwV>_^d}M?si^aUJj(^0@m}lh%l|oN-fZ zn2xuIn;LhY+d}IJ<=7)R;G)^f@jWS6Xn!AX2e&YEOOqH?ifwj8whd6FkjCw=Z*$9#q&yp%VrR|4u!c(baa~CW0oh%2M*fZ{B{->us02}2I->X2u^hz?0;GFc&_@0 zM~r-|x{R5@2heBO0S{@PErgb&1ph~&HP+JDlaQ^q{(}%o<O**@%lWGmL&cX|i>3c5q*ki`Zs|K#7pdgd(;4 zaP3Zi{6dssMXGFxbWR?N06_o`z$0@>nV_(bw4v9W#K5D;`=~ff@_J#qH93D1eUa31 zi0;czR~d*NrRT4;MkT6&sASs~tiIJ^n@Zp-$>3@+Uqc!_>VNBm6Ro575h>Ut)>2Gx zZ&1VleV0fImFnAQa`hlZHcgex=gjC*GqoZyOp1PGUWy-;736XU-!-Tn%|?mFjY^?p z$~Y6*y-4L*Ekbi98pRCE(z;X5;t>ZmEC+2!UNk$z#3b7d`vqssCRS;w8m(k&#go$# zHjmNMe?EaRpnraE+|R$|X2cl9Vr$@!-7>|fHd4KaxZbkVtXZ}-L0C*;6Q>w< zf_o8`pF+WoNvm&_l1h&@e&b-bF$ze2I?5F|wUcUeQ-5@MCMb3omLAT7TXGI=>17cM zlEck$W%Q9tKx`bwIMc=#jz-?W9{t5u5Q0XR<=Z_P*4`dtB|ONV;~HL1hMO&y7`X8% zUO6Z37X$sd$5*|C46(d}p!0Ij`rDR>uxipbq$q%T2bn5a%s6*L4E%G1@iDH1Mu#`2 zA6~0Pw|_f9Fi^_bI*{!4JS}790yf&|y7bp>5PJu?YA1t}_@%)N{I@2XY={g<55hCHBg)QC$pL$L$jli z|3dbE!C?TOIoUtKp@%Mx9nfunAJs=q*Dl%AP=B?AJ66`~Az)BhfzoKnoRVuWMOHH65g z^5#qsH3aS03H6}__5pn6dAd&%7m1G;$%_cij&KXBbXZj%@>uegBBQu6lF@ZK<}vbr zGk>$4+cX7*^W_wl&t{=@+c=Ym9vEz#PXl^g$IE^jKx5k~Cwgb^M7!jYqJMyrL8{1J z@9_2*%t~B|y~22N_t*zW!>&nHl?0^gMWYD~UrqkM3(YbC^i>*_Z}gBy-H`)snmpAH zINl7oruCP!+otDXR4LBJ0eaQb_k=XgzJI>#0Owy8IyOtzyAu8s352%3gV`lIIL+?$ zXe7#e9BmuFyd?|Ro2ufy$V|P0qGeC_xMdAaIU_%#i$Ty?#HTUS`{MWjJK$ck(23I| ybYeQMfpU)0wZKj&^?I5%GW5;wV#3<)!@gajnx%eiEw+qP-#7UG0pe@ZxYM|P`XAB& diff --git a/search.html b/search.html index 9c2123761fd..501b1e704f4 100644 --- a/search.html +++ b/search.html @@ -85,13 +85,23 @@

    Page Contents

    Core Documentation

    diff --git a/searchindex.js b/searchindex.js index 9c9efc2a2ea..03c5f60c620 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{notEquals:[27,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[27,1,1,""],DBRef:[3,0,1,""],ensureIndex:[9,1,1,""],Binary:[24,0,1,""],streamRecords:[17,1,1,""],deserializeStream:[1,1,1,""],findOne:[18,1,1,""],valueOf:[28,1,1,""],chunkCollection:[4,1,1,""],Long:[13,0,1,""],nextObject:[17,1,1,""],validateCollection:[14,1,1,""],removeUser:[9,1,1,""],profilingInfo:[14,1,1,""],dropIndex:[9,1,1,""],findAndRemove:[18,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[27,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[14,1,1,""],getNumBitsAbs:[27,1,1,""],cursorInfo:[9,1,1,""],"generationTime number [Getter|Setter]":[7,2,1,""],Timestamp:[27,0,1,""],batchSize:[17,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[9,0,1,""],dropCollection:[9,1,1,""],Collection:[18,0,1,""],shiftRight:[27,1,1,""],writeFile:[4,1,1,""],Grid:[25,0,1,""],Double:[15,0,1,""],getTimestamp:[7,1,1,""],toString:[27,1,1,""],profilingLevel:[14,1,1,""],collectionNames:[9,1,1,""],toNumber:[27,1,1,""],indexInformation:[9,1,1,""],isOdd:[27,1,1,""],getHighBits:[27,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[14,0,1,""],dropDatabase:[9,1,1,""],Symbol:[28,0,1,""],previousErrors:[9,1,1,""],mapReduce:[18,1,1,""],shiftLeft:[27,1,1,""],shiftRightUnsigned:[27,1,1,""],Cursor:[17,0,1,""],MaxKey:[10,0,1,""],CursorStream:[29,0,1,""],findAndModify:[18,1,1,""],greaterThan:[27,1,1,""],renameCollection:[9,1,1,""],buildInfo:[14,1,1,""],resetErrorHistory:[9,1,1,""],isClosed:[17,1,1,""],getLowBitsUnsigned:[27,1,1,""],toHexString:[7,1,1,""],indexExists:[18,1,1,""],getLowBits:[27,1,1,""],toArray:[17,1,1,""],reIndex:[9,1,1,""],listDatabases:[14,1,1,""],ObjectID:[7,0,1,""],isNegative:[27,1,1,""],geoHaystackSearch:[18,1,1,""],addUser:[9,1,1,""],lessThanOrEqual:[27,1,1,""],isZero:[27,1,1,""],collectionsInfo:[9,1,1,""],lessThan:[27,1,1,""],isCapped:[18,1,1,""],ReadStream:[6,0,1,""],createCollection:[9,1,1,""],createIndex:[9,1,1,""],dropAllIndexes:[18,1,1,""],lastError:[9,1,1,""],geoNear:[18,1,1,""],greaterThanOrEqual:[27,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromHexString:[7,1,1,""]},Timestamp:{fromBits:[27,1,1,""],fromNumber:[27,1,1,""],fromInt:[27,1,1,""],fromString:[27,1,1,""]},Db:{connect:[9,1,1,""]},Long:{fromBits:[13,1,1,""],fromNumber:[13,1,1,""],fromInt:[13,1,1,""],fromString:[13,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{returnkei:[30,17,18],maxscan:[30,17,18],readfilesync:4,prefix:[16,30],crete:18,createindex:[9,18,30,5,21,8],world_safe2:18,world_safe1:18,test_map_reduce_functions_inlin:18,deviat:30,under:30,everi:[0,17,23,19],test_gs_seek_with_buff:4,simple_next_object_collect:17,upload:19,correct:[1,9,7,30,4,31],"10k":30,seper:4,direct:[5,17,31],second:[17,12,2,16,18,4,32,30,7,23,9],aggreg:18,even:[0,18],attemp:18,neg:[27,13],calcul:1,"new":[0,1,2,16,4,5,6,7,9,12,13,14,30,17,18,19,23,24,25,27,29,31,32],metadata:[19,32,4],unpars:30,rootcollect:4,never:[30,9],here:[31,32,4],io_seek_set:4,anymor:30,loos:31,getlowbit:[20,13,27],findandmodifi:[30,18,21,12],vincentcr:30,schemaless:31,total:[0,18],sarah:18,would:[0,9,18,27,13,5,32,30],aaron:30,overhead:31,recommend:[31,18],type:[10,11,1,18,19,3,14,4,28,15,31,24,32,30,26],tell:[9,18,4,21,31,32],relat:5,notic:[31,32],warn:[18,9,12],exce:4,hold:[31,1,4,17],must:[0,27,13,18],err:[0,14,6,17,12,2,19,16,18,4,29,30,25,31,32,23,9],aheckmann:30,setup:[2,32,9],work:[0,9,30,4,31,32,17],rework:30,root:[32,4,25],overrid:[9,17,30,18],simple_geo_haystack_command:18,indic:[0,12,11,16,5,19,31,23],want:[0,9,18,16,4,5,15,31,32,23],david:12,unsign:[27,13],end:[6,17,18,19,16,4,29,31,32],replicaset:[11,9,2,30,31,22,8],quot:17,how:[11,9,18,14,4,26,31,32,17],"_id_":[9,18],recoveri:2,rewind:[0,30,4,21,17],milisecond:[30,9,7],config:[2,30,9],updat:[24,11,9,18,30,12,21,31,32,22,8],maxdist:18,recogn:4,after:[6,17,12,19,30,29,4,1,32],listdatabas:[30,14,9,21],befor:[0,9,18,2,30,5,31,32,23],wrong:30,gs2:4,descriptior:19,parallel:31,attempt:[31,14,23],third:4,exclud:[17,18],perform:[0,14,9,18,27,13,30,17],errorobject:30,order:[0,17,12,18,5,23],oper:[0,14,17,12,16,13,30,27,5,18,31,32,23,9],cursorinfo:[9,21],over:[9,18,30,23,8,17],becaus:[27,13],readbuff:[30,32],vari:30,digest:[30,32],uuid:[24,1],fit:[31,17],fix:[30,32],better:[31,30,23],complex:[31,9,18],loggerinst:30,persist:[31,18],split:[27,13,4],them:31,thei:[31,27,13,32,30],safe:[12,9,18,16,14,29,31,30,17],update_a_simple_docu:18,"instanceof":[9,18,30,14,4,17],choic:30,changelog:[11,30],bonu:31,timeout:[2,30,17,23,18],each:[0,6,17,18,2,27,13,4,30,29,21,32,23,9],debug:30,went:18,a_simple_collect:9,mean:[17,2,30,31,32,23],resum:[29,6,21],reset_error_histori:9,extract:30,newli:[5,16,14],content:[24,0,6,25,12,19,4,31,32,8],daniel:[0,23,19],reader:30,got:[31,9,18],more_index_information_test:[9,18],navig:32,worthwhil:32,default_port:23,situat:30,md5:[24,30,1,4],filter:[9,18],pagin:18,regress:30,onto:30,rang:[0,30,18],unlik:17,alreadi:[17,12,19,16,4,5,31,23],unlin:4,getnumbitsab:[20,13,27],primari:[0,9,18,2,30,31,23,8,17],hexstr:7,rewritten:30,top:[27,13,18],travers:17,startindex:1,tonumb:[20,13,27],ton:[31,32],similarli:31,listen:[30,17],consol:[0,1,12,19,16,31,32,23],namespac:3,eventlisten:30,took:17,incur:31,removeus:[14,9,21],silli:31,target:[32,18],provid:[9,18,27,13,4,31,32],cursorstream:[11,29,17,21],matter:31,iron:31,thu:12,websocket:31,abov:[31,32,12],mind:31,raw:[0,9,18,16,12,30,32,23,17],manner:[30,32],increment:31,seek:[21,19,32,4,8],dbref:[11,9,3,20,31,30],ensureindex:[9,18,30,5,21,8],simple_limit_collect:17,data2:4,simplifi:[30,32],insur:30,plenti:32,usernam:[5,14,9],object:[0,1,2,16,4,5,6,7,8,9,11,12,14,30,17,18,19,23,24,25,26,29,31,32],deleg:23,regular:[0,19],tradit:31,simplic:32,don:[30,23,18],doc:[0,14,1,17,12,30,18,4,29,31,9],flow:30,doe:[12,9,18,16,13,4,30,31,32,27],bson_data_d:1,radix:[27,13],random:4,speedup:30,syntax:30,test_stream_funct:17,identifi:[31,16,32],absolut:[27,13,32,4],acquir:17,field2:0,explain:[0,9,17,21,18],field1:0,theme:31,busi:31,rich:31,io_seek_cur:4,cachefunct:1,nasti:30,test_cursorstream_destroi:29,stop:30,collectionsinfo:[9,21],bson_data_numb:1,report:31,bar:4,patch:30,previouli:17,fileidobject:4,steam:17,fieldnam:0,fair:32,indexnam:[9,18],num:18,structur:[0,32,31],previouserror:[9,21],respons:[0,17],fail:[25,18,30,14,31,9],said:32,databas:[0,25,14,17,12,11,16,18,4,26,30,19,31,32,22,23,8,9],test_gs_empty_file_eof:4,gridstor:[24,11,14,6,17,18,19,30,7,4,29,26,1,21,25,32,22,8,9],simplest:[0,32],awai:32,lotsofdoc:31,accord:2,newnam:18,getlasterror:[9,18],howev:17,against:[0,14,9,18,27,13,4,7,30,17],logic:[0,30],com:[31,30],assur:17,can:[0,17,12,2,19,16,13,30,27,5,32,18,31,7,23,9],simple_explain_collect:17,foobar2:4,path:[19,30,4],assum:[27,13],duplic:[5,9,17,30,18],three:[31,32,4],been:[32,17,9],much:[31,32,12],basic:[11,9,26,18,31,32],life:32,regul:17,search:[11,31,18],argument:[24,14,6,17,18,29,3,13,4,28,1,15,32,30,25,7,27,9],child:9,"catch":18,laurie71:30,another_root:4,peform:[29,9,6,17,18],dissect:32,properti:[0,7,19,30,4,20,21],weren:0,"typeof":[30,1,4],succes:18,sever:[12,2,16,5,31,23],grown:31,test_is_close_function_on_cursor:17,receiv:32,make:[0,17,12,30,18,5,31,32,23,8],drawback:32,descend:[5,17],isneg:[20,13,27],complet:18,nin:0,hang:30,hand:23,fairli:30,tune:32,scenario:23,geohaystack:18,test_close_function_on_cursor:17,client:[9,12,14,4,18,25,31,17],thi:[24,0,14,6,17,12,19,27,13,4,5,30,32,18,31,7,23,9],everyth:12,settimeout:[29,30,6,18],left:[27,13,9,23,18],protocol:[31,30],just:[0,32,31,18],laptop:30,ordin:[9,18],farther:6,yet:23,languag:31,previous:30,collectionn:23,had:17,els:[18,14,23,12],save:[9,18,19,12,4,21,23,8],applic:[31,32],which:[0,2,19,16,13,4,27,30,32,23],preserv:17,background:[9,18],test_ev:9,apart:[31,32],measur:30,specif:[0,9,18,16,7,4,31,30,17],arbitrari:4,negat:[20,13,27],collection2:[9,18],collection1:18,underli:29,www:9,right:[31,27,13,32],old:4,deal:31,manual:[11,8],interv:30,deserializestream:[20,1],dead:30,intern:[0,27,13,19,18],successfulli:17,txt:4,timestampd:7,multipli:[20,13,27,18],christkv:[31,30],condit:[0,30,18],localhost:[31,16,32,9],a_simple_create_drop_collect:9,collection_stats_test:18,promot:31,repositori:31,post:[0,16,13,27],plug:31,obj:18,slightli:31,simul:[27,13,32],commit:9,book:0,simple_previous_error_col:9,bson_data_symbol:1,"float":[31,27,13],encod:[2,31,30,23],bound:[9,17,18],down:[30,9],wrap:[0,6,28,30,29,15],storag:[31,32],wai:[0,18,12,27,13,31,32,30],support:[0,30,32,31,19],serverinfo:18,avail:[6,9,18,2,30,14,4,29,31,32,17],test_rename_collection3:18,test_rename_collection2:18,constantli:31,lowest:30,head:[32,4],medium:14,form:[30,4],forc:[9,14,17,30,18],"true":[0,14,1,17,12,2,19,16,18,4,29,5,6,30,25,31,32,23,9],reset:[0,9,4,17],new_nam:16,geospati:[9,18],maximum:[31,30,17,9],until:[31,14,9],deprect:17,fundament:31,sampl:31,emit:[31,30,29,9,18],featur:32,fromstr:[20,13,27,30],exist:[0,14,9,12,19,16,18,4,5,30,21,31,32,23,8],subtype_user_defin:24,check:[0,14,6,17,18,19,27,13,4,29,5,1,31,30,8,9],test_collection_opt:18,bson_binary_subtype_md5:[24,1],test_to_a_after_each:17,floor:7,when:[0,1,17,12,2,19,16,18,4,29,6,30,31,32,23],refactor:30,simple_limit_skip_find_one_queri:18,test:[14,9,12,19,16,18,4,31,32,30,17],miliscecond:[29,6],node:[11,17,2,30,31,8],insensit:17,consid:18,sql:31,cachefunctionscrc32:1,dropdup:[30,9,18],"_id":[0,9,12,30,18,4,5,32,23,8,25],longer:[30,4],ignor:[31,1,18],time:[11,9,7,2,30,18,26,31,23,17],push:[31,30,29,17,9],backward:[30,17],concept:[31,30],skip:[0,17,21,18],global:30,primer:[11,32,26],row:18,millisecond:23,middl:18,depend:30,dropindex:[21,5,9,8,18],sourc:17,string:[24,0,14,1,17,18,19,3,13,4,28,27,5,32,30,25,31,7,16,9],feasibl:32,test_cursorstream_resum:29,contenttyp:19,level:[9,14,4,30,18],did:[30,9],dig:31,eventemitt:17,iter:[17,18],item:[6,9,18,30,14,4,29,31,17],quick:[31,32],div:[20,13,27],round:31,databasenam:[9,23],wtimeout:[30,9,18],addtoset:31,sign:[16,13,27],slow_onli:14,cost:30,port:[30,9,23],comparis:4,checkoutwrit:9,repli:[31,14,18],current:[14,9,19,3,13,4,31,32,27],subtype_uuid:24,deriv:[27,13],gener:[9,7,30,18,32,23],wait:[9,18],box:31,bson_data_regexp:1,shift:[27,13,30],queue:31,behav:30,more_complex_ensure_index_test:[9,18],extrem:30,weird:30,checkkei:1,extra:0,modul:30,prefer:[0,30,31],toarrai:[0,9,18,30,14,21,31,17],instal:[31,30],includeloc:18,perf:30,memori:[0,17,26,11,30,31,32],regep:31,live:[31,30,32],handler:32,value2:0,value1:0,criteria:12,scope:[31,30,1,9,18],prev:18,maxkei:[10,11,20,1,30],multiplecoll1:9,finit:[27,13],examin:31,content_typ:[19,32],cap:[31,30,9,18],uniqu:[0,18,9,23,5],test_correctly_access_collect:9,whatev:23,bson_binary_subtype_funct:[24,1],mongo:[11,9,26,30,12,31,32],stream:[6,17,19,30,29,4,1,21,31,32,8],predict:30,bson_data_long:1,createcollect:[9,18,16,29,21,31,17],occur:[0,17,12,19,16,4,5,30,23,8],alwai:[31,27,13,17,18],multipl:[18,2,27,13,30,23,8],ping:[30,14,9,21],fieldvalu:0,write:[24,1,9,2,19,30,4,20,6,21,31,32,8,25],foreach:[4,18],pure:[24,14,6,9,18,29,30,7,4,1,25,17],map:[31,18],product:[27,13],max:[9,17,30,18],dive:[31,32],date:[1,17,7,30,14,5,18,31],docstartindex:1,data:[24,11,6,17,18,19,30,26,4,29,1,25,31,32,9],grow:31,sbrekken:30,inform:[17,18,2,19,14,4,5,31,23,8,9],"switch":30,reaper:[30,9,23],combin:[4,9],keepgoingexampl:18,filedata:4,increas:30,still:[0,30,12],pointer:[0,16,4,23,19],test_map_reduce_funct:18,group:[30,32,21,18],gte:0,indexexist:[30,21,18],jim:18,nodelai:[2,30,23],platform:31,mbostock:30,requir:[24,14,6,17,12,29,16,18,4,1,32,30,25,31,7,23,9],main:[31,32],non:[30,18],simple_skip_collect:17,col2:9,col3:9,initi:[9,18,30,4,31,32,17],col1:9,verifi:[9,7,14,4,18],now:[31,30,32,9],nor:16,introduct:[2,11,31,8,26],mapreduc:[21,18],name:[24,0,14,1,17,12,2,19,3,18,4,23,5,30,32,16,9],drop:[9,18,16,14,5,21,30],revert:0,crypto:30,separ:[0,30,4],failov:[2,30],replai:30,replac:[0,18,30,12,4,31],individu:[0,30],a_1_b_1:[9,18],poolreadi:30,serverclust:30,happen:[29,6,4,17],shown:[31,32],accomplish:32,space:[1,9],profil:[14,17,18],stuff:[2,11,32,31,26],factori:[0,23,18],resultset:31,"_event":30,mime:4,sethml:30,replacethiscollect:18,org:9,"byte":[24,0,1,9,7,19,30,31,32,23],care:[2,0,31],question:[27,13],test_gs_tel:4,synchron:31,thing:[31,32,23],place:[27,13],year2013:30,frequent:[27,13],first:[0,14,17,12,19,16,18,4,32,31,7,23,8,9],origin:[18,12],bson_binary_:30,directli:[0,17,31],onc:[5,31],arrai:[24,0,14,1,17,12,2,19,16,18,4,31,30,8,9],"0x7f":1,reopen:[4,23],"long":[11,1,17,7,30,13,20,31],open:[14,6,17,12,2,19,16,18,4,30,29,21,25,31,32,23,8,9],predefin:1,size:[0,1,17,18,19,27,13,4,32,30,9],given:[24,9,18,27,13,4,32,17],breviti:[31,32],workaround:30,paramt:17,collectionnam:[9,18,16,14,5,21,32],conveni:[0,27,13],subtype_md5:24,especi:31,copi:2,specifi:[24,0,9,18,19,4,31,32,23,17],test_arrai:17,keepgo:[30,18],than:[0,17,12,18,2,19,27,13,30,32,23],png:[19,4],tedeh:30,were:[17,12],posit:[24,19,27,13,4,32],pre:[14,1,9,18],sai:32,ani:[0,9,12,31,32,17],simple_rename_collection_2:9,bitwis:[31,27,13],alias:0,destroi:[29,6,21],note:[27,13,17,9],take:[0,1,2,30,31,32],createfromhexstr:[0,20,30,7],begin:[0,4],sure:[32,17],normal:17,buffer:[24,0,1,17,12,19,16,18,4,30,25,32,23,9],clearer:30,getyear:18,renam:[9,18,16,21,31,8],byte_valu:24,later:[32,9,18],indexbound:[9,18],test_gs_read_stream:4,runtim:30,parseint:18,axi:18,show:[24,6,9,18,29,4,1,25,31,17],atom:[31,30,18],objectid3:7,objectid2:7,concurr:30,corner:30,onli:[0,14,17,12,2,30,18,4,5,31,32,23,9],slow:[30,14,9,18],dice:31,setprofilinginfo:14,activ:30,written:[24,18,27,13,4,32],analyt:31,overwritten:32,min_valu:[27,13],variou:[14,18],get:[11,14,6,17,12,19,16,18,32,4,5,26,29,30,21,25,31,7,23,8,9],secondari:[2,9,17,30,18],ssl:30,cannot:[9,18,27,13,31,17],shiftrightunsign:[20,13,27],geo:18,nolock:[30,9],doabl:0,seldom:30,yield:[16,18,9,30,12],isarrai:1,where:[24,0,1,9,12,2,19,16,18,4,5,31,32,30],highbit:[27,13],desced:17,wiki:31,testcas:30,infinit:[27,13,30],detect:2,heckmann:30,fs_chunk:32,integration_tests_2:9,wayt:18,enough:17,between:[31,30,9,23],"import":[31,32],across:[30,23,18],spars:[5,9,18],test_group:18,come:[19,27,13,18],simple_find_and_modify_operations_:18,region:18,gwt:[27,13],tutori:[11,32],mani:[31,17],fromnumb:[20,13,27],reindex:[30,9,21,18],iscap:[30,21,18],db_option:23,period:[0,16],pop:31,createcreateindexcommand:30,fs_file:32,lessthan:[20,13,27],reaperinterv:[30,9,23],cursor_information_collect:9,cursorinst:17,coupl:[24,31,18],aciev:0,rebuilt:[9,18],derefer:[30,9,21],lowbit:[27,13],geonear:[30,21,18],"1mb":32,those:[27,13],"case":[17,18,27,13,5,31,32,30],myself:31,bson_seri:30,tostr:[24,25,7,27,13,4,20,18,32],trick:32,invok:32,idhex:0,firstext:14,simple_sort_collect:17,advantag:31,eras:[19,16],ascii:[2,24,30,23],acess:9,develop:31,author:[0,19,12],same:[0,17,18,27,13,4,5,7,30,9],binari:[24,0,14,6,17,11,19,16,12,4,29,20,1,18,25,31,7,30,9],document:[0,14,1,17,11,2,19,16,12,4,29,5,30,6,18,31,32,23,9],createpk:23,exhaust:17,finish:[32,18],closest:[27,13,18],utf8:[2,31,30,4,23],nest:[0,5],oid:3,driver:[0,12,2,11,16,26,30,21,31,32,23,8],gotend:4,improv:30,defo:0,bson_data_boolean:1,crud:[11,31,26],without:[1,9,27,13,23,30,16],model:18,dereferenc:9,upsert:[18,12],ourexamplefiletowrit:4,execut:[9,12,30,14,4,18,31,17],rest:[30,18],hint:[17,18],db_connector:[16,23],except:[31,30,4,12],littl:31,blog:[0,16],default_chunk_s:4,haystack:18,found2:4,around:[31,30],read:[24,6,17,18,2,19,30,4,20,21,31,32,8,9],grid:[24,11,25,30,21,32],spank:30,world:[6,9,18,12,4,1,32,25],lasterror:[30,9,21],reap:30,mod:[0,27,13],saniti:30,poolsiz:[6,9,18,30,14,4,29,25,31,23,17],integ:[0,1,27,13,31,30],server:[24,14,1,17,12,2,29,16,18,4,6,32,30,25,31,7,23,8,9],either:[19,30,32,31],output:[0,18],greaterthanorequ:[20,13,27],manag:[19,30,31],bson_binary_subtype_byte_arrai:[24,1],eventloop:32,"_bsontyp":30,intact:12,generationtim:7,setnodelai:30,slice:31,writedata:32,node_ev:30,confirm:31,legal:18,evolv:31,profilinginfo:[14,21],bson_data_binari:1,broken:30,aquir:9,bson_binary_subtype_default:[24,30,1],regexp:[31,30,1],"throw":[31,30,32,12],pointer_to_collect:0,firstnam:[0,5],numbit:[27,13],bson_data_code_w_scop:1,gump:18,act:32,luck:32,readstream:[11,6,17,21],addus:[30,14,9,21],test_collections_info:9,your:[2,31,32,4,18],loc:18,log:[0,1,17,18,19,16,12,14,30,31,32,23],hex:[0,25,4,7],overwrit:[14,4],errormessag:30,strict:[16,30,9,23,18],interfac:[6,17,30,29,31,25],low:[31,27,13,32],lot:[17,18,30,5,29,31,32],tupl:5,shamelessli:31,replsetsrv:2,faster:[5,30],pull:[31,30,14],dirti:31,possibl:[0,9,12,30,18,5,31],"default":[24,0,1,17,12,2,19,16,18,4,5,32,30,31,7,23,9],remove_subset_of_documents_saf:18,dropdatabas:[14,9,21,23],bson_data_min_kei:1,expect:[0,23],gone:[25,9,4,18],creat:[24,0,14,1,17,18,2,19,16,7,4,29,5,6,30,25,31,32,23,8,9],certain:[5,31],intro:31,file:[6,25,19,30,4,32,8,9],calculateobjects:[20,1],again:[4,17],field:[0,17,12,30,18,5,31,8,9],valid:[24,1,17,7,16,14,9],longlib:13,you:[0,1,17,12,2,19,16,18,5,30,31,32,23,9],pefrom:18,sequenc:30,symbol:[11,1,28,30,20,31],opt_radix:[27,13],pool:[30,9,23],reduc:[27,13,30,18],lessthanorequ:[20,13,27],directori:30,descript:[24,9,1,4,17],tricki:31,potenti:30,alright:31,cpu:[30,32],unset:31,represent:[10,24,25,7,3,13,4,28,15,27],all:[0,14,1,17,12,2,19,16,18,4,5,30,31,32,23,9],forget:31,numberupd:18,dollar:16,simple_rename_collect:9,follow:[0,17,12,2,4,5,31,32],fetchsiz:17,disk:[32,6,4,18,17],subtype_default:24,nextobject:[0,17,21,9],init:17,setprofilinglevel:[14,21],evaul:9,util:30,test_rename_collect:18,failur:[31,30],veri:[31,30,32],list:[9,18,16,14,4,21,31,32,30,8],resav:18,adjust:[30,32],findandremov:[30,21,18],small:[30,32],retun:1,zero:[27,13,30],pass:[1,17,18,2,16,7,4,30,32,23,9],what:[31,16,32,17],abc:[0,4,12],xor:[20,13,27],sub:[24,18],sum:[27,13],delet:[9,18,19,30,4,21,31,32,23,8,25],version:[30,32,9,23,18],cruso:0,method:[24,0,17,18,11,16,7,4,26,30,31,32,23,25],full:[30,9,18],hash:[0,30,32,9,23],variat:31,getmorecommand:[17,18],foobar3:4,modifi:[31,18,8,12],valu:[0,1,16,4,5,7,8,9,12,13,14,15,30,17,18,19,20,23,24,28,27,31,32],isodd:[20,13,27],ahead:[31,32,18],showdiskloc:[30,17,18],amount:[31,27,13,9],pick:[31,30,32,9],narrow:18,evalfunct:1,via:31,shorthand:12,c_1:18,deprec:9,default_root_collect:4,establish:[6,9,18,30,14,4,29,25,17],select:[18,16,12,23,30,8],test_collection_is_cap:18,distinct:[30,21,18],regist:4,two:[0,9,12,2,19,16,13,4,5,32,31,7,27],coverag:30,bson_binary_subtype_user_defin:[24,1],taken:31,minor:30,more:[0,6,17,12,2,27,13,4,29,18,31,32,30,9],flag:18,stick:31,particular:31,cach:1,none:2,outlin:[31,32],histori:9,remain:[32,4],scan:[17,18],share:[30,9,8,23],shard:19,accept:[30,18],simple_document_insert_collection_no_saf:18,default_url:9,robinson:0,cours:31,newlin:4,divid:[27,13,18],rather:18,anoth:[0,4,31,7],simpl:[24,0,6,17,11,29,16,18,4,5,26,1,25,31,32,30,9],perman:9,resourc:23,variant:31,reflect:30,unlink:[19,32,4,21],associ:[32,4],keyorlist:17,github:[31,30],defineproperti:30,save_a_simple_document_modify_it_and_resave_it:18,caus:[31,30],callback:[0,14,17,12,19,16,18,4,5,30,31,32,23,9],spheric:18,doc_id:0,bson_data_oid:1,trade:32,through:[31,30,9,18],reconnect:[30,23],paramet:[0,17,12,2,19,16,14,4,5,30,31,32,23,9],style:31,mongorepli:30,call:[0,9,30,4,32,23,17],asbuff:1,dbname:[30,9],rapidli:31,bypass:31,simple_limit_skip_queri:18,might:[5,32,9,31],alter:[0,16],good:[31,32],"return":[0,6,3,4,1,7,9,10,12,13,14,15,16,17,18,19,23,24,25,28,27,29,30,31,32],timestamp:[11,1,7,27,18,20,30],more_complex_index_test:[9,18],distancemultipli:18,compound:[9,18],readlen:4,uploadd:19,instruct:2,authent:[30,14,9,21],easili:[27,13],achiev:0,skipvalu:17,found:[0,9,18,4,12],truncat:[16,32,4],hard:31,realli:31,connect:[11,6,17,18,2,30,14,4,26,29,21,25,31,32,23,8,9],barrier:30,event:[6,9,19,30,4,29,31,32,23,17],read_primari:30,pullal:31,foreground:[9,18],core2duo:30,advanc:[11,26,16,4,31,32],asc:[0,17,12],reason:4,base:[7,19,18,4,31,32],connectionopt:9,put:[24,17,18,30,4,20,21,32,25],seconddb:9,gethighbit:[20,13,27],tailabl:[30,17,18],omit:[31,3,32,30],dir:12,assign:[2,30],notifi:[31,32,18],articl:[11,32,26],lastnam:[0,5],number:[24,0,14,1,17,18,27,13,4,5,15,32,30,31,7,23,9],done:[0,6,9,18,19,30,12,14,29,31,32,23],construct:[27,13],autoclos:[19,32,6,4],create_and_drop_an_index:[9,18],miss:30,differ:[9,7,27,13,4,5,18,31,32,30,25],chunk_typ:4,script:19,interact:[31,32,4,25],least:[0,18],custompkfactori:23,settim:7,statement:[31,32,9],illeg:[25,14,9,30,18],master:2,store:[1,9,19,4,31,32,17],otherid:7,option:[24,0,14,1,17,12,2,19,3,18,4,23,5,30,21,25,31,32,16,8,9],reseterrorhistori:[9,21],native_pars:[6,9,18,14,4,29,25,23,17],getter:[4,7],pars:[30,1,18],literarili:31,std:30,kind:32,bson_data_nul:1,whenev:[9,18],remov:[14,9,18,16,12,4,5,21,31,30,8],reus:[30,1],str:[27,13],consumpt:32,luckili:[31,32],"null":[0,1,17,18,2,16,14,4,29,30,25,23,9],built:31,equival:[31,18],valueof:[20,15,28],fromcollect:9,also:[0,17,12,16,4,5,31,32,30],build:[31,30,14,32,9],validatecollect:[30,14,21],reach:[32,6],most:[0,32,31],cygwin:30,selector:[9,17,30,18],"16mb":19,filesystem:19,cover:9,part:[31,30,7],clean:[30,9],frombit:[20,13,27],find:[0,6,17,12,19,30,18,14,5,29,21,31,8,9],firewal:30,pretti:31,test_gs_weird_bug:4,numberofdocu:1,batch_document_insert_collection_saf:18,hit:[9,18],express:[0,31,19,18],fieldtoupd:31,test_map_reduce_functions_scop:18,nativ:[31,30,23],restart:[29,6],statist:[30,14,9,18],wrote:31,set:[0,14,1,17,12,2,19,16,18,4,5,32,30,31,7,23,9],see:[0,12,19,16,13,27,5,31,32,23],close:[6,9,18,19,30,14,4,29,21,25,31,32,23,8,17],my_f:4,misalign:30,someth:[4,23],altern:18,signatur:[4,17],complement:[27,13],javascript:[1,9,18,27,13,31],salzman:30,succeed:5,both:[30,18],last:[19,9,31],create_and_drop_all_index:[9,18],context:23,logout:[14,9,21],whole:[31,9,4,18],createdat:17,load:[0,30],simpli:0,jsmode:18,point:[17,18,27,13,31,32],instanti:[31,30],shutdown:30,linux:30,backend:31,faithfulli:[27,13],user_id:18,due:[31,30,25],empti:[24,0,18,4,17],strategi:[31,30],test_streamingrecords_funct:17,fire:[6,9,12,19,4,31,32,23],admindb:[14,9],imag:[19,32],understand:31,func:[1,18],look:[17,18,19,30,4,5,31,32],straight:[31,32],batch:[31,30,17,18],"while":[0,30,4,19,17],getownpropertynam:30,behavior:[0,12,27,13,31,30],error:[0,14,6,17,12,19,16,18,4,5,29,30,31,23,9],fun:32,robin:31,loop:30,test_gs_unlink:4,readi:[29,6,4,31,17],key2:0,key1:0,jpg:4,itself:17,test_deref_exampl:9,rid:30,simple_key_based_distinct_sub_query_filt:18,chase:30,decor:30,simple_document_insert_with_function_saf:18,geohaystacksearch:[30,21,18],p_db:[2,9],higher:[2,30,32,23,18],optim:[30,18],operaion:19,numberofretri:[30,9,23],iya_logo_final_bw:4,temporari:[4,18],user:[24,0,1,9,12,30,14,4,5],hello2:18,keyf:18,recreat:23,lower:[9,18],entri:[9,32,4,18],explan:[9,18],getlowbitsunsign:[20,13,27],a_1:18,shape:30,update_a_simple_document_multi:18,bson_data_timestamp:1,cur:32,keeptemp:18,appli:[0,30,17,31],input:[27,13,18],subsequ:[9,18],format:[0,9,18,12,14,17],big:[31,30,32],checksum:4,shiftright:[20,13,27],rs_name:[2,30],replsetserv:[24,14,1,17,18,2,29,30,7,4,6,25,9],success:[19,4,17],resolv:9,collect:[0,2,3,4,5,8,9,11,12,14,30,17,18,19,21,22,23,25,26,29,16,31,32],bson_data_cod:1,popular:31,bamboo:30,serverpair:30,often:[27,13],creation:[31,30,14,9,18],some:[24,0,6,17,18,19,30,4,5,25,31,32,9],back:[0,13,18,27,14,4,31],understood:31,dropallindex:[21,18],scale:[31,32,18],slaveok:[30,9,18],chunksiz:[19,32,4],retri:[31,30,9,23],larg:[0,9,18,19,31,32],intial:18,previou:[32,23],run:[11,9,12,26,2,30,18,31,32],simple_reset_error_history_col:9,step:32,simple_explain_queri:18,subtract:[20,13,27],recordquerystat:9,block:[32,9,18],plan:32,within:[27,13],simple_index_test:18,ensur:[9,18,30,5,31,32,8],chang:[18,27,13,31,32,30],test_collection_index_exist:18,bson_deseri:30,textual:[27,13],custom:[0,18,30,32,23,8],includ:[0,17,18,16,4,5,30,31,23,9],forward:4,files:4,properli:[30,4],uniquedoc:18,ascend:[0,17,5],link:[11,32,31,26],simple_count_exampl:18,line:[32,4],info:[30,14,32,9,18],concaten:[27,13,4],consist:30,caller:17,forceserverobjectid:[30,9,23],readlin:[4,21],similar:19,constant:[24,1,9,4,20,21,17],multiplecoll2:9,parser:[30,1,9,23],doesn:[0,23,12],repres:[17,28,27,13,4,15,31],isconnect:30,titl:[0,18,22,12],unidirect:17,wakup:9,nice:31,deseri:[31,20,1,17,30],jannehietamaki:30,mongodb:[0,1,2,16,4,5,6,7,8,9,11,12,14,30,17,18,19,23,24,25,29,31,32],eval:[1,9,18,30,21,17],profilinglevel:[14,21],algorithm:[2,27,13,23,30],cursorinform:9,tradeoff:32,far:4,hello:[24,6,9,18,12,4,1,31,32,25],code:[24,14,6,9,18,29,30,7,4,1,25,31,32,17],partial:[17,18],worldbuff:4,queri:[0,14,17,11,16,12,4,5,26,30,18,31,22,23,8,9],idvalu:0,replicasetcheckinterv:30,base64:[2,30,23,25],update_a_simple_document_upsert:18,send:[2,31,30,9,23],io_seek_end:4,"256k":32,sens:12,reapertimeout:[30,9,23],passiv:30,result2:25,writebuff:30,untouch:23,relev:31,gettim:[17,7],fieldorspec:[9,18],fewer:18,"try":[31,30,18,32,12],race:30,refer:[9,3,4,31,30,17],smaller:19,fortun:31,natur:31,jump:[31,32],video:32,download:31,odd:[27,13],append:[19,4,31],compat:30,index:[11,1,17,18,16,5,21,22,30,8,9],compar:[7,27,13,4,5,20],descriptor:32,access:[9,18,19,14,4,28,15,17],experiment:30,asced:17,lee:30,bson_data_int:1,batchsizevalu:17,cursor_count_collect:17,let:[6,9,18,30,4,31,32,17],filedescriptor:32,becom:31,sinc:[31,27,13,32,12],subtype_byte_arrai:24,nexttick:30,convert:[0,31],convers:[31,18],larger:[19,30,32],implement:[31,27,13,30],configur:[2,31,16,9,30],read_secondari:[2,30],app:2,api:[11,20,32,9,21],from:[24,0,14,1,17,12,2,19,16,13,4,30,32,18,25,31,7,27,8,9],batchsiz:[9,17,21,18],doubl:[11,20,15,30,31],next:[0,32,1,17,23],chr:4,sort:[0,17,12,30,18,5,21],benchmark:30,name2:0,socketopt:[2,30,23],sollect:16,account:18,retriev:[0,14,9,12,19,30,18,4,31,32,17],scalabl:19,multiple_db_inst:9,annot:32,unopen:30,fetch:[0,9,17,18,5,31,25],queryfailur:30,control:[31,30,32,23],objectid:[24,0,14,6,17,11,29,3,18,4,20,1,32,30,25,31,7,23,9],process:[27,13,17,30],lock:[30,32,9],username_:5,high:[9,18,27,13,31,30],tag:[30,18],serial:[20,1,9,30,18],pingresult:14,integration_test_:[2,9],instead:[0,9,18,2,30,5,32,23,17],npm:[31,30],await:9,formattedorderclaus:30,originaldata:25,alloc:[30,1,9],seriou:30,remove_all_documents_no_saf:18,correspond:[5,16,13,27],element:[0,4,31,17],issu:[31,30,18],writ:4,allow:[9,18,16,14,30,31,32,23,17],subtyp:24,deoptim:30,doc2:31,doc3:31,move:[19,30,4,31],doc4:31,autoindexid:9,server_opt:23,effici:[31,32,18],bunch:[30,9,18],perfect:31,crash:30,greater:[0,27,13,17],handl:[17,18,27,13,4,31,32,30],databs:[19,16,23],auth:[30,9],renamecollect:[9,21],precess:31,numberofremoveddoc:18,writefil:[19,32,4,21],convin:0,anyth:30,edit:[32,4],deserializeddoc:1,exampledb:[31,32],subset:[17,18],opensync:4,chunk:[19,30,32,4],bson_binary_subtype_uuid:[24,1],default_content_typ:4,pushal:[31,30],our:[31,32,4,17],special:[31,27,13,32,17],out:[11,9,26,2,30,18,31,32,23],variabl:[31,30,18],trickier:[0,31],categori:32,suitabl:32,leverag:31,ref:30,math:7,jessica:[0,12],insid:[19,0,32,8,5],dropcollect:[16,9,21],manipul:18,releas:30,princess:18,unwant:0,could:[31,30],shiftleft:[20,13,27],keep:[19,30,9,31,18],length:[24,14,1,9,7,19,18,4,20,32,17],lte:0,primarki:0,minkei:[30,1],debugmessag:30,iszero:[20,13,27],should_correctly_rewind_and_restart_cursor:17,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:9,prioriti:30,start:[24,0,1,17,18,2,16,4,31,32],system:[16,32,4],messag:[12,9,18,30,14,4],timestamplib:27,bson_data_max_kei:1,termin:4,"final":[31,30,18],deconstruct:32,test_gs_getc_fil:4,exactli:16,gridstorew:4,bson_data_object:1,replset:[2,9],mongoserv:[16,23],tocollect:9,charact:[24,30,7,4,18],test_gs_puts_and_readlin:4,result:[0,14,6,17,12,19,27,13,4,30,32,18,25,31,7,23,9],counter:[23,18],terribl:30,corrupt:14,have:[0,9,18,2,16,4,5,31,32],tabl:[31,16],need:[0,1,9,12,19,16,13,27,5,31,32,23],turn:[0,14,9],buildinfo:[14,21],min:[9,17,30,18],mix:[0,5],andrewjston:30,milli:14,test_other_drop:18,orgiin:4,singl:[24,0,9,18,19,30,12,4],fileid:[32,6,4],statsync:4,whi:0,serverconfig:[30,9,23],why:31,overwriten:4,url:9,integration_tests_to_drop:9,request:[30,17],face:31,test_collect:12,snapshot:[17,18],determin:[31,17],streamrecord:[31,30,17,21],fact:[31,12],text:[27,13,32,4],serializefunct:[30,1,9,18],verbos:18,nagl:[2,30,23],anywai:[9,18],setter:[4,7],locat:[31,9,18,4,17],should:[0,14,9,18,16,13,32,25,7,27,17],test_cursorstream_paus:29,local:[3,9],doc1:31,ritch:30,gettimestamp:[20,30,7],donewithwrit:32,enabl:[30,9,23],simple_batch_size_collect:17,tohexstr:[0,20,30,7],integr:[31,32],contain:[24,1,17,18,2,16,4,31,32,9],grab:[14,17,9],modulo:[0,20,13,27],packet:30,fromint:[20,13,27],statu:[31,30],wire:[31,30],correctli:[31,30,18],state:[31,17,23],crude:31,world2:18,kei:[0,1,17,18,30,4,5,31,32,23,8,9],buckets:18,simple_queri:18,isol:30,job:18,entir:[32,4,17],auto_reconnect:[6,9,18,2,14,4,29,25,31,32,23,17],crc32:1,addit:[0,1,9,18,27,13,32,17],admin:[11,9,18,30,14,21],equal:[24,0,14,6,17,18,29,27,13,4,20,1,25,31,7,9],etc:[0,23,18],instanc:[14,1,9,18,2,30,7,4,25,31,32,23,17],greaterthan:[20,13,27],subtype_funct:24,comment:[30,17,18],toint:[20,13,27],removealllisten:30,save_a_simple_docu:18,addition:16,compon:30,json:[11,20,13,27,31],treat:[0,30,17],pkfactori:[9,18],immedi:12,bit:[0,1,19,27,13,31,32,30],assert:[24,14,6,9,18,29,7,4,1,25,17],present:[5,16],replic:[2,9],multi:[18,12],plain:30,cursor:[0,6,17,18,11,30,14,29,21,31,8,9],defin:[24,0,1,9,18,12,27,13,4,30,31,23],setreadprefer:30,bson_data_arrai:1,layer:31,helper:30,site:2,tojson:[20,13,27,30],getc:[4,21],cross:30,member:[2,30],world_no_saf:18,probabl:0,difficult:32,incorrect:30,slave:2,hostnam:23,keepal:[2,30,23],upon:17,retriv:14,serializewithbufferandindex:[20,1],chunk_siz:[19,4],off:[9,2,16,14,4,30,31,23,17],center:18,nevertheless:23,well:[0,30,32,31],exampl:[24,0,14,6,17,11,19,16,12,4,29,5,26,1,32,18,25,31,7,23,9],command:[9,18,30,14,4,21,31,23,17],simple_geo_near_command:18,choos:[31,18],latest:31,distanc:18,paus:[29,6,21],less:[31,27,13],"boolean":[6,17,18,19,27,13,4,5,1,32,9],additon:5,tcp:31,indexinform:[9,18,30,5,21,8,17],web:31,seekloc:[32,4],add:[14,9,7,27,13,5,20,18,31],cleanup:[30,32],logger:30,match:[0,14,18,12,16,13,31,27,8],simple_key_based_distinct:18,piec:[31,27,13,32],know:16,password:[30,14,9],recurs:[13,27,1,4],isclos:[17,21],desc:[0,17],bson_data_str:1,insert:[0,14,1,17,11,16,12,4,21,30,29,18,31,22,23,8,9],resid:31,like:[0,9,18,27,13,5,32,17],fsync:[9,18],chunkcollect:[4,21],necessari:0,"0xff":1,async:31,page:[0,31,11],dispatch:31,suppli:[30,32],gridf:[11,25,26,19,30,4,32],flush:[32,6,4],proper:30,fileinfo:32,librari:[30,32],lead:[27,13,30],leak:30,avoid:[5,30,14,31],octet:4,thank:30,leav:[30,12],mode:[9,18,19,16,4,30,32,23,17],slight:31,journal:9,usag:[24,11,1,25,2,19,16,4,30,31,32,23,8],collection_nam:16,host:23,although:32,offset:[24,32,4],java:[27,13],simpler:[31,30,17,18],about:[9,12,5,31,32,23,17],actual:[0,32,9,31,23],socket:[9,2,30,31,23,8],http:[31,30],dbinstanc:32,notequ:[20,13,27],constructor:[1,2,3,4,6,7,9,10,13,14,15,30,17,18,20,21,23,24,25,28,27,29],fals:[0,14,6,17,12,19,16,18,4,29,1,30,25,32,23,9],disabl:[2,30,23],own:[30,4],automat:[6,17,2,19,30,31,32,23,9],dataset:[0,31],bson:[0,6,3,4,1,7,9,10,11,12,14,15,30,17,18,20,23,24,25,28,29,16],merg:[30,18],val:18,pictur:32,transfer:9,mykei:31,trigger:[6,17,18,30,4,29],concat:0,"var":[24,0,14,1,17,12,2,19,16,18,4,29,6,32,25,31,7,23,9],fsname:25,"function":[24,0,14,1,17,12,2,19,16,13,4,27,30,6,32,18,25,31,29,23,9],brand:30,waitforconnect:30,overflow:[27,13],inlin:18,bug:[30,32],count:[0,17,12,16,18,4,21,30,8,9],made:32,wise:0,whether:[27,13],wish:[24,1,9,18,14,4,32],displai:9,asynchron:[2,31],record:[0,17,12,19,16,18,4,5,31,23,8,9],below:[31,27,13,9,12],limit:[0,17,18,19,21,31],otherwis:[1,17,27,13,4,31,32],problem:[30,14],evalu:[1,9],"int":[27,13],dure:[31,30,9,18],year:0,filenam:[19,30,32,4],replica:[2,30,9],retrymilisecond:[30,9,23],inc:[31,30],tick:30,detail:[5,17,19],deepequ:[25,9,18,4,17],other:[0,26,2,11,27,13,4,31,32,30],bool:7,futur:[31,30,9],branch:30,stat:[30,21,18],findon:[0,9,18,30,21,31,8],"class":[10,24,14,6,17,18,29,3,13,4,28,1,15,32,30,25,31,7,27,9],stai:18,eof:[19,32,4,21],integration_test:[6,9,18,14,4,29,25,17],kaij:30},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","Indexes","ReadStream()","ObjectID()","Node.JS MongoDB Driver Manual Contents","Db()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Long()","Admin()","Double()","Collections","Cursor()","Collection()","GridStore","Binary JSON API","Driver API","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Symbol()","CursorStream()","Changelog","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/db","api-bson-generated/maxkey","index","markdown-docs/insert","api-bson-generated/long","api-generated/admin","api-bson-generated/double","markdown-docs/collections","api-generated/cursor","api-generated/collection","markdown-docs/gridfs","api-bson-generated/index","api-generated/index","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","api-bson-generated/symbol","api-generated/cursorstream","changelog/changelog","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file +Search.setIndex({objects:{"":{notEquals:[28,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[28,1,1,""],DBRef:[3,0,1,""],ensureIndex:[17,1,1,""],reIndex:[17,1,1,""],Binary:[25,0,1,""],deserializeStream:[1,1,1,""],findOne:[15,1,1,""],valueOf:[29,1,1,""],chunkCollection:[4,1,1,""],collectionNames:[17,1,1,""],Long:[13,0,1,""],nextObject:[9,1,1,""],validateCollection:[20,1,1,""],removeUser:[17,1,1,""],profilingInfo:[20,1,1,""],dropIndex:[17,1,1,""],findAndRemove:[15,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[28,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[20,1,1,""],getNumBitsAbs:[28,1,1,""],cursorInfo:[17,1,1,""],"generationTime number [Getter|Setter]":[18,2,1,""],Timestamp:[28,0,1,""],batchSize:[9,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[17,0,1,""],dropCollection:[17,1,1,""],Collection:[15,0,1,""],MinKey:[5,0,1,""],shiftRight:[28,1,1,""],writeFile:[4,1,1,""],toString:[28,1,1,""],Double:[14,0,1,""],getTimestamp:[18,1,1,""],Grid:[26,0,1,""],profilingLevel:[20,1,1,""],streamRecords:[9,1,1,""],indexInformation:[17,1,1,""],isOdd:[28,1,1,""],getHighBits:[28,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[20,0,1,""],dropDatabase:[17,1,1,""],Symbol:[29,0,1,""],previousErrors:[17,1,1,""],shiftRightUnsigned:[28,1,1,""],shiftLeft:[28,1,1,""],mapReduce:[15,1,1,""],Cursor:[9,0,1,""],MaxKey:[10,0,1,""],CursorStream:[30,0,1,""],findAndModify:[15,1,1,""],greaterThan:[28,1,1,""],renameCollection:[17,1,1,""],buildInfo:[20,1,1,""],resetErrorHistory:[17,1,1,""],isClosed:[9,1,1,""],getLowBitsUnsigned:[28,1,1,""],toHexString:[18,1,1,""],indexExists:[15,1,1,""],getLowBits:[28,1,1,""],toArray:[9,1,1,""],toNumber:[28,1,1,""],listDatabases:[20,1,1,""],ObjectID:[18,0,1,""],isNegative:[28,1,1,""],geoHaystackSearch:[15,1,1,""],addUser:[17,1,1,""],lessThanOrEqual:[28,1,1,""],isZero:[28,1,1,""],collectionsInfo:[17,1,1,""],lessThan:[28,1,1,""],isCapped:[15,1,1,""],ReadStream:[7,0,1,""],createCollection:[17,1,1,""],createIndex:[17,1,1,""],dropAllIndexes:[15,1,1,""],lastError:[17,1,1,""],geoNear:[15,1,1,""],greaterThanOrEqual:[28,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[18,1,1,""],createFromHexString:[18,1,1,""]},Timestamp:{fromBits:[28,1,1,""],fromNumber:[28,1,1,""],fromInt:[28,1,1,""],fromString:[28,1,1,""]},Db:{connect:[17,1,1,""]},Long:{fromBits:[13,1,1,""],fromNumber:[13,1,1,""],fromInt:[13,1,1,""],fromString:[13,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{returnkei:[16,9,15],maxscan:[16,9,15],readfilesync:4,prefix:[16,31],crete:15,createindex:[17,15,16,6,22,8],world_safe2:15,world_safe1:15,test_map_reduce_functions_inlin:15,deviat:16,under:16,everi:[0,9,24,19],test_gs_seek_with_buff:4,simple_next_object_collect:9,upload:19,correct:[1,17,18,16,4,32],"10k":16,seper:4,direct:[6,9,32],second:[17,12,2,16,18,4,31,15,33,24,9],aggreg:15,even:[0,15],attemp:[17,15],neg:[28,13],calcul:1,"new":[0,1,2,16,4,6,7,9,12,13,15,31,17,18,19,20,24,25,26,28,30,32,33],metadata:[19,33,4],unpars:16,rootcollect:4,never:[16,17],here:[32,33,4],io_seek_set:4,anymor:16,loos:32,getlowbit:[21,13,28,8],findandmodifi:[16,15,22,8,12],vincentcr:16,schemaless:32,total:[0,15],sarah:15,would:[0,17,15,16,13,6,33,28],aaron:16,overhead:32,recommend:[32,15],type:[10,11,1,15,19,3,20,4,5,14,33,32,25,29,16,27],tell:[17,15,4,22,32,33,8],relat:6,notic:[32,33],warn:[15,17,12],exce:4,forceclos:17,must:[0,28,13,15],err:[0,7,17,12,2,19,16,20,4,31,30,15,26,32,33,24,9],aheckmann:16,setup:[2,33,17],work:[0,9,16,4,32,33,17],rework:16,root:[33,4,26],overrid:[16,15,17,9],simple_geo_haystack_command:15,indic:[0,12,11,31,6,19,32,24],want:[0,17,15,31,4,6,14,32,33,24],david:12,unsign:[28,13],end:[7,9,15,19,31,4,30,32,33],replicaset:[11,17,2,16,32,23],quot:9,how:[11,9,15,20,4,27,32,33,17],"_id_":[17,15],recoveri:2,rewind:[0,9,16,4,22,8],milisecond:[16,17,18],config:[2,16,17],updat:[25,11,17,15,16,12,22,32,33,23,8],maxdist:15,recogn:4,after:[7,9,12,19,16,30,4,1,33],listdatabas:[22,16,20,17,8],befor:[0,17,15,2,16,6,32,33,24],wrong:16,simple_document_insert_with_function_saf:15,descriptior:19,parallel:32,attempt:[32,20,24],third:4,exclud:[9,15],perform:[0,20,17,15,16,13,28,9],errorobject:16,order:[0,9,12,15,6,24],oper:[0,20,17,12,16,13,31,28,6,15,32,33,24,9],cursorinfo:[22,17,8],over:[16,15,17,24,9],becaus:[28,13],readbuff:[16,33],vari:16,digest:[16,33],uuid:[25,1],fit:[32,9],fix:[16,33],better:[32,16,24],complex:[32,17,15],loggerinst:16,persist:[32,15],split:[28,13,4],them:32,thei:[32,16,13,33,28],safe:[12,17,15,16,20,30,32,31,9],update_a_simple_docu:15,"instanceof":[9,15,16,20,4,17],choic:16,changelog:[11,16],bonu:32,timeout:[2,16,9,24,15],each:[0,7,17,15,2,16,13,4,28,30,22,33,24,8,9],debug:16,went:15,a_simple_collect:17,mean:[9,2,16,32,33,24],resum:[30,7,22,8],nin:0,extract:16,newli:[6,31,20],content:[25,0,7,26,12,19,4,32,33,8],daniel:[0,24,19],reader:16,got:[32,17,15],more_index_information_test:[17,15],navig:33,worthwhil:33,default_port:24,situat:16,md5:[25,16,1,4],filter:[17,15],pagin:15,regress:16,onto:16,rang:[0,16,15],unlik:9,alreadi:[9,12,19,31,4,6,32,24],unlin:4,getnumbitsab:[21,13,28,8],primari:[0,17,15,2,16,32,24,9],hexstr:18,rewritten:16,top:[28,13,15],travers:9,startindex:1,tonumb:[21,13,28,8],ton:[32,33],similarli:32,listen:[16,9],consol:[0,1,12,19,31,32,33,24],namespac:3,eventlisten:16,took:9,incur:32,removeus:[22,20,17,8],silli:32,target:[33,15],provid:[17,15,28,13,4,32,33],cursorstream:[22,11,30,9,8],matter:32,iron:32,thu:12,websocket:32,abov:[32,33,12],mind:32,raw:[0,17,15,16,12,31,33,24,9],manner:[16,33],increment:32,seek:[22,19,33,4,8],dbref:[11,17,3,21,32,16,8],ensureindex:[17,15,16,6,22,8],simple_limit_collect:9,data2:4,simplifi:[16,33],insur:16,plenti:33,usernam:[6,20,17],object:[0,1,2,16,4,6,7,9,11,12,15,31,17,18,19,20,24,25,26,27,30,32,33],deleg:24,regular:[0,19],tradit:32,simplic:33,don:[16,24,15],doc:[0,1,17,12,16,20,4,30,15,32,9],flow:16,doe:[17,12,16,13,4,31,15,32,33,28],bson_data_d:1,radix:[28,13],random:4,speedup:16,syntax:16,test_stream_funct:9,identifi:[32,31,33],absolut:[28,13,33,4],acquir:9,field2:0,explain:[0,17,15,22,8,9],field1:0,theme:32,busi:32,rich:32,io_seek_cur:4,cachefunct:1,nasti:16,test_cursorstream_destroi:30,stop:16,collectionsinfo:[22,17,8],bson_data_numb:1,report:32,bar:4,patch:16,previouli:9,fileidobject:4,steam:9,fieldnam:0,fair:33,indexnam:[17,15],num:15,structur:[0,33,32],previouserror:[22,17,8],respons:[0,9],fail:[26,15,16,20,32,17],said:33,databas:[0,26,31,17,12,11,16,20,4,27,15,19,32,33,23,24,9],test_gs_empty_file_eof:4,gridstor:[25,11,7,17,18,19,16,20,4,22,27,1,15,26,30,23,33,8,9],simplest:[0,33],awai:33,lotsofdoc:32,accord:2,newnam:15,getlasterror:[17,15],howev:9,against:[0,20,17,18,16,13,4,15,28,9],logic:[0,16],com:[32,16],assur:9,can:[0,13,17,18,2,19,16,12,31,28,6,15,32,33,24,9],simple_explain_collect:9,foobar2:4,path:[19,16,4],assum:[28,13],duplic:[6,16,15,17,9],three:[32,33,4],been:[16,33,17,9],much:[32,33,12],basic:[11,17,27,15,32,33],life:33,regul:9,search:[11,32,15],argument:[25,28,7,17,9,18,30,3,13,4,29,1,14,15,26,33,16,20],child:17,"catch":15,laurie71:16,another_root:4,peform:[30,7,17,15,9],dissect:33,properti:[0,18,19,16,4,21,22,8],weren:0,"typeof":[16,1,4],succes:15,sever:[12,2,31,6,32,24],grown:32,usessl:17,test_is_close_function_on_cursor:9,receiv:33,make:[0,9,12,16,15,6,32,33,24],drawback:33,descend:[6,9],isneg:[21,13,28,8],complet:15,reset_error_histori:17,hang:16,hand:24,fairli:16,tune:33,scenario:24,geohaystack:15,test_close_function_on_cursor:9,client:[12,9,15,20,4,26,32,17],thi:[25,0,7,17,9,18,13,16,12,4,28,6,15,19,32,33,24,20],everyth:12,settimeout:[30,16,7,15],left:[28,13,17,24,15],protocol:[32,16],just:[0,33,32,15],laptop:16,ordin:[17,15],farther:7,yet:24,languag:32,previous:16,collectionn:24,had:9,els:[20,24,15,12],save:[17,15,19,12,4,22,24,8],applic:[32,33,17],which:[0,2,19,16,13,4,28,31,33,24],preserv:9,background:[17,15],test_ev:17,apart:[32,33],measur:16,specif:[0,9,18,16,15,4,32,31,17],arbitrari:4,negat:[21,13,28,8],collection2:[17,15],collection1:15,underli:30,www:17,right:[32,28,13,33],old:4,deal:32,manual:[11,8],interv:16,deserializestream:[21,1,8],dead:16,intern:[0,28,13,19,15],successfulli:9,txt:4,timestampd:18,multipli:[21,13,28,8,15],originalhex:18,christkv:[32,16],condit:[0,16,15],localhost:[32,31,33,17],a_simple_create_drop_collect:17,collection_stats_test:15,promot:32,repositori:32,post:[0,28,13,31],plug:32,obj:15,bson_deseri:16,slightli:32,simul:[28,13,33],commit:17,book:0,simple_previous_error_col:17,bson_data_symbol:1,"float":[32,28,13],encod:[2,32,16,24],bound:[15,17,9],down:[16,17],wrap:[0,7,29,16,30,14],storag:[32,33],wai:[0,15,12,16,13,32,33,28],support:[0,16,33,32,19],serverinfo:15,avail:[7,17,15,2,16,20,4,30,32,33,9],test_rename_collection3:15,test_rename_collection2:15,constantli:32,lowest:16,head:[33,4],medium:20,form:[16,4],forc:[16,20,17,15,9],"true":[0,1,17,12,2,19,16,20,4,30,6,31,7,15,26,32,33,24,9],reset:[0,4,9,17],new_nam:31,geospati:[17,15],maximum:[32,16,17,9],until:[32,20,17],deprect:9,fundament:32,sampl:32,emit:[32,16,30,17,15],shouldcorrectlyfailonretryduetoappcloseofdb:17,featur:33,fromstr:[28,16,13,21,8],exist:[0,17,12,19,16,20,4,22,6,31,15,32,33,24,8],subtype_user_defin:25,check:[0,7,17,9,15,19,16,13,4,30,6,1,32,28,20],test_collection_opt:15,bson_binary_subtype_md5:[25,1],test_to_a_after_each:9,floor:18,when:[0,1,9,12,2,19,16,15,4,30,7,31,32,33,24],refactor:16,simple_limit_skip_find_one_queri:15,test:[9,12,19,16,20,4,15,32,33,31,17],miliscecond:[30,7],node:[11,9,2,16,32,8],insensit:9,consid:15,sql:32,cachefunctionscrc32:1,dropdup:[16,17,15],"_id":[0,17,12,16,15,4,6,33,24,26],longer:[16,4],ignor:[32,1,15],time:[11,17,18,2,16,15,27,32,24,9],push:[32,16,30,17,9],backward:[16,9],concept:[32,16],skip:[22,0,9,8,15],global:16,primer:[11,33,27],row:15,millisecond:24,middl:15,depend:16,dropindex:[22,6,17,8,15],sourc:9,string:[25,0,1,17,9,18,19,3,13,4,29,28,6,31,15,26,32,33,16,20],feasibl:33,test_cursorstream_resum:30,contenttyp:19,level:[16,20,4,15,17],did:[16,17],dig:32,eventemitt:9,iter:[9,15],item:[7,9,15,16,20,4,30,32,17],quick:[32,33],div:[21,13,28,8],round:32,databasenam:[17,24],wtimeout:[16,17,15],addtoset:32,sign:[28,13,31],slow_onli:20,cost:16,port:[16,17,24],comparis:4,checkoutwrit:17,repli:[32,20,15],current:[20,17,19,3,13,4,32,33,28],subtype_uuid:25,deriv:[28,13],gener:[17,15,16,18,33,24],wait:[17,15],box:32,bson_data_regexp:1,shift:[16,13,28],queue:32,behav:16,more_complex_ensure_index_test:[17,15],extrem:16,weird:16,checkkei:1,extra:0,modul:16,prefer:[0,16,32],toarrai:[0,17,15,16,20,22,32,8,9],instal:[32,16],includeloc:15,perf:16,memori:[0,9,27,11,16,32,33],regep:32,live:[32,16,33],handler:33,value2:0,value1:0,criteria:12,scope:[32,16,1,17,15],prev:15,maxkei:[10,11,1,16,21,8],multiplecoll1:17,finit:[28,13],examin:32,content_typ:[19,33],cap:[32,16,17,15],uniqu:[0,15,17,24,6],test_correctly_access_collect:17,whatev:24,bson_binary_subtype_funct:[25,1],mongo:[11,17,27,16,12,32,33],stream:[7,9,19,16,30,4,1,22,32,33,8],predict:16,bson_data_long:1,createcollect:[17,15,31,30,22,32,8,9],occur:[0,9,12,19,16,4,6,31,24],alwai:[32,28,13,9,15],multipl:[15,2,28,13,24,16],ping:[22,16,20,17,8],fieldvalu:0,write:[25,1,17,2,19,16,4,21,7,22,32,33,8,26],foreach:[4,15],pure:[25,7,17,18,30,16,20,4,1,15,26,9],map:[32,15],product:[28,13],max:[16,15,17,9],dive:[32,33],date:[1,9,18,16,20,6,15,32],docstartindex:1,data:[25,11,7,17,15,19,16,27,4,30,1,26,32,33,9],grow:32,sbrekken:16,inform:[9,15,2,19,20,4,6,32,24,17],"switch":16,reaper:[16,17,24],combin:[4,17],keepgoingexampl:15,filedata:4,increas:16,still:[0,16,12],pointer:[0,31,4,24,19],test_map_reduce_funct:15,group:[16,33,22,8,15],gte:0,indexexist:[16,22,8,15],jim:15,nodelai:[2,16,24],platform:32,mbostock:16,requir:[25,7,17,9,12,30,16,18,4,31,1,15,26,32,33,24,20],main:[32,33],non:[16,15],simple_skip_collect:9,col2:17,col3:17,initi:[9,15,16,4,32,33,17],col1:17,verifi:[17,20,4,15,18],now:[32,16,33,17],nor:31,introduct:[2,11,32,27],mapreduc:[16,22,8,15],name:[25,0,1,17,12,2,19,3,20,4,24,6,31,15,33,16,9],drop:[17,15,16,20,6,22,31,8],revert:0,crypto:16,separ:[0,16,4],failov:[2,16],replai:16,replac:[0,15,16,12,4,32],individu:[0,16],a_1_b_1:[17,15],poolreadi:16,serverclust:16,happen:[30,7,4,9],shown:[32,33],accomplish:33,space:[1,17],profil:[20,9,15],stuff:[2,11,33,32,27],factori:[0,24,15],resultset:32,"_event":16,mime:4,sethml:16,replacethiscollect:15,org:17,"byte":[25,0,1,17,18,19,16,32,33,24],care:[2,0,32],test_gs_tel:4,synchron:32,thing:[32,33,24],place:[28,13],year2013:16,frequent:[28,13],first:[0,17,12,19,31,20,4,33,15,32,18,24,9],origin:[15,12],bson_binary_:16,directli:[0,9,32],onc:[6,32],arrai:[25,0,1,17,12,2,19,16,20,4,15,32,31,9],"0x7f":1,reopen:[4,24],"long":[11,1,9,18,16,13,21,32,8],open:[7,17,12,2,19,16,20,4,22,31,30,15,26,32,33,24,8,9],predefin:1,size:[0,1,17,15,19,16,13,4,33,28,9],given:[25,9,15,28,13,4,33,17],breviti:[32,33],workaround:16,paramt:9,collectionnam:[17,15,31,20,6,22,33,8],conveni:[0,28,13],subtype_md5:25,especi:32,copi:2,specifi:[25,0,9,15,19,4,32,33,24,17],test_arrai:9,keepgo:[16,15],than:[0,9,12,2,19,16,13,28,15,33,24],png:[19,4],tedeh:16,were:[9,12],posit:[25,19,28,13,4,33],pre:[1,17,15,20],sai:33,ani:[0,17,12,32,33,9],simple_rename_collection_2:17,bitwis:[32,28,13],alias:0,destroi:[30,7,22,8],note:[28,13,17,9],take:[0,1,2,16,32,33],createfromhexstr:[0,16,21,8,18],begin:[0,4],sure:[33,9],normal:9,buffer:[25,0,1,17,12,19,16,15,4,31,26,33,24,9],clearer:16,getyear:15,renam:[17,15,31,22,32,8],byte_valu:25,later:[33,17,15],indexbound:[17,15],test_gs_read_stream:4,runtim:16,parseint:15,axi:15,show:[25,7,17,18,30,15,4,1,26,32,9],atom:[32,16,15],objectid3:18,objectid2:18,concurr:16,corner:16,onli:[0,17,12,2,16,20,4,6,15,32,33,24,9],slow:[16,20,17,15],dice:32,setprofilinginfo:20,activ:16,written:[25,15,28,13,4,33],analyt:32,overwritten:33,min_valu:[28,13],variou:[20,15],get:[11,7,17,9,18,19,16,12,4,31,22,6,27,30,15,26,32,33,24,8,20],secondari:[2,16,15,17,9],ssl:[16,17],cannot:[17,15,28,13,32,9],shiftrightunsign:[21,13,28,8],geo:15,nolock:[16,17],doabl:0,seldom:16,yield:[16,15,17,31,12],isarrai:1,where:[25,0,1,17,12,2,19,16,15,4,6,32,33,31],highbit:[28,13],desced:9,wiki:32,testcas:16,infinit:[16,13,28],detect:2,heckmann:16,fs_chunk:33,integration_tests_2:17,timestamplib:28,wayt:15,enough:9,between:[32,16,17,24],"import":[32,33],across:[16,24,15],spars:[6,17,15],test_group:15,come:[19,28,13,15],simple_find_and_modify_operations_:15,region:15,gwt:[28,13],tutori:[11,33],mani:[32,9],fromnumb:[21,13,28,8],reindex:[22,16,17,8,15],iscap:[16,22,8,15],db_option:24,period:[0,31],pop:32,createcreateindexcommand:16,fs_file:33,lessthan:[21,13,28,8],reaperinterv:[16,17,24],cursor_information_collect:17,cursorinst:9,coupl:[25,32,15],aciev:0,rebuilt:[17,15],derefer:[22,16,17,8],lowbit:[28,13],geonear:[16,22,8,15],"1mb":33,those:[28,13],"case":[9,15,28,13,6,32,33,16],myself:32,bson_seri:16,tostr:[25,26,15,28,13,4,21,18,33,8],trick:33,invok:33,idhex:0,firstext:20,simple_sort_collect:9,advantag:32,eras:[19,31],ascii:[2,25,16,24],acess:17,develop:32,author:[0,19,12],same:[0,17,18,16,13,4,6,15,28,9],binari:[25,0,26,7,17,9,18,11,16,12,4,30,21,1,15,19,32,31,8,20],document:[0,1,17,9,11,2,19,16,12,4,30,6,31,7,15,32,33,24,20],createpk:24,exhaust:9,finish:[33,15],closest:[28,13,15],utf8:[2,32,16,4,24],nest:[0,6],oid:3,driver:[0,12,2,11,16,27,31,22,32,33,24,8],gotend:4,newobjectid:18,improv:16,defo:0,bson_data_boolean:1,crud:[11,32,27],without:[1,17,28,13,24,31,16],model:15,dereferenc:17,upsert:[15,12],ourexamplefiletowrit:4,execut:[9,12,16,20,4,15,32,17],rest:[16,15,18],hint:[9,15],db_connector:[31,24],except:[32,16,4,12],littl:32,blog:[0,31],default_chunk_s:4,haystack:15,found2:4,around:[32,16],read:[25,7,17,15,2,19,16,4,21,22,32,33,8,9],grid:[25,11,26,16,22,33,8],spank:16,world:[7,17,12,15,4,1,33,26],lasterror:[22,16,17,8],reap:16,mod:[0,28,13],saniti:16,poolsiz:[7,9,15,16,20,4,30,26,32,24,17],integ:[0,1,18,28,13,32,16],server:[25,1,17,9,18,2,30,16,12,4,31,7,15,26,32,33,24,20],either:[19,16,33,32],output:[0,15],greaterthanorequ:[21,13,28,8],manag:[19,16,32],bson_binary_subtype_byte_arrai:[25,1],eventloop:33,"_bsontyp":16,intact:12,generationtim:18,setnodelai:16,slice:32,writedata:33,node_ev:16,confirm:32,legal:15,evolv:32,profilinginfo:[20,22,8],bson_data_binari:1,broken:16,aquir:17,bson_binary_subtype_default:[25,16,1],regexp:[32,16,1],"throw":[32,16,33,12],comparison:18,pointer_to_collect:0,firstnam:[0,6],numbit:[28,13],bson_data_code_w_scop:1,gump:15,act:33,luck:33,readstream:[22,11,7,9,8],addus:[22,16,20,17,8],test_collections_info:17,your:[2,32,33,4,15],loc:15,log:[0,1,9,12,19,16,20,31,15,32,33,24],hex:[0,26,4,18],overwrit:[20,4],errormessag:16,start:[25,0,1,9,15,2,31,4,32,33],interfac:[7,9,16,30,32,26],low:[32,28,13,33],lot:[9,15,16,6,30,32,33],tupl:6,shamelessli:32,replsetsrv:2,faster:[6,16],pull:[32,16,20],dirti:32,possibl:[0,17,12,16,15,6,32],"default":[25,0,1,17,18,2,19,16,12,4,6,31,15,32,33,24,9],remove_subset_of_documents_saf:15,dropdatabas:[22,20,17,8,24],bson_data_min_kei:1,expect:[0,24],gone:[26,15,4,17],creat:[25,0,1,17,18,2,19,16,20,4,30,6,31,7,15,26,32,33,24,9],certain:[6,32],intro:32,file:[7,26,19,16,4,33,17],calculateobjects:[21,1,8],again:[4,9],field:[0,17,12,16,15,6,32,9],valid:[25,1,17,18,31,20,9],longlib:13,you:[0,1,17,12,2,19,16,15,6,31,32,33,24,9],pefrom:15,sequenc:16,symbol:[11,1,29,16,21,32,8],opt_radix:[28,13],pool:[16,17,24],reduc:[16,13,28,15],lessthanorequ:[21,13,28,8],directori:16,descript:[25,1,4,9,17],tricki:32,potenti:16,alright:32,cpu:[16,33],unset:32,represent:[10,25,26,18,3,13,4,5,14,29,28],all:[0,1,17,12,2,19,16,20,4,6,31,15,32,33,24,9],forget:32,numberupd:15,dollar:31,simple_rename_collect:17,follow:[0,9,12,2,4,6,32,33],fetchsiz:9,disk:[33,7,4,15,9],subtype_default:25,nextobject:[22,0,17,8,9],init:9,setprofilinglevel:[20,22,8],evaul:17,util:16,test_rename_collect:15,failur:[32,16],veri:[32,16,33],list:[17,15,16,20,4,22,32,33,31,8],resav:15,adjust:[16,33],findandremov:[16,22,8,15],small:[16,33],retun:1,zero:[16,13,28,18],pass:[1,17,18,2,16,15,4,31,33,24,9],what:[32,31,33,9],abc:[0,4,12],xor:[21,13,28,8],sub:[25,15],sum:[28,13],delet:[17,15,19,16,4,22,32,33,24,8,26],version:[16,33,17,24,15],cruso:0,method:[25,0,31,9,11,16,18,4,27,15,32,33,24,26],full:[16,17,15],hash:[0,16,33,17,24],variat:32,getmorecommand:[9,15],foobar3:4,modifi:[32,15,12],valu:[0,1,16,4,6,8,9,12,13,14,15,31,17,18,19,20,21,24,25,29,28,32,33],isodd:[21,13,28,8],ahead:[32,33,15],showdiskloc:[16,9,15],amount:[32,28,13,17],pick:[32,16,33,17],narrow:15,evalfunct:1,via:32,shorthand:12,c_1:15,deprec:17,default_root_collect:4,establish:[7,9,15,16,20,4,30,26,17],select:[16,15,24,31,12],test_collection_is_cap:15,distinct:[16,22,8,15],regist:4,two:[0,13,17,18,2,19,28,12,4,6,32,33,31],coverag:16,bson_binary_subtype_user_defin:[25,1],taken:32,minor:16,more:[0,7,17,12,2,16,13,4,30,15,32,33,28,9],flag:15,stick:32,particular:32,cach:1,none:2,outlin:[32,33],histori:17,remain:[33,4],scan:[9,15],share:[16,17,24],shard:19,accept:[16,15],simple_document_insert_collection_no_saf:15,default_url:17,robinson:0,cours:32,newlin:4,divid:[28,13,15],rather:15,anoth:[0,4,32,18],simpl:[25,0,7,17,11,30,16,15,4,6,27,1,26,32,33,31,9],perman:17,resourc:24,variant:32,reflect:16,unlink:[22,19,33,4,8],associ:[33,4],keyorlist:9,github:[32,16],defineproperti:16,save_a_simple_document_modify_it_and_resave_it:15,caus:[32,16],callback:[0,17,12,19,16,20,4,6,31,15,32,33,24,9],spheric:15,doc_id:0,bson_data_oid:1,trade:33,through:[32,16,17,15],reconnect:[16,24],paramet:[0,17,12,2,19,16,20,4,6,31,32,33,24,9],style:32,mongorepli:16,call:[0,9,16,4,33,24,17],asbuff:1,dbname:[16,17],rapidli:32,bypass:32,simple_limit_skip_queri:15,might:[6,33,17,32],alter:[0,31],good:[32,33],"return":[0,7,3,4,5,1,9,10,12,13,14,15,16,17,18,19,20,24,25,26,29,28,30,31,32,33],timestamp:[11,1,15,16,18,21,28,8],more_complex_index_test:[17,15],distancemultipli:15,compound:[17,15],readlen:4,uploadd:19,instruct:2,authent:[22,16,20,17,8],easili:[16,13,28],achiev:0,skipvalu:9,found:[0,12,4,15,17],truncat:[31,33,4],hard:32,realli:32,connect:[11,7,17,15,2,16,20,4,27,30,22,26,32,33,24,8,9],barrier:16,event:[7,9,19,16,4,30,32,33,24,17],read_primari:16,pullal:32,foreground:[17,15],core2duo:16,advanc:[11,27,31,4,32,33],asc:[0,9,12],reason:4,base:[15,19,18,4,32,33],connectionopt:17,put:[25,9,15,16,4,21,22,33,8,26],seconddb:17,gethighbit:[21,13,28,8],tailabl:[16,9,15],omit:[32,3,33,16],dir:12,assign:[2,16],notifi:[32,33,15],articl:[11,33,27],lastnam:[0,6],number:[25,0,1,17,9,18,16,13,4,28,6,14,15,32,33,24,20],done:[0,7,17,12,19,16,20,30,15,32,33,24],construct:[28,13],autoclos:[19,33,7,4],create_and_drop_an_index:[17,15],miss:16,differ:[17,18,16,13,4,6,15,32,33,28,26],chunk_typ:4,script:19,interact:[32,33,4,26],least:[0,15],custompkfactori:24,settim:18,statement:[32,33,17],illeg:[26,16,20,17,15],master:2,store:[1,9,19,4,32,33,17],otherid:18,option:[25,0,1,17,12,2,19,3,20,4,24,22,6,31,15,26,32,33,16,8,9],reseterrorhistori:[22,17,8],native_pars:[7,9,15,20,4,30,26,24,17],getter:[4,18],pars:[16,1,15],literarili:32,std:16,kind:33,bson_data_nul:1,whenev:[17,15],remov:[17,12,16,20,4,22,6,15,32,31,8],reus:[16,1,17],str:[28,13],consumpt:33,luckili:[32,33],"null":[0,1,17,15,2,16,20,4,30,31,26,24,9],built:32,equival:[32,15],valueof:[21,14,8,29],fromcollect:17,also:[0,9,12,16,4,6,32,33,31],build:[32,16,20,33,17],choos:[32,15],reach:[33,7],most:[0,33,32],cygwin:16,selector:[16,15,17,9],"16mb":19,filesystem:19,cover:17,part:[32,16,18],clean:[16,17],frombit:[21,13,28,8],find:[0,7,17,12,19,16,20,22,6,30,15,32,8,9],firewal:16,pretti:32,test_gs_weird_bug:4,numberofdocu:1,batch_document_insert_collection_saf:15,hit:[17,15],unus:16,express:[0,32,19,15],fieldtoupd:32,test_map_reduce_functions_scop:15,nativ:[32,16,24],restart:[30,7],statist:[16,20,17,15],wrote:32,set:[0,1,17,9,18,2,19,16,12,4,6,31,15,32,33,24,20],see:[0,12,19,28,13,6,31,32,33,24],close:[7,17,15,19,16,20,4,30,22,26,32,33,24,8,9],my_f:4,misalign:16,someth:[4,24],hold:[32,1,4,9],altern:15,signatur:[4,9],complement:[28,13],javascript:[1,17,15,28,13,32],salzman:16,succeed:6,both:[16,15],last:[19,17,32],create_and_drop_all_index:[17,15],context:24,logout:[22,20,17,8],whole:[32,15,4,17],createdat:9,load:[0,16],simpli:0,jsmode:15,point:[9,15,28,13,32,33],instanti:[32,16],shutdown:16,suppli:[16,33],backend:32,faithfulli:[28,13],user_id:15,due:[32,16,26],empti:[25,0,15,4,9],strategi:[32,16],test_streamingrecords_funct:9,fire:[7,17,12,19,4,32,33,24],admindb:[20,17],imag:[19,33],understand:32,func:[1,15],look:[9,15,19,16,4,6,32,33],straight:[32,33],batch:[32,16,9,15],"while":[0,16,4,19,9],getownpropertynam:16,behavior:[0,12,16,13,32,28],error:[0,7,17,12,19,16,20,4,6,31,30,15,32,24,9],fun:33,robin:32,loop:16,test_gs_unlink:4,readi:[30,7,4,32,9],key2:0,key1:0,jpg:4,itself:9,test_deref_exampl:17,rid:16,simple_key_based_distinct_sub_query_filt:15,chase:16,decor:16,gs2:4,geohaystacksearch:[16,22,8,15],p_db:[2,17],higher:[2,16,33,24,15],optim:[16,15],operaion:19,numberofretri:[16,17,24],iya_logo_final_bw:4,temporari:[4,15],user:[25,0,1,17,12,16,20,4,6],hello2:15,keyf:15,recreat:24,lower:[17,15],entri:[33,15,4,17],explan:[17,15],getlowbitsunsign:[21,13,28,8],a_1:15,shape:16,update_a_simple_document_multi:15,bson_data_timestamp:1,cur:33,keeptemp:15,appli:[0,16,9,32],input:[28,13,15],subsequ:[17,15],format:[0,17,15,12,20,9],big:[32,16,33],checksum:4,shiftright:[21,13,28,8],rs_name:[2,16],replsetserv:[25,1,17,18,2,30,16,20,4,7,15,26,9],success:[19,4,9],resolv:17,collect:[0,2,3,4,6,8,9,11,12,20,31,17,15,19,22,23,24,26,27,30,16,32,33],bson_data_cod:1,popular:32,bamboo:16,serverpair:16,often:[28,13],creation:[32,16,20,17,15],some:[25,0,7,17,15,19,16,4,6,26,32,33,9],back:[0,13,15,28,20,4,32,18],understood:32,dropallindex:[22,8,15],scale:[32,33,15],slaveok:[16,17,15],chunksiz:[19,33,4],retri:[32,16,17,24],larg:[0,17,15,19,32,33],intial:15,previou:[33,24],run:[11,17,15,2,16,12,32,33,27],simple_reset_error_history_col:17,step:33,simple_explain_queri:15,subtract:[21,13,28,8],recordquerystat:17,block:[33,17,15],plan:33,within:[28,13],simple_index_test:15,ensur:[17,15,16,6,32,33],chang:[15,16,13,32,33,28],test_collection_index_exist:15,question:[28,13],textual:[28,13],custom:[0,16,33,24,15],includ:[0,9,15,16,4,6,31,32,24,17],forward:4,files:4,properli:[16,4],uniquedoc:15,ascend:[0,9,6],link:[11,33,32,27],simple_count_exampl:15,line:[33,4],info:[16,20,33,17,15],concaten:[28,13,4],consist:16,caller:9,forceserverobjectid:[16,17,24],readlin:[22,4,8],similar:19,constant:[25,1,9,4,21,22,8,17],multiplecoll2:17,parser:[16,1,17,24],doesn:[0,24,12],repres:[9,18,28,13,4,29,14,32],isconnect:16,titl:[0,15,23,12],unidirect:9,wakup:17,nice:32,deseri:[1,9,16,21,32,8],jannehietamaki:16,mongodb:[0,1,2,16,4,6,7,8,9,11,12,15,31,17,18,19,20,24,25,26,30,32,33],eval:[1,17,15,16,22,8,9],profilinglevel:[20,22,8],algorithm:[2,28,16,13,24],cursorinform:17,tradeoff:33,far:4,hello:[25,7,17,12,15,4,1,32,33,26],code:[25,7,17,18,30,16,20,4,1,15,26,32,33,9],partial:[9,15],worldbuff:4,queri:[0,31,17,12,11,16,20,4,6,27,15,32,23,24,9],idvalu:0,replicasetcheckinterv:16,base64:[2,16,24,26],update_a_simple_document_upsert:15,send:[2,32,16,17,24],io_seek_end:4,"256k":33,sens:12,reapertimeout:[16,17,24],passiv:16,result2:26,writebuff:16,untouch:24,relev:32,gettim:[9,18],fieldorspec:[17,15],fewer:15,"try":[32,16,15,33,12],race:16,refer:[9,3,4,32,16,17],smaller:19,fortun:32,natur:32,jump:[32,33],video:33,download:32,odd:[28,13],append:[19,4,32],compat:16,index:[11,1,17,15,16,6,22,23,31,8,9],compar:[18,28,13,4,6,21,8],descriptor:33,access:[9,15,19,20,4,29,14,17],experiment:16,asced:9,lee:16,bson_data_int:1,batchsizevalu:9,cursor_count_collect:9,let:[7,9,15,16,4,32,33,17],filedescriptor:33,becom:32,sinc:[32,28,13,33,12],subtype_byte_arrai:25,nexttick:16,convert:[0,32,18],convers:[32,15],larger:[19,16,33],implement:[32,16,13,28],configur:[2,32,16,17,31],read_secondari:[2,16],app:[2,16],api:[11,21,33,17,22],from:[25,0,26,1,17,9,18,2,13,16,12,4,31,15,19,32,33,28,20],batchsiz:[22,15,17,8,9],doubl:[11,16,21,14,32,8],next:[0,33,1,9,24],chr:4,sort:[0,9,12,16,18,22,6,15,8],benchmark:16,name2:0,socketopt:[2,16,24],sollect:31,account:15,retriev:[0,17,12,19,16,20,4,15,32,33,9],scalabl:19,multiple_db_inst:17,annot:33,unopen:16,fetch:[0,26,9,15,6,32,17],queryfailur:16,control:[32,16,33,24],objectid:[25,0,7,17,18,11,3,20,4,24,30,21,1,15,26,32,33,16,8,9],process:[28,16,13,9],lock:[16,33,17],username_:6,high:[17,15,28,13,32,16],tag:[16,15],serial:[1,17,15,16,21,8],pingresult:20,integration_test_:[2,17],instead:[0,17,15,2,16,6,33,24,9],npm:[32,16],await:17,formattedorderclaus:16,originaldata:26,alloc:[16,1,17],seriou:16,remove_all_documents_no_saf:15,correspond:[6,28,13,31],element:[0,4,32,9],issu:[32,16,15],writ:4,allow:[17,15,16,20,31,32,33,24,9],subtyp:25,deoptim:16,doc2:32,doc3:32,move:[19,16,4,32],doc4:32,autoindexid:17,server_opt:24,effici:[32,33,15],bunch:[16,17,15],perfect:32,crash:16,greater:[0,28,13,9],handl:[9,15,28,13,4,32,33,16],databs:[19,31,24],auth:[16,17],renamecollect:[22,17,8],precess:32,numberofremoveddoc:15,writefil:[22,19,33,4,8],convin:0,anyth:16,edit:[33,4],deserializeddoc:1,exampledb:[32,33],subset:[9,15],opensync:4,chunk:[19,16,33,4],bson_binary_subtype_uuid:[25,1],default_content_typ:4,pushal:[32,16],our:[32,33,4,9],special:[32,28,13,33,9],out:[11,17,15,2,16,18,32,33,24,27],variabl:[32,16,15],trickier:[0,32],categori:33,suitabl:33,leverag:32,ref:16,math:18,jessica:[0,12],insid:[0,33,19,6],dropcollect:[22,31,17,8],manipul:15,releas:16,princess:15,unwant:0,could:[32,16],shiftleft:[21,13,28,8],keep:[19,16,17,32,15],length:[25,1,17,18,19,20,4,21,15,33,8,9],lte:0,primarki:0,minkei:[11,16,1,21,5],debugmessag:16,iszero:[21,13,28,8],should_correctly_rewind_and_restart_cursor:9,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:17,prioriti:16,strict:[16,31,17,24,15],system:[31,33,4],messag:[12,17,15,16,20,4],createfromtim:[16,21,8,18],bson_data_max_kei:1,termin:4,"final":[32,16,15],deconstruct:33,test_gs_getc_fil:4,exactli:31,gridstorew:4,bson_data_object:1,replset:[2,17],mongoserv:[31,24],tocollect:17,charact:[25,16,15,4,18],test_gs_puts_and_readlin:4,result:[0,26,7,17,9,12,13,16,18,4,28,15,19,32,33,24,20],counter:[24,15],terribl:16,corrupt:20,have:[0,17,15,2,31,4,6,32,33],tabl:[32,31],need:[0,1,17,12,19,28,13,6,31,32,33,24],turn:[0,20,17],buildinfo:[20,22,8],min:[16,15,17,9],mix:[0,6],andrewjston:16,milli:20,test_other_drop:15,orgiin:4,singl:[25,0,17,12,19,16,15,4],fileid:[33,7,4],statsync:4,whi:0,serverconfig:[16,17,24],why:32,overwriten:4,url:17,integration_tests_to_drop:17,request:[16,9],face:32,test_collect:12,snapshot:[9,15],determin:[32,9],streamrecord:[22,32,16,9,8],fact:[32,12],text:[28,13,33,4],serializefunct:[16,1,17,15],verbos:15,nagl:[2,16,24],anywai:[17,15],setter:[4,18],locat:[32,15,4,9,17],should:[0,13,17,18,28,20,15,26,33,31,9],test_cursorstream_paus:30,local:[3,17],doc1:32,ritch:16,gettimestamp:[16,21,8,18],donewithwrit:33,enabl:[16,17,24],simple_batch_size_collect:9,tohexstr:[0,16,21,8,18],integr:[32,33],contain:[25,1,9,15,2,31,4,32,33,17],grab:[20,17,9],modulo:[0,21,13,28,8],packet:16,fromint:[21,13,28,8],statu:[32,16],wire:[32,16],correctli:[32,16,15],state:[32,9,24],crude:32,world2:15,kei:[0,1,17,15,16,4,6,32,33,24,9],buckets:15,simple_queri:15,isol:16,job:15,entir:[33,4,9],auto_reconnect:[7,9,15,2,20,4,30,26,32,33,24,17],crc32:1,addit:[0,1,17,15,28,13,33,9],admin:[11,17,15,16,20,22,8],equal:[25,0,7,17,9,18,30,28,13,4,21,1,15,26,32,8,20],etc:[0,24,15],instanc:[1,17,18,2,16,20,4,15,26,32,33,24,9],greaterthan:[21,13,28,8],subtype_funct:25,comment:[16,9,15],toint:[21,13,28,8],removealllisten:16,save_a_simple_docu:15,addition:31,compon:16,json:[11,21,13,28,32],treat:[0,16,9],pkfactori:[17,15],immedi:12,bit:[0,1,19,28,13,32,33,16],assert:[25,7,17,18,30,20,4,1,15,26,9],present:[6,31],replic:[2,17],multi:[15,12],plain:16,cursor:[0,7,17,11,16,20,22,30,15,32,8,9],defin:[25,0,1,17,12,16,13,4,28,15,32,24],setreadprefer:16,bson_data_arrai:1,layer:32,helper:16,site:2,tojson:[28,16,13,21,8],getc:[22,4,8],cross:16,member:[2,16],world_no_saf:15,probabl:0,difficult:33,incorrect:16,slave:2,hostnam:24,keepal:[2,16,24],upon:9,retriv:20,serializewithbufferandindex:[21,1,8],chunk_siz:[19,4],off:[9,2,16,20,4,31,32,24,17],center:15,nevertheless:24,well:[0,16,33,32],exampl:[25,0,26,7,17,9,18,11,31,12,4,30,6,27,1,15,19,32,33,24,20],command:[9,15,16,20,4,22,32,24,8,17],simple_geo_near_command:15,validatecollect:[16,20,22,8],latest:32,distanc:15,paus:[30,7,22,8],less:[32,28,13],"boolean":[7,17,15,19,28,13,4,6,1,33,9],additon:6,tcp:32,indexinform:[17,15,16,6,22,8,9],web:32,seekloc:[33,4],add:[13,17,18,28,20,6,21,15,32,8],cleanup:[16,33],logger:16,match:[0,20,15,12,28,13,32,31],simple_key_based_distinct:15,piec:[32,28,13,33],know:31,password:[16,20,17],recurs:[13,28,1,4],isclos:[22,9,8],desc:[0,9],bson_data_str:1,insert:[0,1,17,9,11,16,12,4,22,31,30,15,32,23,24,8,20],resid:32,like:[0,17,15,28,13,6,33,9],fsync:[17,15],chunkcollect:[22,4,8],necessari:0,"0xff":1,async:32,page:[0,32,11],dispatch:32,linux:16,gridf:[11,26,27,19,16,4,33],flush:[33,7,4],proper:16,fileinfo:33,newhex:18,librari:[16,33],lead:[16,13,28],leak:16,avoid:[6,16,20,32],octet:4,thank:16,leav:[16,12],mode:[9,15,19,16,4,31,33,24,17],slight:32,journal:17,usag:[25,11,1,26,18,2,19,16,4,31,32,33,24],collection_nam:31,host:24,although:33,offset:[25,33,4],java:[28,13],simpler:[32,16,9,15],about:[17,12,6,32,33,24,9],actual:[0,33,17,32,24],socket:[2,32,16,17,24],http:[32,16],dbinstanc:33,notequ:[21,13,28,8],constructor:[1,2,3,4,5,7,8,9,10,13,14,15,16,17,18,20,21,22,24,25,26,29,28,30],fals:[0,7,17,12,19,16,20,4,30,31,1,15,26,33,24,9],disabl:[2,16,24],own:[16,4],automat:[7,17,2,19,16,32,33,24,9],dataset:[0,32],bson:[0,7,3,4,5,1,8,9,10,11,12,15,14,16,17,18,20,21,24,25,26,29,30,31],merg:[16,15],val:15,pictur:33,transfer:17,mykei:32,trigger:[7,9,15,16,4,30],concat:0,"var":[25,0,1,17,9,18,2,19,31,12,4,30,7,15,26,32,33,24,20],fsname:26,"function":[0,1,2,16,4,7,9,12,13,15,31,17,18,19,20,24,25,26,28,30,32,33],brand:16,waitforconnect:16,overflow:[28,13],inlin:15,bug:[16,33],count:[0,17,12,16,15,4,22,31,8,9],made:33,wise:0,whether:[28,13],wish:[25,1,17,15,20,4,33],displai:17,asynchron:[2,32],record:[0,17,12,19,31,15,4,6,32,24,9],below:[32,28,13,17,12],limit:[0,9,15,19,22,32,8],otherwis:[1,9,28,13,4,32,33],problem:[16,20],evalu:[1,17],"int":[28,13],dure:[32,16,17,15],year:0,filenam:[19,16,33,4],replica:[2,16,17],retrymilisecond:[16,17,24],inc:[32,16],tick:16,detail:[6,9,19],deepequ:[26,15,4,9,17],other:[0,11,2,16,13,4,32,33,28,27],bool:18,futur:[32,16,17],branch:16,stat:[16,22,8,15],findon:[0,17,15,16,22,32,8],"class":[10,25,7,17,9,18,30,3,13,4,5,28,1,14,33,15,26,32,29,16,20],stai:15,eof:[22,19,33,4,8],integration_test:[7,9,15,20,4,30,26,17],kaij:16},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Long()","Double()","Collection()","Changelog","Db()","ObjectID()","GridStore","Admin()","Binary JSON API","Driver API","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Symbol()","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","api-bson-generated/long","api-bson-generated/double","api-generated/collection","changelog/changelog","api-generated/db","api-bson-generated/objectid","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","api-bson-generated/symbol","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file From 33c589b43ac6446422605b521b52c45d557303f2 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Mon, 13 Feb 2012 17:31:30 +0100 Subject: [PATCH 09/56] Updated docs to 0.9.9 --- .buildinfo | 2 +- api-articles/index.html | 10 +++++----- api-articles/nodekoarticle1.html | 10 +++++----- api-articles/nodekoarticle2.html | 10 +++++----- api-bson-generated/binary.html | 10 +++++----- api-bson-generated/bson.html | 10 +++++----- api-bson-generated/code.html | 10 +++++----- api-bson-generated/double.html | 10 +++++----- api-bson-generated/index.html | 10 +++++----- api-bson-generated/long.html | 10 +++++----- api-bson-generated/maxkey.html | 10 +++++----- api-bson-generated/minkey.html | 10 +++++----- api-bson-generated/objectid.html | 10 +++++----- api-bson-generated/symbol.html | 10 +++++----- api-bson-generated/timestamp.html | 10 +++++----- api-generated/admin.html | 10 +++++----- api-generated/collection.html | 10 +++++----- api-generated/cursor.html | 10 +++++----- api-generated/cursorstream.html | 10 +++++----- api-generated/db.html | 10 +++++----- api-generated/grid.html | 10 +++++----- api-generated/gridstore.html | 10 +++++----- api-generated/index.html | 10 +++++----- api-generated/readstream.html | 10 +++++----- changelog/changelog.html | 10 +++++----- contents.html | 10 +++++----- genindex.html | 24 ++++++++++++------------ index.html | 10 +++++----- markdown-docs/collections.html | 10 +++++----- markdown-docs/database.html | 10 +++++----- markdown-docs/gridfs.html | 10 +++++----- markdown-docs/index.html | 10 +++++----- markdown-docs/indexes.html | 10 +++++----- markdown-docs/insert.html | 10 +++++----- markdown-docs/queries.html | 10 +++++----- markdown-docs/replicaset.html | 10 +++++----- objects.inv | Bin 1218 -> 1217 bytes search.html | 10 +++++----- searchindex.js | 2 +- 39 files changed, 189 insertions(+), 189 deletions(-) diff --git a/.buildinfo b/.buildinfo index c99c1eba670..22c7ebed6af 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: c17150b5838a3e308c3c7bec6e59b487 +config: 492103bbe0e2a5e5f605d1b228464520 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/api-articles/index.html b/api-articles/index.html index fa85562d9e6..157429aa7dc 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -7,7 +7,7 @@ - Articles — MongoDB Node.JS Driver 0.9.8.7 documentation + Articles — MongoDB Node.JS Driver 0.9.9 documentation @@ -15,7 +15,7 @@ - + @@ -132,7 +132,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -443,7 +443,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -931,7 +931,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -163,7 +163,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -180,7 +180,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -155,7 +155,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -431,7 +431,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -170,7 +170,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -1106,7 +1106,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -2960,7 +2960,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -1201,7 +1201,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -380,7 +380,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -2418,7 +2418,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -356,7 +356,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -2080,7 +2080,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -388,7 +388,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -408,7 +408,7 @@

    Navigation

  • next |
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -454,7 +454,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -682,7 +682,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -964,7 +964,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • @@ -114,7 +114,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 0.9.8.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9 documentation »
  • -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -454,7 +453,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -682,7 +681,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    diff --git a/github/github.html b/github/github.html index 8c54114d6e6..090d620ec43 100644 --- a/github/github.html +++ b/github/github.html @@ -13,17 +13,16 @@ - - - @@ -133,7 +132,7 @@

    Web frameworks using MongoDB

    Last push16:43:58 on 15/1/201220:47:37 on 15/1/2012
    Homepage http://search.npmjs.org/#/breadWatchers16671666
    @@ -1483,7 +1482,7 @@

    Libraries or Applications for analyticsWatchers -1483 +1486 @@ -1558,7 +1557,7 @@

    Libraries for the connect middlewareWatchers -124 +125 diff --git a/index.html b/index.html index 89f83d0b32e..ff3f762fc0c 100644 --- a/index.html +++ b/index.html @@ -13,17 +13,16 @@ - - - diff --git a/markdown-docs/collections.html b/markdown-docs/collections.html index aeea6899394..f329d8418a4 100644 --- a/markdown-docs/collections.html +++ b/markdown-docs/collections.html @@ -13,17 +13,16 @@ - - - diff --git a/markdown-docs/database.html b/markdown-docs/database.html index d4ec9e7fb76..ef89c4e8b66 100644 --- a/markdown-docs/database.html +++ b/markdown-docs/database.html @@ -13,17 +13,16 @@ - - - diff --git a/markdown-docs/gridfs.html b/markdown-docs/gridfs.html index eddc998aa8f..9986b2b7aec 100644 --- a/markdown-docs/gridfs.html +++ b/markdown-docs/gridfs.html @@ -13,17 +13,16 @@ - - - diff --git a/markdown-docs/index.html b/markdown-docs/index.html index 6e6d8bc138b..eddfec7e175 100644 --- a/markdown-docs/index.html +++ b/markdown-docs/index.html @@ -13,17 +13,16 @@ - - - diff --git a/markdown-docs/indexes.html b/markdown-docs/indexes.html index 0d71ddcdcb9..8ab967207fa 100644 --- a/markdown-docs/indexes.html +++ b/markdown-docs/indexes.html @@ -13,17 +13,16 @@ - - - diff --git a/markdown-docs/insert.html b/markdown-docs/insert.html index f20c86e12e2..8875adbaa5f 100644 --- a/markdown-docs/insert.html +++ b/markdown-docs/insert.html @@ -13,17 +13,16 @@ - - - diff --git a/markdown-docs/queries.html b/markdown-docs/queries.html index b2cb16ff8bb..85af05f90f3 100644 --- a/markdown-docs/queries.html +++ b/markdown-docs/queries.html @@ -13,17 +13,16 @@ - - - diff --git a/markdown-docs/replicaset.html b/markdown-docs/replicaset.html index 1d88da6bc13..5cccf1bb92e 100644 --- a/markdown-docs/replicaset.html +++ b/markdown-docs/replicaset.html @@ -13,17 +13,16 @@ - - - diff --git a/objects.inv b/objects.inv index 618933a6002042927c36283f17f3d49109316ba1..95313f0aa5ffb6bb3a4ad1703340a80ef4e77503 100644 GIT binary patch delta 1095 zcmV-N1i1Ub3Bn1GihqvVHW0n=z$VPGP4w^l9Xc? z{rC3??_Ct4?O6H>8Bs->9V z+MtL5`fDaBG^THo$=$OQ#WYv4oHL`XWnPQSFe!$Oxt)G8R#3_veAS=^EL$U*wkDO5 zIpa(ePa>CBtq3idXblT6%i4K4OFbMltORXHS+y&q#AMqI`xmZmo7GB7)mmlSTD&+b zQI{#6^sf(K41cKqHtx^gb}?d%VrgyQht&$js5VlaMf?*Jzr$f9NqF=ZIJ8E3%W|`3 z#nwa}{kviY-ZOsv=mXAT)W5tgH@>q>zX1-@*51eshDH=oUN6#VCWXKyz2S9o)?s?t zWGrTHSBMs)swB=Z&Vwfrm#|8~j>%d-C?%El-u&Ky7k@(zr0gTC4{_~gwYE7Pc_t|G z6w43SOGI)GZs?o}1S#SEG~(^@2L#>5fsQk6Lh)(jBkX-4_9Hx9mLK-Gu?{{lmd3OE z?nj#g8E(SAhD<7|gBWS$j`6e@p^$;o>LnD2<{dN#B#I0va4~3GSF>?X)KJ>Bp*RG)l2f0D$Xh%Qa zumHJ4;S#)+rHjkVW^-_sd#vjPF(f5=1UWse!SssKs8nTyXEn#srbsWSjov!;XE%AT zUVDeL)dydNW`%$__nZDP);Z3!4B2~V8M5zanSYby^li^waG%V*dTU>>YG~--k=a^3 zM6{_|pnQD^Z&Wj-$RUX6=bP1X`V$b<){zdX(Jp=6AmmOd^IfBxwE{aO@~`bZEA{YC zO?Z?SE}Rq*pcvs8##SbU1ar;=QDcx#-J~J(z&=9dymtI)<|6SPBYBhT*%4mDDjzr1 zhkr7aykp2Hj(F<49<81t{|7VMd7bB=u;*NAR9Camxs+TQ*4-y zw}_h>cc0rr>j~x9BRSxr*~{@gDOhM9Z+{23Fmy|k7*&dGc0{%fP^FN@?XPch;JU=@ z?PiobsX$}S@U?V`iMu2 ze5|^RnZXCpXV?J`X`d~GmZSv#N1-*=(%6%bt+)Pz5K86G(az57&&&JuW-nx&azGgA z$<$3cyQq_D4Yba}3y_M(Sgdb8uCNjJ3%yG4O6_CSdvnGHp1Ny@bs z`|%x7ie;&?MbbG17C9tm=FOW&CYO{63j0VK`ks>*crBrQ2a zkJYD}48(xZ%h$%Do~nVUWZRuse`}^~>It7o1~-fO8q(;8et(~EqIL8(A_beoT8as- z4T>0`eu93Z09cGX(ENd6`av@Je!5^ zvQAJ)fNb4WkW@LbhG8do6k+)(6zrHR^_@~uY3I#vEq_)wMghssN4Z9{wzFE>6kVPP zinPSi!{v&QoP!-Yt$aapxIK!ZG7QqoTmt11t+*7==PCPC~_+r3Uy@U+0yn~?ga?twAmWZ%w(zm22fO-d+Dp|}p zx1A6CbAN>KF}8%9!<*B0uf^+KCI|*f)sRP$-EG2E%xu7%oo-5hZM(O3kZU>_ZQrLG zW+0cSQoOe^(zVuy5R7HMAcn+5k3gxXG?-pd8dl_lCnd+xx@ym8jov!d&u%tfPVJ6j zQmlcNiGMQd4l>p|PQ(k@JBSyu?}(S9#&m7aU4MWd&7HbyU!iKKDdB-t^?C?sRHZ<@ z`t0ATW=fHRm)2C^SIBKfwO2iMsp^UvJEq2Ujc#@_lqATtRi9a@yMIf)X znO2N&thrVY`BdJV38KcJ9otDmD1m)|o_Xo+)5J#N9wT{`z}XRA!YUm%)rUNmykp2H zj(<2Rx*lU5Bma$=?YvA=P}pD2VfkVfI=77ri5P&v#`-j3*LQp%1Jw~if?rX0fFkai zoT1^t=6KD0M}G$;gG^BfKj1|)Sm4-deT7bGuf$J~hTXX8bO)sCgtJ1!*W4q%3e7SB z^i?>|H+m?^9>@U~O`e+vByX|Z+z_r|?thj(F{%{X?1)kupim)=-CtjKfXj~*y*(=d zy%PRv3xqCxd%R6_aGLGwl_Sar9PMs?J-Z9oo4Vq?bWt;cQ!O{UU)V-D+sKdTVi0r| z@p;S)zIZ;t4!BoawK`@EiBwd31#FGgH1;f1Rb2m32*vW};N#A!pXc}M&0fed=07mf zt*Mh&~kWa#tZ)!Mhq!@ew0_fkJvi%Z6- M@BaXP0iWCeq$pV->i_@% diff --git a/search.html b/search.html index d89c452baf3..15f1c7710cf 100644 --- a/search.html +++ b/search.html @@ -13,18 +13,16 @@ - - - - + + + + + + + + + + + + + + +An Introduction to the node.js MongoDB Driver +--------------------------------------------- + +.. raw:: html + +
    + + + + + + + + + + + + +
    + + diff --git a/_sources/content/tutorials.txt b/_sources/content/tutorials.txt new file mode 100644 index 00000000000..d9f84d8df3d --- /dev/null +++ b/_sources/content/tutorials.txt @@ -0,0 +1,33 @@ +=================================== +Tutorials using Node.JS and MongoDB +=================================== + +Node.js and MongoDB Tutorial - Using CoffeeScript and Mongoose (ODM) +-------------------------------------------------------------------- +This is a brief tutorial on how to use Node.js (using CoffeeScript) to connect to a MongoDB (using Mongoose) for a small project I am working on with a group of awesome students. + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + +
    Part 1/6 of the tutorialPart 2/6 of the tutorial
    Part 3/6 of the tutorialPart 4/6 of the tutorial
    Part 5/6 of the tutorialPart 6/6 of the tutorial
    diff --git a/_sources/index.txt b/_sources/index.txt index 3767bf14b7b..517b2b876f6 100644 --- a/_sources/index.txt +++ b/_sources/index.txt @@ -18,6 +18,16 @@ Tutorials api-articles/index +Presentations +------------- + +.. toctree:: + :maxdepth: 3 + + content/nodejsvideo + content/awesomeappsvideo + content/tutorials + API Documentation ----------------- diff --git a/_sources/nodejsvideo.txt b/_sources/nodejsvideo.txt new file mode 100644 index 00000000000..82208f75257 --- /dev/null +++ b/_sources/nodejsvideo.txt @@ -0,0 +1,28 @@ +============================== +Node.JS Specific Presentations +============================== + +NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js +--------------------------------------------------------------------- +Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach + +SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include: + +* Dynamic collection creation +* Updating (Increments over sets) +* Schema +* Next gen schemas for dynamic filters + +.. raw:: html + + + +NYC MongoDB User Group - What's in the Trello +--------------------------------------------- +What's in the Trello - Brett Kiefer, Fog Creek + +Trello is a collaboration tool that organizes your projects into boards. Brett Kiefer will discuss how Trello uses Node.js, Socket.io, MongoDB, Redis, and Backbone to create a responsive single-page app. + +.. raw:: html + + \ No newline at end of file diff --git a/_sources/video.txt b/_sources/video.txt new file mode 100644 index 00000000000..aa6527f4dee --- /dev/null +++ b/_sources/video.txt @@ -0,0 +1,19 @@ +============= +Presentations +============= + + +NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js +--------------------------------------------------------------------- +Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach + +SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include: + +* Dynamic collection creation +* Updating (Increments over sets) +* Schema +* Next gen schemas for dynamic filters + +.. raw:: html + + \ No newline at end of file diff --git a/awesomeappsvideo.html b/awesomeappsvideo.html new file mode 100644 index 00000000000..aeb26733dc3 --- /dev/null +++ b/awesomeappsvideo.html @@ -0,0 +1,135 @@ + + + + + + + + + Awesome Node.js + MongoDB Applications — MongoDB Node.JS Driver 0.9.9.1 documentation + + + + + + + + +
    + +
    +
    +
    +
    + +
    +

    Awesome Node.js + MongoDB Applications

    +
    +

    Node.js blackboard - socket.io

    +

    Nodejs test using express, jade, stylus, socket.io and Mongodb +for persist the data +Source: http://github.com/gotik/nodejs-blackboard +http://node.kamikazepanda.com

    +
    +
    + + +
    +
    +
    +
    +
    + +

    Page Contents

    + + + +

    Core Documentation

    + + + + +

    This Page

    + +
    +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/content/awesomeappsvideo.html b/content/awesomeappsvideo.html new file mode 100644 index 00000000000..b6c0b698729 --- /dev/null +++ b/content/awesomeappsvideo.html @@ -0,0 +1,135 @@ + + + + + + + + + Awesome Node.js + MongoDB Applications — MongoDB Node.JS Driver 0.9.9.1 documentation + + + + + + + + + + +
    +
    +
    +
    + +
    +

    Awesome Node.js + MongoDB Applications

    +
    +

    Node.js blackboard - socket.io

    +

    Nodejs test using express, jade, stylus, socket.io and Mongodb +for persist the data +Source: http://github.com/gotik/nodejs-blackboard +http://node.kamikazepanda.com

    +
    +
    + + +
    +
    +
    +
    +
    + +

    Page Contents

    + + + +

    Core Documentation

    + + + + +

    This Page

    + +
    +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/content/nodejsvideo.html b/content/nodejsvideo.html new file mode 100644 index 00000000000..3d4d880cb5a --- /dev/null +++ b/content/nodejsvideo.html @@ -0,0 +1,181 @@ + + + + + + + + + Node.JS Specific Presentations — MongoDB Node.JS Driver 0.9.9.1 documentation + + + + + + + + + + +
    +
    +
    +
    + +
    +

    Node.JS Specific Presentations

    +
    +

    NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js

    +

    Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach

    +

    SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include:

    +
      +
    • Dynamic collection creation
    • +
    • Updating (Increments over sets)
    • +
    • Schema
    • +
    • Next gen schemas for dynamic filters
    • +
    +
    +
    +

    NYC MongoDB User Group - What’s in the Trello

    +

    What’s in the Trello - Brett Kiefer, Fog Creek

    +

    Trello is a collaboration tool that organizes your projects into boards. Brett Kiefer will discuss how Trello uses Node.js, Socket.io, MongoDB, Redis, and Backbone to create a responsive single-page app.

    +
    +
    +

    NYC Node JS Meetup - August 2011 - Mongoose & other MongoDB Connectors

    +

    Mongoose Meetup August 2011

    +
    + + + + + + + + + + + + + +
    +
    +

    An Introduction to the node.js MongoDB Driver

    +
    + + + + + + + + + + + + +
    +
    + + +
    +
    +
    + +
    +
    + + + + + + + \ No newline at end of file diff --git a/content/tutorials.html b/content/tutorials.html new file mode 100644 index 00000000000..143e55afce2 --- /dev/null +++ b/content/tutorials.html @@ -0,0 +1,154 @@ + + + + + + + + + Tutorials using Node.JS and MongoDB — MongoDB Node.JS Driver 0.9.9.1 documentation + + + + + + + + + + +
    +
    +
    +
    + +
    +

    Tutorials using Node.JS and MongoDB

    +
    +

    Node.js and MongoDB Tutorial - Using CoffeeScript and Mongoose (ODM)

    +

    This is a brief tutorial on how to use Node.js (using CoffeeScript) to connect to a MongoDB (using Mongoose) for a small project I am working on with a group of awesome students.

    + + + + + + + + + + + + + + + + + + + + + + +
    Part 1/6 of the tutorialPart 2/6 of the tutorial
    Part 3/6 of the tutorialPart 4/6 of the tutorial
    Part 5/6 of the tutorialPart 6/6 of the tutorial
    +
    + + +
    +
    +
    +
    +
    + +

    Page Contents

    + + + +

    Core Documentation

    + + + + +

    This Page

    + +
    +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html index c23cb57764a..75fc6e1514a 100644 --- a/genindex.html +++ b/genindex.html @@ -195,7 +195,7 @@

    C

    -
    count() (built-in function), [1] +
    count() (built-in function), [1]
    @@ -315,7 +315,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    diff --git a/index.html b/index.html index ff3f762fc0c..3aa15e7f97a 100644 --- a/index.html +++ b/index.html @@ -83,6 +83,28 @@

    Tutorials +

    Presentations

    + +

    API Documentation

    @@ -157,6 +179,9 @@

    Page Contents

  • Tutorials
  • +
  • Presentations
      +
    +
  • API Documentation
  • diff --git a/nodejsvideo.html b/nodejsvideo.html new file mode 100644 index 00000000000..fcfb78cf070 --- /dev/null +++ b/nodejsvideo.html @@ -0,0 +1,145 @@ + + + + + + + + + Node.JS Specific Presentations — MongoDB Node.JS Driver 0.9.9.1 documentation + + + + + + + + + + +
    +
    +
    +
    + +
    +

    Node.JS Specific Presentations

    +
    +

    NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js

    +

    Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach

    +

    SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include:

    +
      +
    • Dynamic collection creation
    • +
    • Updating (Increments over sets)
    • +
    • Schema
    • +
    • Next gen schemas for dynamic filters
    • +
    +
    +
    +

    NYC MongoDB User Group - What’s in the Trello

    +

    What’s in the Trello - Brett Kiefer, Fog Creek

    +

    Trello is a collaboration tool that organizes your projects into boards. Brett Kiefer will discuss how Trello uses Node.js, Socket.io, MongoDB, Redis, and Backbone to create a responsive single-page app.

    +
    +
    + + +
    +
    +
    +
    + +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js index 20217915fd9..1508f2d877c 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{notEquals:[29,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[29,1,1,""],DBRef:[3,0,1,""],ensureIndex:[18,1,1,""],reIndex:[18,1,1,""],Binary:[26,0,1,""],deserializeStream:[1,1,1,""],findOne:[16,1,1,""],valueOf:[30,1,1,""],chunkCollection:[4,1,1,""],collectionNames:[18,1,1,""],Long:[14,0,1,""],nextObject:[9,1,1,""],validateCollection:[21,1,1,""],removeUser:[18,1,1,""],profilingInfo:[21,1,1,""],dropIndex:[18,1,1,""],findAndRemove:[16,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[29,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[21,1,1,""],getNumBitsAbs:[29,1,1,""],cursorInfo:[18,1,1,""],"generationTime number [Getter|Setter]":[19,2,1,""],Timestamp:[29,0,1,""],batchSize:[9,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[18,0,1,""],dropCollection:[18,1,1,""],Collection:[16,0,1,""],MinKey:[5,0,1,""],shiftRight:[29,1,1,""],writeFile:[4,1,1,""],toString:[29,1,1,""],Double:[15,0,1,""],getTimestamp:[19,1,1,""],Grid:[27,0,1,""],profilingLevel:[21,1,1,""],streamRecords:[9,1,1,""],indexInformation:[18,1,1,""],isOdd:[29,1,1,""],getHighBits:[29,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[21,0,1,""],dropDatabase:[18,1,1,""],Symbol:[30,0,1,""],previousErrors:[18,1,1,""],shiftRightUnsigned:[29,1,1,""],shiftLeft:[29,1,1,""],mapReduce:[16,1,1,""],Cursor:[9,0,1,""],MaxKey:[10,0,1,""],CursorStream:[31,0,1,""],findAndModify:[16,1,1,""],greaterThan:[29,1,1,""],renameCollection:[18,1,1,""],buildInfo:[21,1,1,""],resetErrorHistory:[18,1,1,""],isClosed:[9,1,1,""],getLowBitsUnsigned:[29,1,1,""],toHexString:[19,1,1,""],indexExists:[16,1,1,""],getLowBits:[29,1,1,""],toArray:[9,1,1,""],toNumber:[29,1,1,""],listDatabases:[21,1,1,""],ObjectID:[19,0,1,""],isNegative:[29,1,1,""],geoHaystackSearch:[16,1,1,""],addUser:[18,1,1,""],lessThanOrEqual:[29,1,1,""],isZero:[29,1,1,""],collectionsInfo:[18,1,1,""],lessThan:[29,1,1,""],isCapped:[16,1,1,""],ReadStream:[7,0,1,""],createCollection:[18,1,1,""],createIndex:[18,1,1,""],dropAllIndexes:[16,1,1,""],lastError:[18,1,1,""],geoNear:[16,1,1,""],greaterThanOrEqual:[29,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[19,1,1,""],createFromHexString:[19,1,1,""]},Timestamp:{fromBits:[29,1,1,""],fromNumber:[29,1,1,""],fromInt:[29,1,1,""],fromString:[29,1,1,""]},Db:{connect:[18,1,1,""]},Long:{fromBits:[14,1,1,""],fromNumber:[14,1,1,""],fromInt:[14,1,1,""],fromString:[14,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:13,returnkei:[32,9,16],maxscan:[32,9,16],readfilesync:4,prefix:[17,32],crete:16,attemp:[18,16],world_safe2:16,world_safe1:16,test_map_reduce_functions_inlin:16,deviat:32,under:32,everi:[0,9,25,20],test_gs_seek_with_buff:4,simple_next_object_collect:9,upload:20,correct:[1,18,19,32,4,33],"10k":32,cceac:13,seper:4,direct:[6,9,33],second:[18,12,2,17,19,4,32,16,34,25,9],street:13,aggreg:16,even:[0,16],createindex:[18,16,32,6,23,8],neg:[29,14],"256k":34,"new":[0,1,2,17,4,6,7,9,12,14,16,32,18,19,20,21,25,26,27,29,31,33,34],net:13,metadata:[20,34,4],manipul:16,rootcollect:4,never:[32,18],here:[33,34,4],path:[20,32,4],integration_tests_to_drop:18,anymor:32,loos:[13,33],getlowbit:[22,14,29,8],findandmodifi:[32,16,23,8,12],vincentcr:32,pvorb:13,schemaless:33,sessionstorag:13,middlewar:13,sarah:16,would:[0,18,16,29,14,6,34,32],init:9,concret:13,overhead:33,recommend:[33,16],type:[10,11,1,16,20,3,21,4,5,15,34,33,26,30,32,28],tell:[18,16,4,23,33,34,8],relat:6,notic:[33,34],warn:[16,18,12],exce:4,forceclos:18,must:[0,29,14,16],err:[0,7,18,12,2,20,17,21,4,32,31,16,27,33,34,25,9],aheckmann:32,setup:[2,34,18],work:[0,9,32,4,33,34,18],rework:32,root:[34,4,27],overrid:[32,16,18,9],simple_geo_haystack_command:16,indic:[0,12,11,17,6,20,33,25],want:[0,18,16,17,4,6,15,33,34,25],david:12,unsign:[29,14],end:[7,9,16,20,17,4,31,33,34],replicaset:[11,18,2,32,33,24],quot:9,how:[11,9,16,21,4,28,33,34,18],"_id_":[18,16],recoveri:2,rewind:[0,9,32,4,23,8],milisecond:[32,18,19],config:[2,32,18],updat:[26,11,18,16,12,32,21,23,33,34,24,8],maxdist:16,recogn:4,after:[7,9,12,13,20,32,31,4,1,34],listdatabas:[23,32,21,18,8],befor:[0,18,16,2,32,6,33,34,25],wrong:32,gs2:4,descriptior:20,parallel:33,attempt:[33,21,25],third:4,zzdhidden:13,exclud:[9,16],perform:[0,21,18,16,29,14,32,9],errorobject:32,order:[0,9,12,16,6,25],origin:[16,12],cursorinfo:[23,18,8],over:[18,16,13,32,25,9],becaus:[13,29,14],readbuff:[32,34],flexibl:13,vari:32,digest:[32,34],uuid:[26,1],fit:[33,9],fix:[32,34],mongolia:13,better:[33,32,25],complex:[33,18,16],loggerinst:32,persist:[33,16],split:[29,14,4],them:33,thei:[33,29,14,34,32],safe:[12,18,16,17,21,31,33,32,9],update_a_simple_docu:16,bread:13,"instanceof":[9,16,32,21,4,18],choic:32,guileen:13,changelog:[11,32],bonu:33,timeout:[2,32,9,25,16],each:[0,7,18,16,2,29,14,4,32,31,23,34,25,8,9],debug:32,went:16,a_simple_collect:18,mean:[9,2,32,33,34,25],resum:[31,7,23,8],nin:0,eventstor:13,extract:32,newli:[6,17,21],monitor:13,content:[26,0,7,27,12,13,20,4,33,34,8],daniel:[0,25,20],reader:32,got:[33,18,16],more_index_information_test:[18,16],navig:34,worthwhil:34,rail:13,default_port:25,situat:32,standard:13,md5:[26,32,1,4],filter:[18,16],mvc:13,pagin:16,regress:32,onto:32,rang:[0,32,16],unlik:9,alreadi:[9,12,20,17,4,6,33,25],wrapper:13,unlin:4,getnumbitsab:[22,14,29,8],primari:[0,18,16,2,32,33,25,9],hexstr:19,rewritten:32,top:[13,29,14,16],travers:9,startindex:1,tonumb:[22,14,29,8],ton:[33,34],similarli:33,listen:[32,9],consol:[0,1,12,20,17,33,34,25],namespac:3,eventlisten:32,took:9,incur:33,removeus:[23,32,21,18,8],silli:33,target:[34,16],provid:[18,16,13,29,14,4,33,34],cursorstream:[23,11,31,9,8],project:[13,11],matter:33,iron:33,thu:12,websocket:[13,33],abov:[33,34,12],mind:33,raw:[0,18,16,17,12,32,34,25,9],manner:[32,34],increment:33,seek:[23,20,34,4,8],dbref:[11,18,3,22,33,32,8],ensureindex:[18,16,32,6,23,8],simple_limit_collect:9,data2:4,simplifi:[13,32,34],insur:32,plenti:34,usernam:[6,21,18],object:[0,1,2,17,4,6,7,9,11,12,13,16,32,18,19,20,21,25,26,27,28,31,33,34],deleg:25,regular:[0,20],tradit:33,simplic:34,don:[32,25,16],doc:[0,1,18,12,13,32,21,4,31,16,33,9],flow:32,doe:[18,12,17,14,4,32,16,33,34,29],masylum:13,bson_data_d:1,radix:[29,14],random:4,speedup:32,syntax:32,test_stream_funct:9,identifi:[33,17,34],absolut:[29,14,34,4],acquir:9,field2:0,explain:[0,18,16,23,8,9],field1:0,theme:33,busi:33,rich:33,io_seek_cur:4,cachefunct:1,nasti:32,test_cursorstream_destroi:31,stop:32,collectionsinfo:[23,18,8],bson_data_numb:1,report:33,databank:13,bar:4,npmj:13,patch:32,previouli:9,fileidobject:4,steam:9,fieldnam:0,fair:34,indexnam:[18,16],num:16,result:[0,27,7,18,9,12,14,29,19,4,32,16,20,33,34,25,21],previouserror:[23,18,8],respons:[0,9],fail:[27,16,32,21,33,18],said:34,databas:[0,27,18,12,13,11,17,21,4,28,32,16,20,33,34,24,25,9],test_gs_empty_file_eof:4,gridstor:[26,11,7,18,19,20,32,21,4,23,28,1,16,27,31,24,34,8,9],simplest:[13,0,34],awai:34,lotsofdoc:33,side:13,accord:2,newnam:16,getlasterror:[21,18,16],howev:9,against:[0,21,18,19,29,14,4,16,32,9],logic:[0,32],seri:13,com:[13,33,32],assur:9,can:[0,14,18,19,2,20,17,12,32,29,6,16,33,34,25,9],simple_explain_collect:9,foobar2:4,io_seek_set:4,assum:[29,14],duplic:[6,32,16,18,9],three:[33,34,4],been:[32,34,18,9],trigger:[7,9,16,32,4,31],basic:[11,18,28,16,33,34],life:34,regul:9,nodeeventstor:13,search:[13,11,33,16],argument:[26,7,18,9,19,31,3,14,4,30,32,1,15,16,27,34,29,21],child:18,"catch":16,laurie71:32,another_root:4,peform:[31,7,18,16,9],dissect:34,properti:[0,19,20,32,4,22,23,8],weren:0,"typeof":[32,1,4],succes:16,toolkit:13,my_f:4,sever:[12,2,17,6,33,25],grown:33,usessl:18,test_is_close_function_on_cursor:9,receiv:34,make:[0,9,12,32,16,6,33,34,25],drawback:34,descend:[6,9],isneg:[22,14,29,8],complet:16,reset_error_histori:18,hang:32,hand:25,fairli:32,tune:34,scenario:25,geohaystack:16,test_close_function_on_cursor:9,client:[9,12,13,21,4,16,27,33,18],thi:[26,0,7,18,9,19,13,14,29,12,4,6,32,16,20,33,34,25,21],everyth:12,settimeout:[31,32,7,16],left:[29,14,18,25,16],protocol:[33,32],just:[0,34,33,16],laptop:32,ordin:[18,16],farther:7,yet:25,languag:[13,33],previous:32,octet:4,easi:13,collectionn:25,had:9,els:[21,25,16,12],save:[18,16,20,12,4,23,25,8],applic:[13,33,34,18],which:[0,2,20,17,14,4,29,32,34,25],preserv:9,background:[18,16],test_ev:18,apart:[33,34],measur:32,specif:[0,9,19,17,16,4,33,32,18],arbitrari:4,negat:[22,14,29,8],collection2:[18,16],collection1:16,underli:31,www:[13,18],right:[33,29,14,34],old:4,deal:33,manual:[11,8],interv:32,deserializestream:[22,1,8],dead:32,intern:[0,29,14,20,16],successfulli:9,txt:4,nwtj:13,timestampd:19,multipli:[22,14,29,8,16],originalhex:19,christkv:[33,32],condit:[0,32,16],localhost:[13,33,17,34,18],a_simple_create_drop_collect:18,collection_stats_test:16,promot:33,repositori:[13,33],post:[0,17,14,29],ryanke:13,plug:33,obj:16,slightli:33,simul:[29,14,34],commit:18,book:0,simple_previous_error_col:18,bson_data_symbol:1,"float":[33,29,14],encod:[2,33,32,25],bound:[16,18,9],down:[32,18],wrap:[0,7,30,32,31,15],storag:[13,33,34],git:13,wai:[0,12,16,13,29,14,33,34,32],support:[0,32,34,33,20],serverinfo:16,avail:[7,9,16,2,32,21,4,31,33,34,18],test_rename_collection3:16,test_rename_collection2:16,constantli:33,lowest:32,head:[34,4],medium:21,form:[32,4],forc:[32,21,18,16,9],"true":[0,1,18,12,2,20,17,21,4,31,6,32,7,16,27,33,34,25,9],reset:[0,4,9,18],new_nam:17,geospati:[18,16],maximum:[33,32,18,9],until:[33,21,18],deprect:9,fundament:33,sampl:33,emit:[33,32,31,18,16],shouldcorrectlyfailonretryduetoappcloseofdb:18,featur:34,"abstract":13,fromstr:[22,14,29,8,32],exist:[0,18,12,20,17,21,4,23,6,32,16,33,34,25,8],subtype_user_defin:26,check:[0,7,18,9,16,20,29,14,4,31,6,1,33,32,21],test_collection_opt:16,bson_binary_subtype_md5:[26,1],test_to_a_after_each:9,floor:19,when:[0,1,9,12,2,20,17,16,4,31,7,32,33,34,25],refactor:32,simple_limit_skip_find_one_queri:16,test:[18,12,13,20,17,21,4,16,33,34,32,9],miliscecond:[31,7],node:[11,9,2,32,13,33,8],insensit:9,consid:16,sql:33,cachefunctionscrc32:1,errormessag:32,"_id":[0,18,12,32,16,4,6,34,25,27],longer:[32,4],ignor:[33,1,16],time:[11,18,19,2,32,16,13,28,33,25,9],push:[18,13,32,31,33,9],backward:[32,9],concept:[33,32],skip:[23,0,9,8,16],global:32,primer:[11,34,28],row:16,millisecond:25,middl:16,depend:32,dropindex:[23,6,18,8,16],sourc:9,string:[26,0,1,18,9,19,20,3,14,4,30,29,6,32,16,27,33,34,17,21],feasibl:34,test_cursorstream_resum:31,logmeup:13,contenttyp:20,level:[18,16,13,32,21,4],did:[32,18],dig:33,eventemitt:9,iter:[9,16],item:[7,9,16,32,21,4,31,33,18],quick:[33,34],div:[22,14,29,8],round:33,databasenam:[18,25],wtimeout:[32,21,18,16],addtoset:33,sign:[17,14,29],slow_onli:21,cost:32,port:[32,18,25],comparis:4,checkoutwrit:18,repli:[33,21,16],current:[21,18,20,3,14,4,33,34,29],subtype_uuid:26,boost:13,deriv:[29,14],gener:[18,16,13,32,19,34,25],wait:[18,16],box:33,bson_data_regexp:1,shift:[29,14,32],queue:[13,33],behav:32,examp:13,more_complex_ensure_index_test:[18,16],extrem:32,weird:32,werehamst:13,checkkei:1,extra:0,modul:[13,32],prefer:[0,32,33],toarrai:[0,18,16,13,32,21,23,33,8,9],instal:[33,32],includeloc:16,perf:32,memori:[0,9,28,11,32,33,34],regep:33,live:[33,32,34],handler:34,value2:0,value1:0,criteria:12,scope:[33,32,1,18,16],prev:16,maxkei:[10,11,1,32,22,8],multiplecoll1:18,qard:13,finit:[29,14],visual:13,examin:33,content_typ:[20,34],fly:13,cap:[33,32,18,16],uniqu:[0,16,18,25,6],descriptor:34,whatev:25,bson_binary_subtype_funct:[26,1],mongo:[11,18,28,13,32,12,33,34],stream:[7,9,20,32,31,4,1,23,33,34,8],predict:32,bson_data_long:1,createcollect:[18,16,17,31,23,33,32,8,9],nocr:13,cube:13,occur:[0,9,12,20,17,4,6,32,25],alwai:[33,29,14,9,16],multipl:[16,2,29,14,32,25],ping:[23,32,21,18,8],fieldvalu:0,write:[26,1,18,2,20,32,4,22,7,23,33,34,8,27],foreach:[4,16],pure:[26,7,18,19,31,32,21,4,1,16,27,9],map:[33,16],product:[29,14],max:[32,16,18,9],dive:[33,34],date:[1,9,16,32,21,6,33,19],docstartindex:1,data:[26,11,7,9,16,20,32,28,4,31,1,27,33,34,18],grow:33,sbrekken:32,inform:[18,16,2,20,21,4,6,13,33,25,9],"switch":32,reaper:[32,18,25],combin:[4,18],keepgoingexampl:16,filedata:4,increas:32,still:[0,32,12],pointer:[0,17,4,25,20],test_map_reduce_funct:16,group:[32,34,23,8,16],gte:0,indexexist:[32,23,8,16],jim:16,nodelai:[2,32,25],platform:33,mbostock:32,requir:[26,7,18,9,12,31,17,19,4,32,1,16,27,33,34,25,21],main:[33,34],non:[13,32,16],simple_skip_collect:9,col2:18,col3:18,initi:[9,16,32,4,33,34,18],col1:18,verifi:[18,21,4,16,19],now:[33,32,34,18],nor:17,introduct:[2,11,33,28],mapreduc:[32,23,8,16],name:[26,0,1,18,12,2,20,3,21,4,25,6,32,16,34,17,9],drop:[18,16,17,21,6,23,32,8],revert:0,crypto:32,separ:[0,32,4],jprichardson:13,failov:[2,32],replai:32,dialect:13,replac:[0,16,32,12,4,33],individu:[0,32],firej:13,a_1_b_1:[18,16],poolreadi:32,serverclust:32,happen:[31,7,4,9],shown:[33,34],accomplish:34,space:[1,18],streetsaheadllc:13,profil:[21,9,16],stuff:[2,11,34,33,28],factori:[0,25,16],resultset:33,"_event":32,orm:13,mime:4,sethml:32,replacethiscollect:16,org:[13,18],"byte":[26,0,1,18,19,20,32,33,34,25],care:[2,0,33],question:[29,14],test_gs_tel:4,synchron:33,thing:[33,34,25],place:[29,14],year2013:32,frequent:[29,14],first:[0,18,12,20,17,21,4,34,16,33,19,25,9],oper:[0,21,18,12,17,14,32,29,6,16,33,34,25,9],bson_binary_:32,directli:[0,9,33],onc:[6,33],arrai:[26,0,1,18,12,2,20,17,21,4,16,33,32,9],"0x7f":1,reopen:[4,25],fast:13,happi:13,open:[7,18,12,2,20,17,21,4,23,32,31,16,27,33,34,25,8,9],predefin:1,size:[0,1,9,16,20,29,14,4,34,32,18],given:[26,9,16,29,14,4,34,18],breviti:[33,34],workaround:32,paramt:9,collectionnam:[18,16,17,21,6,23,34,8],conveni:[0,29,14],subtype_md5:26,especi:33,copi:2,specifi:[26,0,9,16,20,32,4,33,34,25,18],test_arrai:9,keepgo:[32,16],than:[0,9,12,16,2,20,29,14,32,34,25],png:[20,4],firebas:13,tedeh:32,were:[9,12],posit:[26,20,29,14,4,34],browser:13,pre:[1,18,16,21],fork:13,sai:34,ani:[0,18,12,13,33,34,9],simple_rename_collection_2:18,bitwis:[33,29,14],squar:13,alias:0,destroi:[31,7,23,8],note:[29,14,18,9],take:[0,1,2,32,33,34],createfromhexstr:[0,22,32,8,19],begin:[0,4],sure:[34,9],normal:9,buffer:[26,0,1,18,12,20,17,16,4,32,27,34,25,9],clearer:32,getyear:16,homepag:13,renam:[18,16,17,23,33,8],byte_valu:26,later:[34,18,16],indexbound:[18,16],test_gs_read_stream:4,runtim:32,parseint:16,axi:16,show:[26,7,18,19,31,16,4,1,27,33,9],atom:[33,32,16],objectid3:19,objectid2:19,concurr:32,corner:32,onli:[0,18,12,2,32,21,4,6,16,33,34,25,9],slow:[32,21,18,16],dice:33,setprofilinginfo:21,activ:[13,32],written:[26,16,13,29,14,4,34],analyt:[13,33],overwritten:34,min_valu:[29,14],variou:[13,21,16],get:[7,17,4,6,8,9,11,12,13,16,32,18,19,20,21,23,25,27,28,31,33,34],secondari:[2,32,16,18,9],ssl:[32,18],cannot:[18,16,29,14,33,9],shiftrightunsign:[22,14,29,8],geo:16,nolock:[32,18],doabl:0,seldom:32,yield:[17,16,18,32,12],isarrai:1,caboos:13,nettl:13,where:[26,0,1,18,12,2,20,17,16,4,6,33,34,32],highbit:[29,14],desced:9,wiki:33,khwang:13,testcas:32,infinit:[29,14,32],detect:2,heckmann:32,fs_chunk:34,integration_tests_2:18,wayt:16,enough:9,between:[33,32,18,25],"import":[33,34],across:[32,25,16],spars:[6,18,16],test_group:16,come:[20,29,14,16],simple_find_and_modify_operations_:16,region:16,gwt:[29,14],tutori:[11,34],mani:[33,9],fromnumb:[22,14,29,8],reindex:[23,32,18,8,16],iscap:[32,23,8,16],db_option:25,period:[0,17],pop:33,createcreateindexcommand:32,fs_file:34,lessthan:[22,14,29,8],reaperinterv:[32,18,25],cursor_information_collect:18,cursorinst:9,coupl:[26,33,16],aciev:0,rebuilt:[18,16],derefer:[23,32,18,8],lowbit:[29,14],geonear:[32,23,8,16],"1mb":34,those:[29,14],"case":[9,16,29,14,6,33,34,32],myself:33,bson_seri:32,tostr:[26,27,16,29,14,4,22,19,34,8],trick:34,invok:34,idhex:0,firstext:21,simple_sort_collect:9,advantag:33,eras:[20,17],dynamicgui:13,ascii:[2,26,32,25],acess:18,develop:[13,33],author:[0,20,12],media:13,same:[0,18,19,29,14,4,6,16,32,9],binari:[26,0,27,7,18,9,19,11,17,12,4,31,22,1,16,20,33,32,8,21],document:[0,1,18,9,11,2,20,17,12,4,31,6,32,7,16,13,33,34,25,21],createpk:25,exhaust:9,finish:[34,16],closest:[29,14,16],utf8:[2,33,32,4,25],nest:[0,6],oid:3,driver:[0,12,2,11,17,28,32,13,23,33,34,25,8],gotend:4,newobjectid:19,improv:32,defo:0,bson_data_boolean:1,crud:[11,33,28],framework:13,without:[1,18,29,14,25,32,17],model:[13,16],dereferenc:18,upsert:[16,12],ourexamplefiletowrit:4,execut:[12,9,16,32,21,4,33,18],rest:[13,32,16,19],hint:[9,16],db_connector:[17,25],except:[33,32,4,12],littl:33,blog:[13,0,17],default_chunk_s:4,haystack:16,found2:4,around:[13,33,32],read:[26,7,9,16,2,20,32,4,22,23,33,34,8,18],grid:[26,11,27,13,32,23,34,8],spank:32,world:[7,18,12,16,4,1,34,27],lasterror:[23,32,18,8],reap:32,mod:[0,29,14],saniti:32,poolsiz:[7,9,16,32,21,4,31,27,33,25,18],integ:[0,1,19,29,14,33,32],server:[26,1,18,9,19,2,31,17,12,4,13,32,7,16,27,33,34,25,21],firebaseco:13,either:[20,32,34,33],output:[0,16],greaterthanorequ:[22,14,29,8],manag:[13,20,32,33],bson_binary_subtype_byte_arrai:[26,1],eventloop:34,ascend:[0,9,6],intact:12,generationtim:19,setnodelai:32,slice:33,writedata:34,node_ev:32,confirm:33,legal:16,evolv:33,profilinginfo:[21,23,8],bson_data_binari:1,power:13,broken:32,aquir:18,bson_binary_subtype_default:[26,32,1],regexp:[33,32,1],"throw":[33,32,34,12],comparison:19,pointer_to_collect:0,firstnam:[0,6],numbit:[29,14],bson_data_code_w_scop:1,gump:16,act:34,luck:34,readstream:[23,11,7,9,8],addus:[23,32,21,18,8],test_collections_info:18,your:[16,2,4,13,33,34],loc:16,log:[0,1,9,12,13,20,17,21,32,16,33,34,25],hex:[0,27,4,19],overwrit:[21,4],dropdup:[32,18,16],strict:[17,32,18,25,16],interfac:[7,9,13,32,31,33,27],low:[33,29,14,34],lot:[9,16,32,6,31,33,34],tupl:6,shamelessli:33,replsetsrv:2,faster:[6,32],pull:[33,32,21],dirti:33,possibl:[0,18,12,13,32,16,6,33],"default":[26,0,1,18,9,19,2,20,17,12,4,6,32,16,33,34,25,21],remove_subset_of_documents_saf:16,dropdatabas:[23,21,18,8,25],bson_data_min_kei:1,expect:[0,25],gone:[27,16,4,18],creat:[26,0,1,18,19,2,20,17,21,4,31,6,32,7,16,27,33,34,25,9],certain:[6,33],watcher:13,intro:33,file:[7,27,13,20,32,4,34,18],incorrect:32,again:[4,9],kaba:13,field:[0,18,12,32,16,6,33,9],valid:[26,1,9,19,17,21,18],longlib:14,you:[0,1,18,12,2,20,17,16,6,32,33,34,25,9],scttnlsn:13,pefrom:16,sequenc:32,symbol:[11,1,30,32,22,33,8],opt_radix:[29,14],pool:[32,18,25],reduc:[29,14,32,16],lessthanorequ:[22,14,29,8],coreh:13,directori:32,descript:[26,1,4,9,18],tricki:33,potenti:32,alright:33,cpu:[32,34],unset:33,represent:[10,26,27,19,3,14,4,5,15,30,29],all:[0,1,18,12,2,20,17,21,4,6,32,16,33,34,25,9],forget:33,numberupd:16,dollar:17,simple_rename_collect:18,erhangundogan:13,follow:[0,9,12,2,4,6,33,34],fetchsiz:9,disk:[34,7,4,16,9],nodej:13,subtype_default:26,nextobject:[23,0,18,8,9],aaron:32,setprofilinglevel:[21,23,8],evaul:18,util:[13,32],test_rename_collect:16,failur:[33,32],veri:[33,32,34],base698:13,list:[18,16,17,21,4,23,33,34,32,8],resav:16,adjust:[32,34],findandremov:[32,23,8,16],small:[32,34],retun:1,eas:13,zero:[29,14,32,19],pass:[1,18,19,2,17,16,4,32,34,25,9],what:[33,17,34,9],abc:[0,4,12],xor:[22,14,29,8],sub:[26,16],sum:[29,14],delet:[18,16,20,32,4,23,33,34,25,8,27],version:[32,34,18,25,16],cruso:0,method:[26,0,9,11,17,19,4,28,32,16,33,34,25,27],full:[32,18,16],hash:[0,32,34,18,25],variat:33,behaviour:13,getmorecommand:[9,16],foobar3:4,modifi:[33,16,12],valu:[0,1,17,4,6,8,9,12,14,15,16,32,18,19,20,21,22,25,26,30,29,33,34],bartt:13,isodd:[22,14,29,8],ahead:[13,33,34,16],showdiskloc:[32,9,16],amount:[33,29,14,18],pick:[33,32,34,18],mongoos:13,narrow:16,evalfunct:1,via:33,shorthand:12,lazybum:13,c_1:16,deprec:18,default_root_collect:4,establish:[7,9,16,32,21,4,31,27,18],select:[17,16,25,32,12],test_collection_is_cap:16,distinct:[32,23,8,16],regist:4,two:[0,14,18,19,2,20,17,12,4,6,13,33,34,29],coverag:32,bson_binary_subtype_user_defin:[26,1],taken:33,minor:32,more:[0,7,18,12,2,29,14,4,31,16,33,34,32,9],flag:16,stick:33,particular:33,cach:1,none:2,outlin:[33,34],dev:13,histori:18,remain:[34,4],learn:13,scan:[9,16],share:[13,32,18,25],shard:20,accept:[32,16],simple_document_insert_collection_no_saf:16,default_url:18,robinson:0,cours:33,newlin:4,divid:[29,14,16],rather:16,anoth:[0,4,33,19],simpl:[26,0,7,18,11,13,31,17,16,4,6,28,1,27,33,34,32,9],perman:18,resourc:[13,25],variant:33,reflect:32,unlink:[23,20,34,4,8],associ:[34,4],keyorlist:9,github:[13,11,32,33],defineproperti:32,save_a_simple_document_modify_it_and_resave_it:16,caus:[33,32],callback:[0,18,12,20,17,21,4,6,32,16,33,34,25,9],spheric:16,doc_id:0,bson_data_oid:1,trade:34,through:[33,32,18,16],reconnect:[32,25],paramet:[0,18,12,2,20,17,21,4,6,32,33,34,25,9],style:[13,33],mongorepli:32,call:[0,9,13,32,4,34,25,18],asbuff:1,dbname:[32,18],rapidli:33,bypass:33,simple_limit_skip_queri:16,might:[6,34,18,33],alter:[0,17],good:[33,34],"return":[0,7,3,4,5,1,9,10,12,14,15,16,17,18,19,20,21,25,26,27,30,29,31,32,33,34],timestamp:[11,1,16,29,19,22,32,8],more_complex_index_test:[18,16],distancemultipli:16,compound:[18,16],karaco:13,readlen:4,emerleit:13,uploadd:20,instruct:2,authent:[23,32,21,18,8],easili:[29,14,32],achiev:0,skipvalu:9,found:[0,12,4,16,18],truncat:[17,34,4],hard:33,realli:33,connect:[11,7,18,16,2,32,21,4,13,28,31,23,27,33,34,25,8,9],slave:2,event:[7,9,20,32,4,31,33,34,25,18],mojo:13,read_primari:32,pullal:33,foreground:[18,16],core2duo:32,advanc:[11,28,17,4,33,34],asc:[0,9,12],reason:4,base:[16,13,20,19,4,33,34],connectionopt:18,put:[26,9,16,32,4,22,23,34,8,27],seconddb:18,gethighbit:[22,14,29,8],tailabl:[32,9,16],omit:[33,3,34,32],dir:12,assign:[2,32],notifi:[33,34,16],articl:[11,34,28],lastnam:[0,6],number:[26,0,1,18,9,19,29,14,4,6,32,15,16,33,34,25,21],done:[0,7,18,16,12,20,32,21,31,33,34,25],construct:[29,14],autoclos:[20,34,7,4],create_and_drop_an_index:[18,16],miss:32,differ:[18,16,29,14,4,6,34,33,19,32,27],chunk_typ:4,script:20,interact:[33,34,4,27],least:[0,16],custompkfactori:25,settim:19,statement:[33,34,18],illeg:[27,21,18,32,16],master:2,store:[1,9,13,20,4,33,34,18],otherid:19,option:[26,0,1,18,12,2,20,3,21,4,25,23,6,32,16,27,33,34,17,8,9],reseterrorhistori:[23,18,8],selector:[32,16,18,9],getter:[4,19],pars:[32,1,16],literarili:33,std:32,kind:34,bson_data_nul:1,whenev:[18,16],remov:[18,12,17,21,4,23,6,16,33,32,8],reus:[32,1,18],str:[29,14],consumpt:34,cleaner:13,luckili:[33,34],"null":[0,1,18,16,2,17,21,4,13,31,32,27,25,9],built:[13,33],equival:[33,16],valueof:[22,15,8,30],fromcollect:18,also:[0,9,12,17,4,6,33,34,32],build:[33,32,21,34,18],tool:13,choos:[33,16],reach:[34,7],most:[0,34,33],plan:34,native_pars:[7,9,16,21,4,31,27,25,18],"16mb":20,filesystem:20,cover:18,part:[33,32,19],clean:[13,32,18],frombit:[22,14,29,8],ridicul:13,session:13,find:[0,7,18,12,13,20,32,21,23,6,31,16,33,8,9],firewal:32,nosql:13,pretti:33,test_gs_weird_bug:4,numberofdocu:1,queu:13,batch_document_insert_collection_saf:16,hit:[18,16],unus:32,express:[13,0,33,20,16],fieldtoupd:33,barrier:32,nativ:[13,33,32,25],ferret:13,restart:[31,7],statist:[32,21,18,16],wrote:33,set:[0,1,18,9,19,2,20,17,12,4,6,32,16,33,34,25,21],see:[0,12,20,17,14,29,6,33,34,25],easymongo:13,close:[7,18,16,13,20,32,21,4,31,23,27,33,34,25,8,9],andrewjston:32,misalign:32,someth:[4,25],configur:[2,33,17,18,32],hold:[33,1,4,9],altern:[13,16],signatur:[4,9],complement:[29,14],javascript:[1,18,16,13,29,14,33],salzman:32,succeed:6,both:[32,16],last:[13,20,18,33],create_and_drop_all_index:[18,16],context:25,logout:[23,21,18,8],whole:[33,16,4,18],createdat:9,load:[0,32],simpli:0,jsmode:16,point:[9,16,29,14,33,34],instanti:[33,32],shutdown:32,linux:32,backend:33,faithfulli:[29,14],user_id:16,due:[33,32,27],empti:[26,0,16,4,9],strategi:[33,32],test_streamingrecords_funct:9,fire:[7,18,12,13,20,4,33,34,25],admindb:[21,18],imag:[20,34],understand:33,func:[1,16],look:[9,16,20,32,4,6,33,34],mdoq:13,straight:[33,34],batch:[33,32,9,16],"while":[0,32,4,20,9],getownpropertynam:32,behavior:[0,12,29,14,33,32],simple_key_based_distinct_sub_query_filt:16,fun:34,fixtur:13,robin:33,loop:32,real:13,test_gs_unlink:4,readi:[31,7,4,33,9],key2:0,key1:0,jpg:4,itself:9,test_deref_exampl:18,rid:32,chase:32,decor:32,simple_document_insert_with_function_saf:16,geohaystacksearch:[32,23,8,16],coffeescript:13,p_db:[2,18],higher:[2,32,34,25,16],optim:[32,16],operaion:20,numberofretri:[32,18,25],iya_logo_final_bw:4,temporari:[4,16],user:[26,0,1,18,12,13,32,21,4,6],hello2:16,keyf:16,recreat:25,lower:[18,16],entri:[34,16,4,18],explan:[18,16],getlowbitsunsign:[22,14,29,8],a_1:16,shape:32,update_a_simple_document_multi:16,bson_data_timestamp:1,cur:34,colladow:13,tdegrunt:13,keeptemp:16,appli:[0,32,9,33],input:[29,14,16],subsequ:[18,16],format:[0,18,16,12,21,9],big:[33,32,34],checksum:4,shiftright:[22,14,29,8],rs_name:[2,32],replsetserv:[26,1,18,19,2,31,32,21,4,7,16,27,9],success:[20,4,9],resolv:18,collect:[0,2,3,4,6,8,9,11,12,13,21,32,18,16,20,23,24,25,27,28,31,17,33,34],bson_data_cod:1,popular:33,bamboo:32,serverpair:32,often:[29,14],creation:[33,32,21,18,16],some:[26,0,7,18,16,20,32,4,6,27,33,34,9],back:[0,14,19,13,29,21,4,16,33],understood:33,dropallindex:[23,8,16],scale:[33,34,16],slaveok:[32,18,16],chunksiz:[20,34,4],retri:[33,32,18,25],larg:[0,18,16,20,33,34],intial:16,previou:[34,25],run:[11,18,12,28,2,32,16,33,34],simple_reset_error_history_col:18,step:34,simple_explain_queri:16,zir:13,subtract:[22,14,29,8],recordquerystat:18,block:[34,18,16],cygwin:32,within:[29,14],simple_index_test:16,ensur:[18,16,32,6,33,34],chang:[16,29,14,33,34,32],test_collection_index_exist:16,bson_deseri:32,textual:[29,14],custom:[0,32,34,25,16],includ:[0,9,16,17,4,6,32,33,25,18],forward:4,files:4,properli:[32,4],uniquedoc:16,"_bsontyp":32,link:[11,34,33,28],translat:13,simple_count_exampl:16,line:[13,34,4],info:[32,21,34,18,16],concaten:[29,14,4],consist:32,caller:9,forceserverobjectid:[32,18,25],contin:13,readlin:[23,4,8],similar:20,constant:[26,1,9,4,22,23,8,18],multiplecoll2:18,parser:[32,1,18,25],doesn:[0,25,12],repres:[9,19,29,14,4,30,15,33],isconnect:32,titl:[0,16,24,12],unidirect:9,wakup:18,nice:33,deseri:[1,9,32,22,33,8],bcoe:13,jannehietamaki:32,mongodb:[0,1,2,17,4,6,7,8,9,11,12,13,16,32,18,19,20,21,25,26,27,31,33,34],eval:[1,18,16,32,23,8,9],profilinglevel:[21,23,8],algorithm:[2,29,14,25,32],cursorinform:18,tradeoff:34,far:4,hello:[26,7,18,12,16,4,1,33,34,27],code:[26,7,18,19,31,32,21,4,1,16,27,33,34,9],partial:[9,16],worldbuff:4,queri:[0,18,12,11,17,21,4,6,28,32,16,33,24,25,9],idvalu:0,mongoskin:13,replicasetcheckinterv:32,base64:[2,32,25,27],update_a_simple_document_upsert:16,send:[2,33,32,18,25],io_seek_end:4,sens:12,reapertimeout:[32,18,25],passiv:32,result2:27,degrunt:13,writebuff:32,untouch:25,relev:33,magic:13,gettim:[9,19],fieldorspec:[18,16],fewer:16,"try":[33,32,16,34,12],race:32,refer:[9,3,4,33,32,18],smaller:20,fortun:33,natur:33,jump:[33,34],video:34,odm:13,download:33,odd:[29,14],append:[20,4,33],compat:32,index:[11,1,18,16,17,6,23,24,32,8,9],compar:[19,29,14,4,6,22,8],test_correctly_access_collect:18,access:[9,16,20,21,4,30,15,18],experiment:32,asced:9,lee:32,bson_data_int:1,batchsizevalu:9,cursor_count_collect:9,calipso:13,let:[7,9,16,32,4,33,34,18],filedescriptor:34,becom:33,sinc:[33,29,14,34,12],subtype_byte_arrai:26,nexttick:32,convert:[0,33,19],convers:[33,16],larger:[20,32,34],implement:[13,33,29,14,32],tempcollect:16,read_secondari:[2,32],app:[2,32],mattinsl:13,api:[11,18,13,22,23,34],chrisgibson:13,from:[26,0,27,1,18,9,19,2,14,17,12,4,32,16,20,33,34,29,21],batchsiz:[23,16,18,8,9],doubl:[11,32,22,15,33,8],next:[0,34,1,9,25],websit:13,chr:4,sort:[0,9,12,32,19,23,6,16,8],benchmark:32,name2:0,socketopt:[2,32,25],sollect:17,account:16,retriev:[0,9,12,20,32,21,4,16,33,34,18],scalabl:20,multiple_db_inst:18,annot:34,tag:[32,16],thin:13,fetch:[0,27,9,16,6,33,18],queryfailur:32,control:[33,32,34,25],objectid:[26,0,7,18,19,11,3,21,4,31,22,1,32,16,27,33,34,25,8,9],process:[13,29,14,9,32],lock:[32,34,18],calcul:1,username_:6,high:[18,16,29,14,33,32],unopen:32,serial:[1,18,16,32,22,8],pingresult:21,integration_test_:[2,18],instead:[0,18,16,2,32,6,34,25,9],npm:[33,32],await:18,formattedorderclaus:32,test_map_reduce_functions_scop:16,alloc:[32,1,18],seriou:32,remove_all_documents_no_saf:16,correspond:[6,17,14,29],element:[0,4,33,9],issu:[33,32,16],writ:4,allow:[18,16,17,21,32,33,34,25,9],subtyp:26,deoptim:32,doc2:33,doc3:33,move:[20,32,4,33],alexeypetrushin:13,doc4:33,autoindexid:18,server_opt:25,effici:[33,34,16],bunch:[32,18,16],perfect:33,total:[0,16],crash:32,greater:[0,29,14,9],handl:[9,16,29,14,4,33,34,32],databs:[20,17,25],auth:[32,18],renamecollect:[23,18,8],precess:33,numberofremoveddoc:16,writefil:[23,20,34,4,8],convin:0,anyth:32,edit:[34,4],deserializeddoc:1,exampledb:[33,34],subset:[9,16],opensync:4,chunk:[20,32,34,4],bson_binary_subtype_uuid:[26,1],default_content_typ:4,pushal:[33,32],our:[33,34,4,9],special:[33,29,14,34,9],out:[11,18,16,2,32,19,33,34,25,28],variabl:[33,32,16],trickier:[0,33],categori:34,suitabl:34,leverag:33,ref:32,clone:13,math:19,jessica:[0,12],insid:[0,34,20,6],dropcollect:[23,17,18,8],unpars:32,releas:32,princess:16,unwant:0,could:[33,32],shiftleft:[22,14,29,8],keep:[20,32,18,33,16],length:[26,1,18,19,20,21,4,22,16,34,8,9],lte:0,primarki:0,minkei:[11,22,1,32,5],evanp:13,debugmessag:32,iszero:[22,14,29,8],should_correctly_rewind_and_restart_cursor:9,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:18,prioriti:32,"long":[11,1,9,19,32,14,22,33,8],start:[26,0,1,9,16,2,17,4,33,34],system:[13,17,34,4],messag:[18,12,32,21,4,16],createfromtim:[22,32,8,19],bson_data_max_kei:1,termin:4,"final":[33,32,16],idottv:13,deconstruct:34,test_gs_getc_fil:4,exactli:17,gridstorew:4,bson_data_object:1,replset:[2,18],mongoserv:[17,25],tocollect:18,charact:[26,32,16,4,19],test_gs_puts_and_readlin:4,bind:13,counter:[25,16],terribl:32,corrupt:21,have:[0,18,16,2,17,4,6,33,34],tabl:[33,17],need:[0,1,18,12,20,17,14,29,6,33,34,25],turn:[0,21,18],buildinfo:[21,23,8],min:[32,16,18,9],rout:13,mix:[0,6],milli:21,test_other_drop:16,orgiin:4,singl:[26,0,18,12,20,32,16,4],fileid:[34,7,4],statsync:4,whi:0,serverconfig:[32,18,25],why:[13,33],overwriten:4,url:[13,18],timestamplib:29,request:[32,9],face:33,test_collect:12,snapshot:[9,16],error:[0,7,18,12,13,20,17,21,4,6,32,31,16,33,25,9],determin:[33,9],streamrecord:[23,33,32,9,8],fact:[33,12],text:[29,14,34,4],serializefunct:[32,1,18,16],verbos:16,"static":13,nagl:[2,32,25],anywai:[18,16],setter:[4,19],locat:[33,16,4,9,18],should:[0,14,18,19,17,21,16,27,34,29,9],noid:13,test_cursorstream_paus:31,local:[3,18],devnul:13,doc1:33,ritch:[13,32],gettimestamp:[22,32,8,19],donewithwrit:34,enabl:[32,18,25],simple_batch_size_collect:9,tohexstr:[0,22,32,8,19],integr:[13,33,34],contain:[26,1,9,16,2,17,4,33,34,18],grab:[21,18,9],mon4mongo:13,view:13,modulo:[0,22,14,29,8],packet:32,meritt:13,statu:[13,33,32],wire:[33,32],correctli:[33,32,16],state:[33,9,25],crude:33,world2:16,kei:[0,1,18,16,32,4,6,33,34,25,9],buckets:16,simple_queri:16,isol:32,job:[13,16],entir:[34,4,9],auto_reconnect:[7,9,16,2,21,4,31,27,33,34,25,18],crc32:1,addit:[0,1,18,16,29,14,21,34,9],mongod:13,admin:[11,18,16,32,21,23,8],mongoj:13,equal:[26,0,7,18,9,19,31,29,14,4,22,1,16,27,33,8,21],etc:[0,25,16],instanc:[1,18,19,2,32,21,4,16,27,33,34,25,9],greaterthan:[22,14,29,8],mongoq:13,subtype_funct:26,comment:[32,9,16],toint:[22,14,29,8],structur:[0,34,33],removealllisten:32,save_a_simple_docu:16,addition:17,compon:32,json:[11,22,14,29,33],treat:[0,32,9],pkfactori:[18,16],immedi:12,bit:[0,1,20,29,14,33,34,32],assert:[26,7,18,19,31,21,4,1,16,27,9],ador:13,present:[6,17],replic:[2,18],multi:[16,12],plain:32,cursor:[0,7,18,11,32,21,23,31,16,33,8,9],defin:[26,0,1,18,12,29,14,4,32,16,33,25],setreadprefer:32,bson_data_arrai:1,observ:13,layer:[13,33],helper:[13,32],site:2,lightweight:13,tojson:[22,14,29,8,32],getc:[23,4,8],cross:32,member:[2,32],world_no_saf:16,probabl:0,gett:13,difficult:34,calculateobjects:[22,1,8],http:[13,33,32],hostnam:25,keepal:[2,32,25],upon:9,retriv:21,serializewithbufferandindex:[22,1,8],chunk_siz:[20,4],off:[9,2,17,21,4,32,33,25,18],center:16,nevertheless:25,well:[0,32,34,33],exampl:[26,0,27,7,18,9,19,11,17,12,4,31,6,28,1,16,20,33,34,25,21],command:[9,16,13,32,21,4,23,33,25,8,18],simple_geo_near_command:16,validatecollect:[32,21,23,8],latest:33,distanc:16,paus:[31,7,23,8],less:[33,29,14],"boolean":[7,18,16,20,29,14,4,6,1,34,9],additon:6,tcp:33,arrj:13,indexinform:[18,16,32,6,23,8,9],web:[13,33],seekloc:[34,4],add:[14,18,19,29,21,6,22,16,33,8],originaldata:27,tjanczuk:13,logger:32,match:[0,21,16,12,17,14,33,29],karait:13,simple_key_based_distinct:16,piec:[33,29,14,34],know:17,password:[32,21,18],recurs:[14,29,1,4],isclos:[23,9,8],desc:[0,9],bson_data_str:1,insert:[0,1,18,9,11,17,12,4,23,32,31,16,33,24,25,8,21],resid:33,like:[0,18,16,13,29,14,6,34,9],fsync:[21,18,16],chunkcollect:[23,4,8],necessari:0,"0xff":1,async:[13,33],page:[0,33,11],dispatch:33,milewis:13,suppli:[32,34],gridf:[11,27,28,20,32,4,34],flush:[34,7,4],proper:32,fileinfo:34,newhex:19,librari:[13,11,32,34],leaf:13,lead:[29,14,32],leak:32,avoid:[6,32,21,33],fromint:[22,14,29,8],thank:32,leav:[32,12],kcbanner:13,mode:[9,16,20,17,4,32,34,25,18],slight:33,journal:18,usag:[26,11,1,27,19,2,20,17,4,32,33,34,25],collection_nam:17,host:25,although:34,offset:[26,34,4],java:[29,14],cliftonc:13,simpler:[13,33,32,9,16],continu:13,about:[18,12,6,33,34,25,9],actual:[0,34,18,33,25],socket:[2,33,32,18,25],dbinstanc:34,notequ:[22,14,29,8],constructor:[1,2,3,4,5,7,8,9,10,14,15,16,32,18,19,21,22,23,25,26,27,30,29,31],fals:[0,7,18,12,20,17,21,4,31,32,1,16,27,34,25,9],disabl:[2,32,25],own:[32,4],automat:[7,18,2,20,32,33,34,25,9],dataset:[0,33],bson:[0,7,3,4,5,1,8,9,10,11,12,16,15,17,18,19,21,22,25,26,27,30,31,32],merg:[32,16],val:16,pictur:34,transfer:18,mykei:33,much:[33,34,12],concat:0,"var":[26,0,1,18,9,19,2,20,17,12,4,31,7,16,27,33,34,25,21],fsname:27,"function":[0,1,2,17,4,7,9,12,13,14,16,32,18,19,20,21,25,26,27,29,31,33,34],brand:32,learnboost:13,waitforconnect:32,overflow:[29,14],inlin:16,bug:[32,34],count:[0,18,12,17,16,4,23,32,8,9],made:34,wise:0,cleanup:[32,34],whether:[29,14],wish:[26,1,18,16,21,4,34],displai:18,asynchron:[2,33],record:[0,18,12,20,17,16,4,6,33,25,9],below:[33,29,14,18,12],limit:[0,9,16,20,23,33,8],otherwis:[1,9,29,14,4,33,34],problem:[32,21],evalu:[1,18],"int":[29,14],dure:[33,32,21,18,16],year:0,filenam:[20,32,34,4],replica:[2,32,18],retrymilisecond:[32,18,25],inc:[33,32],tick:32,detail:[6,9,20],deepequ:[27,16,4,9,18],other:[0,28,2,11,29,14,4,33,34,32],bool:19,futur:[13,33,32,18],branch:32,stat:[32,23,8,16],findon:[0,18,16,32,23,33,8],"class":[10,26,7,18,9,19,31,3,14,4,5,32,1,15,34,16,27,33,30,29,21],geck:13,stai:16,eof:[23,20,34,4,8],integration_test:[7,9,16,21,4,31,27,18],kaij:32},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Double()","Collection()","Collections","Db()","ObjectID()","GridStore","Admin()","Binary JSON API","Driver API","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Symbol()","CursorStream()","Changelog","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/double","api-generated/collection","markdown-docs/collections","api-generated/db","api-bson-generated/objectid","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","api-bson-generated/symbol","api-generated/cursorstream","changelog/changelog","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file +Search.setIndex({objects:{"":{notEquals:[31,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[31,1,1,""],DBRef:[3,0,1,""],ensureIndex:[19,1,1,""],reIndex:[19,1,1,""],Binary:[28,0,1,""],deserializeStream:[1,1,1,""],findOne:[20,1,1,""],valueOf:[30,1,1,""],chunkCollection:[4,1,1,""],collectionNames:[19,1,1,""],Long:[15,0,1,""],nextObject:[10,1,1,""],validateCollection:[22,1,1,""],removeUser:[19,1,1,""],profilingInfo:[22,1,1,""],dropIndex:[19,1,1,""],findAndRemove:[20,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[31,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[22,1,1,""],getNumBitsAbs:[31,1,1,""],cursorInfo:[19,1,1,""],"generationTime number [Getter|Setter]":[8,2,1,""],Timestamp:[31,0,1,""],batchSize:[10,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[19,0,1,""],dropCollection:[19,1,1,""],Collection:[20,0,1,""],MinKey:[5,0,1,""],shiftRight:[31,1,1,""],writeFile:[4,1,1,""],toString:[31,1,1,""],Double:[16,0,1,""],getTimestamp:[8,1,1,""],Grid:[29,0,1,""],profilingLevel:[22,1,1,""],streamRecords:[10,1,1,""],indexInformation:[19,1,1,""],isOdd:[31,1,1,""],getHighBits:[31,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[22,0,1,""],dropDatabase:[19,1,1,""],Symbol:[30,0,1,""],previousErrors:[19,1,1,""],shiftRightUnsigned:[31,1,1,""],shiftLeft:[31,1,1,""],mapReduce:[20,1,1,""],Cursor:[10,0,1,""],MaxKey:[11,0,1,""],CursorStream:[33,0,1,""],findAndModify:[20,1,1,""],greaterThan:[31,1,1,""],renameCollection:[19,1,1,""],buildInfo:[22,1,1,""],resetErrorHistory:[19,1,1,""],isClosed:[10,1,1,""],getLowBitsUnsigned:[31,1,1,""],toHexString:[8,1,1,""],indexExists:[20,1,1,""],getLowBits:[31,1,1,""],toArray:[10,1,1,""],toNumber:[31,1,1,""],listDatabases:[22,1,1,""],ObjectID:[8,0,1,""],isNegative:[31,1,1,""],geoHaystackSearch:[20,1,1,""],addUser:[19,1,1,""],lessThanOrEqual:[31,1,1,""],isZero:[31,1,1,""],collectionsInfo:[19,1,1,""],lessThan:[31,1,1,""],isCapped:[20,1,1,""],ReadStream:[7,0,1,""],createCollection:[19,1,1,""],createIndex:[19,1,1,""],dropAllIndexes:[20,1,1,""],lastError:[19,1,1,""],geoNear:[20,1,1,""],greaterThanOrEqual:[31,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[8,1,1,""],createFromHexString:[8,1,1,""]},Timestamp:{fromBits:[31,1,1,""],fromNumber:[31,1,1,""],fromInt:[31,1,1,""],fromString:[31,1,1,""]},Db:{connect:[19,1,1,""]},Long:{fromBits:[15,1,1,""],fromNumber:[15,1,1,""],fromInt:[15,1,1,""],fromString:[15,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:14,returnkei:[34,10,20],maxscan:[34,10,20],readfilesync:4,prefix:[18,34],crete:20,attemp:[19,20],world_safe2:20,world_safe1:20,test_map_reduce_functions_inlin:20,deviat:34,under:34,everi:[0,10,27,21],test_gs_seek_with_buff:4,simple_next_object_collect:10,upload:21,correct:[1,19,8,34,4,35],gotik:17,servic:[],"10k":34,cceac:14,seper:4,direct:[6,10,35],second:[19,13,2,18,20,4,36,34,8,27,10],street:14,aggreg:20,even:[0,20],createindex:[19,20,34,6,24,9],d27cdb6e:[],neg:[31,15],"256k":36,allowscriptaccess:[],"new":[0,1,2,18,4,6,7,8,10,13,15,22,34,19,20,21,27,28,29,31,33,35,36],net:14,metadata:[21,36,4],manipul:20,rootcollect:4,never:[34,19],here:[35,36,4],epce4qkoh5:32,path:[21,34,4],integration_tests_to_drop:19,anymor:34,loos:[14,35],getlowbit:[23,15,31,9],findandmodifi:[34,20,24,9,13],vincentcr:34,pvorb:14,schemaless:35,sessionstorag:14,middlewar:14,sarah:20,would:[0,19,20,31,15,6,36,34],init:10,concret:14,overhead:35,recommend:[35,32,20],type:[11,12,1,20,21,3,22,4,5,32,16,36,35,28,30,34,37],tell:[19,20,4,24,35,36,9],relat:6,notic:[35,36],warn:[20,19,13],exce:4,forceclos:19,must:[0,31,15,20],err:[0,22,7,19,13,2,21,18,20,4,33,34,29,35,36,27,10],aheckmann:34,setup:[2,36,19],work:[0,10,34,4,35,25,36,19],test_gs_tel:4,rework:34,root:[36,4,29],overrid:[34,19,10,20],simple_geo_haystack_command:20,indic:[0,13,12,18,6,21,35,27],want:[0,19,20,18,4,6,16,35,36,27],david:13,unsign:[31,15],end:[7,10,20,21,18,4,33,35,36],replicaset:[12,19,2,34,35,26],quot:10,playerid:32,swflash:[],how:[12,32,10,20,22,4,37,35,25,36,19],"_id_":[19,20],recoveri:2,rewind:[0,10,34,4,24,9],milisecond:[34,19,8],config:[2,34,19],updat:[28,12,32,19,20,13,34,22,24,35,36,26,9],maxdist:20,recogn:4,after:[7,10,13,14,21,34,33,4,1,36],listdatabas:[24,34,22,19,9],befor:[0,19,20,2,34,6,35,36,27],wrong:34,gs2:4,descriptior:21,parallel:35,attempt:[35,22,27],third:4,zzdhidden:14,exclud:[10,20],receiv:36,errorobject:34,order:[0,10,13,20,6,27],origin:[20,13],cursorinfo:[24,19,9],over:[19,20,14,34,32,27,10],becaus:[14,31,15],readbuff:[34,36],flexibl:14,vari:34,digest:[34,36],uuid:[28,1],fit:[35,10],fix:[34,36],mongolia:14,better:[35,34,27],complex:[35,19,20],loggerinst:34,persist:[35,17,20],split:[31,15,4],them:35,thei:[35,31,15,36,34],safe:[13,19,20,18,22,33,35,34,10],update_a_simple_docu:20,bread:14,"instanceof":[10,20,34,22,4,19],choic:34,guileen:14,changelog:[12,34],bonu:35,timeout:[2,34,10,27,20],each:[0,7,19,20,2,31,15,4,34,33,24,36,27,9,10],debug:34,went:20,a_simple_collect:19,mean:[10,2,34,35,36,27],resum:[33,7,24,9],nin:0,eventstor:14,extract:34,newli:[6,18,22],monitor:14,content:[28,0,7,29,13,14,21,32,4,35,36,9],daniel:[0,27,21],reader:34,got:[35,19,20],more_index_information_test:[19,20],navig:36,worthwhil:36,rail:14,default_port:27,situat:34,standard:14,md5:[28,34,1,4],filter:[32,19,20],mvc:14,pagin:20,regress:34,onto:34,rang:[0,34,20],unlik:10,alreadi:[10,13,21,18,4,6,35,27],wrapper:14,unlin:4,getnumbitsab:[23,15,31,9],primari:[0,19,20,2,34,35,27,10],hexstr:8,rewritten:34,top:[14,31,15,20],travers:10,startindex:1,tonumb:[23,15,31,9],ton:[35,36],similarli:35,kamikazepanda:17,listen:[34,10],consol:[0,1,13,21,18,35,36,27],namespac:3,eventlisten:34,took:10,incur:35,removeus:[24,34,22,19,9],silli:35,target:[36,20],provid:[19,20,14,31,15,4,35,36],cursorstream:[24,12,33,10,9],project:[14,12,25,32],matter:35,iron:35,myexperience620186085001:32,thu:13,websocket:[14,35],abov:[35,36,13],mind:35,raw:[0,19,20,18,13,34,36,27,10],manner:[34,36],increment:[35,32],seek:[24,21,36,4,9],dbref:[12,19,3,23,35,34,9],ensureindex:[19,20,34,6,24,9],simple_limit_collect:10,data2:4,simplifi:[14,34,36],insur:34,plenti:36,usernam:[6,22,19],object:[0,1,2,18,4,6,7,8,10,12,13,14,22,34,19,20,21,27,28,29,37,32,33,35,36],deleg:27,regular:[0,21],sub:[28,20],tradit:35,simplic:36,don:[34,27,20],doc:[0,22,1,19,13,14,34,20,4,33,35,10],flow:34,doe:[19,13,18,15,4,34,20,35,36,31],masylum:14,bson_data_d:1,radix:[31,15],random:4,speedup:34,syntax:34,test_stream_funct:10,identifi:[35,18,36],absolut:[31,15,36,4],bind:14,acquir:10,field2:0,explain:[0,10,20,24,9,19],field1:0,theme:35,busi:35,rich:35,ppf_qxbkwm4g:32,io_seek_cur:4,cachefunct:1,nasti:34,test_cursorstream_destroi:33,stop:34,collectionsinfo:[24,19,9],bson_data_numb:1,report:35,youtub:[25,32,17],databank:14,bar:4,npmj:14,patch:34,previouli:10,fileidobject:4,steam:10,fieldnam:0,fair:36,indexnam:[19,20],num:20,result:[0,22,7,19,13,21,31,15,4,34,36,20,29,35,8,27,10],previouserror:[24,19,9],respons:[0,32,10],fail:[29,20,34,22,35,19],said:36,databas:[0,29,22,19,13,14,12,18,20,4,37,34,21,35,36,26,27,10],test_gs_empty_file_eof:4,discoveri:32,gridstor:[28,12,22,7,19,20,21,34,8,4,33,37,1,24,29,36,26,9,10],simplest:[14,0,36],awai:36,lotsofdoc:35,side:14,accord:2,newnam:20,getlasterror:[22,19,20],howev:10,against:[0,22,10,20,31,15,4,8,34,19],logic:[0,34],seri:14,com:[14,34,32,17,35,25],assur:10,can:[0,19,13,2,21,18,15,34,31,6,36,20,35,8,27,10],simple_explain_collect:10,ae6d:[],height:[25,32,17],foobar2:4,io_seek_set:4,dropdatabas:[24,22,19,9,27],duplic:[6,34,19,10,20],three:[35,36,4],been:[34,36,19,10],trigger:[7,10,20,34,4,33],basic:[12,19,37,20,35,36],life:36,regul:10,nodeeventstor:14,search:[14,12,35,20],argument:[28,22,7,19,20,33,3,15,4,30,1,16,36,34,29,8,31,10],child:19,"catch":20,laurie71:34,another_root:4,subsequ:[19,20],peform:[33,7,19,10,20],dissect:36,properti:[0,8,21,34,4,23,24,9],weren:0,"typeof":[34,1,4],succes:20,toolkit:14,my_f:4,sever:[13,2,18,6,35,27],grown:35,usessl:19,test_is_close_function_on_cursor:10,perform:[0,15,19,20,31,22,34,10],make:[0,10,13,34,20,6,35,36,27],transpar:32,meetup:[12,32],drawback:36,descend:[6,10],isneg:[23,15,31,9],complet:20,reset_error_histori:19,hang:34,hand:27,fairli:34,tune:36,speakerdeck:[],scenario:27,geohaystack:20,test_close_function_on_cursor:10,client:[22,10,13,14,20,4,29,35,19],thi:[28,0,22,7,19,13,14,21,31,15,4,27,6,34,36,20,35,8,25,10],everyth:13,settimeout:[33,34,7,20],left:[31,15,19,27,20],protocol:[35,34],just:[0,36,35,20],laptop:34,ordin:[19,20],farther:7,yet:27,languag:[14,35,32],previous:34,wmode:32,easi:14,collectionn:27,had:10,board:32,els:[20,22,27,13],ffffff:32,save:[19,20,21,13,4,24,27,9],dynamicstream:32,applic:[12,19,14,17,35,36],which:[0,2,21,18,15,4,31,34,36,27],preserv:10,background:[19,20],test_ev:19,apart:[35,36],measur:34,specif:[0,32,19,20,12,18,8,4,35,34,10],arbitrari:4,negat:[23,15,31,9],collection2:[19,20],collection1:20,underli:33,www:[14,25,32,17,19],right:[35,31,15,36],old:4,creek:32,deal:35,manual:[12,9],interv:34,deserializestream:[23,1,9],dead:34,intern:[0,31,15,21,20],successfulli:10,m_tddbw6qnuu4iuxlyo:32,nwtj:14,timestampd:8,multipli:[23,15,31,9,20],fog:32,christkv:[35,34],condit:[0,34,20],localhost:[14,35,18,36,19],a_simple_create_drop_collect:19,collection_stats_test:20,promot:35,repositori:[14,35],post:[0,18,15,31],ryanke:14,plug:35,obj:20,slightli:35,simul:[31,15,36],commit:19,book:0,simple_previous_error_col:19,bson_data_symbol:1,"float":[35,31,15],encod:[2,35,34,27],bound:[19,10,20],down:[34,19],wrap:[0,7,30,34,33,16],storag:[14,35,36],git:14,wai:[0,13,20,14,31,15,35,36,34],support:[0,34,36,35,21],serverinfo:20,avail:[7,10,20,2,34,22,4,33,35,36,19],width:[25,32,17],test_rename_collection3:20,test_rename_collection2:20,constantli:35,bulqmxg0vdc:32,lowest:34,head:[36,4],medium:22,form:[34,4],forc:[34,22,19,10,20],"true":[0,22,1,19,13,2,21,18,20,4,32,33,6,7,34,29,35,36,27,10],reset:[0,4,10,19],new_nam:18,geospati:[19,20],maximum:[35,34,19,10],until:[35,22,19],deprect:10,fundament:35,sampl:35,emit:[35,34,33,19,20],classid:[],shouldcorrectlyfailonretryduetoappcloseofdb:19,featur:36,"abstract":14,fromstr:[23,15,31,9,34],exist:[0,22,19,13,21,18,20,4,6,34,24,35,36,27,9],videoplay:32,check:[0,22,7,19,20,21,31,15,4,33,6,1,35,34,10],test_collection_opt:20,bson_binary_subtype_md5:[28,1],test_to_a_after_each:10,floor:8,when:[0,1,10,13,2,21,18,20,4,33,7,34,35,36,27],refactor:34,simple_limit_skip_find_one_queri:20,test:[22,19,13,14,21,18,20,4,17,35,36,34,10],miliscecond:[33,7],node:[12,10,2,34,32,14,17,35,25,9],insensit:10,consid:20,sql:35,cachefunctionscrc32:1,errormessag:34,"_id":[0,19,13,34,20,4,6,36,27,29],longer:[34,4],ignor:[35,1,20],time:[12,32,19,20,2,34,8,14,37,35,27,10],push:[19,14,34,33,35,10],seamlesstab:[],backward:[34,10],concept:[35,34],skip:[24,0,10,9,20],global:34,primer:[12,36,37],row:20,millisecond:27,middl:20,depend:34,flash:[],originalhex:8,dropindex:[24,6,19,9,20],sourc:[17,10],string:[28,0,22,1,19,20,21,3,15,4,30,31,6,36,34,29,35,8,18,10],feasibl:36,test_cursorstream_resum:33,logmeup:14,contenttyp:21,level:[19,20,14,34,22,4],did:[34,19],dig:35,eventemitt:10,iter:[10,20],item:[7,10,20,34,22,4,33,35,19],quick:[35,36],div:[32,23,15,31,9],round:35,databasenam:[19,27],wtimeout:[34,22,19,20],addtoset:35,sign:[18,15,31],slow_onli:22,cost:34,port:[34,19,27],comparis:4,checkoutwrit:19,repli:[35,22,20],muq2w2u5x9m:25,current:[22,19,21,3,15,4,35,36,31],subtype_uuid:28,boost:14,deriv:[31,15],gener:[19,8,14,34,20,36,27],wait:[19,20],box:35,bson_data_regexp:1,shift:[31,15,34],queue:[14,35],behav:34,examp:14,more_complex_ensure_index_test:[19,20],extrem:34,weird:34,werehamst:14,flashobj:[],extra:0,modul:[14,34],prefer:[0,34,35],toarrai:[0,10,20,14,34,22,24,35,9,19],bxhflrwemeg:17,instal:[35,34],includeloc:20,perf:34,memori:[0,10,12,34,37,35,36],regep:35,connector:[12,32],live:[35,34,36],handler:36,value2:0,value1:0,criteria:13,scope:[35,34,1,19,20],prev:20,maxkei:[11,12,1,34,23,9],multiplecoll1:19,qard:14,finit:[31,15],visual:14,examin:35,content_typ:[21,36],fly:14,cap:[35,34,19,20],uniqu:[0,20,19,27,6],descriptor:36,whatev:27,cab:[],bson_binary_subtype_funct:[28,1],mongo:[12,19,13,14,34,37,35,36],stream:[7,10,21,34,33,4,1,24,35,36,9],predict:34,bson_data_long:1,createcollect:[10,20,18,33,24,35,34,9,19],topic:32,nocr:14,cube:14,kaflr8pi5nk:25,occur:[0,10,13,21,18,4,6,34,27],alwai:[35,31,15,10,20],multipl:[20,2,31,15,34,27],ping:[24,34,22,19,9],fieldvalu:0,write:[28,1,19,2,21,34,4,23,7,24,35,36,9,29],foreach:[4,20],pure:[28,22,7,10,20,33,34,8,4,1,29,19],nyc:[12,32],map:[35,20],product:[31,15],max:[34,19,10,20],dive:[35,36],date:[1,10,8,34,22,6,20,35],docstartindex:1,data:[28,12,7,19,20,21,34,32,4,33,37,1,17,29,35,36,10],grow:35,sbrekken:34,inform:[19,20,2,21,22,4,6,14,35,27,10],"switch":34,reaper:[34,19,27],combin:[4,19],keepgoingexampl:20,filedata:4,increas:34,still:[0,34,13],pointer:[0,18,4,27,21],dynam:32,test_map_reduce_funct:20,group:[12,20,34,32,24,25,36,9],gte:0,indexexist:[34,24,9,20],jim:20,nodelai:[2,34,27],platform:35,mbostock:34,requir:[28,22,7,19,13,33,18,20,4,1,36,34,29,35,8,27,10],main:[35,36],non:[14,34,20],"6pjmp23z0lw":25,simple_skip_collect:10,col2:19,col3:19,initi:[10,20,34,4,35,36,19],col1:19,verifi:[8,20,22,4,19],now:[35,34,36,19],discuss:32,nor:18,introduct:[2,12,37,32,35],mapreduc:[34,24,9,20],name:[28,0,22,1,19,13,2,21,3,20,4,27,6,32,34,36,18,10],drop:[19,20,18,22,6,24,34,9],revert:0,crypto:34,separ:[0,34,4],jprichardson:14,failov:[2,34],domain:[],replai:34,dialect:14,replac:[0,20,34,13,4,35],individu:[0,34],firej:14,a_1_b_1:[19,20],poolreadi:34,serverclust:34,happen:[33,7,4,10],shown:[35,36],accomplish:36,space:[1,19],streetsaheadllc:14,profil:[22,10,20],stuff:[2,12,36,37,35],factori:[0,27,20],brett:32,"_event":34,orm:14,mime:4,sethml:34,replacethiscollect:20,org:[14,19],"byte":[28,0,1,19,8,21,34,35,36,27],care:[2,0,35],question:[31,15],bradberri:32,synchron:35,thing:[35,36,27],place:[31,15],year2013:34,frequent:[31,15],first:[0,22,19,13,21,18,20,4,36,35,8,27,10],oper:[0,22,19,13,18,15,34,31,6,20,35,36,27,10],bson_binary_:34,directli:[0,10,35],onc:[6,35],arrai:[28,0,22,1,19,13,2,21,18,20,4,35,34,10],"0x7f":1,reopen:[4,27],fast:14,happi:14,open:[22,7,19,13,2,21,18,20,4,34,33,24,29,35,36,27,9,10],predefin:1,size:[0,1,19,20,21,31,15,4,36,34,10],given:[28,10,20,31,15,4,36,19],breviti:[35,36],workaround:34,paramt:10,collectionnam:[19,20,18,22,6,24,36,9],conveni:[0,31,15],subtype_md5:28,especi:35,copi:2,specifi:[28,0,10,20,21,34,4,35,36,27,19],test_arrai:10,keepgo:[34,20],than:[0,10,13,20,2,21,31,15,34,36,27],png:[21,4],firebas:14,tedeh:34,were:[10,13],posit:[28,21,31,15,4,36],browser:14,pre:[22,1,19,20],fork:14,sai:36,ani:[0,19,13,14,35,36,10],simple_rename_collection_2:19,p1_prod_vers:[],bitwis:[35,31,15],squar:14,alias:0,destroi:[33,7,24,9],note:[31,15,19,10],take:[0,1,2,34,35,36],createfromhexstr:[0,23,34,9,8],begin:[0,4],sure:[36,10],normal:10,buffer:[28,0,1,19,13,21,18,20,4,34,29,36,27,10],clearer:34,getyear:20,homepag:14,renam:[19,20,18,24,35,9],byte_valu:28,later:[36,19,20],indexbound:[19,20],test_gs_read_stream:4,runtim:34,parseint:20,axi:20,show:[28,7,10,20,33,8,4,1,29,35,19],atom:[35,34,20],objectid3:8,objectid2:8,concurr:34,corner:34,onli:[0,22,19,13,2,34,20,4,6,35,36,27,10],slow:[34,22,19,20],dice:35,setprofilinginfo:22,activ:[14,34],written:[28,20,14,31,15,4,36],analyt:[14,12,32,35],overwritten:36,min_valu:[31,15],variou:[14,22,20],get:[7,18,4,6,8,9,10,12,13,14,22,34,19,20,21,24,27,29,37,33,35,36],secondari:[2,34,19,10,20],ssl:[34,19],cannot:[19,20,31,15,35,10],shiftrightunsign:[23,15,31,9],geo:20,gen:32,nolock:[34,19],doabl:0,seldom:34,yield:[18,20,19,34,13],isarrai:1,caboos:14,nettl:14,where:[28,0,1,19,13,2,21,18,20,4,6,35,36,34],highbit:[31,15],desced:10,wiki:35,khwang:14,testcas:34,infinit:[31,15,34],detect:2,heckmann:34,fs_chunk:36,integration_tests_2:19,wayt:20,enough:10,between:[35,34,19,27],"import":[35,36],across:[34,27,20],spars:[6,19,20],august:[12,32],test_group:20,come:[21,31,15,20],simple_find_and_modify_operations_:20,region:20,gwt:[31,15],tutori:[12,25,36],mani:[35,10],fromnumb:[23,15,31,9],reindex:[24,34,19,9,20],iscap:[34,24,9,20],db_option:27,period:[0,18],pop:35,createcreateindexcommand:34,fs_file:36,lessthan:[23,15,31,9],reaperinterv:[34,19,27],cursor_information_collect:19,cursorinst:10,coupl:[28,35,20],aciev:0,rebuilt:[19,20],derefer:[24,34,19,9],lowbit:[31,15],geonear:[34,24,9,20],"1mb":36,those:[31,15],"case":[10,20,31,15,6,35,36,34],myself:35,bson_seri:34,tostr:[28,29,8,31,15,4,23,20,36,9],trick:36,invok:36,idhex:0,firstext:22,simple_sort_collect:10,trello:[12,32],advantag:35,createexperi:32,eras:[21,18],dynamicgui:14,ascii:[2,28,34,27],acess:19,develop:[14,35],author:[0,21,13],media:14,same:[0,19,20,31,15,4,6,8,34,10],binari:[28,0,22,7,19,12,21,18,13,4,33,23,1,20,29,35,8,34,9,10],document:[0,22,1,19,12,2,21,18,13,4,33,6,34,7,20,14,35,36,27,10],createpk:27,exhaust:10,ifram:[25,32,17],finish:[36,20],closest:[31,15,20],utf8:[2,35,34,4,27],nest:[0,6],oid:3,driver:[0,13,2,12,18,32,34,14,24,35,36,27,9,37],gotend:4,newobjectid:8,improv:34,defo:0,bson_data_boolean:1,crud:[12,37,35],framework:14,brightcov:32,without:[1,19,31,15,27,34,18],model:[14,20],dereferenc:19,upsert:[20,13],ourexamplefiletowrit:4,execut:[10,13,34,22,4,20,35,19],rest:[14,34,8,20],hint:[10,20],db_connector:[18,27],except:[35,34,4,13],littl:35,blog:[14,0,18],framebord:[25,32,17],default_chunk_s:4,haystack:20,found2:4,around:[14,35,34],read:[28,7,19,20,2,21,34,4,23,24,35,36,9,10],grid:[28,12,29,14,34,24,36,9],spank:34,world:[7,19,13,20,4,1,36,29],lasterror:[24,34,19,9],reap:34,subtype_user_defin:28,saniti:34,poolsiz:[7,10,20,34,22,4,33,29,35,27,19],integ:[0,1,8,31,15,35,34],server:[28,22,1,19,13,2,33,18,20,4,14,7,36,34,29,35,8,27,10],firebaseco:14,either:[21,34,36,35],output:[0,20],greaterthanorequ:[23,15,31,9],manag:[14,21,34,35],bson_binary_subtype_byte_arrai:[28,1],eventloop:36,ascend:[0,10,6],intact:13,generationtim:8,setnodelai:34,slice:35,writedata:36,node_ev:34,confirm:35,heeeeeeeeeeeeeeeeeeeeeeeeeeee:[],legal:20,evolv:35,profilinginfo:[22,24,9],refer:[10,3,4,35,34,19],power:[14,32],broken:34,aquir:19,bson_binary_subtype_default:[28,34,1],regexp:[35,34,1],"throw":[35,34,36,13],comparison:8,pointer_to_collect:0,firstnam:[0,6],nocooki:[25,32,17],numbit:[31,15],bson_data_code_w_scop:1,gump:20,act:36,luck:36,readstream:[24,12,7,10,9],addus:[24,34,22,19,9],test_collections_info:19,your:[20,2,32,4,14,35,36],loc:20,log:[0,1,10,20,14,21,18,13,22,34,35,36,27],hex:[0,29,4,8],overwrit:[22,4],dropdup:[34,19,20],strict:[18,34,19,27,20],interfac:[7,10,14,34,33,35,29],low:[35,31,15,36],lot:[10,20,34,6,33,35,36],isvid:32,tupl:6,shamelessli:35,replsetsrv:2,faster:[6,34],pull:[35,34,22],dirti:35,possibl:[0,19,13,14,34,20,6,35],"default":[28,0,22,1,19,13,2,21,18,20,4,6,36,34,35,8,27,10],remove_subset_of_documents_saf:20,bson_data_min_kei:1,expect:[0,27],gone:[29,20,4,19],creat:[28,0,22,1,19,20,2,21,18,8,4,32,33,6,7,34,29,35,36,27,10],certain:[6,35],watcher:14,intro:35,file:[7,29,14,21,34,4,36,19],russel:32,incorrect:34,again:[4,10],kaba:14,field:[0,10,13,34,20,6,35,19],valid:[28,1,19,8,18,22,10],longlib:15,you:[0,1,19,13,2,21,18,20,6,34,35,36,27,10],scttnlsn:14,pefrom:20,sequenc:34,symbol:[12,1,30,34,23,35,9],opt_radix:[31,15],pool:[34,19,27],reduc:[31,15,34,20],lessthanorequ:[23,15,31,9],coreh:14,directori:34,descript:[28,1,4,10,19],tricki:35,potenti:34,alright:35,cpu:[34,36],unset:35,represent:[11,28,29,8,3,15,4,5,16,30,31],all:[0,22,1,19,13,2,21,18,20,4,6,34,35,36,27,10],forget:35,numberupd:20,dollar:18,simple_rename_collect:19,erhangundogan:14,follow:[0,10,13,2,4,6,35,36],fetchsiz:10,disk:[36,7,4,10,20],nodej:[14,17],subtype_default:28,nextobject:[24,0,19,9,10],aaron:34,setprofilinglevel:[22,24,9],evaul:19,util:[14,34],test_rename_collect:20,failur:[35,34],veri:[35,34,36],base698:14,list:[19,20,18,22,4,24,35,36,34,9],resav:20,adjust:[34,36],findandremov:[34,24,9,20],small:[25,36,34],retun:1,eas:14,zero:[31,15,34,8],pass:[1,19,20,2,18,8,4,34,36,27,10],what:[12,10,18,32,35,36],abc:[0,4,13],xor:[23,15,31,9],barrier:34,sum:[31,15],brief:25,delet:[19,20,21,34,4,24,35,36,27,9,29],version:[34,36,19,27,20],cruso:0,method:[28,0,10,20,12,18,8,4,37,34,35,36,27,29],full:[34,19,20],hash:[0,34,36,19,27],variat:35,behaviour:14,getmorecommand:[10,20],foobar3:4,strong:25,modifi:[35,20,13],valu:[0,1,18,4,6,8,9,10,13,15,22,16,34,19,20,21,23,27,28,30,31,32,35,36],bartt:14,isodd:[23,15,31,9],ahead:[14,35,36,20],showdiskloc:[34,10,20],amount:[35,31,15,19],pick:[35,34,36,19],codebas:[],mongoos:[14,12,25,32],narrow:20,evalfunct:1,via:35,shorthand:13,lazybum:14,c_1:20,deprec:19,default_root_collect:4,establish:[7,10,20,34,22,4,33,29,19],select:[18,20,27,34,13],test_collection_is_cap:20,distinct:[34,24,9,20],regist:4,two:[0,19,13,2,21,18,15,4,6,36,14,35,8,31],coverag:34,bson_binary_subtype_user_defin:[28,1],taken:35,minor:34,more:[0,7,19,13,2,31,15,4,33,20,35,36,34,10],flag:20,stick:35,particular:35,cach:1,none:[2,32],outlin:[35,36],dev:14,histori:19,remain:[36,4],learn:14,scan:[10,20],share:[14,34,19,27],shard:21,accept:[34,20],simple_document_insert_collection_no_saf:20,default_url:19,robinson:0,cours:35,newlin:4,divid:[31,15,20],rather:20,anoth:[0,4,35,8],simpl:[28,0,7,19,12,14,33,18,20,4,6,37,1,29,35,36,34,10],perman:19,resourc:[14,27],resultset:35,reflect:34,unlink:[24,21,36,4,9],associ:[36,4],keyorlist:10,github:[14,12,34,17,35],defineproperti:34,save_a_simple_document_modify_it_and_resave_it:20,caus:[35,34],callback:[0,22,19,13,21,18,20,4,6,34,35,36,27,10],spheric:20,doc_id:0,bson_data_oid:1,trade:36,through:[35,34,19,20],reconnect:[34,27],paramet:[0,19,13,2,21,18,22,4,6,34,35,36,27,10],style:[14,35,32],mongorepli:34,call:[0,10,14,34,4,36,27,19],asbuff:1,dbname:[34,19],stylu:17,rapidli:35,bypass:35,simple_limit_skip_queri:20,might:[6,36,19,35],alter:[0,18],good:[35,36],"return":[0,7,3,4,5,1,8,10,11,13,15,22,16,18,19,20,21,27,28,29,30,31,33,34,35,36],timestamp:[12,1,8,31,20,23,34,9],more_complex_index_test:[19,20],distancemultipli:20,compound:[19,20],karaco:14,readlen:4,emerleit:14,uploadd:21,instruct:2,authent:[24,34,22,19,9],easili:[31,15,34],achiev:0,skipvalu:10,found:[0,13,4,20,19],truncat:[18,36,4],hard:35,realli:35,connect:[12,7,19,20,2,34,22,4,14,37,33,36,24,29,35,25,27,9,10],slave:2,event:[7,10,21,34,4,33,35,36,27,19],mojo:14,b4ajeu13u6u:25,read_primari:34,shockwav:[],pullal:35,foreground:[19,20],core2duo:34,advanc:[12,37,18,4,35,36],pub:[],asc:[0,10,13],reason:4,base:[8,14,21,20,4,35,36],connectionopt:19,put:[28,10,20,34,4,23,24,36,9,29],seconddb:19,gethighbit:[23,15,31,9],tailabl:[34,10,20],omit:[35,3,36,34],dir:13,assign:[2,34],notifi:[35,36,20],articl:[12,36,37],lastnam:[0,6],number:[28,0,22,1,19,20,31,15,4,6,16,36,34,35,8,27,10],done:[0,7,19,20,21,34,13,22,33,35,36,27],construct:[31,15],autoclos:[21,36,7,4],create_and_drop_an_index:[19,20],miss:34,differ:[19,8,31,15,4,6,20,35,36,34,29],chunk_typ:4,script:[21,32],interact:[35,36,4,29],least:[0,20],custompkfactori:27,settim:8,statement:[35,36,19],illeg:[29,22,19,34,20],master:2,store:[1,10,14,21,4,35,36,19],schema:[12,32],otherid:8,option:[28,0,22,1,19,13,2,21,3,20,4,27,6,34,24,29,35,36,18,9,10],reseterrorhistori:[24,19,9],selector:[34,19,10,20],getter:[4,8],pars:[34,1,20],literarili:35,std:34,kind:36,bson_data_nul:1,whenev:[19,20],remov:[22,19,13,18,20,4,6,24,35,34,9],reus:[34,1,19],str:[31,15],consumpt:36,cleaner:14,luckili:[35,36],"null":[0,1,19,20,2,18,22,4,14,33,34,29,27,10],built:[14,35],equival:[35,20],valueof:[23,16,9,30],fromcollect:19,also:[0,10,13,18,4,6,35,36,34],build:[22,19,34,32,35,36],tool:[14,32],lubow:32,blackboard:[12,17],choos:[35,20],reach:[36,7],most:[0,36,35],plan:36,native_pars:[7,10,20,22,4,33,29,27,19],"16mb":21,filesystem:21,cover:19,part:[35,25,34,8],clean:[14,34,19],frombit:[23,15,31,9],ridicul:14,brightcoveexperi:32,session:14,find:[0,7,19,13,14,21,34,20,22,6,33,24,35,9,10],firewal:34,nosql:14,pretti:35,test_gs_weird_bug:4,numberofdocu:1,queu:14,batch_document_insert_collection_saf:20,hit:[19,20],unus:34,express:[0,20,14,21,17,35],fieldtoupd:35,test_map_reduce_functions_scop:20,nativ:[14,35,34,27],ferret:14,restart:[33,7],statist:[34,22,19,20],wrote:35,set:[0,22,1,19,13,2,21,18,20,4,6,32,36,34,35,8,27,10],jade:17,see:[0,13,21,18,15,31,6,35,36,27],easymongo:14,close:[7,19,20,14,21,34,22,4,33,24,29,35,36,27,9,10],andrewjston:34,misalign:34,someth:[4,27],hold:[35,1,4,10],shockwaveflash:[],altern:[14,20],signatur:[4,10],complement:[31,15],javascript:[1,19,20,14,31,15,32,35],salzman:34,succeed:6,batchsizevalu:10,last:[14,21,19,35],create_and_drop_all_index:[19,20],context:27,logout:[24,22,19,9],whole:[35,20,4,19],createdat:10,load:[0,34],simpli:0,jsmode:20,point:[10,20,31,15,35,36],instanti:[35,34],param:32,shutdown:34,linux:34,backend:35,faithfulli:[31,15],user_id:20,due:[35,34,29],empti:[28,0,4,10,20],bgcolor:32,txt:4,strategi:[35,34],test_streamingrecords_funct:10,fire:[7,19,13,14,21,4,35,36,27],admindb:[22,19],imag:[21,36],understand:35,func:[1,20],look:[10,20,21,34,4,6,35,36],mdoq:14,straight:[35,36],batch:[35,34,10,20],"while":[0,34,4,21,10],getownpropertynam:34,behavior:[0,13,31,15,35,34],simple_key_based_distinct_sub_query_filt:20,fun:36,fixtur:14,robin:35,loop:34,real:[14,12,32],test_gs_unlink:4,readi:[33,7,4,35,10],key2:0,key1:0,jpg:4,itself:10,test_deref_exampl:19,rid:34,chase:34,decor:34,simple_document_insert_with_function_saf:20,geohaystacksearch:[34,24,9,20],coffeescript:[14,12,25],p_db:[2,19],higher:[2,34,36,27,20],optim:[34,20],operaion:21,numberofretri:[34,19,27],iya_logo_final_bw:4,temporari:[4,20],user:[28,0,1,19,12,14,34,13,4,6,32,22],hello2:20,keyf:20,recreat:27,lower:[19,20],entri:[36,20,4,19],explan:[19,20],getlowbitsunsign:[23,15,31,9],a_1:20,collabor:32,shape:34,tempcollect:20,sidebar:[],update_a_simple_document_multi:20,checkkei:1,bson_data_timestamp:1,cur:36,colladow:14,tdegrunt:14,keeptemp:20,appli:[0,34,10,35],input:[31,15,20],mod:[0,31,15],format:[0,19,20,13,22,10],big:[35,34,36],checksum:4,shiftright:[23,15,31,9],rs_name:[2,34],replsetserv:[28,22,1,19,20,2,33,34,8,4,7,29,10],like:[0,19,20,14,31,15,6,36,10],success:[21,4,10],resolv:19,collect:[0,2,3,4,6,9,10,12,13,14,22,34,19,20,21,24,26,27,29,37,32,33,18,35,36],bson_data_cod:1,popular:35,bamboo:34,variant:35,serverpair:34,often:[31,15],federated_f9:[],creation:[22,19,20,34,32,35],some:[28,0,7,19,20,21,34,4,6,29,35,36,10],back:[0,22,8,14,31,15,4,20,35],understood:35,dropallindex:[24,9,20],scale:[35,36,20],slaveok:[34,19,20],chunksiz:[21,36,4],retri:[35,34,19,27],larg:[0,19,20,21,35,36],cgi:[],intial:20,previou:[36,27],run:[12,19,20,2,34,13,35,36,37],lublow:32,simple_reset_error_history_col:19,step:36,simple_explain_queri:20,zir:14,subtract:[23,15,31,9],"96b8":[],k1mnspb8wvq:25,allowfullscreen:[25,32,17],recordquerystat:19,block:[36,19,20],cygwin:34,flashvar:[],within:[31,15],simple_index_test:20,ensur:[19,20,34,6,35,36],test_collection_index_exist:20,bson_deseri:34,textual:[31,15],custom:[0,34,36,27,20],includ:[0,19,20,18,32,4,6,34,35,27,10],forward:4,files:4,properli:[34,4],uniquedoc:20,"_bsontyp":34,link:[12,36,37,35],translat:14,simple_count_exampl:20,line:[14,36,4],info:[34,22,36,19,20],concaten:[31,15,4],consist:34,caller:10,forceserverobjectid:[34,19,27],contin:14,readlin:[24,4,9],similar:21,constant:[28,1,10,4,23,24,9,19],multiplecoll2:19,parser:[34,1,19,27],doesn:[0,27,13],repres:[10,8,31,15,4,30,16,35],isconnect:34,titl:[0,20,26,13],unidirect:10,wakup:19,nice:35,deseri:[1,10,34,23,35,9],bcoe:14,jannehietamaki:34,mongodb:[0,1,2,18,4,6,7,8,9,10,12,13,14,22,17,34,19,20,21,25,27,28,29,32,33,35,36],eval:[1,10,20,34,24,9,19],profilinglevel:[22,24,9],algorithm:[2,31,15,27,34],cursorinform:19,"11cf":[],tradeoff:36,awesom:[12,25,17],far:4,hello:[28,7,19,13,20,4,1,35,36,29],code:[28,22,7,10,20,33,34,8,4,1,29,35,36,19],partial:[10,20],worldbuff:4,queri:[0,22,19,13,12,18,20,4,6,37,34,35,26,27,10],idvalu:0,mongoskin:14,octet:4,replicasetcheckinterv:34,base64:[2,34,27,29],update_a_simple_document_upsert:20,send:[2,35,34,19,27],swliveconnect:[],io_seek_end:4,sens:13,reapertimeout:[34,19,27],passiv:34,result2:29,degrunt:14,writebuff:34,untouch:27,relev:35,magic:14,gettim:[10,8],fieldorspec:[19,20],fewer:20,"try":[35,34,20,36,13],race:34,bson_data_binari:1,smaller:21,fortun:35,natur:35,jump:[35,36],video:36,odm:[14,12,25],download:35,odd:[31,15],append:[21,4,35],compat:34,index:[12,1,19,20,18,6,24,26,34,9,10],compar:[8,31,15,4,6,23,9],test_correctly_access_collect:19,access:[10,20,21,22,4,30,16,19],experiment:34,asced:10,lee:34,bson_data_int:1,simplereach:32,cursor_count_collect:10,calipso:14,let:[7,10,20,34,4,35,36,19],filedescriptor:36,becom:35,sinc:[35,31,15,36,13],subtype_byte_arrai:28,nexttick:34,convert:[0,35,8],convers:[35,20],larger:[21,34,36],technolog:32,chang:[20,31,15,35,36,34],configur:[2,35,18,19,34],read_secondari:[2,34],app:[2,34,32],mattinsl:14,api:[12,19,14,23,24,36],redi:32,chrisgibson:14,from:[28,0,22,1,19,13,2,21,18,15,4,34,36,20,29,35,8,31,10],batchsiz:[24,10,19,9,20],doubl:[12,34,23,16,35,9],next:[0,1,10,32,36,27],websit:[14,32],chr:4,sort:[0,10,13,34,20,6,24,8,9],src:[25,32,17],benchmark:34,name2:0,socketopt:[2,34,27],sollect:18,account:20,retriev:[0,22,10,13,21,34,20,4,35,36,19],scalabl:21,multiple_db_inst:19,annot:36,tag:[34,20],thin:14,assum:[31,15],fetch:[0,29,10,20,6,35,19],queryfailur:34,control:[35,34,36,27],objectid:[28,0,22,7,19,12,33,3,20,4,23,1,36,34,29,35,8,27,9,10],process:[14,31,15,10,34],lock:[34,36,19],calcul:1,username_:6,high:[19,20,31,15,35,34],unopen:34,serial:[1,19,20,34,23,9],pingresult:22,integration_test_:[2,19],instead:[0,19,20,2,34,6,36,27,10],npm:[35,34],await:19,formattedorderclaus:34,originaldata:29,alloc:[34,1,19],aaaaipotmrk:32,remove_all_documents_no_saf:20,correspond:[6,18,15,31],element:[0,4,35,10],issu:[35,34,20],writ:4,allow:[19,20,18,22,34,35,36,27,10],subtyp:28,deoptim:34,movi:[],doc2:35,doc3:35,move:[21,34,4,35],alexeypetrushin:14,doc4:35,autoindexid:19,server_opt:27,effici:[35,36,20],bunch:[34,19,20],perfect:35,total:[0,20],crash:34,greater:[0,31,15,10],handl:[10,20,31,15,4,35,36,34],databs:[21,18,27],auth:[34,19],renamecollect:[24,19,9],precess:35,numberofremoveddoc:20,writefil:[24,21,36,4,9],convin:0,anyth:34,edit:[36,4],emb:[25,32,17],slide:32,deserializeddoc:1,exampledb:[35,36],subset:[10,20],opensync:4,chunk:[21,34,36,4],bson_binary_subtype_uuid:[28,1],default_content_typ:4,pushal:[35,34],our:[35,36,4,10],special:[35,31,15,36,10],out:[12,19,8,2,34,20,35,36,27,37],variabl:[35,34,20],trickier:[0,35],categori:36,suitabl:36,clsid:[],leverag:35,ref:34,clone:14,math:8,jessica:[0,13],insid:[0,36,21,6],dropcollect:[24,18,19,9],unpars:34,releas:34,princess:20,unwant:0,could:[35,34],shiftleft:[23,15,31,9],keep:[21,34,19,35,20],length:[28,22,1,10,20,21,8,4,23,36,9,19],lte:0,primarki:0,minkei:[12,23,1,34,5],evanp:14,debugmessag:34,iszero:[23,15,31,9],should_correctly_rewind_and_restart_cursor:10,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:19,prioriti:34,"long":[12,1,10,8,34,15,23,35,9],start:[28,0,1,10,20,2,18,4,35,36],system:[14,18,36,4],messag:[19,13,34,22,4,20],createfromtim:[23,34,9,8],bson_data_max_kei:1,termin:4,"final":[35,34,20],idottv:14,deconstruct:36,test_gs_getc_fil:4,exactli:18,gridstorew:4,bson_data_object:1,replset:[2,19],mongoserv:[18,27],tocollect:19,charact:[28,34,8,4,20],test_gs_puts_and_readlin:4,seriou:34,"function":[0,1,2,18,4,7,8,10,13,14,15,22,34,19,20,21,27,28,29,31,33,35,36],counter:[27,20],terribl:34,viewer:[],corrupt:22,have:[0,19,20,2,18,4,6,35,36],tabl:[35,18,25],need:[0,1,19,13,21,18,15,31,6,35,36,27],turn:[0,22,19],border:25,buildinfo:[22,24,9],min:[34,19,10,20],rout:14,mix:[0,6],milli:22,test_other_drop:20,orgiin:4,singl:[28,0,32,19,13,21,34,20,4],fileid:[36,7,4],statsync:4,whi:0,serverconfig:[34,19,27],why:[14,35],overwriten:4,url:[14,19],timestamplib:31,request:[34,10],face:35,test_collect:13,snapshot:[10,20],error:[0,22,7,19,13,14,21,18,20,4,6,33,34,35,27,10],determin:[35,10],streamrecord:[24,35,34,10,9],fact:[35,13],text:[32,31,15,36,4],serializefunct:[34,1,19,20],verbos:20,"static":14,nagl:[2,34,27],anywai:[19,20],setter:[4,8],locat:[35,20,4,10,19],playerkei:32,should:[0,22,19,20,18,15,36,29,8,31,10],noid:14,test_cursorstream_paus:33,local:[3,19],devnul:14,doc1:35,ritch:[14,34],kiefer:32,gettimestamp:[23,34,9,8],donewithwrit:36,enabl:[34,19,27],organ:32,simple_batch_size_collect:10,tohexstr:[0,23,34,9,8],integr:[14,35,36],contain:[28,1,19,20,2,18,4,35,36,10],grab:[22,19,10],mon4mongo:14,"4e9491be94469d0054000072":[],view:14,modulo:[0,23,15,31,9],packet:34,meritt:14,statu:[14,35,34],wire:[35,34],correctli:[35,34,20],state:[35,10,27],crude:35,world2:20,kei:[0,1,19,20,34,4,6,35,36,27,10],buckets:20,simple_queri:20,isol:34,job:[14,20],entir:[36,4,10],auto_reconnect:[7,10,20,2,22,4,33,29,35,36,27,19],crc32:1,addit:[0,1,19,20,31,15,22,36,10],mongod:14,admin:[12,32,19,20,34,22,24,9],mongoj:14,equal:[28,0,22,7,19,20,33,31,15,4,23,1,29,35,8,9,10],etc:[0,27,20],instanc:[22,1,10,20,2,34,8,4,29,35,36,27,19],greaterthan:[23,15,31,9],mongoq:14,subtype_funct:28,comment:[34,10,20],toint:[23,15,31,9],structur:[0,36,35],removealllisten:34,save_a_simple_docu:20,addition:18,compon:34,json:[12,23,15,31,35],treat:[0,34,10],pkfactori:[19,20],immedi:13,bit:[0,1,21,31,15,35,36,34],both:[34,20],assert:[28,22,7,10,20,33,8,4,1,29,19],ador:14,present:[6,18,32,12],replic:[2,19],multi:[20,13],plain:34,cursor:[0,7,19,20,12,34,22,33,24,35,9,10],defin:[28,0,1,19,13,31,15,4,34,20,35,27],setreadprefer:34,bson_data_arrai:1,observ:14,layer:[14,35],helper:[14,34],site:2,lightweight:14,tojson:[23,15,31,9,34],getc:[24,4,9],cross:34,member:[2,34],world_no_saf:20,probabl:0,gett:14,difficult:36,calculateobjects:[23,1,9],http:[14,34,32,17,35,25],hostnam:27,keepal:[2,34,27],upon:10,pluginspag:[],retriv:22,student:25,serializewithbufferandindex:[23,1,9],chunk_siz:[21,4],off:[10,2,18,22,4,34,35,27,19],center:20,nevertheless:27,well:[0,34,36,35],exampl:[28,0,22,7,19,12,21,18,13,4,33,6,37,1,36,20,29,35,8,27,10],command:[10,20,14,34,22,4,24,35,27,9,19],simple_geo_near_command:20,validatecollect:[34,22,24,9],latest:35,distanc:20,paus:[33,7,24,9],less:[35,31,15],"boolean":[7,19,20,21,31,15,4,6,1,36,10],additon:6,tcp:35,arrj:14,indexinform:[10,20,34,6,24,9,19],web:[14,35],seekloc:[36,4],add:[22,19,8,31,15,6,23,20,35,9],cleanup:[34,36],tjanczuk:14,logger:34,match:[0,22,20,13,18,15,35,31],karait:14,simple_key_based_distinct:20,piec:[35,31,15,36],know:18,password:[34,22,19],recurs:[15,31,1,4],isclos:[24,10,9],desc:[0,10],bson_data_str:1,insert:[0,22,1,19,12,18,13,4,24,34,33,20,35,26,27,9,10],resid:35,backbon:32,fsync:[22,19,20],isui:32,chunkcollect:[24,4,9],necessari:0,"0xff":1,async:[14,35],page:[0,32,35,12],dispatch:35,milewis:14,suppli:[34,36],macromedia:[],gridf:[12,29,37,21,34,4,36],flush:[36,7,4],proper:34,fileinfo:36,newhex:8,librari:[14,12,34,36],leaf:14,lead:[31,15,34],leak:34,avoid:[6,34,22,35],fromint:[23,15,31,9],thank:34,leav:[34,13],kcbanner:14,mode:[10,20,21,18,4,34,36,27,19],slight:35,journal:19,usag:[28,12,1,29,8,2,21,18,4,34,35,36,27],collection_nam:18,host:27,although:36,offset:[28,36,4],java:[31,15],cliftonc:14,simpler:[14,35,34,10,20],continu:14,about:[19,13,6,35,36,27,10],actual:[0,36,19,35,27],socket:[12,19,2,34,32,17,35,27],dbinstanc:36,notequ:[23,15,31,9],constructor:[1,2,3,4,5,7,8,9,10,11,15,22,16,34,19,20,23,24,27,28,29,30,31,33],fals:[0,22,7,19,13,21,18,20,4,33,1,34,29,36,27,10],disabl:[2,34,27],own:[34,4],automat:[7,19,2,21,34,35,36,27,10],dataset:[0,35],bson:[0,7,3,4,5,1,8,9,10,11,12,13,22,16,18,19,20,23,27,28,29,30,33,34],merg:[34,20],val:20,pictur:36,transfer:19,mykei:35,much:[35,36,13],concat:0,"var":[28,0,22,1,19,13,2,21,18,20,4,33,7,36,29,35,8,27,10],fsname:29,deliveri:32,brand:34,learnboost:14,waitforconnect:34,overflow:[31,15],inlin:20,bug:[34,36],count:[0,19,13,18,20,4,24,34,9,10],made:36,wise:0,whether:[31,15],wish:[28,1,19,20,22,4,36],displai:[32,19],asynchron:[2,35],record:[0,19,13,21,18,20,4,6,35,27,10],below:[35,31,15,19,13],limit:[0,10,20,21,24,35,9],otherwis:[1,10,31,15,4,35,36],problem:[34,22],myexperience1123429378001:32,evalu:[1,19],"int":[31,15],dure:[35,34,22,19,20],year:0,filenam:[21,34,36,4],replica:[2,34,19],implement:[14,35,31,15,34],eric:32,retrymilisecond:[34,19,27],inc:[35,34],tick:34,detail:[6,10,21],deepequ:[29,20,4,10,19],other:[0,32,12,2,31,15,4,35,36,34,37],bool:8,futur:[14,35,34,19],branch:34,stat:[34,24,9,20],findon:[0,19,20,34,24,35,9],"class":[7,3,4,5,1,8,10,11,15,22,16,34,19,20,28,29,30,31,32,33,35,36],geck:14,stai:20,eof:[24,21,36,4,9],integration_test:[7,10,20,22,4,33,29,19],kaij:34,"0_gnhwzhc":25},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","ObjectID()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Double()","Awesome Node.js + MongoDB Applications","Collections","Db()","Collection()","GridStore","Admin()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Binary()","Grid()","Symbol()","Timestamp()","Node.JS Specific Presentations","CursorStream()","Changelog","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver","Articles"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/double","content/awesomeappsvideo","markdown-docs/collections","api-generated/db","api-generated/collection","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-bson-generated/symbol","api-bson-generated/timestamp","content/nodejsvideo","api-generated/cursorstream","changelog/changelog","api-articles/nodekoarticle1","api-articles/nodekoarticle2","api-articles/index"]}) \ No newline at end of file diff --git a/video.html b/video.html new file mode 100644 index 00000000000..409e25055c0 --- /dev/null +++ b/video.html @@ -0,0 +1,139 @@ + + + + + + + + + Presentations — MongoDB Node.JS Driver 0.9.9.1 documentation + + + + + + + + + + +
    +
    +
    +
    + +
    +

    Presentations

    +
    +

    NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js

    +

    Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach

    +

    SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include:

    +
      +
    • Dynamic collection creation
    • +
    • Updating (Increments over sets)
    • +
    • Schema
    • +
    • Next gen schemas for dynamic filters
    • +
    +
    +
    + + +
    +
    +
    +
    +
    + +

    Page Contents

    + + + +

    Core Documentation

    + + + + +

    This Page

    + +
    +
    +
    +
    + + + + + + + \ No newline at end of file From e3987e580ca23d765afb4b7ca78a18fe8fcad4c1 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Thu, 16 Feb 2012 12:52:41 +0100 Subject: [PATCH 12/56] Updated docs --- .buildinfo | 2 +- .npmignore | 12 - HISTORY | 402 --- Makefile | 67 - Readme.md | 408 --- TODO | 25 - _sources/api-generated/changelog.txt | 401 --- _sources/awesomeappsvideo.txt | 14 - _sources/content/nodejsvideo.txt | 118 +- _sources/index.txt | 52 +- _sources/nodejsvideo.txt | 28 - _sources/video.txt | 19 - api-generated/changelog.html | 806 ------ awesomeappsvideo.html | 135 - content/nodejsvideo.html | 106 +- dev/benchmark/bson_benchmark.js | 86 - dev/benchmark/bson_buffalo_benchmark.js | 299 --- dev/benchmark/bson_native_benchmark.js | 112 - dev/benchmark/emit_benchmark.js | 49 - dev/benchmark/grid_fs_write_benchmark.js | 25 - dev/benchmark/gridfs_benchmark.js | 104 - dev/benchmark/hammer.js | 143 - dev/benchmark/hammer_replicaset.js | 197 -- dev/benchmark/streaming_benchmark.js | 43 - dev/harness/memory_leak_harness.js | 46 - dev/tools/build-docs.js | 174 -- dev/tools/doc-templates/changelog.ejs | 5 - dev/tools/doc-templates/class.ejs | 317 --- dev/tools/doc-templates/function.ejs | 1 - dev/tools/doc-templates/github.ejs | 76 - dev/tools/doc-templates/index.ejs | 15 - dev/tools/doc-templates/index_no_header.ejs | 11 - dev/tools/docs.js | 476 ---- dev/tools/gleak.js | 7 - dev/tools/test_all.js | 176 -- dev/tools/test_set_runner.js | 27 - docs/README.md | 14 - docs/articles/NodeKOArticle1.md | 279 -- docs/articles/NodeKOArticle2.md | 199 -- docs/collections.md | 117 - docs/database.md | 120 - docs/gridfs.md | 135 - docs/indexes.md | 73 - docs/insert.md | 124 - docs/queries.md | 271 -- docs/replicaset.md | 53 - docs/sphinx-docs/.gitignore | 7 - docs/sphinx-docs/Makefile | 130 - docs/sphinx-docs/conf.py | 256 -- docs/sphinx-docs/npm_dependent_packages.json | 266 -- docs/sphinx-docs/source/contents.rst | 26 - docs/sphinx-docs/source/index.rst | 50 - docs/sphinx-docs/source/static/.mongodb | 0 docs/sphinx-docs/source/static/active.png | Bin 1630 -> 0 bytes .../source/static/logo-mongodb.png | Bin 13030 -> 0 bytes docs/sphinx-docs/source/static/nonactive.png | Bin 703 -> 0 bytes docs/sphinx-docs/templates/.mongodb | 0 .../sphinx-docs/themes/mongodb/globaltoc.html | 12 - docs/sphinx-docs/themes/mongodb/layout.html | 210 -- docs/sphinx-docs/themes/mongodb/localtoc.html | 11 - .../sphinx-docs/themes/mongodb/relations.html | 19 - .../themes/mongodb/static/mongodb-docs.css_t | 250 -- docs/sphinx-docs/themes/mongodb/theme.conf | 4 - examples/admin.js | 53 - examples/blog.js | 102 - examples/capped.js | 27 - examples/cursor.js | 70 - examples/gridfs.js | 149 -- examples/index.js | 62 - examples/info.js | 48 - examples/oplog.js | 114 - examples/queries.js | 125 - examples/replSetServersQueries.js | 138 - examples/replSetServersSimple.js | 66 - examples/simple.js | 42 - examples/strict.js | 36 - examples/types.js | 42 - examples/url.js | 12 - external-libs/bson/.gitignore | 3 - external-libs/bson/Makefile | 45 - external-libs/bson/bson.cc | 2334 ----------------- external-libs/bson/bson.h | 105 - external-libs/bson/index.js | 20 - external-libs/bson/test/test_bson.js | 347 --- external-libs/bson/test/test_full_bson.js | 216 -- .../bson/test/test_stackless_bson.js | 130 - external-libs/bson/wscript | 39 - genindex.html | 14 +- getting-started.html | 159 -- index.html | 90 +- index.js | 1 - install.js | 41 - lib/mongodb/admin.js | 342 --- lib/mongodb/bson/binary.js | 186 -- lib/mongodb/bson/binary_parser.js | 392 --- lib/mongodb/bson/binary_utils.js | 29 - lib/mongodb/bson/bson.js | 1344 ---------- lib/mongodb/bson/code.js | 23 - lib/mongodb/bson/db_ref.js | 29 - lib/mongodb/bson/double.js | 31 - lib/mongodb/bson/float_parser.js | 118 - lib/mongodb/bson/long.js | 852 ------ lib/mongodb/bson/max_key.js | 11 - lib/mongodb/bson/min_key.js | 11 - lib/mongodb/bson/objectid.js | 247 -- lib/mongodb/bson/symbol.js | 47 - lib/mongodb/bson/timestamp.js | 852 ------ lib/mongodb/collection.js | 1432 ---------- lib/mongodb/commands/base_command.js | 31 - lib/mongodb/commands/db_command.js | 207 -- lib/mongodb/commands/delete_command.js | 113 - lib/mongodb/commands/get_more_command.js | 85 - lib/mongodb/commands/insert_command.js | 143 - lib/mongodb/commands/kill_cursor_command.js | 100 - lib/mongodb/commands/query_command.js | 212 -- lib/mongodb/commands/update_command.js | 176 -- lib/mongodb/connection/connection.js | 417 --- lib/mongodb/connection/connection_pool.js | 259 -- lib/mongodb/connection/connection_utils.js | 23 - lib/mongodb/connection/repl_set_servers.js | 968 ------- lib/mongodb/connection/server.js | 622 ----- lib/mongodb/connection/simple_emitter.js | 48 - .../connection/strategies/ping_strategy.js | 125 - .../strategies/statistics_strategy.js | 40 - lib/mongodb/cursor.js | 704 ----- lib/mongodb/cursorstream.js | 139 - lib/mongodb/db.js | 1694 ------------ lib/mongodb/gridfs/chunk.js | 210 -- lib/mongodb/gridfs/grid.js | 95 - lib/mongodb/gridfs/gridstore.js | 1094 -------- lib/mongodb/gridfs/readstream.js | 167 -- lib/mongodb/index.js | 131 - lib/mongodb/responses/mongo_reply.js | 133 - lib/mongodb/utils.js | 44 - nodejsvideo.html | 145 - objects.inv | Bin 1218 -> 1217 bytes package.json | 80 - searchindex.js | 2 +- test/admin_test.js | 698 ----- test/authentication_test.js | 171 -- test/auxilliary/authentication_test.js | 216 -- test/auxilliary/repl_set_ssl_test.js | 80 - test/auxilliary/replicaset_auth_test.js | 242 -- .../single_server_kill_reconnect.js | 159 -- test/auxilliary/ssl_test.js | 78 - test/bson/bson_test.js | 1606 ------------ test/bson/commands_test.js | 129 - test/bson_types_test.js | 215 -- test/certificates/mycert.pem | 36 - test/collection_test.js | 1189 --------- test/connect_test.js | 147 -- test/connection/connection_pool_test.js | 102 - test/connection/message_parser_test.js | 436 --- test/connection_test.js | 170 -- test/cursor_test.js | 1965 -------------- test/cursorstream_test.js | 230 -- test/custom_pk_test.js | 107 - test/db_test.js | 1441 ---------- test/error_test.js | 311 --- test/exception_handling_test.js | 101 - test/find_test.js | 1647 ------------ test/geo_search_test.js | 145 - test/gridstore/grid_store_file_test.js | 947 ------- test/gridstore/grid_store_stream_test.js | 310 --- test/gridstore/grid_store_test.js | 1351 ---------- test/gridstore/grid_test.js | 189 -- test/gridstore/iya_logo_final_bw.jpg | Bin 74008 -> 0 bytes test/gridstore/readstream_test.js | 239 -- test/gridstore/test_gs_weird_bug.png | Bin 52184 -> 0 bytes test/gridstore/test_gs_working_field_read.pdf | Bin 130253 -> 0 bytes test/index_test.js | 699 ----- test/insert_test.js | 1149 -------- test/logging_test.js | 93 - .../grids_fs_compatibility_test.js | 20 - test/manual_tests/hanging_queries_test.js | 182 -- test/manual_tests/issue_replicaset_test.js | 43 - test/manual_tests/manual_larger_queries.js | 137 - test/manual_tests/manual_lock.js | 84 - test/manual_tests/replicaset_test.js | 70 - test/manual_tests/server_load.js | 152 -- test/manual_tests/simple_test.js | 23 - test/manual_tests/single_test.js | 61 - test/manual_tests/test.js | 83 - test/map_reduce_test.js | 520 ---- test/multiple_dbs_on_connection_pool_test.js | 256 -- test/objectid_test.js | 351 --- test/raw_test.js | 397 --- test/reaper_test.js | 88 - test/regexp_test.js | 126 - test/remove_test.js | 171 -- test/replicaset/connect_test.js | 518 ---- test/replicaset/count_test.js | 208 -- test/replicaset/insert_test.js | 484 ---- test/replicaset/map_reduce_test.js | 251 -- test/replicaset/query_secondaries_test.js | 283 -- .../read_preference_replicaset_test.js | 424 --- .../read_preferences_single_test.js | 362 --- test/replicaset/tags_test.js | 382 --- test/replicaset/two_server_tests.js | 162 -- test/streaming_test.js | 143 - test/tools/keyfile.txt | 1 - test/tools/replica_set_manager.js | 591 ----- test/tools/server_manager.js | 142 - test/tools/sharding_manager.js | 155 -- test/unicode_test.js | 185 -- video.html | 139 - 206 files changed, 308 insertions(+), 49877 deletions(-) delete mode 100644 .npmignore delete mode 100644 HISTORY delete mode 100644 Makefile delete mode 100644 Readme.md delete mode 100644 TODO delete mode 100644 _sources/api-generated/changelog.txt delete mode 100644 _sources/awesomeappsvideo.txt delete mode 100644 _sources/nodejsvideo.txt delete mode 100644 _sources/video.txt delete mode 100644 api-generated/changelog.html delete mode 100644 awesomeappsvideo.html delete mode 100644 dev/benchmark/bson_benchmark.js delete mode 100644 dev/benchmark/bson_buffalo_benchmark.js delete mode 100644 dev/benchmark/bson_native_benchmark.js delete mode 100644 dev/benchmark/emit_benchmark.js delete mode 100644 dev/benchmark/grid_fs_write_benchmark.js delete mode 100644 dev/benchmark/gridfs_benchmark.js delete mode 100644 dev/benchmark/hammer.js delete mode 100644 dev/benchmark/hammer_replicaset.js delete mode 100644 dev/benchmark/streaming_benchmark.js delete mode 100644 dev/harness/memory_leak_harness.js delete mode 100644 dev/tools/build-docs.js delete mode 100644 dev/tools/doc-templates/changelog.ejs delete mode 100644 dev/tools/doc-templates/class.ejs delete mode 100644 dev/tools/doc-templates/function.ejs delete mode 100644 dev/tools/doc-templates/github.ejs delete mode 100644 dev/tools/doc-templates/index.ejs delete mode 100644 dev/tools/doc-templates/index_no_header.ejs delete mode 100644 dev/tools/docs.js delete mode 100644 dev/tools/gleak.js delete mode 100644 dev/tools/test_all.js delete mode 100644 dev/tools/test_set_runner.js delete mode 100644 docs/README.md delete mode 100644 docs/articles/NodeKOArticle1.md delete mode 100644 docs/articles/NodeKOArticle2.md delete mode 100644 docs/collections.md delete mode 100644 docs/database.md delete mode 100644 docs/gridfs.md delete mode 100644 docs/indexes.md delete mode 100644 docs/insert.md delete mode 100644 docs/queries.md delete mode 100644 docs/replicaset.md delete mode 100644 docs/sphinx-docs/.gitignore delete mode 100644 docs/sphinx-docs/Makefile delete mode 100644 docs/sphinx-docs/conf.py delete mode 100644 docs/sphinx-docs/npm_dependent_packages.json delete mode 100644 docs/sphinx-docs/source/contents.rst delete mode 100644 docs/sphinx-docs/source/index.rst delete mode 100644 docs/sphinx-docs/source/static/.mongodb delete mode 100644 docs/sphinx-docs/source/static/active.png delete mode 100644 docs/sphinx-docs/source/static/logo-mongodb.png delete mode 100644 docs/sphinx-docs/source/static/nonactive.png delete mode 100644 docs/sphinx-docs/templates/.mongodb delete mode 100644 docs/sphinx-docs/themes/mongodb/globaltoc.html delete mode 100644 docs/sphinx-docs/themes/mongodb/layout.html delete mode 100644 docs/sphinx-docs/themes/mongodb/localtoc.html delete mode 100644 docs/sphinx-docs/themes/mongodb/relations.html delete mode 100644 docs/sphinx-docs/themes/mongodb/static/mongodb-docs.css_t delete mode 100644 docs/sphinx-docs/themes/mongodb/theme.conf delete mode 100644 examples/admin.js delete mode 100644 examples/blog.js delete mode 100644 examples/capped.js delete mode 100644 examples/cursor.js delete mode 100644 examples/gridfs.js delete mode 100644 examples/index.js delete mode 100644 examples/info.js delete mode 100644 examples/oplog.js delete mode 100644 examples/queries.js delete mode 100644 examples/replSetServersQueries.js delete mode 100644 examples/replSetServersSimple.js delete mode 100644 examples/simple.js delete mode 100644 examples/strict.js delete mode 100644 examples/types.js delete mode 100644 examples/url.js delete mode 100644 external-libs/bson/.gitignore delete mode 100644 external-libs/bson/Makefile delete mode 100644 external-libs/bson/bson.cc delete mode 100644 external-libs/bson/bson.h delete mode 100644 external-libs/bson/index.js delete mode 100644 external-libs/bson/test/test_bson.js delete mode 100644 external-libs/bson/test/test_full_bson.js delete mode 100644 external-libs/bson/test/test_stackless_bson.js delete mode 100644 external-libs/bson/wscript delete mode 100644 getting-started.html delete mode 100755 index.js delete mode 100644 install.js delete mode 100644 lib/mongodb/admin.js delete mode 100644 lib/mongodb/bson/binary.js delete mode 100644 lib/mongodb/bson/binary_parser.js delete mode 100644 lib/mongodb/bson/binary_utils.js delete mode 100644 lib/mongodb/bson/bson.js delete mode 100644 lib/mongodb/bson/code.js delete mode 100644 lib/mongodb/bson/db_ref.js delete mode 100644 lib/mongodb/bson/double.js delete mode 100644 lib/mongodb/bson/float_parser.js delete mode 100644 lib/mongodb/bson/long.js delete mode 100644 lib/mongodb/bson/max_key.js delete mode 100644 lib/mongodb/bson/min_key.js delete mode 100644 lib/mongodb/bson/objectid.js delete mode 100644 lib/mongodb/bson/symbol.js delete mode 100644 lib/mongodb/bson/timestamp.js delete mode 100644 lib/mongodb/collection.js delete mode 100644 lib/mongodb/commands/base_command.js delete mode 100644 lib/mongodb/commands/db_command.js delete mode 100644 lib/mongodb/commands/delete_command.js delete mode 100644 lib/mongodb/commands/get_more_command.js delete mode 100644 lib/mongodb/commands/insert_command.js delete mode 100644 lib/mongodb/commands/kill_cursor_command.js delete mode 100644 lib/mongodb/commands/query_command.js delete mode 100644 lib/mongodb/commands/update_command.js delete mode 100644 lib/mongodb/connection/connection.js delete mode 100644 lib/mongodb/connection/connection_pool.js delete mode 100644 lib/mongodb/connection/connection_utils.js delete mode 100644 lib/mongodb/connection/repl_set_servers.js delete mode 100644 lib/mongodb/connection/server.js delete mode 100644 lib/mongodb/connection/simple_emitter.js delete mode 100644 lib/mongodb/connection/strategies/ping_strategy.js delete mode 100644 lib/mongodb/connection/strategies/statistics_strategy.js delete mode 100644 lib/mongodb/cursor.js delete mode 100644 lib/mongodb/cursorstream.js delete mode 100644 lib/mongodb/db.js delete mode 100644 lib/mongodb/gridfs/chunk.js delete mode 100644 lib/mongodb/gridfs/grid.js delete mode 100644 lib/mongodb/gridfs/gridstore.js delete mode 100644 lib/mongodb/gridfs/readstream.js delete mode 100644 lib/mongodb/index.js delete mode 100644 lib/mongodb/responses/mongo_reply.js delete mode 100644 lib/mongodb/utils.js delete mode 100644 nodejsvideo.html delete mode 100755 package.json delete mode 100644 test/admin_test.js delete mode 100644 test/authentication_test.js delete mode 100644 test/auxilliary/authentication_test.js delete mode 100644 test/auxilliary/repl_set_ssl_test.js delete mode 100644 test/auxilliary/replicaset_auth_test.js delete mode 100644 test/auxilliary/single_server_kill_reconnect.js delete mode 100644 test/auxilliary/ssl_test.js delete mode 100644 test/bson/bson_test.js delete mode 100644 test/bson/commands_test.js delete mode 100644 test/bson_types_test.js delete mode 100644 test/certificates/mycert.pem delete mode 100644 test/collection_test.js delete mode 100644 test/connect_test.js delete mode 100644 test/connection/connection_pool_test.js delete mode 100644 test/connection/message_parser_test.js delete mode 100644 test/connection_test.js delete mode 100644 test/cursor_test.js delete mode 100644 test/cursorstream_test.js delete mode 100644 test/custom_pk_test.js delete mode 100644 test/db_test.js delete mode 100644 test/error_test.js delete mode 100644 test/exception_handling_test.js delete mode 100644 test/find_test.js delete mode 100644 test/geo_search_test.js delete mode 100644 test/gridstore/grid_store_file_test.js delete mode 100644 test/gridstore/grid_store_stream_test.js delete mode 100644 test/gridstore/grid_store_test.js delete mode 100644 test/gridstore/grid_test.js delete mode 100644 test/gridstore/iya_logo_final_bw.jpg delete mode 100644 test/gridstore/readstream_test.js delete mode 100644 test/gridstore/test_gs_weird_bug.png delete mode 100644 test/gridstore/test_gs_working_field_read.pdf delete mode 100644 test/index_test.js delete mode 100644 test/insert_test.js delete mode 100644 test/logging_test.js delete mode 100644 test/manual_tests/grids_fs_compatibility_test.js delete mode 100644 test/manual_tests/hanging_queries_test.js delete mode 100644 test/manual_tests/issue_replicaset_test.js delete mode 100644 test/manual_tests/manual_larger_queries.js delete mode 100644 test/manual_tests/manual_lock.js delete mode 100644 test/manual_tests/replicaset_test.js delete mode 100644 test/manual_tests/server_load.js delete mode 100644 test/manual_tests/simple_test.js delete mode 100644 test/manual_tests/single_test.js delete mode 100644 test/manual_tests/test.js delete mode 100644 test/map_reduce_test.js delete mode 100644 test/multiple_dbs_on_connection_pool_test.js delete mode 100644 test/objectid_test.js delete mode 100644 test/raw_test.js delete mode 100644 test/reaper_test.js delete mode 100644 test/regexp_test.js delete mode 100644 test/remove_test.js delete mode 100644 test/replicaset/connect_test.js delete mode 100644 test/replicaset/count_test.js delete mode 100644 test/replicaset/insert_test.js delete mode 100644 test/replicaset/map_reduce_test.js delete mode 100644 test/replicaset/query_secondaries_test.js delete mode 100644 test/replicaset/read_preference_replicaset_test.js delete mode 100644 test/replicaset/read_preferences_single_test.js delete mode 100644 test/replicaset/tags_test.js delete mode 100644 test/replicaset/two_server_tests.js delete mode 100644 test/streaming_test.js delete mode 100644 test/tools/keyfile.txt delete mode 100644 test/tools/replica_set_manager.js delete mode 100644 test/tools/server_manager.js delete mode 100644 test/tools/sharding_manager.js delete mode 100644 test/unicode_test.js delete mode 100644 video.html diff --git a/.buildinfo b/.buildinfo index 22c7ebed6af..b751583e35f 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 492103bbe0e2a5e5f605d1b228464520 +config: 1afea3d5b2430fce039e23741c93a3b4 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/.npmignore b/.npmignore deleted file mode 100644 index ed901d90e73..00000000000 --- a/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -.git* -.buildinfo -.mongodb -docs/ -docs/sphinx-docs -data/ -dev/ -examples/ -test/ -.DS_Store - - diff --git a/HISTORY b/HISTORY deleted file mode 100644 index adfb2fcce5c..00000000000 --- a/HISTORY +++ /dev/null @@ -1,402 +0,0 @@ -0.9.9.1 2012-02-15 ------------------- -* Better handling of safe when using some commands such as createIndex, ensureIndex, addUser, removeUser, createCollection. -* Mapreduce now throws error if out parameter is not specified. - -0.9.9 2012-02-13 ----------------- -* Added createFromTime method on ObjectID to allow for queries against _id more easily using the timestamp. -* Db.close(true) now makes connection unusable as it's been force closed by app. -* Fixed mapReduce and group functions to correctly send slaveOk on queries. -* Fixes for find method to correctly work with find(query, fields, callback) (Issue #506). -* A fix for connection error handling when using the SSL on MongoDB. - -0.9.8-7 2012-02-06 ------------------- -* Simplified findOne to use the find command instead of the custom code (Issue #498). -* BSON JS parser not also checks for _bsonType variable in case BSON object is in weird scope (Issue #495). - -0.9.8-6 2012-02-04 ------------------- -* Removed the check for replicaset change code as it will never work with node.js. - -0.9.8-5 2012-02-02 ------------------- -* Added geoNear command to Collection. -* Added geoHaystackSearch command to Collection. -* Added indexes command to collection to retrieve the indexes on a Collection. -* Added stats command to collection to retrieve the statistics on a Collection. -* Added listDatabases command to admin object to allow retrieval of all available dbs. -* Changed createCreateIndexCommand to work better with options. -* Fixed dereference method on Db class to correctly dereference Db reference objects. -* Moved connect object onto Db class(Db.connect) as well as keeping backward compatibility. -* Removed writeBuffer method from gridstore, write handles switching automatically now. -* Changed readBuffer to read on Gridstore, Gridstore now only supports Binary Buffers no Strings anymore. -* Moved Long class to bson directory. - -0.9.8-4 2012-01-28 ------------------- -* Added reIndex command to collection and db level. -* Added support for $returnKey, $maxScan, $min, $max, $showDiskLoc, $comment to cursor and find/findOne methods. -* Added dropDups and v option to createIndex and ensureIndex. -* Added isCapped method to Collection. -* Added indexExists method to Collection. -* Added findAndRemove method to Collection. -* Fixed bug for replicaset connection when no active servers in the set. -* Fixed bug for replicaset connections when errors occur during connection. -* Merged in patch for BSON Number handling from Lee Salzman, did some small fixes and added test coverage. - -0.9.8-3 2012-01-21 ------------------- -* Workaround for issue with Object.defineProperty (Issue #484) -* ObjectID generation with date does not set rest of fields to zero (Issue #482) - -0.9.8-2 2012-01-20 ------------------- -* Fixed a missing this in the ReplSetServers constructor. - -0.9.8-1 2012-01-17 ------------------- -* FindAndModify bug fix for duplicate errors (Issue #481) - -0.9.8 2012-01-17 ----------------- -* Replicasets now correctly adjusts to live changes in the replicaset configuration on the servers, reconnecting correctly. - - Set the interval for checking for changes setting the replicaSetCheckInterval property when creating the ReplSetServers instance or on db.serverConfig.replicaSetCheckInterval. (default 1000 miliseconds) -* Fixes formattedOrderClause in collection.js to accept a plain hash as a parameter (Issue #469) https://github.com/tedeh -* Removed duplicate code for formattedOrderClause and moved to utils module -* Pass in poolSize for ReplSetServers to set default poolSize for new replicaset members -* Bug fix for BSON JS deserializer. Isolating the eval functions in separate functions to avoid V8 deoptimizations -* Correct handling of illegal BSON messages during deserialization -* Fixed Infinite loop when reading GridFs file with no chunks (Issue #471) -* Correctly update existing user password when using addUser (Issue #470) - -0.9.7.3-5 2012-01-04 --------------------- -* Fix for RegExp serialization for 0.4.X where typeof /regexp/ == 'function' vs in 0.6.X typeof /regexp/ == 'object' -* Don't allow keepAlive and setNoDelay for 0.4.X as it throws errors - -0.9.7.3-4 2012-01-04 --------------------- -* Chased down potential memory leak on findAndModify, Issue #467 (node.js removeAllListeners leaves the key in the _events object, node.js bug on eventlistener?, leads to extremely slow memory leak on listener object) -* Sanity checks for GridFS performance with benchmark added - -0.9.7.3-3 2012-01-04 --------------------- -* Bug fixes for performance issues going form 0.9.6.X to 0.9.7.X on linux -* BSON bug fixes for performance - -0.9.7.3-2 2012-01-02 --------------------- -* Fixed up documentation to reflect the preferred way of instantiating bson types -* GC bug fix for JS bson parser to avoid stop-and-go GC collection - -0.9.7.3-1 2012-01-02 --------------------- -* Fix to make db.bson_serializer and db.bson_deserializer work as it did previously - -0.9.7.3 2011-12-30 --------------------- -* Moved BSON_BINARY_SUBTYPE_DEFAULT from BSON object to Binary object and removed the BSON_BINARY_ prefixes -* Removed Native BSON types, C++ parser uses JS types (faster due to cost of crossing the JS-C++ barrier for each call) -* Added build fix for 0.4.X branch of Node.js where GetOwnPropertyNames is not defined in v8 -* Fix for wire protocol parser for corner situation where the message is larger than the maximum socket buffer in node.js (Issue #464, #461, #447) -* Connection pool status set to connected on poolReady, isConnected returns false on anything but connected status (Issue #455) - -0.9.7.2-5 2011-12-22 --------------------- -* Brand spanking new Streaming Cursor support Issue #458 (https://github.com/christkv/node-mongodb-native/pull/458) thanks to Mr Aaron Heckmann - -0.9.7.2-4 2011-12-21 --------------------- -* Refactoring of callback code to work around performance regression on linux -* Fixed group function to correctly use the command mode as default - -0.9.7.2-3 2011-12-18 --------------------- -* Fixed error handling for findAndModify while still working for mongodb 1.8.6 (Issue #450). -* Allow for force send query to primary, pass option (read:'primary') on find command. - * ``find({a:1}, {read:'primary'}).toArray(function(err, items) {});`` - -0.9.7.2-2 2011-12-16 --------------------- -* Fixes infinite streamRecords QueryFailure fix when using Mongos (Issue #442) - -0.9.7.2-1 2011-12-16 --------------------- -* ~10% perf improvement for ObjectId#toHexString (Issue #448, https://github.com/aheckmann) -* Only using process.nextTick on errors emitted on callbacks not on all parsing, reduces number of ticks in the driver -* Changed parsing off bson messages to use process.nextTick to do bson parsing in batches if the message is over 10K as to yield more time to the event look increasing concurrency on big mongoreply messages with multiple documents - -0.9.7.2 2011-12-15 ------------------- -* Added SSL support for future version of mongodb (VERY VERY EXPERIMENTAL) - * pass in the ssl:true option to the server or replicaset server config to enable - * a bug either in mongodb or node.js does not allow for more than 1 connection pr db instance (poolSize:1). -* Added getTimestamp() method to objectID that returns a date object -* Added finalize function to collection.group - * function group (keys, condition, initial, reduce, finalize, command, callback) -* Reaper no longer using setTimeout to handle reaping. Triggering is done in the general flow leading to predictable behavior. - * reaperInterval, set interval for reaper (default 10000 miliseconds) - * reaperTimeout, set timeout for calls (default 30000 miliseconds) - * reaper, enable/disable reaper (default false) -* Work around for issues with findAndModify during high concurrency load, insure that the behavior is the same across the 1.8.X branch and 2.X branch of MongoDb -* Reworked multiple db's sharing same connection pool to behave correctly on error, timeout and close -* EnsureIndex command can be executed without a callback (Issue #438) -* Eval function no accepts options including nolock (Issue #432) - * eval(code, parameters, options, callback) (where options = {nolock:true}) - -0.9.7.1-4 2011-11-27 --------------------- -* Replaced install.sh with install.js to install correctly on all supported os's - -0.9.7.1-3 2011-11-27 --------------------- -* Fixes incorrect scope for ensureIndex error wrapping (Issue #419) https://github.com/ritch - -0.9.7.1-2 2011-11-27 --------------------- -* Set statistical selection strategy as default for secondary choice. - -0.9.7.1-1 2011-11-27 --------------------- -* Better handling of single server reconnect (fixes some bugs) -* Better test coverage of single server failure -* Correct handling of callbacks on replicaset servers when firewall dropping packets, correct reconnect - -0.9.7.1 2011-11-24 ------------------- -* Better handling of dead server for single server instances -* FindOne and find treats selector == null as {}, Issue #403 -* Possible to pass in a strategy for the replicaset to pick secondary reader node - * parameter strategy - * ping (default), pings the servers and picks the one with the lowest ping time - * statistical, measures each request and pick the one with the lowest mean and std deviation -* Set replicaset read preference replicaset.setReadPreference() - * Server.READ_PRIMARY (use primary server for reads) - * Server.READ_SECONDARY (from a secondary server (uses the strategy set)) - * tags, {object of tags} -* Added replay of commands issued to a closed connection when the connection is re-established -* Fix isConnected and close on unopened connections. Issue #409, fix by (https://github.com/sethml) -* Moved reaper to db.open instead of constructor (Issue #406) -* Allows passing through of socket connection settings to Server or ReplSetServer under the option socketOptions - * timeout = set seconds before connection times out (default 0) - * noDelay = Disables the Nagle algorithm (default true) - * keepAlive = Set if keepAlive is used (default 0, which means no keepAlive, set higher than 0 for keepAlive) - * encoding = ['ascii', 'utf8', or 'base64'] (default null) -* Fixes for handling of errors during shutdown off a socket connection -* Correctly applies socket options including timeout -* Cleanup of test management code to close connections correctly -* Handle parser errors better, closing down the connection and emitting an error -* Correctly emit errors from server.js only wrapping errors that are strings - -0.9.7 2011-11-10 ----------------- -* Added priority setting to replicaset manager -* Added correct handling of passive servers in replicaset -* Reworked socket code for simpler clearer handling -* Correct handling of connections in test helpers -* Added control of retries on failure - * control with parameters retryMiliSeconds and numberOfRetries when creating a db instance -* Added reaper that will timeout and cleanup queries that never return - * control with parameters reaperInterval and reaperTimeout when creating a db instance -* Refactored test helper classes for replicaset tests -* Allows raw (no bson parser mode for insert, update, remove, find and findOne) - * control raw mode passing in option raw:true on the commands - * will return buffers with the binary bson objects -* Fixed memory leak in cursor.toArray -* Fixed bug in command creation for mongodb server with wrong scope of call -* Added db(dbName) method to db.js to allow for reuse of connections against other databases -* Serialization of functions in an object is off by default, override with parameter - * serializeFunctions [true/false] on db level, collection level or individual insert/update/findAndModify -* Added Long.fromString to c++ class and fixed minor bug in the code (Test case for $gt operator on 64-bit integers, Issue #394) -* FindOne and find now share same code execution and will work in the same manner, Issue #399 -* Fix for tailable cursors, Issue #384 -* Fix for Cursor rewind broken, Issue #389 -* Allow Gridstore.exist to query using regexp, Issue #387, fix by (https://github.com/kaij) -* Updated documentation on https://github.com/christkv/node-mongodb-native -* Fixed toJSON methods across all objects for BSON, Binary return Base64 Encoded data - -0.9.6-22 2011-10-15 -------------------- -* Fixed bug in js bson parser that could cause wrong object size on serialization, Issue #370 -* Fixed bug in findAndModify that did not throw error on replicaset timeout, Issue #373 - -0.9.6-21 2011-10-05 -------------------- -* Reworked reconnect code to work correctly -* Handling errors in different parts of the code to ensure that it does not lock the connection -* Consistent error handling for Object.createFromHexString for JS and C++ - -0.9.6-20 2011-10-04 -------------------- -* Reworked bson.js parser to get rid off Array.shift() due to it allocating new memory for each call. Speedup varies between 5-15% depending on doc -* Reworked bson.cc to throw error when trying to serialize js bson types -* Added MinKey, MaxKey and Double support for JS and C++ parser -* Reworked socket handling code to emit errors on unparsable messages -* Added logger option for Db class, lets you pass in a function in the shape - { - log : function(message, object) {}, - error : function(errorMessage, errorObject) {}, - debug : function(debugMessage, object) {}, - } - - Usage is new Db(new Server(..), {logger: loggerInstance}) - -0.9.6-19 2011-09-29 -------------------- -* Fixing compatibility issues between C++ bson parser and js parser -* Added Symbol support to C++ parser -* Fixed socket handling bug for seldom misaligned message from mongodb -* Correctly handles serialization of functions using the C++ bson parser - -0.9.6-18 2011-09-22 -------------------- -* Fixed bug in waitForConnection that would lead to 100% cpu usage, Issue #352 - -0.9.6-17 2011-09-21 -------------------- -* Fixed broken exception test causing bamboo to hang -* Handling correctly command+lastError when both return results as in findAndModify, Issue #351 - -0.9.6-16 2011-09-14 -------------------- -* Fixing a bunch of issues with compatibility with MongoDB 2.0.X branch. Some fairly big changes in behavior from 1.8.X to 2.0.X on the server. -* Error Connection MongoDB V2.0.0 with Auth=true, Issue #348 - -0.9.6-15 2011-09-09 -------------------- -* Fixed issue where pools would not be correctly cleaned up after an error, Issue #345 -* Fixed authentication issue with secondary servers in Replicaset, Issue #334 -* Duplicate replica-set servers when omitting port, Issue #341 -* Fixing findAndModify to correctly work with Replicasets ensuring proper error handling, Issue #336 -* Merged in code from (https://github.com/aheckmann) that checks for global variable leaks - -0.9.6-14 2011-09-05 -------------------- -* Minor fixes for error handling in cursor streaming (https://github.com/sethml), Issue #332 -* Minor doc fixes -* Some more cursor sort tests added, Issue #333 -* Fixes to work with 0.5.X branch -* Fix Db not removing reconnect listener from serverConfig, (https://github.com/sbrekken), Issue #337 -* Removed node_events.h includes (https://github.com/jannehietamaki), Issue #339 -* Implement correct safe/strict mode for findAndModify. - -0.9.6-13 2011-08-24 -------------------- -* Db names correctly error checked for illegal characters - -0.9.6-12 2011-08-24 -------------------- -* Nasty bug in GridFS if you changed the default chunk size -* Fixed error handling bug in findOne - -0.9.6-11 2011-08-23 -------------------- -* Timeout option not correctly making it to the cursor, Issue #320, Fix from (https://github.com/year2013) -* Fixes for memory leaks when using buffers and C++ parser -* Fixes to make tests pass on 0.5.X -* Cleanup of bson.js to remove duplicated code paths -* Fix for errors occurring in ensureIndex, Issue #326 -* Removing require.paths to make tests work with the 0.5.X branch - -0.9.6-10 2011-08-11 -------------------- -* Specific type Double for capped collections (https://github.com/mbostock), Issue #312 -* Decorating Errors with all all object info from Mongo (https://github.com/laurie71), Issue #308 -* Implementing fixes for mongodb 1.9.1 and higher to make tests pass -* Admin validateCollection now takes an options argument for you to pass in full option -* Implemented keepGoing parameter for mongodb 1.9.1 or higher, Issue #310 -* Added test for read_secondary count issue, merged in fix from (https://github.com/year2013), Issue #317 - -0.9.6-9 -------- -* Bug fix for bson parsing the key '':'' correctly without crashing - -0.9.6-8 -------- -* Changed to using node.js crypto library MD5 digest -* Connect method support documented mongodb: syntax by (https://github.com/sethml) -* Support Symbol type for BSON, serializes to it's own type Symbol, Issue #302, #288 -* Code object without scope serializing to correct BSON type -* Lot's of fixes to avoid double callbacks (https://github.com/aheckmann) Issue #304 -* Long deserializes as Number for values in the range -2^53 to 2^53, Issue #305 (https://github.com/sethml) -* Fixed C++ parser to reflect JS parser handling of long deserialization -* Bson small optimizations - -0.9.6-7 2011-07-13 ------------------- -* JS Bson deserialization bug #287 - -0.9.6-6 2011-07-12 ------------------- -* FindAndModify not returning error message as other methods Issue #277 -* Added test coverage for $push, $pushAll and $inc atomic operations -* Correct Error handling for non 12/24 bit ids on Pure JS ObjectID class Issue #276 -* Fixed terrible deserialization bug in js bson code #285 -* Fix by andrewjstone to avoid throwing errors when this.primary not defined - -0.9.6-5 2011-07-06 ------------------- -* Rewritten BSON js parser now faster than the C parser on my core2duo laptop -* Added option full to indexInformation to get all index info Issue #265 -* Passing in ObjectID for new Gridstore works correctly Issue #272 - -0.9.6-4 2011-07-01 ------------------- -* Added test and bug fix for insert/update/remove without callback supplied - -0.9.6-3 2011-07-01 ------------------- -* Added simple grid class called Grid with put, get, delete methods -* Fixed writeBuffer/readBuffer methods on GridStore so they work correctly -* Automatic handling of buffers when using write method on GridStore -* GridStore now accepts a ObjectID instead of file name for write and read methods -* GridStore.list accepts id option to return of file ids instead of filenames -* GridStore close method returns document for the file allowing user to reference _id field - -0.9.6-2 2011-06-30 ------------------- -* Fixes for reconnect logic for server object (replays auth correctly) -* More testcases for auth -* Fixes in error handling for replicaset -* Fixed bug with safe parameter that would fail to execute safe when passing w or wtimeout -* Fixed slaveOk bug for findOne method -* Implemented auth support for replicaset and test cases -* Fixed error when not passing in rs_name - -0.9.6-1 2011-06-25 ------------------- -* Fixes for test to run properly using c++ bson parser -* Fixes for dbref in native parser (correctly handles ref without db component) -* Connection fixes for replicasets to avoid runtime conditions in cygwin (https://github.com/vincentcr) -* Fixes for timestamp in js bson parser (distinct timestamp type now) - -0.9.6 2011-06-21 ----------------- -* Worked around npm version handling bug -* Race condition fix for cygwin (https://github.com/vincentcr) - -0.9.5-1 2011-06-21 ------------------- -* Extracted Timestamp as separate class for bson js parser to avoid instanceof problems -* Fixed driver strict mode issue - -0.9.5 2011-06-20 ----------------- -* Replicaset support (failover and reading from secondary servers) -* Removed ServerPair and ServerCluster -* Added connection pool functionality -* Fixed serious bug in C++ bson parser where bytes > 127 would generate 2 byte sequences -* Allows for forcing the server to assign ObjectID's using the option {forceServerObjectId: true} - -0.6.8 ------ -* Removed multiple message concept from bson -* Changed db.open(db) to be db.open(err, db) - -0.1 2010-01-30 --------------- -* Initial release support of driver using native node.js interface -* Supports gridfs specification -* Supports admin functionality \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 26d9dd2142f..00000000000 --- a/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -NODE = node -NPM = npm -NODEUNIT = deps/nodeunit/bin/nodeunit -DOX = node_modules/dox/bin/dox -name = all - -total: build_native - -build_native: - $(MAKE) -C ./external-libs/bson all - -build_native_debug: - $(MAKE) -C ./external-libs/bson all_debug - -build_native_clang: - $(MAKE) -C ./external-libs/bson clang - -build_native_clang_debug: - $(MAKE) -C ./external-libs/bson clang_debug - -clean_native: - $(MAKE) -C ./external-libs/bson clean - -test: build_native - @echo "\n == Run All tests minus replicaset tests==" - $(NODE) dev/tools/test_all.js --noreplicaset --boot - -test_junit: build_native - @echo "\n == Run All tests minus replicaset tests==" - $(NODE) dev/tools/test_all.js --junit --noreplicaset - -test_nodeunit_pure: - @echo "\n == Execute Test Suite using Pure JS BSON Parser == " - @$(NODEUNIT) test/ test/gridstore test/bson - -test_js: - @$(NODEUNIT) $(TESTS) - -test_nodeunit_replicaset_pure: - @echo "\n == Execute Test Suite using Pure JS BSON Parser == " - @$(NODEUNIT) test/replicaset - -test_nodeunit_native: - @echo "\n == Execute Test Suite using Native BSON Parser == " - @TEST_NATIVE=TRUE $(NODEUNIT) test/ test/gridstore test/bson - -test_nodeunit_replicaset_native: - @echo "\n == Execute Test Suite using Native BSON Parser == " - @TEST_NATIVE=TRUE $(NODEUNIT) test/replicaset - -test_all: build_native - @echo "\n == Run All tests ==" - $(NODE) dev/tools/test_all.js --boot - -test_all_junit: build_native - @echo "\n == Run All tests ==" - $(NODE) dev/tools/test_all.js --junit --boot - -clean: - rm ./external-libs/bson/bson.node - rm -r ./external-libs/bson/build - -generate_docs: - $(NODE) dev/tools/build-docs.js - make --directory=./docs/sphinx-docs --file=Makefile html - -.PHONY: total diff --git a/Readme.md b/Readme.md deleted file mode 100644 index 0008875e597..00000000000 --- a/Readme.md +++ /dev/null @@ -1,408 +0,0 @@ -Install -======== - -To install the most recent release from npm, run: - - npm install mongodb - -That may give you a warning telling you that bugs['web'] should be bugs['url'], it would be safe to ignore it (this has been fixed in the development version) - -To install from the latest from the repository, run:: - - npm install path/to/node-mongodb-native - -Community -======== -Check out the google group [node-mongodb-native](http://groups.google.com/group/node-mongodb-native) for questions/answers from users of the driver. - -Introduction -======== - -This is a node.js driver for MongoDB. It's a port (or close to a port) of the library for ruby at http://github.com/mongodb/mongo-ruby-driver/. - -A simple example of inserting a document. - - var client = new Db('test', new Server("127.0.0.1", 27017, {})), - test = function (err, collection) { - collection.insert({a:2}, function(err, docs) { - - collection.count(function(err, count) { - test.assertEquals(1, count); - }); - - // Locate all the entries using find - collection.find().toArray(function(err, results) { - test.assertEquals(1, results.length); - test.assertTrue(results.a === 2); - - // Let's close the db - client.close(); - }); - }); - }; - - client.open(function(err, p_client) { - client.collection('test_insert', test); - }); - -Data types -======== - -To store and retrieve the non-JSON MongoDb primitives ([ObjectID](http://www.mongodb.org/display/DOCS/Object+IDs), Long, Binary, [Timestamp](http://www.mongodb.org/display/DOCS/Timestamp+data+type), [DBRef](http://www.mongodb.org/display/DOCS/Database+References#DatabaseReferences-DBRef), Code). - -In particular, every document has a unique `_id` which can be almost any type, and by default a 12-byte ObjectID is created. ObjectIDs can be represented as 24-digit hexadecimal strings, but you must convert the string back into an ObjectID before you can use it in the database. For example: - - // Get the objectID type - var ObjectID = require('mongodb').ObjectID; - - var idString = '4e4e1638c85e808431000003'; - collection.findOne({_id: new ObjectID(idString)}, console.log) // ok - collection.findOne({_id: idString}, console.log) // wrong! callback gets undefined - -Here are the constructors the non-Javascript BSON primitive types: - - // Fetch the library - var mongo = require('mongodb'); - // Create new instances of BSON types - new mongo.Long(numberString) - new mongo.ObjectID(hexString) - new mongo.Timestamp() // the actual unique number is generated on insert. - new mongo.DBRef(collectionName, id, dbName) - new mongo.Binary(buffer) // takes a string or Buffer - new mongo.Code(code, [context]) - new mongo.Symbol(string) - new mongo.MinKey() - new mongo.MaxKey() - new mongo.Double(number) // Force double storage - -The C/C++ bson parser/serializer --------- - -From V0.8.0 to V0.9.6.9, the Javascript bson parser was slower than an optional C/C++ bson parser. As of V0.9.6.9+, due to performance improvements in the Javascript parser, the C/C++ parser is deprecated and is not installed by default anymore. - -If you are running a version of this library has the C/C++ parser compiled, to enable the driver to use the C/C++ bson parser pass it the option native_parser:true like below - - // using Deprecated native_parser: - var client = new Db('integration_tests_20', - new Server("127.0.0.1", 27017), - {native_parser:true}); - -The C++ parser uses the js objects both for serialization and deserialization. - -GitHub information -======== - -The source code is available at http://github.com/christkv/node-mongodb-native. -You can either clone the repository or download a tarball of the latest release. - -Once you have the source you can test the driver by running - - $ make test - -in the main directory. You will need to have a mongo instance running on localhost for the integration tests to pass. - -Examples -======== - -For examples look in the examples/ directory. You can execute the examples using node. - - $ cd examples - $ node queries.js - -GridStore -========= - -The GridStore class allows for storage of binary files in mongoDB using the mongoDB defined files and chunks collection definition. - -For more information have a look at [Gridstore](https://github.com/christkv/node-mongodb-native/blob/master/docs/gridfs.md) - -Replicasets -=========== -For more information about how to connect to a replicaset have a look at [Replicasets](https://github.com/christkv/node-mongodb-native/blob/master/docs/replicaset.md) - -Primary Key Factories --------- - -Defining your own primary key factory allows you to generate your own series of id's -(this could f.ex be to use something like ISBN numbers). The generated the id needs to be a 12 byte long "string". - -Simple example below - - // Custom factory (need to provide a 12 byte array); - CustomPKFactory = function() {} - CustomPKFactory.prototype = new Object(); - CustomPKFactory.createPk = function() { - return new ObjectID("aaaaaaaaaaaa"); - } - - var p_client = new Db('integration_tests_20', new Server("127.0.0.1", 27017, {}), {'pk':CustomPKFactory}); - p_client.open(function(err, p_client) { - p_client.dropDatabase(function(err, done) { - p_client.createCollection('test_custom_key', function(err, collection) { - collection.insert({'a':1}, function(err, docs) { - collection.find({'_id':new ObjectID("aaaaaaaaaaaa")}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.assertEquals(1, items.length); - - // Let's close the db - p_client.close(); - }); - }); - }); - }); - }); - }); - -Strict mode --------- - -Each database has an optional strict mode. If it is set then asking for a collection -that does not exist will return an Error object in the callback. Similarly if you -attempt to create a collection that already exists. Strict is provided for convenience. - - var error_client = new Db('integration_tests_', new Server("127.0.0.1", 27017, {auto_reconnect: false}), {strict:true}); - test.assertEquals(true, error_client.strict); - - error_client.open(function(err, error_client) { - error_client.collection('does-not-exist', function(err, collection) { - test.assertTrue(err instanceof Error); - test.assertEquals("Collection does-not-exist does not exist. Currently in strict mode.", err.message); - }); - - error_client.createCollection('test_strict_access_collection', function(err, collection) { - error_client.collection('test_strict_access_collection', function(err, collection) { - test.assertTrue(collection instanceof Collection); - // Let's close the db - error_client.close(); - }); - }); - }); - -Documentation -======== - -If this document doesn't answer your questions, see the source of -[Collection](https://github.com/christkv/node-mongodb-native/blob/master/lib/mongodb/collection.js) -or [Cursor](https://github.com/christkv/node-mongodb-native/blob/master/lib/mongodb/cursor.js), -or the documentation at MongoDB for query and update formats. - -Find --------- - -The find method is actually a factory method to create -Cursor objects. A Cursor lazily uses the connection the first time -you call `nextObject`, `each`, or `toArray`. - -The basic operation on a cursor is the `nextObject` method -that fetches the next matching document from the database. The convenience -methods `each` and `toArray` call `nextObject` until the cursor is exhausted. - -Signatures: - - var cursor = collection.find(query, [fields], options); - cursor.sort(fields).limit(n).skip(m). - - cursor.nextObject(function(err, doc) {}); - cursor.each(function(err, doc) {}); - cursor.toArray(function(err, docs) {}); - - cursor.rewind() // reset the cursor to its initial state. - -Useful chainable methods of cursor. These can optionally be options of `find` instead of method calls: - -* `.limit(n).skip(m)` to control paging. -* `.sort(fields)` Order by the given fields. There are several equivalent syntaxes: - * `.sort({field1: -1, field2: 1})` descending by field1, then ascending by field2. - * `.sort([['field1', 'desc'], ['field2', 'asc']])` same as above - * `.sort([['field1', 'desc'], 'field2'])` same as above - * `.sort('field1')` ascending by field1 - -Other options of `find`: - -* `fields` the fields to fetch (to avoid transferring the entire document) -* `tailable` if true, makes the cursor [tailable](http://www.mongodb.org/display/DOCS/Tailable+Cursors). -* `batchSize` The number of the subset of results to request the database -to return for every request. This should initially be greater than 1 otherwise -the database will automatically close the cursor. The batch size can be set to 1 -with `batchSize(n, function(err){})` after performing the initial query to the database. -* `hint` See [Optimization: hint](http://www.mongodb.org/display/DOCS/Optimization#Optimization-Hint). -* `explain` turns this into an explain query. You can also call -`explain()` on any cursor to fetch the explanation. -* `snapshot` prevents documents that are updated while the query is active -from being returned multiple times. See more -[details about query snapshots](http://www.mongodb.org/display/DOCS/How+to+do+Snapshotted+Queries+in+the+Mongo+Database). -* `timeout` if false, asks MongoDb not to time out this cursor after an -inactivity period. - - -For information on how to create queries, see the -[MongoDB section on querying](http://www.mongodb.org/display/DOCS/Querying). - - var mongodb = require('mongodb'); - var server = new mongodb.Server("127.0.0.1", 27017, {}); - new mongodb.Db('test', server, {}).open(function (error, client) { - if (error) throw error; - var collection = new mongodb.Collection(client, 'test_collection'); - collection.find({}, {limit:10}).toArray(function(err, docs) { - console.dir(docs); - }); - }); - -Insert --------- - -Signature: - - collection.insert(docs, options, [callback]); - -where `docs` can be a single document or an array of documents. - -Useful options: - -* `safe:true` Should always set if you have a callback. - -See also: [MongoDB docs for insert](http://www.mongodb.org/display/DOCS/Inserting). - - var mongodb = require('mongodb'); - var server = new mongodb.Server("127.0.0.1", 27017, {}); - new mongodb.Db('test', server, {}).open(function (error, client) { - if (error) throw error; - var collection = new mongodb.Collection(client, 'test_collection'); - collection.insert({hello: 'world'}, {safe:true}, - function(err, objects) { - if (err) console.warn(err.message); - if (err && err.message.indexOf('E11000 ') !== -1) { - // this _id was already inserted in the database - } - }); - }); - -Note that there's no reason to pass a callback to the insert or update commands -unless you use the `safe:true` option. If you don't specify `safe:true`, then -your callback will be called immediately. - -Update; update and insert (upsert) --------- - -The update operation will update the first document that matches your query -(or all documents that match if you use `multi:true`). -If `safe:true`, `upsert` is not set, and no documents match, your callback -will be given an error. - -See the [MongoDB docs](http://www.mongodb.org/display/DOCS/Updating) for -the modifier (`$inc`, `$set`, `$push`, etc.) formats. - -Signature: - - collection.update(criteria, objNew, options, [callback]); - -Useful options: - -* `safe:true` Should always set if you have a callback. -* `multi:true` If set, all matching documents are updated, not just the first. -* `upsert:true` Atomically inserts the document if no documents matched. - -Example for `update`: - - var mongodb = require('mongodb'); - var server = new mongodb.Server("127.0.0.1", 27017, {}); - new mongodb.Db('test', server, {}).open(function (error, client) { - if (error) throw error; - var collection = new mongodb.Collection(client, 'test_collection'); - collection.update({hi: 'here'}, {$set: {hi: 'there'}}, {safe:true}, - function(err) { - if (err) console.warn(err.message); - else console.log('successfully updated'); - }); - }); - -Find and modify --------- - -`findAndModify` is like `update`, but it also gives the updated document to -your callback. But there are a few key differences between findAndModify and -update: - - 1. The signatures differ. - 2. You can only findAndModify a single item, not multiple items. - -Signature: - - collection.findAndModify(query, sort, update, options, callback) - -The sort parameter is used to specify which object to operate on, if more than -one document matches. It takes the same format as the cursor sort (see -Connection.find above). - -See the -[MongoDB docs for findAndModify](http://www.mongodb.org/display/DOCS/findAndModify+Command) -for more details. - -Useful options: - -* `remove:true` set to a true to remove the object before returning -* `new:true` set to true if you want to return the modified object rather than the original. Ignored for remove. -* `upsert:true` Atomically inserts the document if no documents matched. - -Example for `findAndModify`: - - var mongodb = require('mongodb'); - var server = new mongodb.Server("127.0.0.1", 27017, {}); - new mongodb.Db('test', server, {}).open(function (error, client) { - if (error) throw error; - var collection = new mongodb.Collection(client, 'test_collection'); - collection.findAndModify({hello: 'world'}, [['_id','asc']], {$set: {hi: 'there'}}, {}, - function(err, object) { - if (err) console.warn(err.message); - else console.dir(object); // undefined if no matching object exists. - }); - }); - -Save --------- - -The `save` method is a shorthand for upsert if the document contains an -`_id`, or an insert if there is no `_id`. - -Sponsors -======== -Just as Felix Geisendörfer I'm also working on the driver for my own startup and this driver is a big project that also benefits other companies who are using MongoDB. - -If your company could benefit from a even better-engineered node.js mongodb driver I would appreciate any type of sponsorship you may be able to provide. All the sponsors will get a lifetime display in this readme, priority support and help on problems and votes on the roadmap decisions for the driver. If you are interested contact me on [christkv AT g m a i l.com](mailto:christkv@gmail.com) for details. - -And I'm very thankful for code contributions. If you are interested in working on features please contact me so we can discuss API design and testing. - -Release Notes -============= - -See HISTORY - -Credits -======== - -1. [10gen](http://github.com/mongodb/mongo-ruby-driver/) -2. [Google Closure Library](http://code.google.com/closure/library/) -3. [Jonas Raoni Soares Silva](http://jsfromhell.com/classes/binary-parser) - -Contributors -============= - -Aaron Heckmann, Christoph Pojer, Pau Ramon Revilla, Nathan White, Emmerman, Seth LaForge, Boris Filipov, Stefan Schärmeli, Tedde Lundgren, renctan, Sergey Ukustov, Ciaran Jessup, kuno, srimonti, Erik Abele, Pratik Daga, Slobodan Utvic, Kristina Chodorow, Yonathan Randolph, Brian Noguchi, Sam Epstein, James Harrison Fisher, Vladimir Dronnikov, Ben Hockey, Henrik Johansson, Simon Weare, Alex Gorbatchev, Shimon Doodkin, Kyle Mueller, Eran Hammer-Lahav, Marcin Ciszak, François de Metz, Vinay Pulim, nstielau, Adam Wiggins, entrinzikyl, Jeremy Selier, Ian Millington, Public Keating, andrewjstone, Christopher Stott, Corey Jewett, brettkiefer, Rob Holland, Senmiao Liu, heroic, gitfy - -License -======== - - Copyright 2009 - 2010 Christian Amor Kvalheim. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/TODO b/TODO deleted file mode 100644 index 1ed86e8de1f..00000000000 --- a/TODO +++ /dev/null @@ -1,25 +0,0 @@ -TODO for jan 4 - 2011 -- Chase down potential memory leak in findAndModify -- Check compatibility for gridFS between python and js -- Ensure Gridfs speed is comparable to other solutions -- Map out python replicaset driver functionality - -ACCOMPLISHED jan 4 - 2011 -+ Chase down potential memory leak in findAndModify -+ Check compatibility for gridFS between python and js -+ Ensure Gridfs speed is comparable to other solutions - -0.9.7.4-dev -- Amortize documents (only deserialize when accessed) -- Mongo tests to handle special Mongos situations -- If a secondary server disappears don't kill the driver connection -- Check for new servers coming online (a new secondary server etc) -- http://api.mongodb.org/python/current/api/pymongo/index.html#pymongo.ReadPreference - ---------------------------------------------------------------------------------------------* Allow secondary read with no master -* Add lowest response time selection of read server for replicaset using a selectable strategy. First one being using the ping command response time -* Allow execution of multiple commands against the same server connection when having a connection pool -* Implement tag support for replicasets -* Change bson c++ parser to use js objects instead of native c++ objects -* Whole stack benchmark with profiling to locate where the driver spends time -* Change bson c++ parser to be stackless to look at performance difference \ No newline at end of file diff --git a/_sources/api-generated/changelog.txt b/_sources/api-generated/changelog.txt deleted file mode 100644 index 145adc2ec29..00000000000 --- a/_sources/api-generated/changelog.txt +++ /dev/null @@ -1,401 +0,0 @@ -========= -Changelog -========= - -0.9.9 2012-02-13 ----------------- -* Added createFromTime method on ObjectID to allow for queries against _id more easily using the timestamp. -* Db.close(true) now makes connection unusable as it's been force closed by app. -* Fixed mapReduce and group functions to correctly send slaveOk on queries. -* Fixes for find method to correctly work with find(query, fields, callback) (Issue #506). -* A fix for connection error handling when using the SSL on MongoDB. - -0.9.8-7 2012-02-06 ------------------- -* Simplified findOne to use the find command instead of the custom code (Issue #498). -* BSON JS parser not also checks for _bsonType variable in case BSON object is in weird scope (Issue #495). - -0.9.8-6 2012-02-04 ------------------- -* Removed the check for replicaset change code as it will never work with node.js. - -0.9.8-5 2012-02-02 ------------------- -* Added geoNear command to Collection. -* Added geoHaystackSearch command to Collection. -* Added indexes command to collection to retrieve the indexes on a Collection. -* Added stats command to collection to retrieve the statistics on a Collection. -* Added listDatabases command to admin object to allow retrieval of all available dbs. -* Changed createCreateIndexCommand to work better with options. -* Fixed dereference method on Db class to correctly dereference Db reference objects. -* Moved connect object onto Db class(Db.connect) as well as keeping backward compatibility. -* Removed writeBuffer method from gridstore, write handles switching automatically now. -* Changed readBuffer to read on Gridstore, Gridstore now only supports Binary Buffers no Strings anymore. -* Moved Long class to bson directory. - -0.9.8-4 2012-01-28 ------------------- -* Added reIndex command to collection and db level. -* Added support for $returnKey, $maxScan, $min, $max, $showDiskLoc, $comment to cursor and find/findOne methods. -* Added dropDups and v option to createIndex and ensureIndex. -* Added isCapped method to Collection. -* Added indexExists method to Collection. -* Added findAndRemove method to Collection. -* Fixed bug for replicaset connection when no active servers in the set. -* Fixed bug for replicaset connections when errors occur during connection. -* Merged in patch for BSON Number handling from Lee Salzman, did some small fixes and added test coverage. - -0.9.8-3 2012-01-21 ------------------- -* Workaround for issue with Object.defineProperty (Issue #484) -* ObjectID generation with date does not set rest of fields to zero (Issue #482) - -0.9.8-2 2012-01-20 ------------------- -* Fixed a missing this in the ReplSetServers constructor. - -0.9.8-1 2012-01-17 ------------------- -* FindAndModify bug fix for duplicate errors (Issue #481) - -0.9.8 2012-01-17 ----------------- -* Replicasets now correctly adjusts to live changes in the replicaset configuration on the servers, reconnecting correctly. - - Set the interval for checking for changes setting the replicaSetCheckInterval property when creating the ReplSetServers instance or on db.serverConfig.replicaSetCheckInterval. (default 1000 miliseconds) -* Fixes formattedOrderClause in collection.js to accept a plain hash as a parameter (Issue #469) https://github.com/tedeh -* Removed duplicate code for formattedOrderClause and moved to utils module -* Pass in poolSize for ReplSetServers to set default poolSize for new replicaset members -* Bug fix for BSON JS deserializer. Isolating the eval functions in separate functions to avoid V8 deoptimizations -* Correct handling of illegal BSON messages during deserialization -* Fixed Infinite loop when reading GridFs file with no chunks (Issue #471) -* Correctly update existing user password when using addUser (Issue #470) - -0.9.7.3-5 2012-01-04 --------------------- -* Fix for RegExp serialization for 0.4.X where typeof /regexp/ == 'function' vs in 0.6.X typeof /regexp/ == 'object' -* Don't allow keepAlive and setNoDelay for 0.4.X as it throws errors - -0.9.7.3-4 2012-01-04 --------------------- -* Chased down potential memory leak on findAndModify, Issue #467 (node.js removeAllListeners leaves the key in the _events object, node.js bug on eventlistener?, leads to extremely slow memory leak on listener object) -* Sanity checks for GridFS performance with benchmark added - -0.9.7.3-3 2012-01-04 --------------------- -* Bug fixes for performance issues going form 0.9.6.X to 0.9.7.X on linux -* BSON bug fixes for performance - -0.9.7.3-2 2012-01-02 --------------------- -* Fixed up documentation to reflect the preferred way of instantiating bson types -* GC bug fix for JS bson parser to avoid stop-and-go GC collection - -0.9.7.3-1 2012-01-02 --------------------- -* Fix to make db.bson_serializer and db.bson_deserializer work as it did previously - -0.9.7.3 2011-12-30 --------------------- -* Moved BSON_BINARY_SUBTYPE_DEFAULT from BSON object to Binary object and removed the BSON_BINARY_ prefixes -* Removed Native BSON types, C++ parser uses JS types (faster due to cost of crossing the JS-C++ barrier for each call) -* Added build fix for 0.4.X branch of Node.js where GetOwnPropertyNames is not defined in v8 -* Fix for wire protocol parser for corner situation where the message is larger than the maximum socket buffer in node.js (Issue #464, #461, #447) -* Connection pool status set to connected on poolReady, isConnected returns false on anything but connected status (Issue #455) - -0.9.7.2-5 2011-12-22 --------------------- -* Brand spanking new Streaming Cursor support Issue #458 (https://github.com/christkv/node-mongodb-native/pull/458) thanks to Mr Aaron Heckmann - -0.9.7.2-4 2011-12-21 --------------------- -* Refactoring of callback code to work around performance regression on linux -* Fixed group function to correctly use the command mode as default - -0.9.7.2-3 2011-12-18 --------------------- -* Fixed error handling for findAndModify while still working for mongodb 1.8.6 (Issue #450). -* Allow for force send query to primary, pass option (read:'primary') on find command. - * ``find({a:1}, {read:'primary'}).toArray(function(err, items) {});`` - -0.9.7.2-2 2011-12-16 --------------------- -* Fixes infinite streamRecords QueryFailure fix when using Mongos (Issue #442) - -0.9.7.2-1 2011-12-16 --------------------- -* ~10% perf improvement for ObjectId#toHexString (Issue #448, https://github.com/aheckmann) -* Only using process.nextTick on errors emitted on callbacks not on all parsing, reduces number of ticks in the driver -* Changed parsing off bson messages to use process.nextTick to do bson parsing in batches if the message is over 10K as to yield more time to the event look increasing concurrency on big mongoreply messages with multiple documents - -0.9.7.2 2011-12-15 ------------------- -* Added SSL support for future version of mongodb (VERY VERY EXPERIMENTAL) - * pass in the ssl:true option to the server or replicaset server config to enable - * a bug either in mongodb or node.js does not allow for more than 1 connection pr db instance (poolSize:1). -* Added getTimestamp() method to objectID that returns a date object -* Added finalize function to collection.group - * function group (keys, condition, initial, reduce, finalize, command, callback) -* Reaper no longer using setTimeout to handle reaping. Triggering is done in the general flow leading to predictable behavior. - * reaperInterval, set interval for reaper (default 10000 miliseconds) - * reaperTimeout, set timeout for calls (default 30000 miliseconds) - * reaper, enable/disable reaper (default false) -* Work around for issues with findAndModify during high concurrency load, insure that the behavior is the same across the 1.8.X branch and 2.X branch of MongoDb -* Reworked multiple db's sharing same connection pool to behave correctly on error, timeout and close -* EnsureIndex command can be executed without a callback (Issue #438) -* Eval function no accepts options including nolock (Issue #432) - * eval(code, parameters, options, callback) (where options = {nolock:true}) - -0.9.7.1-4 2011-11-27 --------------------- -* Replaced install.sh with install.js to install correctly on all supported os's - -0.9.7.1-3 2011-11-27 --------------------- -* Fixes incorrect scope for ensureIndex error wrapping (Issue #419) https://github.com/ritch - -0.9.7.1-2 2011-11-27 --------------------- -* Set statistical selection strategy as default for secondary choice. - -0.9.7.1-1 2011-11-27 --------------------- -* Better handling of single server reconnect (fixes some bugs) -* Better test coverage of single server failure -* Correct handling of callbacks on replicaset servers when firewall dropping packets, correct reconnect - -0.9.7.1 2011-11-24 ------------------- -* Better handling of dead server for single server instances -* FindOne and find treats selector == null as {}, Issue #403 -* Possible to pass in a strategy for the replicaset to pick secondary reader node - * parameter strategy - * ping (default), pings the servers and picks the one with the lowest ping time - * statistical, measures each request and pick the one with the lowest mean and std deviation -* Set replicaset read preference replicaset.setReadPreference() - * Server.READ_PRIMARY (use primary server for reads) - * Server.READ_SECONDARY (from a secondary server (uses the strategy set)) - * tags, {object of tags} -* Added replay of commands issued to a closed connection when the connection is re-established -* Fix isConnected and close on unopened connections. Issue #409, fix by (https://github.com/sethml) -* Moved reaper to db.open instead of constructor (Issue #406) -* Allows passing through of socket connection settings to Server or ReplSetServer under the option socketOptions - * timeout = set seconds before connection times out (default 0) - * noDelay = Disables the Nagle algorithm (default true) - * keepAlive = Set if keepAlive is used (default 0, which means no keepAlive, set higher than 0 for keepAlive) - * encoding = ['ascii', 'utf8', or 'base64'] (default null) -* Fixes for handling of errors during shutdown off a socket connection -* Correctly applies socket options including timeout -* Cleanup of test management code to close connections correctly -* Handle parser errors better, closing down the connection and emitting an error -* Correctly emit errors from server.js only wrapping errors that are strings - -0.9.7 2011-11-10 ----------------- -* Added priority setting to replicaset manager -* Added correct handling of passive servers in replicaset -* Reworked socket code for simpler clearer handling -* Correct handling of connections in test helpers -* Added control of retries on failure - * control with parameters retryMiliSeconds and numberOfRetries when creating a db instance -* Added reaper that will timeout and cleanup queries that never return - * control with parameters reaperInterval and reaperTimeout when creating a db instance -* Refactored test helper classes for replicaset tests -* Allows raw (no bson parser mode for insert, update, remove, find and findOne) - * control raw mode passing in option raw:true on the commands - * will return buffers with the binary bson objects -* Fixed memory leak in cursor.toArray -* Fixed bug in command creation for mongodb server with wrong scope of call -* Added db(dbName) method to db.js to allow for reuse of connections against other databases -* Serialization of functions in an object is off by default, override with parameter - * serializeFunctions [true/false] on db level, collection level or individual insert/update/findAndModify -* Added Long.fromString to c++ class and fixed minor bug in the code (Test case for $gt operator on 64-bit integers, Issue #394) -* FindOne and find now share same code execution and will work in the same manner, Issue #399 -* Fix for tailable cursors, Issue #384 -* Fix for Cursor rewind broken, Issue #389 -* Allow Gridstore.exist to query using regexp, Issue #387, fix by (https://github.com/kaij) -* Updated documentation on https://github.com/christkv/node-mongodb-native -* Fixed toJSON methods across all objects for BSON, Binary return Base64 Encoded data - -0.9.6-22 2011-10-15 -------------------- -* Fixed bug in js bson parser that could cause wrong object size on serialization, Issue #370 -* Fixed bug in findAndModify that did not throw error on replicaset timeout, Issue #373 - -0.9.6-21 2011-10-05 -------------------- -* Reworked reconnect code to work correctly -* Handling errors in different parts of the code to ensure that it does not lock the connection -* Consistent error handling for Object.createFromHexString for JS and C++ - -0.9.6-20 2011-10-04 -------------------- -* Reworked bson.js parser to get rid off Array.shift() due to it allocating new memory for each call. Speedup varies between 5-15% depending on doc -* Reworked bson.cc to throw error when trying to serialize js bson types -* Added MinKey, MaxKey and Double support for JS and C++ parser -* Reworked socket handling code to emit errors on unparsable messages -* Added logger option for Db class, lets you pass in a function in the shape - { - log : function(message, object) {}, - error : function(errorMessage, errorObject) {}, - debug : function(debugMessage, object) {}, - } - - Usage is new Db(new Server(..), {logger: loggerInstance}) - -0.9.6-19 2011-09-29 -------------------- -* Fixing compatibility issues between C++ bson parser and js parser -* Added Symbol support to C++ parser -* Fixed socket handling bug for seldom misaligned message from mongodb -* Correctly handles serialization of functions using the C++ bson parser - -0.9.6-18 2011-09-22 -------------------- -* Fixed bug in waitForConnection that would lead to 100% cpu usage, Issue #352 - -0.9.6-17 2011-09-21 -------------------- -* Fixed broken exception test causing bamboo to hang -* Handling correctly command+lastError when both return results as in findAndModify, Issue #351 - -0.9.6-16 2011-09-14 -------------------- -* Fixing a bunch of issues with compatibility with MongoDB 2.0.X branch. Some fairly big changes in behavior from 1.8.X to 2.0.X on the server. -* Error Connection MongoDB V2.0.0 with Auth=true, Issue #348 - -0.9.6-15 2011-09-09 -------------------- -* Fixed issue where pools would not be correctly cleaned up after an error, Issue #345 -* Fixed authentication issue with secondary servers in Replicaset, Issue #334 -* Duplicate replica-set servers when omitting port, Issue #341 -* Fixing findAndModify to correctly work with Replicasets ensuring proper error handling, Issue #336 -* Merged in code from (https://github.com/aheckmann) that checks for global variable leaks - -0.9.6-14 2011-09-05 -------------------- -* Minor fixes for error handling in cursor streaming (https://github.com/sethml), Issue #332 -* Minor doc fixes -* Some more cursor sort tests added, Issue #333 -* Fixes to work with 0.5.X branch -* Fix Db not removing reconnect listener from serverConfig, (https://github.com/sbrekken), Issue #337 -* Removed node_events.h includes (https://github.com/jannehietamaki), Issue #339 -* Implement correct safe/strict mode for findAndModify. - -0.9.6-13 2011-08-24 -------------------- -* Db names correctly error checked for illegal characters - -0.9.6-12 2011-08-24 -------------------- -* Nasty bug in GridFS if you changed the default chunk size -* Fixed error handling bug in findOne - -0.9.6-11 2011-08-23 -------------------- -* Timeout option not correctly making it to the cursor, Issue #320, Fix from (https://github.com/year2013) -* Fixes for memory leaks when using buffers and C++ parser -* Fixes to make tests pass on 0.5.X -* Cleanup of bson.js to remove duplicated code paths -* Fix for errors occurring in ensureIndex, Issue #326 -* Removing require.paths to make tests work with the 0.5.X branch - -0.9.6-10 2011-08-11 -------------------- -* Specific type Double for capped collections (https://github.com/mbostock), Issue #312 -* Decorating Errors with all all object info from Mongo (https://github.com/laurie71), Issue #308 -* Implementing fixes for mongodb 1.9.1 and higher to make tests pass -* Admin validateCollection now takes an options argument for you to pass in full option -* Implemented keepGoing parameter for mongodb 1.9.1 or higher, Issue #310 -* Added test for read_secondary count issue, merged in fix from (https://github.com/year2013), Issue #317 - -0.9.6-9 -------- -* Bug fix for bson parsing the key '':'' correctly without crashing - -0.9.6-8 -------- -* Changed to using node.js crypto library MD5 digest -* Connect method support documented mongodb: syntax by (https://github.com/sethml) -* Support Symbol type for BSON, serializes to it's own type Symbol, Issue #302, #288 -* Code object without scope serializing to correct BSON type -* Lot's of fixes to avoid double callbacks (https://github.com/aheckmann) Issue #304 -* Long deserializes as Number for values in the range -2^53 to 2^53, Issue #305 (https://github.com/sethml) -* Fixed C++ parser to reflect JS parser handling of long deserialization -* Bson small optimizations - -0.9.6-7 2011-07-13 ------------------- -* JS Bson deserialization bug #287 - -0.9.6-6 2011-07-12 ------------------- -* FindAndModify not returning error message as other methods Issue #277 -* Added test coverage for $push, $pushAll and $inc atomic operations -* Correct Error handling for non 12/24 bit ids on Pure JS ObjectID class Issue #276 -* Fixed terrible deserialization bug in js bson code #285 -* Fix by andrewjstone to avoid throwing errors when this.primary not defined - -0.9.6-5 2011-07-06 ------------------- -* Rewritten BSON js parser now faster than the C parser on my core2duo laptop -* Added option full to indexInformation to get all index info Issue #265 -* Passing in ObjectID for new Gridstore works correctly Issue #272 - -0.9.6-4 2011-07-01 ------------------- -* Added test and bug fix for insert/update/remove without callback supplied - -0.9.6-3 2011-07-01 ------------------- -* Added simple grid class called Grid with put, get, delete methods -* Fixed writeBuffer/readBuffer methods on GridStore so they work correctly -* Automatic handling of buffers when using write method on GridStore -* GridStore now accepts a ObjectID instead of file name for write and read methods -* GridStore.list accepts id option to return of file ids instead of filenames -* GridStore close method returns document for the file allowing user to reference _id field - -0.9.6-2 2011-06-30 ------------------- -* Fixes for reconnect logic for server object (replays auth correctly) -* More testcases for auth -* Fixes in error handling for replicaset -* Fixed bug with safe parameter that would fail to execute safe when passing w or wtimeout -* Fixed slaveOk bug for findOne method -* Implemented auth support for replicaset and test cases -* Fixed error when not passing in rs_name - -0.9.6-1 2011-06-25 ------------------- -* Fixes for test to run properly using c++ bson parser -* Fixes for dbref in native parser (correctly handles ref without db component) -* Connection fixes for replicasets to avoid runtime conditions in cygwin (https://github.com/vincentcr) -* Fixes for timestamp in js bson parser (distinct timestamp type now) - -0.9.6 2011-06-21 ----------------- -* Worked around npm version handling bug -* Race condition fix for cygwin (https://github.com/vincentcr) - -0.9.5-1 2011-06-21 ------------------- -* Extracted Timestamp as separate class for bson js parser to avoid instanceof problems -* Fixed driver strict mode issue - -0.9.5 2011-06-20 ----------------- -* Replicaset support (failover and reading from secondary servers) -* Removed ServerPair and ServerCluster -* Added connection pool functionality -* Fixed serious bug in C++ bson parser where bytes > 127 would generate 2 byte sequences -* Allows for forcing the server to assign ObjectID's using the option {forceServerObjectId: true} - -0.6.8 ------ -* Removed multiple message concept from bson -* Changed db.open(db) to be db.open(err, db) - -0.1 2010-01-30 --------------- -* Initial release support of driver using native node.js interface -* Supports gridfs specification -* Supports admin functionality \ No newline at end of file diff --git a/_sources/awesomeappsvideo.txt b/_sources/awesomeappsvideo.txt deleted file mode 100644 index bacbaf554ac..00000000000 --- a/_sources/awesomeappsvideo.txt +++ /dev/null @@ -1,14 +0,0 @@ -====================================== -Awesome Node.js + MongoDB Applications -====================================== - -Node.js blackboard - socket.io ------------------------------- -Nodejs test using express, jade, stylus, socket.io and Mongodb -for persist the data -Source: http://github.com/gotik/nodejs-blackboard -http://node.kamikazepanda.com - -.. raw:: html - - \ No newline at end of file diff --git a/_sources/content/nodejsvideo.txt b/_sources/content/nodejsvideo.txt index ce9cdc1185f..c8f01a5ce89 100644 --- a/_sources/content/nodejsvideo.txt +++ b/_sources/content/nodejsvideo.txt @@ -2,6 +2,84 @@ Node.JS Specific Presentations ============================== +An Introduction to the node.js MongoDB Driver +--------------------------------------------- +Christian Kvalheim gives an introduction to the node.js MongoDB driver. + +.. raw:: html + +
    + + + + + + + + + + + + +
    + +Node.js and MongoDB, a Panel Discussion +--------------------------------------- +Working with Node’s JavaScript means that MongoDB documents get their most natural representation - as JSON - right in the application layer. This session introduces the open source tools available for using MongoDB with Node.js through a panel discussion with the main contributors to these projects. Tom Hughes-Croucher, Node.js Chief Evangelist at Joyent, moderates the discussion. Towards the end, Tom field questions from the attendees. + +.. raw:: html + +
    + +
    + +Schemas for Real Time Analytics with Node.js +-------------------------------------------- +SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include: + +* Dynamic collection creation +* Updating (Increments over sets) +* Schema +* Next gen schemas for dynamic filters + +.. raw:: html + +
    + + + + + + + + + + + + +
    + +Happy Mongo-ing in Node.js +-------------------------- +Node.js is JavaScript. MongoDB speaks JSON. So why bother with an in-between "ORM" layer like Mongoose? Join us for a look at the object modeling... tool designed and maintained by the team at LearnBoost. Recent updates have made Mongoose even more compelling. We'll share the pros and cons we've experienced in using it day-to-day on our current project. + +.. raw:: html + +
    + + + + + + + + + + + + +
    + NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js --------------------------------------------------------------------- Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach @@ -49,24 +127,34 @@ Mongoose Meetup August 2011 -An Introduction to the node.js MongoDB Driver ---------------------------------------------- +A beautiful marriage: MongoDB and node.js +----------------------------------------- +What does it take to handle a million requests a day with sub 400ms response times? Not much when you marry the appropriate technologies. Learn how Proxlet.com leverages MongoDB & NodeJS to serve over a million daily requests.... on a $10/month server. After briefly setting describing the product context, I will discuss why we chose NodeJS & MongoDB to form the backbone of Proxlet, how the technologies play-nice & poised for scale. .. raw:: html
    - - - - - - - - - - - - -
    + +
    + +Rapid Realtime App Development with Node.JS & MongoDB +----------------------------------------------------- +Jump on board to learn about combining two of the most exciting technologies to quickly build realtime apps yourself. This talk will introduce the popular Node.js library, Mongoose, which is a MongoDB "ORM" for Node.js. First, the speaker will deliver a quick primer on Node.js. Then, he'll walk you through Mongoose's schema api, powerful query builder, middleware capabilities, and exciting plugin ecosystem. Finally, he'll demonstrate some realtime capabilities using Node.js and Mongoose. + +.. raw:: html + +
    + + + + + + + + + + + +
    diff --git a/_sources/index.txt b/_sources/index.txt index 517b2b876f6..ad20d10d0d3 100644 --- a/_sources/index.txt +++ b/_sources/index.txt @@ -8,8 +8,8 @@ Usage .. toctree:: :maxdepth: 1 - markdown-docs/index - + markdown-docs/index + Tutorials --------- @@ -18,16 +18,6 @@ Tutorials api-articles/index -Presentations -------------- - -.. toctree:: - :maxdepth: 3 - - content/nodejsvideo - content/awesomeappsvideo - content/tutorials - API Documentation ----------------- @@ -37,6 +27,24 @@ API Documentation api-generated/index api-bson-generated/index + +External Tutorials +------------------ + + * http://howtonode.org/express-mongodb, Blog rolling with mongoDB, express and Node.js + * http://nodetuts.com/tutorials/18-mongodb-and-mongoose.html, Node Tuts - episode 18 - Node.js, MongoDB and Mongoose from Pedro Teixeira on Vimeo. + * http://howtonode.org/node-js-and-mongodb-getting-started-with-mongojs, Node.js and MongoDB - Getting started with MongoJS + +Video Presentations about different topics around the MongoDB and Node.js +------------------------------------------------------------------------- + +.. toctree:: + :maxdepth: 3 + + content/nodejsvideo + content/awesomeappsvideo + content/tutorials + Projects and Libraries using the driver --------------------------------------- @@ -45,6 +53,26 @@ Projects and Libraries using the driver github/github +MongoDB in General +------------------ +There are two main places to learn about MongoDB itself. I've included links below. + + * http://www.mongodb.org, all the documentation for the database + * http://www.10gen.com/presentations, lots of presentations and slides about using the database. + +There are also some very good books out these days + + * `MongoDB: The Definitive Guide `_ + * `MongoDB in Action `_ + * `The Definitive Guide to MongoDB: The NoSQL Database for Cloud and Desktop Computing `_ + * `50 Tips and Tricks for MongoDB Developers `_ + * `Scaling MongoDB `_ + * `MongoDB and Python: Patterns and processes for the popular document-oriented database `_ + * `MongoDB and PHP `_ + * `PHP and MongoDB Web Development Beginner's Guide `_ + * `Node Web Development `_ + * `Document Design for MongoDB `_ + Changelog --------- diff --git a/_sources/nodejsvideo.txt b/_sources/nodejsvideo.txt deleted file mode 100644 index 82208f75257..00000000000 --- a/_sources/nodejsvideo.txt +++ /dev/null @@ -1,28 +0,0 @@ -============================== -Node.JS Specific Presentations -============================== - -NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js ---------------------------------------------------------------------- -Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach - -SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include: - -* Dynamic collection creation -* Updating (Increments over sets) -* Schema -* Next gen schemas for dynamic filters - -.. raw:: html - - - -NYC MongoDB User Group - What's in the Trello ---------------------------------------------- -What's in the Trello - Brett Kiefer, Fog Creek - -Trello is a collaboration tool that organizes your projects into boards. Brett Kiefer will discuss how Trello uses Node.js, Socket.io, MongoDB, Redis, and Backbone to create a responsive single-page app. - -.. raw:: html - - \ No newline at end of file diff --git a/_sources/video.txt b/_sources/video.txt deleted file mode 100644 index aa6527f4dee..00000000000 --- a/_sources/video.txt +++ /dev/null @@ -1,19 +0,0 @@ -============= -Presentations -============= - - -NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js ---------------------------------------------------------------------- -Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach - -SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include: - -* Dynamic collection creation -* Updating (Increments over sets) -* Schema -* Next gen schemas for dynamic filters - -.. raw:: html - - \ No newline at end of file diff --git a/api-generated/changelog.html b/api-generated/changelog.html deleted file mode 100644 index 2a6427fbfd5..00000000000 --- a/api-generated/changelog.html +++ /dev/null @@ -1,806 +0,0 @@ - - - - - - - - - Changelog — MongoDB Node.JS Driver 0.9.9 documentation - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Changelog

    -
    -

    0.9.9 2012-02-13

    -
      -
    • Added createFromTime method on ObjectID to allow for queries against _id more easily using the timestamp.
    • -
    • Db.close(true) now makes connection unusable as it’s been force closed by app.
    • -
    • Fixed mapReduce and group functions to correctly send slaveOk on queries.
    • -
    • Fixes for find method to correctly work with find(query, fields, callback) (Issue #506).
    • -
    • A fix for connection error handling when using the SSL on MongoDB.
    • -
    -
    -
    -

    0.9.8-7 2012-02-06

    -
      -
    • Simplified findOne to use the find command instead of the custom code (Issue #498).
    • -
    • BSON JS parser not also checks for _bsonType variable in case BSON object is in weird scope (Issue #495).
    • -
    -
    -
    -

    0.9.8-6 2012-02-04

    -
      -
    • Removed the check for replicaset change code as it will never work with node.js.
    • -
    -
    -
    -

    0.9.8-5 2012-02-02

    -
      -
    • Added geoNear command to Collection.
    • -
    • Added geoHaystackSearch command to Collection.
    • -
    • Added indexes command to collection to retrieve the indexes on a Collection.
    • -
    • Added stats command to collection to retrieve the statistics on a Collection.
    • -
    • Added listDatabases command to admin object to allow retrieval of all available dbs.
    • -
    • Changed createCreateIndexCommand to work better with options.
    • -
    • Fixed dereference method on Db class to correctly dereference Db reference objects.
    • -
    • Moved connect object onto Db class(Db.connect) as well as keeping backward compatibility.
    • -
    • Removed writeBuffer method from gridstore, write handles switching automatically now.
    • -
    • Changed readBuffer to read on Gridstore, Gridstore now only supports Binary Buffers no Strings anymore.
    • -
    • Moved Long class to bson directory.
    • -
    -
    -
    -

    0.9.8-4 2012-01-28

    -
      -
    • Added reIndex command to collection and db level.
    • -
    • Added support for $returnKey, $maxScan, $min, $max, $showDiskLoc, $comment to cursor and find/findOne methods.
    • -
    • Added dropDups and v option to createIndex and ensureIndex.
    • -
    • Added isCapped method to Collection.
    • -
    • Added indexExists method to Collection.
    • -
    • Added findAndRemove method to Collection.
    • -
    • Fixed bug for replicaset connection when no active servers in the set.
    • -
    • Fixed bug for replicaset connections when errors occur during connection.
    • -
    • Merged in patch for BSON Number handling from Lee Salzman, did some small fixes and added test coverage.
    • -
    -
    -
    -

    0.9.8-3 2012-01-21

    -
      -
    • Workaround for issue with Object.defineProperty (Issue #484)
    • -
    • ObjectID generation with date does not set rest of fields to zero (Issue #482)
    • -
    -
    -
    -

    0.9.8-2 2012-01-20

    -
      -
    • Fixed a missing this in the ReplSetServers constructor.
    • -
    -
    -
    -

    0.9.8-1 2012-01-17

    -
      -
    • FindAndModify bug fix for duplicate errors (Issue #481)
    • -
    -
    -
    -

    0.9.8 2012-01-17

    -
      -
    • Replicasets now correctly adjusts to live changes in the replicaset configuration on the servers, reconnecting correctly. -- Set the interval for checking for changes setting the replicaSetCheckInterval property when creating the ReplSetServers instance or on db.serverConfig.replicaSetCheckInterval. (default 1000 miliseconds)
    • -
    • Fixes formattedOrderClause in collection.js to accept a plain hash as a parameter (Issue #469) https://github.com/tedeh
    • -
    • Removed duplicate code for formattedOrderClause and moved to utils module
    • -
    • Pass in poolSize for ReplSetServers to set default poolSize for new replicaset members
    • -
    • Bug fix for BSON JS deserializer. Isolating the eval functions in separate functions to avoid V8 deoptimizations
    • -
    • Correct handling of illegal BSON messages during deserialization
    • -
    • Fixed Infinite loop when reading GridFs file with no chunks (Issue #471)
    • -
    • Correctly update existing user password when using addUser (Issue #470)
    • -
    -
    -
    -

    0.9.7.3-5 2012-01-04

    -
      -
    • Fix for RegExp serialization for 0.4.X where typeof /regexp/ == ‘function’ vs in 0.6.X typeof /regexp/ == ‘object’
    • -
    • Don’t allow keepAlive and setNoDelay for 0.4.X as it throws errors
    • -
    -
    -
    -

    0.9.7.3-4 2012-01-04

    -
      -
    • Chased down potential memory leak on findAndModify, Issue #467 (node.js removeAllListeners leaves the key in the _events object, node.js bug on eventlistener?, leads to extremely slow memory leak on listener object)
    • -
    • Sanity checks for GridFS performance with benchmark added
    • -
    -
    -
    -

    0.9.7.3-3 2012-01-04

    -
      -
    • Bug fixes for performance issues going form 0.9.6.X to 0.9.7.X on linux
    • -
    • BSON bug fixes for performance
    • -
    -
    -
    -

    0.9.7.3-2 2012-01-02

    -
      -
    • Fixed up documentation to reflect the preferred way of instantiating bson types
    • -
    • GC bug fix for JS bson parser to avoid stop-and-go GC collection
    • -
    -
    -
    -

    0.9.7.3-1 2012-01-02

    -
      -
    • Fix to make db.bson_serializer and db.bson_deserializer work as it did previously
    • -
    -
    -
    -

    0.9.7.3 2011-12-30

    -
      -
    • Moved BSON_BINARY_SUBTYPE_DEFAULT from BSON object to Binary object and removed the BSON_BINARY_ prefixes
    • -
    • Removed Native BSON types, C++ parser uses JS types (faster due to cost of crossing the JS-C++ barrier for each call)
    • -
    • Added build fix for 0.4.X branch of Node.js where GetOwnPropertyNames is not defined in v8
    • -
    • Fix for wire protocol parser for corner situation where the message is larger than the maximum socket buffer in node.js (Issue #464, #461, #447)
    • -
    • Connection pool status set to connected on poolReady, isConnected returns false on anything but connected status (Issue #455)
    • -
    -
    -
    -

    0.9.7.2-5 2011-12-22

    - -
    -
    -

    0.9.7.2-4 2011-12-21

    -
      -
    • Refactoring of callback code to work around performance regression on linux
    • -
    • Fixed group function to correctly use the command mode as default
    • -
    -
    -
    -

    0.9.7.2-3 2011-12-18

    -
      -
    • Fixed error handling for findAndModify while still working for mongodb 1.8.6 (Issue #450).

      -
    • -
    • -
      Allow for force send query to primary, pass option (read:’primary’) on find command.
      -
        -
      • find({a:1}, {read:'primary'}).toArray(function(err, items) {});
      • -
      -
      -
      -
    • -
    -
    -
    -

    0.9.7.2-2 2011-12-16

    -
      -
    • Fixes infinite streamRecords QueryFailure fix when using Mongos (Issue #442)
    • -
    -
    -
    -

    0.9.7.2-1 2011-12-16

    -
      -
    • ~10% perf improvement for ObjectId#toHexString (Issue #448, https://github.com/aheckmann)
    • -
    • Only using process.nextTick on errors emitted on callbacks not on all parsing, reduces number of ticks in the driver
    • -
    • Changed parsing off bson messages to use process.nextTick to do bson parsing in batches if the message is over 10K as to yield more time to the event look increasing concurrency on big mongoreply messages with multiple documents
    • -
    -
    -
    -

    0.9.7.2 2011-12-15

    -
      -
    • -
      Added SSL support for future version of mongodb (VERY VERY EXPERIMENTAL)
      -
        -
      • pass in the ssl:true option to the server or replicaset server config to enable
      • -
      • a bug either in mongodb or node.js does not allow for more than 1 connection pr db instance (poolSize:1).
      • -
      -
      -
      -
    • -
    • Added getTimestamp() method to objectID that returns a date object

      -
    • -
    • -
      Added finalize function to collection.group
      -
        -
      • function group (keys, condition, initial, reduce, finalize, command, callback)
      • -
      -
      -
      -
    • -
    • -
      Reaper no longer using setTimeout to handle reaping. Triggering is done in the general flow leading to predictable behavior.
      -
        -
      • reaperInterval, set interval for reaper (default 10000 miliseconds)
      • -
      • reaperTimeout, set timeout for calls (default 30000 miliseconds)
      • -
      • reaper, enable/disable reaper (default false)
      • -
      -
      -
      -
    • -
    • Work around for issues with findAndModify during high concurrency load, insure that the behavior is the same across the 1.8.X branch and 2.X branch of MongoDb

      -
    • -
    • Reworked multiple db’s sharing same connection pool to behave correctly on error, timeout and close

      -
    • -
    • EnsureIndex command can be executed without a callback (Issue #438)

      -
    • -
    • -
      Eval function no accepts options including nolock (Issue #432)
      -
        -
      • eval(code, parameters, options, callback) (where options = {nolock:true})
      • -
      -
      -
      -
    • -
    -
    -
    -

    0.9.7.1-4 2011-11-27

    -
      -
    • Replaced install.sh with install.js to install correctly on all supported os’s
    • -
    -
    -
    -

    0.9.7.1-3 2011-11-27

    - -
    -
    -

    0.9.7.1-2 2011-11-27

    -
      -
    • Set statistical selection strategy as default for secondary choice.
    • -
    -
    -
    -

    0.9.7.1-1 2011-11-27

    -
      -
    • Better handling of single server reconnect (fixes some bugs)
    • -
    • Better test coverage of single server failure
    • -
    • Correct handling of callbacks on replicaset servers when firewall dropping packets, correct reconnect
    • -
    -
    -
    -

    0.9.7.1 2011-11-24

    -
      -
    • Better handling of dead server for single server instances

      -
    • -
    • FindOne and find treats selector == null as {}, Issue #403

      -
    • -
    • -
      Possible to pass in a strategy for the replicaset to pick secondary reader node
      -
        -
      • -
        parameter strategy
        -
          -
        • ping (default), pings the servers and picks the one with the lowest ping time
        • -
        • statistical, measures each request and pick the one with the lowest mean and std deviation
        • -
        -
        -
        -
      • -
      -
      -
      -
    • -
    • -
      Set replicaset read preference replicaset.setReadPreference()
      -
        -
      • Server.READ_PRIMARY (use primary server for reads)
      • -
      • Server.READ_SECONDARY (from a secondary server (uses the strategy set))
      • -
      • tags, {object of tags}
      • -
      -
      -
      -
    • -
    • Added replay of commands issued to a closed connection when the connection is re-established

      -
    • -
    • Fix isConnected and close on unopened connections. Issue #409, fix by (https://github.com/sethml)

      -
    • -
    • Moved reaper to db.open instead of constructor (Issue #406)

      -
    • -
    • -
      Allows passing through of socket connection settings to Server or ReplSetServer under the option socketOptions
      -
        -
      • timeout = set seconds before connection times out (default 0)
      • -
      • noDelay = Disables the Nagle algorithm (default true)
      • -
      • keepAlive = Set if keepAlive is used (default 0, which means no keepAlive, set higher than 0 for keepAlive)
      • -
      • encoding = [‘ascii’, ‘utf8’, or ‘base64’] (default null)
      • -
      -
      -
      -
    • -
    • Fixes for handling of errors during shutdown off a socket connection

      -
    • -
    • Correctly applies socket options including timeout

      -
    • -
    • Cleanup of test management code to close connections correctly

      -
    • -
    • Handle parser errors better, closing down the connection and emitting an error

      -
    • -
    • Correctly emit errors from server.js only wrapping errors that are strings

      -
    • -
    -
    -
    -

    0.9.7 2011-11-10

    -
      -
    • Added priority setting to replicaset manager

      -
    • -
    • Added correct handling of passive servers in replicaset

      -
    • -
    • Reworked socket code for simpler clearer handling

      -
    • -
    • Correct handling of connections in test helpers

      -
    • -
    • -
      Added control of retries on failure
      -
        -
      • control with parameters retryMiliSeconds and numberOfRetries when creating a db instance
      • -
      -
      -
      -
    • -
    • -
      Added reaper that will timeout and cleanup queries that never return
      -
        -
      • control with parameters reaperInterval and reaperTimeout when creating a db instance
      • -
      -
      -
      -
    • -
    • Refactored test helper classes for replicaset tests

      -
    • -
    • -
      Allows raw (no bson parser mode for insert, update, remove, find and findOne)
      -
        -
      • control raw mode passing in option raw:true on the commands
      • -
      • will return buffers with the binary bson objects
      • -
      -
      -
      -
    • -
    • Fixed memory leak in cursor.toArray

      -
    • -
    • Fixed bug in command creation for mongodb server with wrong scope of call

      -
    • -
    • Added db(dbName) method to db.js to allow for reuse of connections against other databases

      -
    • -
    • -
      Serialization of functions in an object is off by default, override with parameter
      -
        -
      • serializeFunctions [true/false] on db level, collection level or individual insert/update/findAndModify
      • -
      -
      -
      -
    • -
    • Added Long.fromString to c++ class and fixed minor bug in the code (Test case for $gt operator on 64-bit integers, Issue #394)

      -
    • -
    • FindOne and find now share same code execution and will work in the same manner, Issue #399

      -
    • -
    • Fix for tailable cursors, Issue #384

      -
    • -
    • Fix for Cursor rewind broken, Issue #389

      -
    • -
    • Allow Gridstore.exist to query using regexp, Issue #387, fix by (https://github.com/kaij)

      -
    • -
    • Updated documentation on https://github.com/christkv/node-mongodb-native

      -
    • -
    • Fixed toJSON methods across all objects for BSON, Binary return Base64 Encoded data

      -
    • -
    -
    -
    -

    0.9.6-22 2011-10-15

    -
      -
    • Fixed bug in js bson parser that could cause wrong object size on serialization, Issue #370
    • -
    • Fixed bug in findAndModify that did not throw error on replicaset timeout, Issue #373
    • -
    -
    -
    -

    0.9.6-21 2011-10-05

    -
      -
    • Reworked reconnect code to work correctly
    • -
    • Handling errors in different parts of the code to ensure that it does not lock the connection
    • -
    • Consistent error handling for Object.createFromHexString for JS and C++
    • -
    -
    -
    -

    0.9.6-20 2011-10-04

    -
      -
    • Reworked bson.js parser to get rid off Array.shift() due to it allocating new memory for each call. Speedup varies between 5-15% depending on doc

      -
    • -
    • Reworked bson.cc to throw error when trying to serialize js bson types

      -
    • -
    • Added MinKey, MaxKey and Double support for JS and C++ parser

      -
    • -
    • Reworked socket handling code to emit errors on unparsable messages

      -
    • -
    • -
      Added logger option for Db class, lets you pass in a function in the shape
      -
      -
      {
      -

      log : function(message, object) {}, -error : function(errorMessage, errorObject) {}, -debug : function(debugMessage, object) {},

      -
      -
      -

      }

      -
      -
      -

      Usage is new Db(new Server(..), {logger: loggerInstance})

      -
    • -
    -
    -
    -

    0.9.6-19 2011-09-29

    -
      -
    • Fixing compatibility issues between C++ bson parser and js parser
    • -
    • Added Symbol support to C++ parser
    • -
    • Fixed socket handling bug for seldom misaligned message from mongodb
    • -
    • Correctly handles serialization of functions using the C++ bson parser
    • -
    -
    -
    -

    0.9.6-18 2011-09-22

    -
      -
    • Fixed bug in waitForConnection that would lead to 100% cpu usage, Issue #352
    • -
    -
    -
    -

    0.9.6-17 2011-09-21

    -
      -
    • Fixed broken exception test causing bamboo to hang
    • -
    • Handling correctly command+lastError when both return results as in findAndModify, Issue #351
    • -
    -
    -
    -

    0.9.6-16 2011-09-14

    -
      -
    • Fixing a bunch of issues with compatibility with MongoDB 2.0.X branch. Some fairly big changes in behavior from 1.8.X to 2.0.X on the server.
    • -
    • Error Connection MongoDB V2.0.0 with Auth=true, Issue #348
    • -
    -
    -
    -

    0.9.6-15 2011-09-09

    -
      -
    • Fixed issue where pools would not be correctly cleaned up after an error, Issue #345
    • -
    • Fixed authentication issue with secondary servers in Replicaset, Issue #334
    • -
    • Duplicate replica-set servers when omitting port, Issue #341
    • -
    • Fixing findAndModify to correctly work with Replicasets ensuring proper error handling, Issue #336
    • -
    • Merged in code from (https://github.com/aheckmann) that checks for global variable leaks
    • -
    -
    -
    -

    0.9.6-14 2011-09-05

    -
      -
    • Minor fixes for error handling in cursor streaming (https://github.com/sethml), Issue #332
    • -
    • Minor doc fixes
    • -
    • Some more cursor sort tests added, Issue #333
    • -
    • Fixes to work with 0.5.X branch
    • -
    • Fix Db not removing reconnect listener from serverConfig, (https://github.com/sbrekken), Issue #337
    • -
    • Removed node_events.h includes (https://github.com/jannehietamaki), Issue #339
    • -
    • Implement correct safe/strict mode for findAndModify.
    • -
    -
    -
    -

    0.9.6-13 2011-08-24

    -
      -
    • Db names correctly error checked for illegal characters
    • -
    -
    -
    -

    0.9.6-12 2011-08-24

    -
      -
    • Nasty bug in GridFS if you changed the default chunk size
    • -
    • Fixed error handling bug in findOne
    • -
    -
    -
    -

    0.9.6-11 2011-08-23

    -
      -
    • Timeout option not correctly making it to the cursor, Issue #320, Fix from (https://github.com/year2013)
    • -
    • Fixes for memory leaks when using buffers and C++ parser
    • -
    • Fixes to make tests pass on 0.5.X
    • -
    • Cleanup of bson.js to remove duplicated code paths
    • -
    • Fix for errors occurring in ensureIndex, Issue #326
    • -
    • Removing require.paths to make tests work with the 0.5.X branch
    • -
    -
    -
    -

    0.9.6-10 2011-08-11

    -
      -
    • Specific type Double for capped collections (https://github.com/mbostock), Issue #312
    • -
    • Decorating Errors with all all object info from Mongo (https://github.com/laurie71), Issue #308
    • -
    • Implementing fixes for mongodb 1.9.1 and higher to make tests pass
    • -
    • Admin validateCollection now takes an options argument for you to pass in full option
    • -
    • Implemented keepGoing parameter for mongodb 1.9.1 or higher, Issue #310
    • -
    • Added test for read_secondary count issue, merged in fix from (https://github.com/year2013), Issue #317
    • -
    -
    -
    -

    0.9.6-9

    -
      -
    • Bug fix for bson parsing the key ‘’:’’ correctly without crashing
    • -
    -
    -
    -

    0.9.6-8

    -
      -
    • Changed to using node.js crypto library MD5 digest
    • -
    • Connect method support documented mongodb: syntax by (https://github.com/sethml)
    • -
    • Support Symbol type for BSON, serializes to it’s own type Symbol, Issue #302, #288
    • -
    • Code object without scope serializing to correct BSON type
    • -
    • Lot’s of fixes to avoid double callbacks (https://github.com/aheckmann) Issue #304
    • -
    • Long deserializes as Number for values in the range -2^53 to 2^53, Issue #305 (https://github.com/sethml)
    • -
    • Fixed C++ parser to reflect JS parser handling of long deserialization
    • -
    • Bson small optimizations
    • -
    -
    -
    -

    0.9.6-7 2011-07-13

    -
      -
    • JS Bson deserialization bug #287
    • -
    -
    -
    -

    0.9.6-6 2011-07-12

    -
      -
    • FindAndModify not returning error message as other methods Issue #277
    • -
    • Added test coverage for $push, $pushAll and $inc atomic operations
    • -
    • Correct Error handling for non 12/24 bit ids on Pure JS ObjectID class Issue #276
    • -
    • Fixed terrible deserialization bug in js bson code #285
    • -
    • Fix by andrewjstone to avoid throwing errors when this.primary not defined
    • -
    -
    -
    -

    0.9.6-5 2011-07-06

    -
      -
    • Rewritten BSON js parser now faster than the C parser on my core2duo laptop
    • -
    • Added option full to indexInformation to get all index info Issue #265
    • -
    • Passing in ObjectID for new Gridstore works correctly Issue #272
    • -
    -
    -
    -

    0.9.6-4 2011-07-01

    -
      -
    • Added test and bug fix for insert/update/remove without callback supplied
    • -
    -
    -
    -

    0.9.6-3 2011-07-01

    -
      -
    • Added simple grid class called Grid with put, get, delete methods
    • -
    • Fixed writeBuffer/readBuffer methods on GridStore so they work correctly
    • -
    • Automatic handling of buffers when using write method on GridStore
    • -
    • GridStore now accepts a ObjectID instead of file name for write and read methods
    • -
    • GridStore.list accepts id option to return of file ids instead of filenames
    • -
    • GridStore close method returns document for the file allowing user to reference _id field
    • -
    -
    -
    -

    0.9.6-2 2011-06-30

    -
      -
    • Fixes for reconnect logic for server object (replays auth correctly)
    • -
    • More testcases for auth
    • -
    • Fixes in error handling for replicaset
    • -
    • Fixed bug with safe parameter that would fail to execute safe when passing w or wtimeout
    • -
    • Fixed slaveOk bug for findOne method
    • -
    • Implemented auth support for replicaset and test cases
    • -
    • Fixed error when not passing in rs_name
    • -
    -
    -
    -

    0.9.6-1 2011-06-25

    -
      -
    • Fixes for test to run properly using c++ bson parser
    • -
    • Fixes for dbref in native parser (correctly handles ref without db component)
    • -
    • Connection fixes for replicasets to avoid runtime conditions in cygwin (https://github.com/vincentcr)
    • -
    • Fixes for timestamp in js bson parser (distinct timestamp type now)
    • -
    -
    -
    -

    0.9.6 2011-06-21

    - -
    -
    -

    0.9.5-1 2011-06-21

    -
      -
    • Extracted Timestamp as separate class for bson js parser to avoid instanceof problems
    • -
    • Fixed driver strict mode issue
    • -
    -
    -
    -

    0.9.5 2011-06-20

    -
      -
    • Replicaset support (failover and reading from secondary servers)
    • -
    • Removed ServerPair and ServerCluster
    • -
    • Added connection pool functionality
    • -
    • Fixed serious bug in C++ bson parser where bytes &gt; 127 would generate 2 byte sequences
    • -
    • Allows for forcing the server to assign ObjectID’s using the option {forceServerObjectId: true}
    • -
    -
    -
    -

    0.6.8

    -
      -
    • Removed multiple message concept from bson
    • -
    • Changed db.open(db) to be db.open(err, db)
    • -
    -
    -
    -

    0.1 2010-01-30

    -
      -
    • Initial release support of driver using native node.js interface
    • -
    • Supports gridfs specification
    • -
    • Supports admin functionality
    • -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - - - - \ No newline at end of file diff --git a/awesomeappsvideo.html b/awesomeappsvideo.html deleted file mode 100644 index aeb26733dc3..00000000000 --- a/awesomeappsvideo.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - Awesome Node.js + MongoDB Applications — MongoDB Node.JS Driver 0.9.9.1 documentation - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Awesome Node.js + MongoDB Applications

    -
    -

    Node.js blackboard - socket.io

    -

    Nodejs test using express, jade, stylus, socket.io and Mongodb -for persist the data -Source: http://github.com/gotik/nodejs-blackboard -http://node.kamikazepanda.com

    -
    -
    - - -
    -
    -
    -
    -
    - -

    Page Contents

    - - - -

    Core Documentation

    - - - - -

    This Page

    - -
    -
    -
    -
    - - - - - - - \ No newline at end of file diff --git a/content/nodejsvideo.html b/content/nodejsvideo.html index 3d4d880cb5a..1a29d9e3e4e 100644 --- a/content/nodejsvideo.html +++ b/content/nodejsvideo.html @@ -43,6 +43,69 @@

    Navigation

    Node.JS Specific Presentations

    +
    +

    An Introduction to the node.js MongoDB Driver

    +

    Christian Kvalheim gives an introduction to the node.js MongoDB driver.

    +
    + + + + + + + + + + + + +
    +
    +

    Node.js and MongoDB, a Panel Discussion

    +

    Working with Node’s JavaScript means that MongoDB documents get their most natural representation - as JSON - right in the application layer. This session introduces the open source tools available for using MongoDB with Node.js through a panel discussion with the main contributors to these projects. Tom Hughes-Croucher, Node.js Chief Evangelist at Joyent, moderates the discussion. Towards the end, Tom field questions from the attendees.

    +
    + +
    +
    +

    Schemas for Real Time Analytics with Node.js

    +

    SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include:

    +
      +
    • Dynamic collection creation
    • +
    • Updating (Increments over sets)
    • +
    • Schema
    • +
    • Next gen schemas for dynamic filters
    • +
    +
    + + + + + + + + + + + + +
    +
    +

    Happy Mongo-ing in Node.js

    +

    Node.js is JavaScript. MongoDB speaks JSON. So why bother with an in-between “ORM” layer like Mongoose? Join us for a look at the object modeling... tool designed and maintained by the team at LearnBoost. Recent updates have made Mongoose even more compelling. We’ll share the pros and cons we’ve experienced in using it day-to-day on our current project.

    +
    + + + + + + + + + + + + +

    NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js

    Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach

    @@ -77,22 +140,28 @@

    NYC Node JS Meetup - August 2011 - Mongoose & other MongoDB Connectors

    -
    -

    An Introduction to the node.js MongoDB Driver

    +
    +

    A beautiful marriage: MongoDB and node.js

    +

    What does it take to handle a million requests a day with sub 400ms response times? Not much when you marry the appropriate technologies. Learn how Proxlet.com leverages MongoDB & NodeJS to serve over a million daily requests.... on a $10/month server. After briefly setting describing the product context, I will discuss why we chose NodeJS & MongoDB to form the backbone of Proxlet, how the technologies play-nice & poised for scale.

    - - - - - - - - - - - - -
    + +
    +
    +

    Rapid Realtime App Development with Node.JS & MongoDB

    +

    Jump on board to learn about combining two of the most exciting technologies to quickly build realtime apps yourself. This talk will introduce the popular Node.js library, Mongoose, which is a MongoDB “ORM” for Node.js. First, the speaker will deliver a quick primer on Node.js. Then, he’ll walk you through Mongoose’s schema api, powerful query builder, middleware capabilities, and exciting plugin ecosystem. Finally, he’ll demonstrate some realtime capabilities using Node.js and Mongoose.

    +
    + + + + + + + + + + + +
    @@ -107,10 +176,15 @@

    An Introduction to the node.js MongoDB DriverNode.JS Specific Presentations diff --git a/dev/benchmark/bson_benchmark.js b/dev/benchmark/bson_benchmark.js deleted file mode 100644 index 884f9ea724e..00000000000 --- a/dev/benchmark/bson_benchmark.js +++ /dev/null @@ -1,86 +0,0 @@ -var BSON = require('../lib/mongodb').BSONNative.BSON, - ObjectID = require('../lib/mongodb').BSONNative.ObjectID, - Code = require('../lib/mongodb').BSONNative.Code, - Long = require('../lib/mongodb').BSONNative.Long, - Binary = require('../lib/mongodb').BSONNative.Binary, - debug = require('util').debug, - inspect = require('util').inspect; - -// var BSON = require('../lib/mongodb').BSONPure.BSON, -// ObjectID = require('../lib/mongodb').BSONPure.ObjectID, -// Code = require('../lib/mongodb').BSONPure.Code, -// Long = require('../lib/mongodb').BSONPure.Long, -// Binary = require('../lib/mongodb').BSONPure.Binary; - -var COUNT = 1000; -var COUNT = 100; - -var object = { - string: "Strings are great", - decimal: 3.14159265, - bool: true, - integer: 5, - long: Long.fromNumber(100), - bin: new Binary(), - - subObject: { - moreText: "Bacon ipsum dolor sit amet cow pork belly rump ribeye pastrami andouille. Tail hamburger pork belly, drumstick flank salami t-bone sirloin pork chop ribeye ham chuck pork loin shankle. Ham fatback pork swine, sirloin shankle short loin andouille shank sausage meatloaf drumstick. Pig chicken cow bresaola, pork loin jerky meatball tenderloin brisket strip steak jowl spare ribs. Biltong sirloin pork belly boudin, bacon pastrami rump chicken. Jowl rump fatback, biltong bacon t-bone turkey. Turkey pork loin boudin, tenderloin jerky beef ribs pastrami spare ribs biltong pork chop beef.", - longKeylongKeylongKeylongKeylongKeylongKey: "Pork belly boudin shoulder ribeye pork chop brisket biltong short ribs. Salami beef pork belly, t-bone sirloin meatloaf tail jowl spare ribs. Sirloin biltong bresaola cow turkey. Biltong fatback meatball, bresaola tail shankle turkey pancetta ham ribeye flank bacon jerky pork chop. Boudin sirloin shoulder, salami swine flank jerky t-bone pork chop pork beef tongue. Bresaola ribeye jerky andouille. Ribeye ground round sausage biltong beef ribs chuck, shank hamburger chicken short ribs spare ribs tenderloin meatloaf pork loin." - }, - - subArray: [1,2,3,4,5,6,7,8,9,10], - anotherString: "another string", - code: new Code("function() {}", {i:1}) -} - -// Number of objects -var numberOfObjects = 100; -// var numberOfObjects = 2; - -// Object serialized -objectBSON = BSON.serialize(object, null, true) - -// Buffer With copies of the objectBSON -var data = new Buffer(objectBSON.length * numberOfObjects); -var index = 0; - -// Copy the buffer 1000 times to create a strea m of objects -for(var i = 0; i < numberOfObjects; i++) { - // Copy data - objectBSON.copy(data, index); - // Adjust index - index = index + objectBSON.length; -} - -// console.log("-----------------------------------------------------------------------------------") -// console.dir(objectBSON) - -var x, start, end, j -var objectBSON, objectJSON - -// Allocate the return array (avoid concatinating everything) -var results = new Array(numberOfObjects); - -console.log(COUNT + "x (objectBSON = BSON.serialize(object))") -start = new Date - -// var objects = BSON.deserializeStream(data, 0, numberOfObjects); -// console.log("----------------------------------------------------------------------------------- 0") -// var objects = BSON.deserialize(data); -// console.log("----------------------------------------------------------------------------------- 1") -// console.dir(objects) - -for (j=COUNT; --j>=0; ) { - var nextIndex = BSON.deserializeStream(data, 0, numberOfObjects, results, 0); -} - -end = new Date -var opsprsecond = COUNT / ((end - start)/1000); -console.log("bson size (bytes): ", objectBSON.length); -console.log("time = ", end - start, "ms -", COUNT / ((end - start)/1000), " ops/sec"); -console.log("MB/s = " + ((opsprsecond*objectBSON.length)/1024)); - -// console.dir(nextIndex) -// console.dir(results) - - diff --git a/dev/benchmark/bson_buffalo_benchmark.js b/dev/benchmark/bson_buffalo_benchmark.js deleted file mode 100644 index 43848b24a62..00000000000 --- a/dev/benchmark/bson_buffalo_benchmark.js +++ /dev/null @@ -1,299 +0,0 @@ -var BSON = require('/Users/christiankvalheim/coding/checkout/node-buffalo/buffalo') -var mongoNative = require('../lib/mongodb'), - assert = require('assert'), - Long = require('../lib/mongodb/bson/long').Long, - ObjectID = require('../lib/mongodb/bson/bson').ObjectID, - Binary = require('../lib/mongodb/bson/bson').Binary, - Code = require('../lib/mongodb/bson/bson').Code, - DBRef = require('../lib/mongodb/bson/bson').DBRef, - Symbol = require('../lib/mongodb/bson/bson').Symbol, - Double = require('../lib/mongodb/bson/bson').Double, - MaxKey = require('../lib/mongodb/bson/bson').MaxKey, - MinKey = require('../lib/mongodb/bson/bson').MinKey, - Timestamp = require('../lib/mongodb/bson/bson').Timestamp; - -var BSONPure = new mongoNative.BSONPure.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); -var BSONNative = new mongoNative.BSONNative.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); - -var COUNT = 100000 -// var COUNT = 20000 -// var COUNT = 10000 -// var COUNT = 1 - -// Function with scope -var function2 = function() {}; -function2.scope = {a:1}; - -// var COUNT = 1 -var object = { - string: "Strings are great", - decimal: 3.14159265, - 'undefined': undefined, - bool: true, - integer: 5, - regexp:/fdfdfd/, - // regexp:/fdfdfd/mig, - subObject: { - moreText: "Bacon ipsum dolor sit amet cow pork belly rump ribeye pastrami andouille. Tail hamburger pork belly, drumstick flank salami t-bone sirloin pork chop ribeye ham chuck pork loin shankle. Ham fatback pork swine, sirloin shankle short loin andouille shank sausage meatloaf drumstick. Pig chicken cow bresaola, pork loin jerky meatball tenderloin brisket strip steak jowl spare ribs. Biltong sirloin pork belly boudin, bacon pastrami rump chicken. Jowl rump fatback, biltong bacon t-bone turkey. Turkey pork loin boudin, tenderloin jerky beef ribs pastrami spare ribs biltong pork chop beef.", - longKeylongKeylongKeylongKeylongKeylongKey: "Pork belly boudin shoulder ribeye pork chop brisket biltong short ribs. Salami beef pork belly, t-bone sirloin meatloaf tail jowl spare ribs. Sirloin biltong bresaola cow turkey. Biltong fatback meatball, bresaola tail shankle turkey pancetta ham ribeye flank bacon jerky pork chop. Boudin sirloin shoulder, salami swine flank jerky t-bone pork chop pork beef tongue. Bresaola ribeye jerky andouille. Ribeye ground round sausage biltong beef ribs chuck, shank hamburger chicken short ribs spare ribs tenderloin meatloaf pork loin.", - - subObject: { - moreText: "Bacon ipsum dolor sit amet cow pork belly rump ribeye pastrami andouille. Tail hamburger pork belly, drumstick flank salami t-bone sirloin pork chop ribeye ham chuck pork loin shankle. Ham fatback pork swine, sirloin shankle short loin andouille shank sausage meatloaf drumstick. Pig chicken cow bresaola, pork loin jerky meatball tenderloin brisket strip steak jowl spare ribs. Biltong sirloin pork belly boudin, bacon pastrami rump chicken. Jowl rump fatback, biltong bacon t-bone turkey. Turkey pork loin boudin, tenderloin jerky beef ribs pastrami spare ribs biltong pork chop beef.", - longKeylongKeylongKeylongKeylongKeylongKey: "Pork belly boudin shoulder ribeye pork chop brisket biltong short ribs. Salami beef pork belly, t-bone sirloin meatloaf tail jowl spare ribs. Sirloin biltong bresaola cow turkey. Biltong fatback meatball, bresaola tail shankle turkey pancetta ham ribeye flank bacon jerky pork chop. Boudin sirloin shoulder, salami swine flank jerky t-bone pork chop pork beef tongue. Bresaola ribeye jerky andouille. Ribeye ground round sausage biltong beef ribs chuck, shank hamburger chicken short ribs spare ribs tenderloin meatloaf pork loin.", - }, - }, - date: new Date(), - code: function() {}, - function2: function2, - buffer:new Buffer('hello world'), - 'null': null, - subArray: [1,2,3,4,5,6,7,8,9,10], - anotherString: "another string" -} - -// var object2 = { -// string: "Strings are great", -// obj: { -// string2: "This is String 2", -// }, -// -// decimal: 3.14159265, -// 'undefined': undefined, -// bool: true, -// integer: 5, -// regexp:/fdfdfd/mig, -// regexp:/fdfdfd/, -// subObject: { -// moreText: "Bacon ipsum dolor sit amet cow pork belly rump ribeye pastrami andouille. Tail hamburger pork belly, drumstick flank salami t-bone sirloin pork chop ribeye ham chuck pork loin shankle. Ham fatback pork swine, sirloin shankle short loin andouille shank sausage meatloaf drumstick. Pig chicken cow bresaola, pork loin jerky meatball tenderloin brisket strip steak jowl spare ribs. Biltong sirloin pork belly boudin, bacon pastrami rump chicken. Jowl rump fatback, biltong bacon t-bone turkey. Turkey pork loin boudin, tenderloin jerky beef ribs pastrami spare ribs biltong pork chop beef.", -// longKeylongKeylongKeylongKeylongKeylongKey: "Pork belly boudin shoulder ribeye pork chop brisket biltong short ribs. Salami beef pork belly, t-bone sirloin meatloaf tail jowl spare ribs. Sirloin biltong bresaola cow turkey. Biltong fatback meatball, bresaola tail shankle turkey pancetta ham ribeye flank bacon jerky pork chop. Boudin sirloin shoulder, salami swine flank jerky t-bone pork chop pork beef tongue. Bresaola ribeye jerky andouille. Ribeye ground round sausage biltong beef ribs chuck, shank hamburger chicken short ribs spare ribs tenderloin meatloaf pork loin.", -// -// subObject: { -// moreText: "Bacon ipsum dolor sit amet cow pork belly rump ribeye pastrami andouille. Tail hamburger pork belly, drumstick flank salami t-bone sirloin pork chop ribeye ham chuck pork loin shankle. Ham fatback pork swine, sirloin shankle short loin andouille shank sausage meatloaf drumstick. Pig chicken cow bresaola, pork loin jerky meatball tenderloin brisket strip steak jowl spare ribs. Biltong sirloin pork belly boudin, bacon pastrami rump chicken. Jowl rump fatback, biltong bacon t-bone turkey. Turkey pork loin boudin, tenderloin jerky beef ribs pastrami spare ribs biltong pork chop beef.", -// longKeylongKeylongKeylongKeylongKeylongKey: "Pork belly boudin shoulder ribeye pork chop brisket biltong short ribs. Salami beef pork belly, t-bone sirloin meatloaf tail jowl spare ribs. Sirloin biltong bresaola cow turkey. Biltong fatback meatball, bresaola tail shankle turkey pancetta ham ribeye flank bacon jerky pork chop. Boudin sirloin shoulder, salami swine flank jerky t-bone pork chop pork beef tongue. Bresaola ribeye jerky andouille. Ribeye ground round sausage biltong beef ribs chuck, shank hamburger chicken short ribs spare ribs tenderloin meatloaf pork loin." -// } -// }, -// dbref: new DBRef('collection', new ObjectID(), 'db'), -// long: Long.fromNumber(1000), -// double: new Double(3.14), -// code1: new Code((function() {}).toString(), {a:1}), -// code: new Code((function() {}).toString()), -// minKey: new MinKey(), -// maxKey: new MaxKey(), -// objectId: new ObjectID(), -// binary: new Binary('hello world'), -// symbol: new Symbol('hello'), -// timestamp: Timestamp.fromNumber(1000), -// date: new Date(), -// function1: function() {}, -// function2: function2, -// buffer:new Buffer('hello world'), -// 'null': null, -// subArray: [1,2,3,4,5,6,7,8,9,10], -// anotherString: "another string" -// } -// -// var object2 = { -// cursorId: Long.fromString("3688496768165567218"), -// } - -// Serialize the object -var serializedDoc = BSONPure.serialize(object, null, true); - -// Read a test doc -// var bufferData = require('fs').readFileSync("/Users/christiankvalheim/coding/projects/node-mongodb-native/1325633340440_18.txt", 'ascii'); -// Serialized doc -// var serializedDoc = new Buffer(bufferData, 'hex'); - -// console.dir(serializedDoc) -// var index = 0; -// var binary_reply = serializedDoc; -// -// console.log("---------------------------------------------------------") -// while(index < serializedDoc.length) { -// // Read the size of the bson object -// var bsonObjectSize = binary_reply[index] | binary_reply[index + 1] << 8 | binary_reply[index + 2] << 16 | binary_reply[index + 3] << 24; -// // var d_doc = BSONNative.deserialize(binary_reply.slice(index, index + bsonObjectSize)); -// var d_doc = BSONPure.deserialize(binary_reply.slice(index, index + bsonObjectSize)); -// console.dir(d_doc); -// index = index + bsonObjectSize; -// } -// -// Deserialize the object -// var d_doc = BSONPure.deserialize2(serializedDoc, {evalFunctions:true, cacheFunctions:true}); -// var d_doc = BSONPure.deserialize(serializedDoc); -// var d_doc = BSONNative.deserialize(serializedDoc); -// -// console.log("---------------------------------------------------------") -// console.dir(d_doc); -// return - -// Warm up the method -for(var i = 0 ; i < COUNT; i++) { - BSONPure.deserialize(serializedDoc); - BSON.parse(serializedDoc); - BSONNative.deserialize(serializedDoc); -} - -// var object2 = { authenticate: 1, -// user: 'admin', -// nonce: '2e8e9e9533db3dae', -// key: 'e75fea840d9f52bab39903b011898b8f' } -// -// var object2 = {'name' : 'child', 'parent' : new DBRef("test_resave_dbref", new ObjectID())} -// -// var object2 = {'doc': {'doc2': new Code('this.a > i', {i:1})}}; -// // var object2 = {'doc2': new Code('this.a > i', {i:1})}; -// var object2 = {'doc': {'doc2': new Code('this.a > i', {})}}; -// -// var object3 = { -// // function2: new Code((function() {}).toString(), {a:1}), -// // function1: new Code((function() {}).toString()), -// } - -// // object2 = object; -// var x, start, end, i -// var serializedBSON, serializedBSONPure, serializedBSONNative, serializedJSON -// var deserializedBSON, deserializedBSONPure, deserializedBSONNative, deserializedJSON -// -// for (i=COUNT; --i>=0; ) { -// calculate1 = BSON.calculate(object) -// // calculate2 = BSONPure.calculateObjectSize(object2, true) -// calculate3 = BSONPure.calculateObjectSize2(object2, true) -// calculate4 = BSONNative.calculateObjectSize(object2) -// } -// -// start = new Date -// for (i=COUNT; --i>=0; ) { -// calculate1 = BSON.calculate(object) -// } -// end = new Date -// console.log(COUNT + "x buffalo.calculate(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") -// -// start = new Date -// for (i=COUNT; --i>=0; ) { -// calculate2 = BSONPure.calculateObjectSize2(object, true) -// } -// end = new Date -// console.log(COUNT + "x BSONPure.calculateObjectSize(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") -// -// -// start = new Date -// for (i=COUNT; --i>=0; ) { -// calculate3 = BSONPure.calculateObjectSize2(object2) -// } -// end = new Date -// console.log(COUNT + "x BSONPure.calculateObjectSize2(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") -// -// -// console.log("==================================================================") -// console.dir("BSON.calculate :: " + calculate1) -// // console.dir("BSONPure.calculateObjectSize :: " + calculate2) -// console.dir("BSONPure.calculateObjectSize2 :: " + calculate3) -// console.dir("BSONNative.calculateObjectSize :: " + calculate4) - -// console.log("========================================================== serialize") -// console.log("BSON.serialize :: ") -// console.dir(BSON.serialize(object).toString('hex')) -// console.log("BSONPure.serialize2 :: ") -// console.dir(BSONPure.serialize2(object2, null, true).toString('hex')) -// console.dir(BSONPure.serialize2(object2, null, true).toString('ascii')) -// console.log("BSONPure.serialize :: ") -// console.dir(BSONPure.serialize(object, null, true).toString('hex')) -// console.log("BSONNative.serialize :: ") -// console.dir(BSONNative.serialize(object2, null, true).toString('hex')) -// console.dir(BSONNative.serialize(object2, null, true).toString('ascii')) - -// // Serialize -// var a = BSONPure.serialize(object2, null, true); -// var b = BSONNative.serialize(object2, null, true); -// -// console.log("==================================== check") -// for(var i = 0; i < b.length; i++) { -// console.log("[" + a[i] + "] = [" + b[i] + "] :: " + (a[i] === b[i] ? 'true' : "FALSE FALSE FALSE")); -// } -// -// assert.equal(BSONNative.serialize(object2, null, true).toString('hex'), -// BSONPure.serialize2(object2, null, true).toString('hex')) -// -// -// start = new Date -// for (i=COUNT; --i>=0; ) { -// serializedBSON = BSON.serialize(object) -// } -// end = new Date -// console.log(COUNT + "x buffalo.serialize(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") -// -// start = new Date -// for (i=COUNT; --i>=0; ) { -// serializedBSONPure = BSONPure.serialize2(object, null, true) -// } -// end = new Date -// console.log(COUNT + "x mongodb.BSONPure.serialize2(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - -// start = new Date -// for (i=COUNT; --i>=0; ) { -// serializedBSONPure = BSONPure.serialize(object, null, true) -// } -// end = new Date -// console.log(COUNT + "x mongodb.BSONPure.serialize(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") -// -// if (BSONNative) { -// start = new Date -// for (i=COUNT; --i>=0; ) { -// serializedBSONNative = BSONNative.serialize(object, null, true) -// } -// end = new Date -// console.log(COUNT + "x mongodb.BSONNative.serialize(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") -// } -// -// start = new Date -// for (i=COUNT; --i>=0; ) { -// serializedJSON = JSON.stringify(object) -// } -// end = new Date -// console.log(COUNT + "x JSON.stringify(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - -// start = new Date -// for (i=COUNT; --i>=0; ) { -// deserializedBSONPure = BSONPure.deserialize2(serializedDoc) -// } -// end = new Date -// console.log(COUNT + "x mongodb.BSONPure.deserialize2(buffer) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - -start = new Date -for (i=COUNT; --i>=0; ) { - deserializedBSON = BSON.parse(serializedDoc) -} -end = new Date -console.log(COUNT + "x buffalo.parse(buffer) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - -if (BSONNative) { - start = new Date - for (i=COUNT; --i>=0; ) { - deserializedBSONNative = BSONNative.deserialize(serializedDoc) - } - end = new Date - console.log(COUNT + "x mongodb.BSONNative.deserialize(buffer) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") -} - -start = new Date -for (i=COUNT; --i>=0; ) { - deserializedBSONPure = BSONPure.deserialize(serializedDoc) -} -end = new Date -console.log(COUNT + "x mongodb.BSONPure.deserialize(buffer) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - -console.log("---------------------------------------------------------") -console.dir(deserializedBSON) -console.dir(deserializedBSONNative) -console.dir(deserializedBSONPure) - -function compare(b1, b2) { - try { - require('assert').deepEqual(b1,b2) - return true - } catch (e) { - console.error(e) - return false - } -} diff --git a/dev/benchmark/bson_native_benchmark.js b/dev/benchmark/bson_native_benchmark.js deleted file mode 100644 index 09d6afd894f..00000000000 --- a/dev/benchmark/bson_native_benchmark.js +++ /dev/null @@ -1,112 +0,0 @@ -var BSON = require('/Users/christiankvalheim/coding/checkout/node-buffalo/buffalo') -var mongoNative = require('../lib/mongodb'), - assert = require('assert'), - Long = require('../lib/mongodb/bson/long').Long, - ObjectID = require('../lib/mongodb/bson/bson').ObjectID, - Binary = require('../lib/mongodb/bson/bson').Binary, - Code = require('../lib/mongodb/bson/bson').Code, - DBRef = require('../lib/mongodb/bson/bson').DBRef, - Symbol = require('../lib/mongodb/bson/bson').Symbol, - Double = require('../lib/mongodb/bson/bson').Double, - MaxKey = require('../lib/mongodb/bson/bson').MaxKey, - MinKey = require('../lib/mongodb/bson/bson').MinKey, - Timestamp = require('../lib/mongodb/bson/bson').Timestamp; - -var BSONPure = new mongoNative.BSONPure.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); -var BSONNative = new mongoNative.BSONNative.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); - -var COUNT = 500000 -// var COUNT = 100000 -// var COUNT = 20000 -// var COUNT = 10000 -// var COUNT = 1 - -// Function with scope -var function2 = function() {}; -function2.scope = {a:1}; - -var object = { - string: "Strings are great", - // obj: { - // string2: "This is String 2", - // }, - // - // decimal: 3.14159265, - // 'undefined': undefined, - // bool: true, - // integer: 5, - // regexp:/fdfdfd/mig, - // regexp:/fdfdfd/, - // subObject: { - // moreText: "Bacon ipsum dolor sit amet cow pork belly rump ribeye pastrami andouille. Tail hamburger pork belly, drumstick flank salami t-bone sirloin pork chop ribeye ham chuck pork loin shankle. Ham fatback pork swine, sirloin shankle short loin andouille shank sausage meatloaf drumstick. Pig chicken cow bresaola, pork loin jerky meatball tenderloin brisket strip steak jowl spare ribs. Biltong sirloin pork belly boudin, bacon pastrami rump chicken. Jowl rump fatback, biltong bacon t-bone turkey. Turkey pork loin boudin, tenderloin jerky beef ribs pastrami spare ribs biltong pork chop beef.", - // longKeylongKeylongKeylongKeylongKeylongKey: "Pork belly boudin shoulder ribeye pork chop brisket biltong short ribs. Salami beef pork belly, t-bone sirloin meatloaf tail jowl spare ribs. Sirloin biltong bresaola cow turkey. Biltong fatback meatball, bresaola tail shankle turkey pancetta ham ribeye flank bacon jerky pork chop. Boudin sirloin shoulder, salami swine flank jerky t-bone pork chop pork beef tongue. Bresaola ribeye jerky andouille. Ribeye ground round sausage biltong beef ribs chuck, shank hamburger chicken short ribs spare ribs tenderloin meatloaf pork loin.", - // - // subObject: { - // moreText: "Bacon ipsum dolor sit amet cow pork belly rump ribeye pastrami andouille. Tail hamburger pork belly, drumstick flank salami t-bone sirloin pork chop ribeye ham chuck pork loin shankle. Ham fatback pork swine, sirloin shankle short loin andouille shank sausage meatloaf drumstick. Pig chicken cow bresaola, pork loin jerky meatball tenderloin brisket strip steak jowl spare ribs. Biltong sirloin pork belly boudin, bacon pastrami rump chicken. Jowl rump fatback, biltong bacon t-bone turkey. Turkey pork loin boudin, tenderloin jerky beef ribs pastrami spare ribs biltong pork chop beef.", - // longKeylongKeylongKeylongKeylongKeylongKey: "Pork belly boudin shoulder ribeye pork chop brisket biltong short ribs. Salami beef pork belly, t-bone sirloin meatloaf tail jowl spare ribs. Sirloin biltong bresaola cow turkey. Biltong fatback meatball, bresaola tail shankle turkey pancetta ham ribeye flank bacon jerky pork chop. Boudin sirloin shoulder, salami swine flank jerky t-bone pork chop pork beef tongue. Bresaola ribeye jerky andouille. Ribeye ground round sausage biltong beef ribs chuck, shank hamburger chicken short ribs spare ribs tenderloin meatloaf pork loin." - // } - // }, - // dbref: new DBRef('collection', new ObjectID(), 'db'), - // long: Long.fromNumber(1000), - // double: new Double(3.14), - // code1: new Code((function() {}).toString(), {a:1}), - // code: new Code((function() {}).toString()), - // minKey: new MinKey(), - // maxKey: new MaxKey(), - // objectId: new ObjectID(), - // binary: new Binary('hello world'), - // symbol: new Symbol('hello'), - // timestamp: Timestamp.fromNumber(1000), - // date: new Date(), - // function1: function() {}, - // function2: function2, - // buffer:new Buffer('hello world'), - // 'null': null, - // subArray: [1,2,3,4,5,6,7,8,9,10], - // anotherString: "another string" -} - -var start = new Date -for (i=COUNT; --i>=0; ) { - // calculate1 = BSONPure.calculateObjectSize(object, true); - serialize1 = BSONPure.serialize(object, null, true) -} -var end = new Date -console.log(COUNT + "x BSONPure.calculateObjectSize(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - -start = new Date -for (i=COUNT; --i>=0; ) { - // calculate2 = BSONNative.calculateObjectSize(object, true); - serialize2 = BSONNative.serialize(object, null, true) -} -end = new Date -console.log(COUNT + "x BSONNative.calculateObjectSize(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - - -start = new Date -for (i=COUNT; --i>=0; ) { - // calculate3 = BSONNative.calculateObjectSize2(object) - serialize3 = BSONNative.serialize2(object, null, true) -} -end = new Date -console.log(COUNT + "x BSONNative.calculateObjectSize2(object) time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - -// console.log("----------------------------------------------------------------------- size"); -// console.log("calculate1 = " + calculate1); -// console.log("calculate2 = " + calculate2); -// console.log("calculate3 = " + calculate3); - -console.log("----------------------------------------------------------------------- serialize"); -console.log(serialize1.toString('hex')) -console.log(serialize2.toString('hex')) -console.log(serialize3.toString('hex')) - -function compare(b1, b2) { - try { - require('assert').deepEqual(b1,b2) - return true - } catch (e) { - console.error(e) - return false - } -} diff --git a/dev/benchmark/emit_benchmark.js b/dev/benchmark/emit_benchmark.js deleted file mode 100644 index aa365dee089..00000000000 --- a/dev/benchmark/emit_benchmark.js +++ /dev/null @@ -1,49 +0,0 @@ -var debug = require('util').debug, - inspect = require('util').inspect, - inherits = require('util').inherits, - net = require('net'), - EventEmitter = require("events").EventEmitter; - -var COUNT = 1000000; - -var Emitter = function() { -} - -inherits(Emitter, EventEmitter); - -Emitter.prototype.start = function() { - for(var i = 0; i < COUNT; i++) { - this.emit("data", "============================================== data") - } -} - -Emitter.prototype.start2 = function(callback) { - for(var i = 0; i < COUNT; i++) { - callback(null, "============================================== data") - } -} - -// Create test object -var emitObj = new Emitter(); -emitObj.on("data", function(data) { -}) - -console.log(COUNT + "x (objectBSON = BSON.serialize(object))") -start = new Date - -emitObj.start(); - -end = new Date -console.log("time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - - -console.log(COUNT + "x (objectBSON = BSON.serialize(object))") -start = new Date - -emitObj.start2(function(err, data) { - // debug(data) -}); - -end = new Date -console.log("time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") - diff --git a/dev/benchmark/grid_fs_write_benchmark.js b/dev/benchmark/grid_fs_write_benchmark.js deleted file mode 100644 index ae454f2b98f..00000000000 --- a/dev/benchmark/grid_fs_write_benchmark.js +++ /dev/null @@ -1,25 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Server = require('../lib/mongodb').Server, - ObjectID = require('../lib/mongodb').ObjectID, - GridStore = require('../lib/mongodb').GridStore; - -var simulated_buffer = new Buffer(1024*1000*10).toString(); - -new Db('grid_fs_write_benchmark', new Server("127.0.0.1", 27017, {auto_reconnect: true}), {}).open(function(err, new_client) { - new_client.dropDatabase(function(err, result) { - new_client.close(); - - for(var i = 0; i < 1; i++) { - new Db('grid_fs_write_benchmark', new Server("127.0.0.1", 27017, {auto_reconnect: true}), {}).open(function(err, client) { - var gridStore = new GridStore(client, "foobar" + i, "w"); - gridStore.open(function(err, gridStore) { - gridStore.write(simulated_buffer.toString(), function(err, gridStore) { - gridStore.close(function(err, result) { - client.close(); - }); - }); - }); - }); - } - }) -}); diff --git a/dev/benchmark/gridfs_benchmark.js b/dev/benchmark/gridfs_benchmark.js deleted file mode 100644 index 23d7aa56782..00000000000 --- a/dev/benchmark/gridfs_benchmark.js +++ /dev/null @@ -1,104 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Server = require('../lib/mongodb').Server, - ObjectID = require('../lib/mongodb').ObjectID, - GridStore = require('../lib/mongodb').GridStore; - -var Mongolian = require('mongolian'); -var COUNT = 1000; -var currentWritingIndex = 0; -var server = new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize:1, native_parser:true}); - -// Read in the test file -var fileData = require('fs').readFileSync("./test/gridstore/iya_logo_final_bw.jpg"); - -// ------------------------------------------------------------------------------ -// TEST MONGODB NATIVE -// ------------------------------------------------------------------------------ -// Open a db for the file -new Db('gridfs_benchmark', server, {}).open(function(err, new_client) { - new_client.dropDatabase(function(err, result) { - new_client.close(); - - new Db('gridfs_benchmark', server, {}).open(function(err, client) { - // Start Time - var startTime = new Date().getTime(); - - // Iterate COUNT times writing file to gridfs - for(var i = 0; i < COUNT; i++) { - var gridStore = new GridStore(client, "foobar" + i, "w"); - gridStore.open(function(err, gridStore) { - gridStore.writeBuffer(fileData, true, function(err, gridStore) { - // Update current write index - currentWritingIndex = currentWritingIndex + 1; - - // finish up - if(currentWritingIndex >= COUNT) { - // Start Time - var endTime = new Date().getTime(); - var totalTime = (endTime - startTime); - var msPerOperation = totalTime/COUNT; - var operationsPrSecond = 1000/msPerOperation; - var bytesPrSecond = Math.floor(fileData.length * operationsPrSecond); - var mbsPrSecond = (bytesPrSecond/1024)/1024 ; - - console.log("-------------------------------------------------- DONE NATIVE") - console.log("total time ms :: " + totalTime); - console.log("ms pr operation :: " + msPerOperation); - console.log("operations pr second :: " + operationsPrSecond); - console.log("bytes pr second :: " + bytesPrSecond); - console.log("MB pr second :: " + mbsPrSecond); - // Close db - client.close(); - // Execute mongolian test - executeMongolianTest(); - } - }) - }); - } - }); - }) -}); - -// ------------------------------------------------------------------------------ -// TEST MONGODB NATIVE -// ------------------------------------------------------------------------------ -var executeMongolianTest = function() { - var db = new Mongolian('mongo://localhost/mongolian_test', { log:false }) - var gridfs = db.gridfs('testfs') - - // Number of executed operations - var currentWritingIndexM = 0; - // Start Time - var startTime = new Date().getTime(); - - // Execute Mongolian Count times writing data - for(var i = 0; i < COUNT; i++) { - var stream = gridfs.create('foo' + i).writeStream(); - stream.on('close', function() { - currentWritingIndexM = currentWritingIndexM + 1; - - if(currentWritingIndexM >= COUNT) { - // Start Time - var endTime = new Date().getTime(); - var totalTime = (endTime - startTime); - var msPerOperation = totalTime/COUNT; - var operationsPrSecond = 1000/msPerOperation; - var bytesPrSecond = Math.floor(fileData.length * operationsPrSecond); - var mbsPrSecond = (bytesPrSecond/1024)/1024 ; - - console.log("-------------------------------------------------- DONE MONGOLIAN") - console.log("total time ms :: " + totalTime); - console.log("ms pr operation :: " + msPerOperation); - console.log("operations pr second :: " + operationsPrSecond); - console.log("bytes pr second :: " + bytesPrSecond); - console.log("MB pr second :: " + mbsPrSecond); - - // Close connection - db.server.close() - } - }); - - // Write file - stream.end(fileData); - } -} diff --git a/dev/benchmark/hammer.js b/dev/benchmark/hammer.js deleted file mode 100644 index fa8d5336c7f..00000000000 --- a/dev/benchmark/hammer.js +++ /dev/null @@ -1,143 +0,0 @@ -var BSON = require('../../lib/mongodb').BSONNative.BSON, - ObjectID = require('../../lib/mongodb').BSONNative.ObjectID, - Code = require('../../lib/mongodb').BSONNative.Code, - debug = require('util').debug, - inspect = require('util').inspect, - mongodb = require('../../lib/mongodb'), - Db = mongodb.Db, - Server = mongodb.Server, - Step = require("../../deps/step/lib/step"); - -var BSON = require('../../lib/mongodb').BSONPure.BSON, - ObjectID = require('../../lib/mongodb').BSONPure.ObjectID; - -// Open the db connection -new Db('hammer_db', new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 1}), {native_parser: false}).open(function(err, db) { - db.dropCollection('hammer_collection', function(err, result) { - db.admin().authenticate('admin', 'admin', function(err, result) { - var i = 0; - // Fire random command - setInterval(function() { - var command = Math.round(Math.random() * 4); - // command = 1; - - // debug("================= execute :: " + i++ + " = " + command) - - // Execute the command - if(command == 1) { - // Execute an insert - db.collection('hammer_collection', function(err, collection) { - collection.insert(randomDoc(), {safe:false}, function(err, result) { - debug("---------------------------------------- INSERT") - }); - }); - } else if(command == 2) { - // Update some random record - db.collection('hammer_collection', function(err, collection) { - collection.findOne({}, function(err, item) { - if(!err && item != null) { - // Grab key before we bork it - var _id = item._id; - var keys = Object.keys(item); - var objLength = keys.length; - var pickRandomItem = Math.round(Math.random() * objLength); - // Show a random doc in - item[keys[pickRandomItem]] = randomDoc(); - // Update doc - collection.update({'_id':_id}, item, {safe:false}, function(err, result) { - debug("---------------------------------------- UPDATE") - }); - } - }) - }); - } else if(command == 3) { - // Update some random record - db.collection('hammer_collection', function(err, collection) { - collection.findOne({}, function(err, item) { - if(!err && item != null) { - // Update doc - collection.remove({'_id':item._id}, {safe:false}, function(err, result) { - debug("---------------------------------------- REMOVE") - }); - } - }) - }); - } else if(command == 4) { - db.collection('hammer_collection', function(err, collection) { - collection.find().limit(100).toArray(function(err, items) { - debug("---------------------------------------- QUERY :: " + items.length) - }) - }) - } - }, 0); - }) - }); -}); - -// -// Create a random document -var randomDoc = function() { - var numberOfElements = Math.round(Math.random() * 100); - var object = {}; - - for(var i = 0; i< numberOfElements; i++) { - // Pick an element and add it - var element = Math.round(Math.random() * 4); - var name = randomName(); - - if(element == 1) { - object[name] = randomString(); - } else if(element == 2) { - object[name] = Math.round(Math.random() * 4294967295); - } else if(element == 3) { - object[name] = Math.round(Math.random() * -4294967295); - } else if(element == 4) { - - } - } - - return object; -} - -// -// Create a random name -var randomName = function() { - var numberOfElements = Math.round(Math.random() * 250); - var buffer = new Buffer(numberOfElements); - - for(var i = 0; i< numberOfElements; i++) { - buffer[i] = 97 + Math.round(Math.random() * (122-97)); - } - - return buffer.toString(); -} - -// -// Create a random string -var randomString = function() { - var numberOfElements = Math.round(Math.random() * 250); - var buffer = new Buffer(numberOfElements); - - for(var i = 0; i< numberOfElements; i++) { - buffer[i] = Math.round(Math.random() * 255); - } - - return buffer.toString(); -} - - - - - - - - - - - - - - - - - diff --git a/dev/benchmark/hammer_replicaset.js b/dev/benchmark/hammer_replicaset.js deleted file mode 100644 index fc2d038e2f5..00000000000 --- a/dev/benchmark/hammer_replicaset.js +++ /dev/null @@ -1,197 +0,0 @@ -var BSON = require('../../lib/mongodb').BSONNative.BSON, - ObjectID = require('../../lib/mongodb').BSONNative.ObjectID, - Code = require('../../lib/mongodb').BSONNative.Code, - debug = require('util').debug, - inspect = require('util').inspect, - mongodb = require('../../lib/mongodb'), - Db = mongodb.Db, - Server = mongodb.Server, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - ReplicaSetManager = require('../../test/tools/replica_set_manager').ReplicaSetManager, - Step = require("../../deps/step/lib/step"); - -var BSON = require('../../lib/mongodb').BSONPure.BSON, - ObjectID = require('../../lib/mongodb').BSONPure.ObjectID; - -var db = null; -var poolSize = 1; -var RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); -RS.startSet(true, function(err, result) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true, poolSize: poolSize } ), - // new Server( RS.host, RS.ports[0], { auto_reconnect: true, poolSize: poolSize } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true, poolSize: poolSize } ) - ], - {rs_name:RS.name, readPreference:Server.READ_SECONDARY, poolSize: poolSize} - ); - - // Open the db connection - new Db('hammer_db', replSet, {native_parser: false, retryMiliSeconds: 1000}).open(function(err, p_db) { - db = p_db; - if(err != null) throw err; - // Start hammering - hammerTime(); - }); -}); - -// Hammer the set -var hammerTime = function() { - db.dropCollection('hammer_collection', function(err, result) { - var i = 0; - // Fire random command - setInterval(function() { - var command = Math.round(Math.random() * 4); - // command = 2; - - debug("================= execute :: " + i++ + " = " + command) - - // Execute the command - if(command == 1) { - // Execute an insert - db.collection('hammer_collection', function(err, collection) { - collection.insert(randomDoc(), {safe:false}, function(err, result) { - debug("---------------------------------------- INSERT ") - debug(inspect(err)) - }); - }); - } else if(command == 2) { - // Update some random record - db.collection('hammer_collection', function(err, collection) { - // console.log("================================================================== update :: 0") - if(err != null) { - console.log("------------------------------------- error update 1") - console.dir(err) - } - - collection.findOne({}, function(err, item) { - if(err == null && item != null) { - // console.log("================================================================== update :: 1") - // Grab key before we bork it - var _id = item._id; - var keys = Object.keys(item); - var objLength = keys.length; - var pickRandomItem = Math.round(Math.random() * objLength); - // Show a random doc in - item[keys[pickRandomItem]] = randomDoc(); - // Update doc - collection.update({'_id':_id}, item, {safe:false}, function(err, result) { - debug("---------------------------------------- UPDATE") - }); - } else { - console.log("------------------------------------- error update 2") - console.dir(err) - } - }) - }); - } else if(command == 3) { - // Update some random record - db.collection('hammer_collection', function(err, collection) { - // if(err != null) { - // console.log("------------------------------------- error remove 1") - // console.dir(err) - // } - - collection.findOne({}, function(err, item) { - // debug(inspect(err)) - // debug(inspect(item)) - - if(err == null && item != null) { - // Update doc - collection.remove({'_id':item._id}, {safe:false}, function(err, result) { - debug("---------------------------------------- REMOVE") - }); - } else { - // console.log("------------------------------------- error remove 2") - // console.dir(err) - } - }) - }); - } else if(command == 4) { - db.collection('hammer_collection', function(err, collection) { - // if(err != null) { - // console.log("------------------------------------- error query 1") - // console.dir(err) - // } - - collection.find().limit(100).toArray(function(err, items) { - if(err != null) { - console.log("------------------------------------- error query 2") - console.dir(err) - } else { - debug("---------------------------------------- QUERY :: " + items.length) - } - }) - }) - } - }, 100); - }); -} - -// -// Create a random document -var randomDoc = function() { - var numberOfElements = Math.round(Math.random() * 100); - var object = {}; - - for(var i = 0; i< numberOfElements; i++) { - // Pick an element and add it - var element = Math.round(Math.random() * 4); - var name = randomName(); - - if(element == 1) { - object[name] = randomString(); - } else if(element == 2) { - object[name] = Math.round(Math.random() * 4294967295); - } else if(element == 3) { - object[name] = Math.round(Math.random() * -4294967295); - } else if(element == 4) { - - } - } - - return object; -} - -// -// Create a random name -var randomName = function() { - var numberOfElements = Math.round(Math.random() * 250); - var buffer = new Buffer(numberOfElements); - - for(var i = 0; i< numberOfElements; i++) { - buffer[i] = 97 + Math.round(Math.random() * (122-97)); - } - - return buffer.toString(); -} - -// -// Create a random string -var randomString = function() { - var numberOfElements = Math.round(Math.random() * 250); - var buffer = new Buffer(numberOfElements); - - for(var i = 0; i< numberOfElements; i++) { - buffer[i] = Math.round(Math.random() * 255); - } - - return buffer.toString(); -} - - - - - - - - - - - - - - - - - diff --git a/dev/benchmark/streaming_benchmark.js b/dev/benchmark/streaming_benchmark.js deleted file mode 100644 index 44014da40b3..00000000000 --- a/dev/benchmark/streaming_benchmark.js +++ /dev/null @@ -1,43 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Server = require('../lib/mongodb').Server, - Cursor = require('../lib/mongodb').Cursor, - Collection = require('../lib/mongodb').Collection, - sys = require('util'), - debug = require('util').debug, - inspect = require('util').inspect; - -var parser = require('../lib/mongodb').BSONPure; -var objectID = require('../lib/mongodb').ObjectID; - -var db = new Db('streaming_benchmark', new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize:4}), {}) -// Open the db -db.open(function(err, client) { - client.collection('streaming_benchmark', function(err, collection) { - collection.remove({}, function(err, result) { - // Benchmark - var started_at = new Date().getTime(); - // Add documents - for(var i = 0; i < 100000; i++) { - // for(var i = 0; i < 10000; i++) { - collection.save({'i':i, 'a':i, 'c':i, 'd':{'i':i}}, function(err, result){}); - } - sys.puts("save recs: " + ((new Date().getTime() - started_at)/1000) + "seconds"); - - // Benchmark - var started_at = new Date().getTime(); - var count = 0; - collection.find(function(err, cursor) { - var stream = cursor.streamRecords(function(er,item) {}); - stream.addListener('end', function() { - client.close(); - }); - stream.addListener('data',function(data){ - if(count == 0) started_at = new Date().getTime(); - count++; - if ((count%10000)==0) sys.puts("recs:" + count + " :: " + - ((new Date().getTime() - started_at)/10000) + "seconds"); - }); - }); - }) - }) -}); \ No newline at end of file diff --git a/dev/harness/memory_leak_harness.js b/dev/harness/memory_leak_harness.js deleted file mode 100644 index e61ba73464d..00000000000 --- a/dev/harness/memory_leak_harness.js +++ /dev/null @@ -1,46 +0,0 @@ -var http = require('http'), - Server = require('../lib/mongodb').Server, - ObjectID = require('../lib/mongodb').ObjectID, - Db = require('../lib/mongodb').Db; - -// Set up the mongodb instance -var db = new Db('memory_leak_harness', new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4}), {native_parser:false}); - -// Set up http server -var server = http.createServer(); -server.on('request', function(request, response) { - // Fetch the url - var url = request.url; - - // Switch on the url - if(url === "/findAndModify") { - findAndModifyCommand(request, response); - } else { - response.end('Command not supported'); - } -}) - -// Open the db connection -db.open(function(err, db) { - server.listen(8080, '127.0.0.1'); -}); - -// Find And Modify Command -var findAndModifyCommand = function(request, response) { - // Perform an insert and the modify that one - var objectId = new ObjectID(); - // Fetch collection and insert document then modify it - db.createCollection('findAndModify', function(err, collection) { - collection.insert({_id:objectId, a:1, b:true, date:new Date()}, {safe:true}, function(err, result) { - if(err != null) { - response.end("findAndModifyCommand ERROR :: " + err.toString()); - return; - } - - // Perform the modifyAndModify - collection.findAndModify({_id:objectId}, [['_id', 1]], {'$set':{'a':2}}, {'new':true, safe:true}, function(err, updated_doc) { - response.end("findAndModifyCommand SUCCESS :: " + JSON.stringify(updated_doc)); - }); - }) - }); -} \ No newline at end of file diff --git a/dev/tools/build-docs.js b/dev/tools/build-docs.js deleted file mode 100644 index b5f97bc8881..00000000000 --- a/dev/tools/build-docs.js +++ /dev/null @@ -1,174 +0,0 @@ -var fs = require('fs'), - dox = require('dox'), - parseJS = require('uglify-js').parser, - ejs = require('ejs'), - exec = require('child_process').exec, - format = require('util').format, - format = require('util').format, - docs = require('./docs'); - -// ---------------------------------------------------------------------------- -// INITALIZE -// ---------------------------------------------------------------------------- -// All source files for the api generation -var apiClasses = [ - {tag:"admin", path:"./lib/mongodb/admin.js"}, - {tag:"collection", path:"./lib/mongodb/collection.js"}, - {tag:"db", path:"./lib/mongodb/db.js"}, - {tag:"cursor", path:"./lib/mongodb/cursor.js"}, - {tag:"cursorstream", path:"./lib/mongodb/cursorstream.js"}, - {tag:"gridstore", path:"./lib/mongodb/gridfs/gridstore.js"}, - {tag:"readstream", path:"./lib/mongodb/gridfs/readstream.js"}, - {tag:"grid", path:"./lib/mongodb/gridfs/grid.js"} - ]; - -// All test files -var testClasses = [ - {path:"./test/admin_test.js"}, - {path:"./test/objectid_test.js"}, - {path:"./test/insert_test.js"}, - {path:"./test/remove_test.js"}, - {path:"./test/collection_test.js"}, - {path:"./test/db_test.js"}, - {path:"./test/find_test.js"}, - {path:"./test/map_reduce_test.js"}, - {path:"./test/index_test.js"}, - {path:"./test/geo_search_test.js"}, - {path:"./test/replicaset/connect_test.js"}, - {path:"./test/connect_test.js"}, - {path:"./test/multiple_dbs_on_connection_pool_test.js"}, - {path:"./test/cursor_test.js"}, - {path:"./test/cursorstream_test.js"}, - {path:"./test/gridstore/grid_store_test.js"}, - {path:"./test/gridstore/grid_store_file_test.js"}, - {path:"./test/gridstore/grid_store_stream_test.js"}, - {path:"./test/gridstore/readstream_test.js"}, - {path:"./test/gridstore/grid_test.js"}, - {path:"./test/bson_types_test.js"}, - {path:"./test/bson/bson_test.js"} - ] - -// Read all the templates -var templates = [ - {tag:'index', path:'./dev/tools/doc-templates/index.ejs'}, - {tag:'changelog', path:'./dev/tools/doc-templates/changelog.ejs'}, - {tag:'index_no_header', path:'./dev/tools/doc-templates/index_no_header.ejs'}, - {tag:'class', path:'./dev/tools/doc-templates/class.ejs'}, - {tag:'github', path:'./dev/tools/doc-templates/github.ejs'}, - {tag:'function', path:'./dev/tools/doc-templates/function.ejs'} -] - -// Output directory -var outputDirectory = "./docs/sphinx-docs/source/api-generated" - -// ---------------------------------------------------------------------------- -// PROCESS Driver API -// ---------------------------------------------------------------------------- -docs.renderAPIDocs(outputDirectory, apiClasses, testClasses, templates, {index_title:'Driver API'}); - -// ---------------------------------------------------------------------------- -// PROCESS BSON API -// ---------------------------------------------------------------------------- -// Output directory -var outputDirectory2 = "./docs/sphinx-docs/source/api-bson-generated" -// Force create the directory for the generated docs -exec('rm -rf ' + outputDirectory2, function (error, stdout, stderr) {}); -exec('mkdir ' + outputDirectory2, function (error, stdout, stderr) {}); - -var apiClasses2 = [ - {tag:"objectid", path:"./lib/mongodb/bson/objectid.js"}, - {tag:"binary", path:"./lib/mongodb/bson/binary.js"}, - {tag:"code", path:"./lib/mongodb/bson/code.js"}, - {tag:"code", path:"./lib/mongodb/bson/db_ref.js"}, - {tag:"double", path:"./lib/mongodb/bson/double.js"}, - {tag:"minkey", path:"./lib/mongodb/bson/min_key.js"}, - {tag:"maxkey", path:"./lib/mongodb/bson/max_key.js"}, - {tag:"symbol", path:"./lib/mongodb/bson/symbol.js"}, - {tag:"timestamp", path:"./lib/mongodb/bson/timestamp.js"}, - {tag:"long", path:"./lib/mongodb/bson/long.js"}, - {tag:"bson", path:"./lib/mongodb/bson/bson.js"} - ]; - -// Render the API docs -docs.renderAPIDocs(outputDirectory2, apiClasses2, testClasses, templates, {index_title:'Binary JSON API'}); - -// ---------------------------------------------------------------------------- -// PROCESS MARKDOWN DOCUMENTS TO STRUCTURED TEXT -// ---------------------------------------------------------------------------- -// Transform the tutorials -var articles = [ - {name:"NodeKOArticle1", output:"NodeKOArticle1.rst", path:"./docs/articles/NodeKOArticle1.md"}, - {name:"NodeKOArticle2", output:"NodeKOArticle2.rst", path:"./docs/articles/NodeKOArticle2.md"} - ]; -// Tranform the markdown to restructured text -docs.writeMarkDownFile("./docs/sphinx-docs/source/api-articles", articles, templates, - {title:'Articles', template:'index'}); - -// Transform the tutorials -var articles = [ - {name:"collections", output:"collections.rst", path:"./docs/collections.md"}, - {name:"database", output:"database.rst", path:"./docs/database.md"}, - {name:"gridfs", output:"gridfs.rst", path:"./docs/gridfs.md"}, - {name:"indexes", output:"indexes.rst", path:"./docs/indexes.md"}, - {name:"insert", output:"insert.rst", path:"./docs/insert.md"}, - {name:"queries", output:"queries.rst", path:"./docs/queries.md"}, - {name:"replicaset", output:"replicaset.rst", path:"./docs/replicaset.md"}, - ]; - -// Tranform the markdown to restructured text -docs.writeMarkDownFile("./docs/sphinx-docs/source/markdown-docs", articles, templates, - {title:'Using the driver', template:'index_no_header'}); - -// ---------------------------------------------------------------------------- -// WRITE CHANGELOG TO THE DOCUMENTATION -// ---------------------------------------------------------------------------- -// Outputdiectory -var outputDirectoryChangelog = "./docs/sphinx-docs/source/changelog"; -// Force create the directory for the generated docs -exec('rm -rf ' + outputDirectoryChangelog, function (error, stdout, stderr) {}); -exec('mkdir ' + outputDirectoryChangelog, function (error, stdout, stderr) { - // Read all the templates - var templateObjects = docs.readAllTemplates(templates); - // Read the changelog - var changelog = fs.readFileSync('./HISTORY').toString(); - // Just write out the index - var content = ejs.render(templateObjects["changelog"], {content:changelog}); - // Write it out - fs.writeFileSync(format("%s/changelog.rst", outputDirectoryChangelog), content); -}); - -// ---------------------------------------------------------------------------- -// Generate using the driver pages -// ---------------------------------------------------------------------------- -// Outputdiectory -var outputDirectoryGithub = "./docs/sphinx-docs/source/github"; -var inputFile = "./docs/sphinx-docs/npm_dependent_packages.json"; - -// tag descriptions -var tagDescriptions = { - odm: "Object Document Modeling Libraries", - webframework: "Web frameworks using MongoDB", - cms: "Content Management Systems", - gridfs: "Grid FS libraries or tools", - wrapper: "Wrapper libraries to ease the use of development or provide simple ODM like behaviours", - rest: "REST api's around MongoDB or resource based libraries", - test: "Test helpers and libraries", - manage: "Tools or applications to manage your MongoDB's", - queue: "Queue libraries using MongoDB", - logging: "Logging libraries or applications", - monitoring: "Monitoring applications or libraries", - framework: "General frameworks over MongoDB", - translation: "Translation libraries or frameworks", - analytics: "Libraries or Applications for analytics", - connect: "Libraries for the connect middleware", - continuosintegration: "Libraries or applications for continous integration", - example: "Exampe applications" -} - -// Create the github documents -// docs.generateGithubPackageList(inputFile, outputDirectory, templates, tagDescriptions, {dontfetch:true}); -docs.generateGithubPackageList(inputFile, outputDirectoryGithub, templates, tagDescriptions, {}); - - - - diff --git a/dev/tools/doc-templates/changelog.ejs b/dev/tools/doc-templates/changelog.ejs deleted file mode 100644 index 54626d17cda..00000000000 --- a/dev/tools/doc-templates/changelog.ejs +++ /dev/null @@ -1,5 +0,0 @@ -========= -Changelog -========= - -<%= content %> \ No newline at end of file diff --git a/dev/tools/doc-templates/class.ejs b/dev/tools/doc-templates/class.ejs deleted file mode 100644 index 96624a9b8ca..00000000000 --- a/dev/tools/doc-templates/class.ejs +++ /dev/null @@ -1,317 +0,0 @@ -<% -// for(var i = 0; i < entries.length; i++) { -// if(isClass(entries[i].tags)) { -// -// } -// } - -var addLine = function(char, length) { - var chars = []; - for(var i = 0; i < length; i++) chars[i] = char; - return chars.join(''); -} - -// Contains the current class name -var className = null; - -for(var i = 0; i < entries.length; i++) { - if(isClass(entries[i].tags)) { - var _name = entries[i].ctx.string.trim(); - - %><%= format("%s\n%s\n%s\n", addLine("=", _name.length), _name, addLine("=", _name.length)) %><% - className = entries[i].ctx.string.replace("()", ""); - - %><%= format("\n------------------\nConstructor\n------------------\n") %><% - - // Get full description and clean it - var fullDescription = entries[i].description.summary; - fullDescription = fullDescription.replace(/\\/g, ".. code-block:: javascript\n\n ") - .replace(/\<\/code\>\<\/pre\>/g, "") - .replace(/\|\<\/h2\>/g, "**") - .replace(/\/g, "\n\n") - .replace(/\<\/p\>/g, "") - .replace(/\|\<\/strong\>/g, "**") - .replace(/\|\<\/em\>/g, "*") - .replace(/\|\<\/br[ ]*\>|\/g, "\n"); - %><%- format("%s\n\n", fullDescription) %><% - %><%= format("\n .. js:class:: %s\n\n", entries[i].ctx.string) %><% - - for(var ti = 0; ti < entries[i].tags.length; ti++) { - // Get the current tag - var tag = entries[i].tags[ti]; - // If we have a parameter render it - if(tag.type == 'param') { - // Unpack the tag - var type = tag.types[0].toLowerCase(); - var name = tag.name; - var description = tag.description; - // Render the parameter - %><%= format(" :param %s %s: %s\n", type, name, description) %><% - } else if(tag.type == 'return') { - // Unpack the tag - var type = tag.types[0].toLowerCase(); - var description = tag.description; - // Render the parameter - %><%= format(" :returns: %s %s\n", type, description) %><% - } - } - - // Get full description and clean it - var fullDescription = entries[i].description.body; - fullDescription = fullDescription.replace(/\\/g, ".. code-block:: javascript\n\n ") - .replace(/\<\/code\>\<\/pre\>/g, "") - .replace(/\|\<\/h2\>/g, "**") - .replace(/\/g, "\n\n") - .replace(/\<\/p\>/g, "") - .replace(/\|\<\/strong\>/g, "**") - .replace(/\|\<\/em\>/g, "*") - .replace(/\|\<\/br[ ]*\>|\/g, "\n"); - %><%- format("%s\n\n", fullDescription) %><% - } -} - -for(var i = 0; i < entries.length; i++) { - if(isClassConstant(entries[i])) { - %><%= format("\n------------------\nConstants\n------------------\n") %><% -%> -.. csv-table:: - :header: "Constant Name", "Value", "Description" - :widths: 15, 10, 30 - -<% - break; - } -} - -for(var i = 0; i < entries.length; i++) { - if(isClassConstant(entries[i])) { - // Extract values - var attributeName = format("%s = %s;", entries[i].ctx.string, entries[i].ctx.value); - var getterSetters = []; - var type = ""; - - // Get full description and clean it - var fullDescription = entries[i].description.full; - fullDescription = fullDescription.replace(/\\/g, ".. code-block:: javascript\n\n ") - .replace(/\<\/code\>\<\/pre\>/g, "") - .replace(/\|\<\/h2\>/g, "**") - .replace(/\/g, "\n\n") - .replace(/\<\/p\>/g, "") - .replace(/\|\<\/br[ ]*\>|\/g, "\n"); - - // Write out the class definition row - %><%- format(" \"%s\", \"%s\", \"%s\"\n", entries[i].ctx.string.trim(), entries[i].ctx.value.trim(), fullDescription.trim()) %><% - } -} - -for(var i = 0; i < entries.length; i++) { - if(isProperty(entries[i])) { - %><%= format("\n------------------\nProperties\n------------------\n") %><% - break; - } -} - -for(var i = 0; i < entries.length; i++) { - if(isProperty(entries[i])) { - // Extract values - var attributeName = ""; - var getterSetters = []; - var type = ""; - - // Loop over all tags - for(var ti = 0; ti < entries[i].tags.length; ti++) { - if(entries[i].tags[ti].type == 'field') attributeName = entries[i].tags[ti].string; - if(entries[i].tags[ti].type == 'getter') getterSetters.push("Getter"); - if(entries[i].tags[ti].type == 'setter') getterSetters.push("Setter"); - if(entries[i].tags[ti].type == 'type') type = entries[i].tags[ti].types[0].toLowerCase(); - } - - // Get full description and clean it - var fullDescription = entries[i].description.full; - fullDescription = fullDescription.replace(/\\/g, ".. code-block:: javascript\n\n ") - .replace(/\<\/code\>\<\/pre\>/g, "") - .replace(/\|\<\/h2\>/g, "**") - .replace(/\/g, "\n\n") - .replace(/\<\/p\>/g, "") - .replace(/\|\<\/br[ ]*\>|\/g, "\n"); - - // Write out the text - %><%- format("%s\n\n", fullDescription) %><% - %><%= format(".. js:attribute:: %s %s [%s]\n\n", attributeName, type, getterSetters.join("|")) %><% - - // If we have examples render them - if(examples != null && examples[attributeName]) { - %><%= format("\n**Examples**\n\n") %><% - var examplesArray = examples[attributeName]; - // Iterate over all the examples - for(var ei = 0; ei < examplesArray.length; ei++) { - // Fetch an example - var example = examplesArray[ei]; - var code = example.code; - code = code.replace(", ssl:useSSL", "") - .replace("native_parser: native_parser", "native_parser: false") - .replace(/test\.ok/g, "assert.ok") - .replace(/test\.equal/g, "assert.equal") - .replace(/test\.deepEqual/g, "assert.deepEqual") - .replace(/\n[ |\t]*test\.done\(\)\;/, ""); - - // Split and adjust code - var codeLines = code.split(/\n/); - for(var ci = 0; ci < codeLines.length; ci++) { - codeLines[ci] = " " + codeLines[ci]; - } - - var fullDescription = example.description.full; - fullDescription = fullDescription.replace(/\\/g, ".. code-block:: javascript\n\n ") - .replace(/\<\/code\>\<\/pre\>/g, "") - .replace(/\|\<\/h2\>/g, "**") - .replace(/\/g, "\n\n") - .replace(/\<\/p\>/g, "") - .replace(/\|\<\/br[ ]*\>|\/g, "\n"); - - // Split up and move - var fullDescriptionLines = fullDescription.split(/\n/); - for(var ci = 0; ci < fullDescriptionLines.length; ci++) { - fullDescriptionLines[ci] = " " + fullDescriptionLines[ci]; - } - - // Starting template Lines - var startingTemplateLines = [ - " var Db = require('mongodb').Db,", - " Server = require('mongodb').Server,", - " ReplSetServers = require('mongodb').ReplSetServers,", - " ObjectID = require('mongodb').ObjectID,", - " Binary = require('mongodb').Binary,", - " GridStore = require('mongodb').GridStore,", - " Code = require('mongodb').Code,", - " BSON = require('mongodb').pure().BSON,", - " assert = require('assert');\n\n" - ]; - - // Let's render it - %><%- format("%s\n\n", fullDescriptionLines.join("\n")) %><% - %><%- format(" .. code-block:: javascript\n\n%s%s\n\n", startingTemplateLines.join("\n"), codeLines.join("\n")) %><% - } - } - } -} - -for(var i = 0; i < entries.length; i++) { - // If it's a function parse it - if(isFunction(entries[i])) { - var paramsStrings = []; - var paramNames = []; - - for(var ti = 0; ti < entries[i].tags.length; ti++) { - // Get the current tag - var tag = entries[i].tags[ti]; - // If we have a parameter render it - if(tag.type == 'param') { - // Unpack the tag - var type = tag.types[0].toLowerCase(); - var name = tag.name; - var description = tag.description; - // Add to list of params - paramNames.push(name); - // Render the parameter - paramsStrings.push(format(" :param %s %s: %s\n", type, name, description)); - } else if(tag.type == 'return') { - // Unpack the tag - var type = tag.types[0].toLowerCase(); - var description = tag.description; - // Render the parameter - paramsStrings.push(format(" :returns: %s %s\n\n", type, description)); - } - } - - // Reformat any optional parameters from ,[] to [,] - var paramsString = paramNames.join(", ").replace(/\, \[/, "[, "); - // Write out the methods - var fullDescription = entries[i].description.full; - - fullDescription = fullDescription.replace(/\\/g, ".. code-block:: javascript\n\n ") - .replace(/\<\/code\>\<\/pre\>/g, "") - .replace(/\|\<\/h2\>/g, "**") - .replace(/\/g, "\n\n") - .replace(/\<\/p\>/g, "") - .replace(/\|\<\/strong\>/g, "**") - .replace(/\|\<\/em\>/g, "*") - .replace(/\|\<\/br[ ]*\>|\/g, "\n"); - - // The name of examples - var examplesName = entries[i].ctx.name; - - // Write header depending on if it's class or instance level - if(entries[i].ctx.receiver != null) { - // Change examples Name to include class name - var examplesName = format("%s.%s", className, entries[i].ctx.name); - var _length = format("%s.%s", className, entries[i].ctx.name).length; - %><%= format("\n%s\n%s.%s\n%s\n", addLine("-", _length), className, entries[i].ctx.name, addLine("-", _length)) %><% - %><%- format("%s\n\n", fullDescription) %><% - %><%= format(".. js:function:: %s.%s(%s)\n\n", className, entries[i].ctx.name, paramsString) %><% - } else { - var _length = entries[i].ctx.name.length; - %><%= format("\n%s\n%s\n%s\n", addLine("-", _length), entries[i].ctx.name, addLine("-", _length)) %><% - %><%- format("%s\n\n", fullDescription) %><% - %><%= format(".. js:function:: %s(%s)\n\n", entries[i].ctx.name, paramsString) %><% - } - - %><%= Array.isArray(paramsStrings) ? paramsStrings.join("") : paramsStrings %><% - - // If we have examples render them - if(examples != null && examples[examplesName]) { - %><%= format("\n**Examples**\n\n") %><% - var examplesArray = examples[examplesName]; - // Iterate over all the examples - for(var ei = 0; ei < examplesArray.length; ei++) { - // Fetch an example - var example = examplesArray[ei]; - var code = example.code; - code = code.replace(", ssl:useSSL", "") - .replace("native_parser: native_parser", "native_parser: false") - .replace(/test\.ok/g, "assert.ok") - .replace(/test\.equal/g, "assert.equal") - .replace(/test\.deepEqual/g, "assert.deepEqual") - .replace(/\n[ |\t]*test\.done\(\)\;/, ""); - - // Split and adjust code - var codeLines = code.split(/\n/); - for(var ci = 0; ci < codeLines.length; ci++) { - codeLines[ci] = " " + codeLines[ci]; - } - - var fullDescription = example.description.full; - fullDescription = fullDescription.replace(/\\/g, ".. code-block:: javascript\n\n ") - .replace(/\<\/code\>\<\/pre\>/g, "") - .replace(/\|\<\/h2\>/g, "**") - .replace(/\/g, "\n\n") - .replace(/\<\/p\>/g, "") - .replace(/\|\<\/br[ ]*\>|\/g, "\n"); - - // Split up and move - var fullDescriptionLines = fullDescription.split(/\n/); - for(var ci = 0; ci < fullDescriptionLines.length; ci++) { - fullDescriptionLines[ci] = " " + fullDescriptionLines[ci]; - } - - // Starting template Lines - var startingTemplateLines = [ - " var Db = require('mongodb').Db,", - " Server = require('mongodb').Server,", - " ReplSetServers = require('mongodb').ReplSetServers,", - " ObjectID = require('mongodb').ObjectID,", - " Binary = require('mongodb').Binary,", - " GridStore = require('mongodb').GridStore,", - " Code = require('mongodb').Code,", - " BSON = require('mongodb').pure().BSON,", - " assert = require('assert');\n\n" - ]; - - // Let's render it - %><%- format("%s\n\n", fullDescriptionLines.join("\n")) %><% - %><%- format(" .. code-block:: javascript\n\n%s%s\n\n", startingTemplateLines.join("\n"), codeLines.join("\n")) %><% - } - } - } -} -%> \ No newline at end of file diff --git a/dev/tools/doc-templates/function.ejs b/dev/tools/doc-templates/function.ejs deleted file mode 100644 index 1ff17c59a14..00000000000 --- a/dev/tools/doc-templates/function.ejs +++ /dev/null @@ -1 +0,0 @@ -Function \ No newline at end of file diff --git a/dev/tools/doc-templates/github.ejs b/dev/tools/doc-templates/github.ejs deleted file mode 100644 index fa8815572d0..00000000000 --- a/dev/tools/doc-templates/github.ejs +++ /dev/null @@ -1,76 +0,0 @@ -============================================== -Github libraries and projects using the driver -============================================== - -<% -var addLine = function(char, length) { - var chars = []; - for(var i = 0; i < length; i++) chars[i] = char; - return chars.join(''); -} - -var keys = Object.keys(objectByTags); -for(var j = 0; j < keys.length; j++) { - var key = keys[j]; - var entries = objectByTags[key]; - var title = tags[key] != null ? tags[key] : key; - -%><%= format("%s\n%s\n\n", title, addLine('-', title.length)) %><% - - // Iterate over all the objects - for(var i = 0; i < entries.length; i++) { - // for(var i = 0; i < 1; i++) { - var entry = entries[i]; - var content = entry.content; - - if(content != null) { - // Parse the pushed at date - var t = Date.parse(content.pushed_at ); - var d = new Date(); - d.setTime(t); - - // If there is no activity newer than 6 months it's dead - var fourMonths = 1000*60*60*24*31*4; - var currentDate = (new Date()).getTime() - fourMonths; - - var activityArrow = ".. image:: ../static/active.png"; - if(t < currentDate) { - var activityArrow = ".. image:: ../static/nonactive.png"; - } - - // var minutes = 1000 * 60; - // var hours = minutes * 60; - // var days = hours * 24; - // var years = days * 365; - // var y = t / years; - - // document.write("It's been: " + y + " years from Jan 1, 1970"); - // document.write(" to Jul 8, 2005."); - - %><%- format(".. topic:: %s\n\n\ %s\n", content.name, content.description) %><% - %> - .. list-table:: - :widths: 25 85 - :header-rows: 0 - - * - **Activity Level** - - <%- activityArrow %> - * - **Last push** - - <%= format("%s:%s:%s on %s/%s/%s", d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCDate(), d.getUTCMonth(), d.getUTCFullYear()) %> - * - **Homepage** - - <%= format("http://%s", content.homepage) %> - * - **Url** - - <%= content.html_url %> - * - **Clone Url** - - <%= content.clone_url %> - * - **Forks** - - <%= content.forks %> - * - **Watchers** - - <%= content.watchers %> - -<% - } - } -} - -%> \ No newline at end of file diff --git a/dev/tools/doc-templates/index.ejs b/dev/tools/doc-templates/index.ejs deleted file mode 100644 index 453e61d64b1..00000000000 --- a/dev/tools/doc-templates/index.ejs +++ /dev/null @@ -1,15 +0,0 @@ -================== -<%- title %> -================== - -.. toctree:: - :maxdepth: 2 - -<% - for(var i = 0; i < entries.length; i++) { - // Classname - var name = entries[i]; - // Write out the name - %><%= format(" %s\n", name) %><% - } -%> \ No newline at end of file diff --git a/dev/tools/doc-templates/index_no_header.ejs b/dev/tools/doc-templates/index_no_header.ejs deleted file mode 100644 index 62b582a3315..00000000000 --- a/dev/tools/doc-templates/index_no_header.ejs +++ /dev/null @@ -1,11 +0,0 @@ -.. toctree:: - :maxdepth: 1 - -<% - for(var i = 0; i < entries.length; i++) { - // Classname - var name = entries[i]; - // Write out the name - %><%= format(" %s\n", name) %><% - } -%> \ No newline at end of file diff --git a/dev/tools/docs.js b/dev/tools/docs.js deleted file mode 100644 index 05d6841e658..00000000000 --- a/dev/tools/docs.js +++ /dev/null @@ -1,476 +0,0 @@ -var fs = require('fs'), - dox = require('dox'), - parseJS = require('uglify-js').parser, - ejs = require('ejs'), - exec = require('child_process').exec, - markdown = require('markdown').markdown, - github = require('github3'), - format = require('util').format; - -// ----------------------------------------------------------------------------------------------------- -// -// Markdown converter -// -// ----------------------------------------------------------------------------------------------------- -// Parse markdown to Rich text format -var transformMarkdownToStructuredText = exports.transformMarkdownToStructuredText = function(markDownText) { - // Parse the md file and generate a json tree - var jsonTree = markdown.parse(markDownText); - var documentLines = []; - return convert_tree_to_rs(jsonTree, documentLines).join('\n'); -} - -var addLine = function(char, length) { - var chars = []; - for(var i = 0; i < length; i++) chars[i] = char; - return chars.join(''); -} - -var convert_tree_to_rs = function(nodes, documentLines) { - if(!Array.isArray(nodes)) throw new Error("Malformed tree structure"); - // Go through all the tags and render - for(var i = 0; i < nodes.length; i++) { - var line = nodes[i]; - - if(Array.isArray(line)) { - switch(line[0]) { - case 'header': - // Unpack the parts - var options = line[1]; - var title = line[2]; - // Add lines to the document - if(options.level == 1) { - documentLines.push(addLine("=", title.length)) - documentLines.push(title); - documentLines.push(addLine("=", title.length)) - } else if(options.level == 2) { - documentLines.push(addLine("-", title.length)) - documentLines.push(title); - documentLines.push(addLine("-", title.length)) - } - break; - case 'para': - var paraLines = []; - paraLines.push("\n"); - - for(var j = 1; j < line.length; j++) { - // bullet list item - if(Array.isArray(line[j])) { - var subdocs = []; - convert_tree_to_rs([line[j]], subdocs); - paraLines.push(subdocs.join('')); - } else { - paraLines.push(line[j]); - } - } - - // Merge the docs in - documentLines.push(paraLines.join(' ')); - documentLines.push('\n'); - break; - case 'link': - documentLines.push(format("`%s <%s>`_", line[2], line[1].href.replace(".md", ".html"))); - break; - case 'inlinecode': - documentLines.push(format("``%s``", line[1])); - break; - case 'code_block': - // Unpack code block - var codeLines = line[1].split("\n"); - // Format all the lines - documentLines.push(" .. code-block:: javascript\n"); - for(var j = 0; j < codeLines.length; j++) { - documentLines.push(format(" %s", codeLines[j])); - } - - documentLines.push("\n"); - break; - case 'bulletlist': - // Render the list (line.length - 1) - for(var j = 1; j < line.length; j++) { - // bullet list item - if(Array.isArray(line[j])) { - var subdocs = []; - convert_tree_to_rs([line[j]], subdocs); - documentLines.push(subdocs.join(' ')); - } else { - documentLines.push(line[j]); - } - } - - // Add an empty line - documentLines.push("\n"); - break; - case 'listitem': - var listitemLines = []; - - for(var j = 1; j < line.length; j++) { - // bullet list item - if(Array.isArray(line[j])) { - var subdocs = []; - convert_tree_to_rs([line[j]], subdocs); - listitemLines.push(subdocs.join(' ')); - } else { - listitemLines.push(line[j]); - } - } - - // Merge the docs in - documentLines.push(format(" * %s", listitemLines.join(' ').trim())); - break; - case 'em': - documentLines.push(format("*%s*", line[1])); - break; - case 'strong': - documentLines.push(format("**%s**", line[1])); - break; - default: - console.dir(line) - break; - } - } - } - - return documentLines; -} - -exports.writeMarkDownFile = function(outputDirectory, articles, templates, options) { - // Read all the templates - var templateObjects = exports.readAllTemplates(templates); - - // Force create the directory for the generated docs - exec('rm -rf ' + outputDirectory, function (error, stdout, stderr) { - exec('mkdir ' + outputDirectory, function (error, stdout, stderr) { - // Contains all the names for the index - var names = []; - - // Process all the articles - for(var i = 0 ; i < articles.length; i++) { - // Fetch the article markdown content - var article = fs.readFileSync(articles[i].path).toString(); - // Convert the text into restructured text for sphinx - var text = transformMarkdownToStructuredText(article); - // Write out the content - fs.writeFileSync(format("%s/%s", outputDirectory, articles[i].output.toLowerCase()), text); - names.push(articles[i].name.toLowerCase()); - } - - // Just write out the index - var indexContent = ejs.render(templateObjects[options.template], {entries:names, format:format, title:options.title}); - fs.writeFileSync(format("%s/%s", outputDirectory, 'index.rst'), indexContent); - }); - }); -} - -// ----------------------------------------------------------------------------------------------------- -// -// API Doc generation -// -// ----------------------------------------------------------------------------------------------------- -exports.renderAPIDocs = function(outputDirectory, apiClasses, testClasses, templates, templateDocObjects) { - // Force create the directory for the generated docs - exec('rm -rf ' + outputDirectory, function (error, stdout, stderr) { - exec('mkdir ' + outputDirectory, function (error, stdout, stderr) { - // Extract meta data from source files - var dataObjects = exports.extractLibraryMetaData(apiClasses); - // Filter out and prepare the test Objects hash - var testObjects = exports.buildTestHash(exports.extractLibraryMetaData(testClasses)); - // Read all the templates - var templateObject = exports.readAllTemplates(templates); - // Render all the classes that are decorated - exports.renderAllTemplates(outputDirectory, templateObject, dataObjects, testObjects, templateDocObjects); - }); - }); -} - - -// Parses all the files and extracts the dox data for the library -exports.extractLibraryMetaData = function(sourceFiles) { - var dataObjects = {}; - // Iterate over all source files - for(var i = 0; i < sourceFiles.length; i++) { - // Read source file content - var sourceFile = fs.readFileSync(sourceFiles[i].path); - // Parse the content - var metaData = dox.parseComments(sourceFile.toString()); - // Save the metadata - dataObjects[sourceFiles[i]["tag"] != null ? sourceFiles[i].tag : i] = metaData; - } - - // Return all objects - return dataObjects; -} - -// Build a hash to easy access to the objects -exports.buildTestHash = function(objects) { - // Organize the objects by class-function so we can query them - var objectsByClassAndMethod = {}; - var objectKeys = Object.keys(objects); - - // Get all the objects - for(var i = 0; i < objectKeys.length; i++) { - // Get the object with the metadata - var object = objects[objectKeys[i]]; - // Go through each example and pull them out - for(var j = 0; j < object.length; j++) { - var block = object[j]; - var tags = block.tags; - - // Build a class type - var tagObject = {}; - - // Check for the _class tag - for(var tagIndex = 0; tagIndex < tags.length; tagIndex++) { - // Get the tag - var tag = tags[tagIndex]; - // Grab the tag if it's got it - if(tag['type'] != null && tag['string'] != null) { - tagObject[tag['type']] = tag['string']; - } - } - - // Check if we have the tags _class and _function signaling a test - if(tagObject['_class'] != null && tagObject['_function'] != null) { - // Add a class reference if none exists - if(objectsByClassAndMethod[tagObject['_class']] == null) { - objectsByClassAndMethod[tagObject['_class']] = {}; - } - - // Add a method reference if none exists - if(objectsByClassAndMethod[tagObject['_class']][tagObject['_function']] == null) { - objectsByClassAndMethod[tagObject['_class']][tagObject['_function']] = []; - } - - // Push the object on the list - objectsByClassAndMethod[tagObject['_class']][tagObject['_function']].push(block); - - // Format the block code - var codeLines = block.code.split(/\n/); - // Drop first and last line - codeLines = codeLines.slice(1, codeLines.length - 1); - // Indent the code - for(var k = 0; k < codeLines.length; k++) { - codeLines[k] = codeLines[k].replace(/^ /, "") - } - // Reasign the code block - block.code = codeLines.join("\n"); - } - } - } - - // Return the object mapped by _class and _function - return objectsByClassAndMethod; -} - -// Render all the templates -exports.renderAllTemplates = function(outputDirectory, templates, dataObjects, testObjects, attributeTags) { - // Helper methods used in the rendering - var isClass = function(tags) { - for(var k = 0; k < tags.length; k++) { - if(tags[k].type == 'class') return true; - } - return false; - } - - var isFunction = function(entry) { - return entry.ctx != null && entry.ctx.type == 'method' && entry.isPrivate == false; - } - - var isProperty = function(entry) { - var tags = entry.tags; - for(var k = 0; k < tags.length; k++) { - if(tags[k].type == 'property') return true; - } - return false; - } - - var isClassConstant = function(entry) { - var tags = entry.tags; - for(var k = 0; k < tags.length; k++) { - if(tags[k].type == 'classconstant') return true; - } - return false; - } - - // Iterate over all classes - var classNames = Object.keys(dataObjects); - - // For each class generate output - for(var i = 0; i < classNames.length; i++) { - var className = classNames[i]; - // The meta data object - var classMetaData = dataObjects[className]; - // Grab the examples for this Metadata class - var classExamplesData = testObjects[className]; - // Render the class template - var classContent = ejs.render(templates['class'], - {entries:classMetaData, examples:classExamplesData, isClass:isClass, - isFunction:isFunction, isProperty:isProperty, isClassConstant:isClassConstant, - format:format}); - // Write out the content to disk - fs.writeFileSync(format("%s/%s.rst", outputDirectory, className), classContent); - } - - // Let's render the index api file - var indexContent = ejs.render(templates['index'], - {entries:classNames, isClass:isClass, isFunction:isFunction, isProperty:isProperty, - isClassConstant:isClassConstant, format:format, title:attributeTags['index_title']}); - // Write out the api index to disk - fs.writeFileSync(format("%s/%s.rst", outputDirectory, "index"), indexContent); -} - -// Read all the templates -exports.readAllTemplates = function(templates) { - var finishedTemplates = {}; - // Read in all the templates - for(var i = 0; i < templates.length; i++) { - finishedTemplates[templates[i].tag] = fs.readFileSync(templates[i].path).toString(); - } - - // Return the finished templates - return finishedTemplates; -} - -// ----------------------------------------------------------------------------------------------------- -// -// Pull down github and generate docs -// -// ----------------------------------------------------------------------------------------------------- -exports.generateGithubPackageList = function(inputFile, outputDirectory, templates, tagDescriptions, options) { - if(options == null || options.dontfetch == null) { - // Force create the directory for the generated docs - exec('rm -rf ' + outputDirectory, function (error, stdout, stderr) { - exec('mkdir ' + outputDirectory, function (error, stdout, stderr) { - _generateGithubPackageList(inputFile, outputDirectory, templates, tagDescriptions, options); - }); - }); - } else { - _generateGithubPackageList(inputFile, outputDirectory, templates, tagDescriptions, options); - } -} - -var _generateGithubPackageList = function(inputFile, outputDirectory, templates, tagDescriptions, options) { - // Set credentials - github.setCredentials(user, password); - // Read all the templates - var templateObjects = exports.readAllTemplates(templates); - // Check the user and password - var user = process.env['GITHUB_USER']; - var password = process.env['GITHUB_PASSWORD']; - // Make sure we have user and password - if(user == null && password == null) throw "Please provide a GITHUB_USER and GITHUB_PASSWORD environment variable"; - - // Read in the json file - var jsonData = fs.readFileSync(inputFile, 'ascii'); - var objects = JSON.parse(jsonData); - var length = objects.length; - var totalNumberOfRepos = length; - - // Iterate over all the repos - for(var i = 0; i < length; i++) { - // Fetch the object - var object = objects[i]; - // Unpack the object - var description = object.description; - var location = object.location; - var url = object.url; - var tag = object.tag; - // Unpack the url - var urlparts = url.split(/\//); - // Chop of the 2 last elements so we can get the parts - urlparts = urlparts.slice(urlparts.length - 2) - // Unpack url - var username = urlparts[0]; - var repo = urlparts[1]; - // Add stuff back to the object - object.username = username; - object.repo = repo; - // Let's fetch the content - if(options == null || options.dontfetch == null) { - // Get repo information - new function(_repo, _username) { - // Get the repo information - github.getRepository(_repo, _username, function(err, result) { - // Correct the number of remaining repos - totalNumberOfRepos = totalNumberOfRepos - 1; - // Write the content to disk - fs.writeFileSync(format("%s/%s.%s.json", outputDirectory, _repo, _username), JSON.stringify(result, null, 2), 'ascii'); - - // If we are done skip to next processing step - if(totalNumberOfRepos == 0) { - return _processGithub(objects, outputDirectory, templateObjects, tagDescriptions); - } - }); - }(repo, username) - } - } - - // If don't want to download just skip to processing - if(options != null && options.dontfetch) { - // Do the processing instead - return _processGithub(objects, outputDirectory, templateObjects, tagDescriptions); - } -} - -var _processGithub = function(objects, outputDirectory, templates, tagDescriptions) { - // Let's read all the json files in and map them to the correct object - var directoryListing = fs.readdirSync(outputDirectory); - // Iterate over all entries - for(var i = 0; i < directoryListing.length; i++) { - var file = directoryListing[i]; - - // If we have a json file - if(file.indexOf('.json') != -1) { - var fileContent = fs.readFileSync(format("%s/%s", outputDirectory, file), 'ascii'); - var fileObject = JSON.parse(fileContent); - // Did not retrive document correctly - if(fileObject != null) { - // Unpack parameters used for matching - var username = fileObject.owner.login; - var repo = fileObject.name; - - // Map it to the correct object - for(var j = 0; j < objects.length; j++) { - var object = objects[j]; - - // If we match username and repo add to the object - if(object.username == username && object.repo == repo) { - // Add the content to the object - object.content = fileObject; - } - } - } - } - } - - // Group object by tags - var objectByTags = {}; - // Iterate over all the objects - for(var i = 0; i < objects.length; i++) { - var object = objects[i]; - var tag = object.tag; - - if(objectByTags[tag] == null) { - objectByTags[tag] = []; - } - - objectByTags[tag].push(object); - } - - // Just write out the index - var indexContent = ejs.render(templates['github'], {objectByTags:objectByTags, format:format, tags:tagDescriptions}); - fs.writeFileSync(format("%s/%s", outputDirectory, 'github.rst'), indexContent); -} - - - - - - - - - - - - - diff --git a/dev/tools/gleak.js b/dev/tools/gleak.js deleted file mode 100644 index 1890e1e42f0..00000000000 --- a/dev/tools/gleak.js +++ /dev/null @@ -1,7 +0,0 @@ - -var gleak = require('gleak')(); -gleak.ignore('AssertionError'); -gleak.ignore('testFullSpec_param_found'); -gleak.ignore('events'); - -module.exports = gleak; diff --git a/dev/tools/test_all.js b/dev/tools/test_all.js deleted file mode 100644 index d271c2a27d5..00000000000 --- a/dev/tools/test_all.js +++ /dev/null @@ -1,176 +0,0 @@ -var nodeunit = require('nodeunit'), - debug = require('util').debug, - inspect = require('util').inspect, - fs = require('fs'), - exec = require('child_process').exec, - spawn = require('child_process').spawn, - Step = require('step/lib/step'), - ServerManager = require('../../test/tools/server_manager').ServerManager, - ReplicaSetManager = require('../../test/tools/replica_set_manager').ReplicaSetManager; - -// Manage the test server -var serverManager = new ServerManager(); -var replicaSetManager = new ReplicaSetManager(); -// test directories -var files = []; -var directories = [{dir: __dirname + "/../../test", path: "/test/"}, - {dir: __dirname + "/../../test/gridstore", path: "/test/gridstore/"}, - {dir: __dirname + "/../../test/connection", path: "/test/connection/"}, - {dir: __dirname + "/../../test/bson", path: "/test/bson/"}]; - -// Generate a list of tests -directories.forEach(function(dirEntry) { - // Add the files - files = files.concat(fs.readdirSync(dirEntry.dir).filter(function(item) { - return /_test\.js$/i.test(item); - }).map(function(file) { - return dirEntry.path + file; - })); -}); - -// Replicasetfiles -var replicasetFiles = fs.readdirSync(__dirname + "/../../test/replicaset").filter(function(item) { - return /_test\.js$/i.test(item); -}).map(function(file) { - return "/test/replicaset/" + file; -}); - -var specifedParameter = function(arguments, param) { - for(var i = 0; i < arguments.length; i++) { - if(arguments[i] == param) return true; - } - return false; -} - -// Different options -var junit = specifedParameter(process.argv, '--junit', false); -var noReplicaSet = specifedParameter(process.argv, '--noreplicaset', false); -var boot = specifedParameter(process.argv, '--boot', false); -// Basic default test runner -var runner = nodeunit.reporters.default; -var options = { error_prefix: '\u001b[31m', - error_suffix: '\u001b[39m', - ok_prefix: '\u001b[32m', - ok_suffix: '\u001b[39m', - bold_prefix: '\u001b[1m', - bold_suffix: '\u001b[22m', - assertion_prefix: '\u001b[35m', - assertion_suffix: '\u001b[39m' }; - -// cleanup output directory -exec('rm -rf ./output', function(err, stdout, stderr) { - // if we have a junit reporter - if(junit) { - // Remove directory - fs.mkdirSync("./output", 0777); - // Set up options - options.output = './output'; - options.junit = true; - } - - // Run all tests including replicaset ones - if(!noReplicaSet) { - // Boot up the test server and run the tests - Step( - // Start the single server - function startSingleServer() { - if(boot) { - serverManager.start(true, {purgedirectories:true}, this); - } else { - this(null, null); - } - }, - - // Run all the integration tests using the pure js bson parser - function runPureJS() { - options.suffix = 'pure'; - var test_set_runner = spawn('node', ['./dev/tools/test_set_runner.js', JSON.stringify(files), JSON.stringify(options)]); - test_set_runner.stdout.on('data', function(data) { - process.stdout.write(data.toString()); - }); - test_set_runner.stderr.on('data', function(data) { - process.stdout.write("err: " + data.toString()); - }); - - test_set_runner.on('exit', this); - }, - - // Execute all the replicaset tests - function executeReplicaSetTests() { - options.suffix = 'pure'; - var test_set_runner = spawn('node', ['./dev/tools/test_set_runner.js', JSON.stringify(replicasetFiles), JSON.stringify(options)]); - test_set_runner.stdout.on('data', function(data) { - process.stdout.write(data.toString()); - }); - test_set_runner.stderr.on('data', function(data) { - process.stdout.write("err: " + data.toString()); - }); - - test_set_runner.on('exit', this); - }, - - function done() { - if(boot) { - // Kill all mongod server - replicaSetManager.killAll(function() { - // Force exit - process.exit(); - }) - } else { - process.exit(); - } - } - ); - } else { - // Execute without replicaset tests - Step( - function startSingleServer() { - if(boot) { - serverManager.start(true, {purgedirectories:true}, this); - } else { - this(null, null); - } - }, - - function runPureJS() { - options.suffix = 'pure'; - var test_set_runner = spawn('node', ['./dev/tools/test_set_runner.js', JSON.stringify(files), JSON.stringify(options)]); - test_set_runner.stdout.on('data', function(data) { - process.stdout.write(data.toString()); - }); - test_set_runner.stderr.on('data', function(data) { - process.stdout.write("err: " + data.toString()); - }); - - test_set_runner.on('exit', this); - }, - - function runNativeJS() { - options.suffix = 'native'; - options.native = true; - - var test_set_runner = spawn('node', ['./dev/tools/test_set_runner.js', JSON.stringify(files), JSON.stringify(options)]); - test_set_runner.stdout.on('data', function(data) { - process.stdout.write(data.toString()); - }); - test_set_runner.stderr.on('data', function(data) { - process.stdout.write("err: " + data.toString()); - }); - - test_set_runner.on('exit', this); - }, - - function done() { - if(boot) { - // Kill all mongod server - replicaSetManager.killAll(function() { - // Force exit - process.exit(); - }) - } else { - process.exit(); - } - } - ); - } -}); diff --git a/dev/tools/test_set_runner.js b/dev/tools/test_set_runner.js deleted file mode 100644 index b75155eb45a..00000000000 --- a/dev/tools/test_set_runner.js +++ /dev/null @@ -1,27 +0,0 @@ -var nodeunit = require('nodeunit'); - -// Let's parse the argv (ensure we have all the number of parameters) -if(process.argv.length === 4) { - // Pop the arguments off - var options = JSON.parse(process.argv.pop()); - var files = JSON.parse(process.argv.pop()); - - // Basic default test runner - var runner = options['junit'] == true ? nodeunit.reporters.junit : nodeunit.reporters.default; - var nativeExecution = options['native'] == null ? false : options['native']; - // Remove junit tag if it exists - delete options['junit']; - delete options['native']; - - // Set native process - if(nativeExecution) { - process.env['TEST_NATIVE'] = 'TRUE'; - } - - // Let's set up nodeunit to run - runner.run(files, options, function() { - process.exit(0); - }); -} else { - console.error("Must pass in a list of files and options object"); -} diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 6bae039cf9a..00000000000 --- a/docs/README.md +++ /dev/null @@ -1,14 +0,0 @@ -node-mongodb-native -=================== - -Select a topic of interest for detailed description: - - * [Database](https://github.com/christkv/node-mongodb-native/tree/master/docs/database.md) - * [Collections](https://github.com/christkv/node-mongodb-native/tree/master/docs/collections.md) - * [Querying documents](https://github.com/christkv/node-mongodb-native/tree/master/docs/queries.md) - * [Inserting/updating documents](https://github.com/christkv/node-mongodb-native/tree/master/docs/insert.md) - * [GridStore](https://github.com/christkv/node-mongodb-native/tree/master/docs/gridfs.md) - * [Indexes](https://github.com/christkv/node-mongodb-native/tree/master/docs/indexes.md) - * [Replicasets](https://github.com/christkv/node-mongodb-native/tree/master/docs/replicaset.md) - -This documentation is incomplete, the best source for documentation on all possible methods is [the source for node-mongodb-native](https://github.com/christkv/node-mongodb-native) and [the MongoDB manual](http://www.mongodb.org/display/DOCS/Manual). \ No newline at end of file diff --git a/docs/articles/NodeKOArticle1.md b/docs/articles/NodeKOArticle1.md deleted file mode 100644 index 2a54aef230c..00000000000 --- a/docs/articles/NodeKOArticle1.md +++ /dev/null @@ -1,279 +0,0 @@ -# A Basic introduction to Mongo DB -Mongo DB has rapidly grown to become a popular database for web applications and is a perfect fit for Node.JS applications, letting you write Javascript for the client, backend and database layer. It's schemaless nature is a better match to our constantly evolving data structures in web applications and the integrated support for location queries a bonus that it's hard to ignore. Throw Replicasets for scaling and we are looking at really nice platform to grow your storage needs now and in the future. - -Now to shamelessly plug my driver. It can be downloaded either using npm or fetched from the github repository. To install via npm do the following. - -`npm install mongodb` - -or go fetch it from github at [https://github.com/christkv/node-mongodb-native](https://github.com/christkv/node-mongodb-native) - -Once this business is taken care of let's move through the types available for the driver and then how to connect to your Mongo DB instance before facing the usage of some crud operations. - -## Mongo DB data types -So there is an important thing to keep in mind when working with Mongo DB and that is that there is a slight mapping difference between the types supported in Mongo DB and what is native types in Javascript. Let's have a look at the types supported out of the box and then how types are promoted by the driver to try to fit as close to the native Javascript types as possible. - -* **Float** is a 8 byte and is directly convertible to the Javascript type Number -* **Double class** a special class representing a float value, this is especially useful when using capped collections where you need to ensure your values are always floats. -* **Integers** is a bit trickier due to the fact that Javascript represents all Numbers as 64 bit floats meaning that the maximum integer value is at a 53 bit. Mongo has two types for integers, a 32 bit and a 64 bit. The driver will try to fit the value into 32 bits if it can and promote it to 64 bits if it has to. Similarly it will deserialize attempting to fit it into 53 bits if it can. If it cannot it will return an instance of **Long** to avoid loosing precession. -* **Long class** a special class that let's you store 64 bit integers and also let's you operate on the 64 bits integers. -* **Date** maps directly to a Javascript Date -* **RegEp** maps directly to a Javascript RegExp -* **String** maps directly to a Javascript String (encoded in utf8) -* **Binary class** a special class that let's you store data in Mongo DB -* **Code class** a special class that let's you store javascript functions in Mongo DB, can also provide a scope to run the method in -* **ObjectID class** a special class that holds a MongoDB document identifier (the equivalent to a Primary key) -* **DbRef class** a special class that let's you include a reference in a document pointing to another object -* **Symbol class** a special class that let's you specify a symbol, not really relevant for javascript but for languages that supports the concept of symbols. - -As we see the number type can be a little tricky due to the way integers are implemented in Javascript. The latest driver will do correct conversion up to 53 bit's of complexity. If you need to handle big integers the recommendation is to use the Long class to operate on the numbers. - -## Getting that connection to the database -Let's get around to setting up a connection with the Mongo DB database. Jumping straight into the code let's do direct connection and then look at the code. - - var mongo = require('mongodb'), - Server = mongo.Server, - Db = mongo.Db; - - var server = new Server('localhost', 27017, {auto_reconnect: true}); - var db = new Db('exampleDb', server); - - db.open(function(err, db) { - if(!err) { - console.log("We are connected"); - } - }); - -Let's have a quick look at the simple connection. The **new Server(...)** sets up a configuration for the connection and the **auto_reconnect** tells the driver to retry sending a command to the server if there is a failure. Another option you can set is **poolSize**, this allows you to control how many tcp connections are opened in parallel. The default value for this is 1 but you can set it as high as you want. The driver will use a round-robin strategy to dispatch and read from the tcp connection. - -We are up and running with a connection to the database. Let's move on and look at what collections are and how they work. - -## Mongo DB and Collections -Collections are the equivalent of tables in traditional databases and contain all your documents. A database can have many collections. So how do we go about defining and using collections. Well there are a couple of methods that we can use. Let's jump straight into code and then look at the code. - -**the requires and and other initializing stuff omitted for brevity** - - db.open(function(err, db) { - if(!err) { - db.collection('test', function(err, collection) {}); - - db.collection('test', {safe:true}, function(err, collection) {}); - - db.createCollection('test', function(err, collection) {}); - - db.createCollection('test', {safe:true}, function(err, collection) {}); - } - }); - -Three different ways of creating a collection object but slightly different in behavior. Let's go through them and see what they do - - db.collection('test', function(err, collection) {}); - -This function will not actually create a collection on the database until you actually insert the first document. - - db.collection('test', {safe:true}, function(err, collection) {}); - -Notice the **{safe:true}** option. This option will make the driver check if the collection exists and issue an error if it does not. - - db.createCollection('test', function(err, collection) {}); - -This command will create the collection on the Mongo DB database before returning the collection object. If the collection already exists it will ignore the creation of the collection. - - db.createCollection('test', {safe:true}, function(err, collection) {}); - -The **{safe:true}** option will make the method return an error if the collection already exists. - -With an open db connection and a collection defined we are ready to do some CRUD operation on the data. - -## And then there was CRUD - -So let's get dirty with the basic operations for Mongo DB. The Mongo DB wire protocol is built around 4 main operations **insert/update/remove/query**. Most operations on the database are actually queries with special json objects defining the operation on the database. But I'm getting ahead of myself. Let's go back and look at insert first and do it with some code. - -**the requires and and other initializing stuff omitted for brevity** - - db.open(function(err, db) { - if(!err) { - db.collection('test', function(err, collection) { - var doc1 = {'hello':'doc1'}; - var doc2 = {'hello':'doc2'}; - var lotsOfDocs = [{'hello':'doc3'}, {'hello':'doc4'}]; - - collection.insert(doc1); - - collection.insert(doc2, {safe:true}, function(err, result) {}); - - collection.insert(lotsOfDocs, {safe:true}, function(err, result) {}); - }); - } - }); - -A couple of variations on the theme of inserting a document as we can see. To understand why it's important to understand how Mongo DB works during inserts of documents. - -Mongo DB has asynchronous **insert/update/remove** operations. This means that when you issue an **insert** operation its a fire and forget operation where the database does not reply with the status of the insert operation. To retrieve the status of the operation you have to issue a query to retrieve the last error status of the connection. To make it simpler to the developer the driver implements the **{safe:true}** options so that this is done automatically when inserting the document. **{safe:true}** becomes especially important when you do **update** or **remove** as otherwise it's not possible to determine the amount of documents modified or removed. - -Now let's go through the different types of inserts shown in the code above. - - collection.insert(doc1); - -Taking advantage of the async behavior and not needing confirmation about the persisting of the data to Mongo DB we just fire off the insert (we are doing live analytics, loosing a couple of records does not matter). - - collection.insert(doc2, {safe:true}, function(err, result) {}); - -That document needs to stick. Using the **{safe:true}** option ensure you get the error back if the document fails to insert correctly. - - collection.insert(lotsOfDocs, {safe:true}, function(err, result) {}); - -A batch insert of document with any errors being reported. This is much more efficient if you need to insert large batches of documents as you incur a lot less overhead. - -Right that's the basics of insert's ironed out. We got some documents in there but want to update them as we need to change the content of a field. Let's have a look at a simple example and then we will dive into how Mongo DB updates work and how to do them efficiently. - -**the requires and and other initializing stuff omitted for brevity** - - db.open(function(err, db) { - if(!err) { - db.collection('test', function(err, collection) { - var doc = {mykey:1, fieldtoupdate:1}; - - collection.insert(doc, {safe:true}, function(err, result) { - collection.update({mykey:1}, {$set:{fieldtoupdate:2}}, {safe:true}, function(err, result) {}); - }); - - var doc2 = {mykey:2, docs:[{doc1:1}]}; - - collection.insert(doc2, {safe:true}, function(err, result) { - collection.update({mykey:2}, {$push:{docs:{doc2:1}}, {safe:true}, function(err, result) {}); - }); - }); - }; - }); - -Alright before we look at the code we want to understand how document updates work and how to do the efficiently. The most basic and less efficient way is to replace the whole document, this is not really the way to go if you want to change just a field in your document. Luckily Mongo DB provides a whole set of operations that let you modify just pieces of the document [Atomic operations documentation](http://www.mongodb.org/display/DOCS/Atomic+Operations). Basically outlined below. - -* $inc - increment a particular value by a certain amount -* $set - set a particular value -* $unset - delete a particular field (v1.3+) -* $push - append a value to an array -* $pushAll - append several values to an array -* $addToSet - adds value to the array only if its not in the array already -* $pop - removes the last element in an array -* $pull - remove a value(s) from an existing array -* $pullAll - remove several value(s) from an existing array -* $rename - renames the field -* $bit - bitwise operations - -Now that the operations are outline let's dig into the specific cases show in the code example. - - collection.update({mykey:1}, {$set:{fieldtoupdate:2}}, {safe:true}, function(err, result) {}); - -Right so this update will look for the document that has a field **mykey** equal to **1** and apply an update to the field **fieldtoupdate** setting the value to **2**. Since we are using the **{safe:true}** option the result parameter in the callback will return the value **1** indicating that 1 document was modified by the update statement. - - collection.update({mykey:2}, {$push:{docs:{doc2:1}}, {safe:true}, function(err, result) {}); - -This updates adds another document to the field **docs** in the document identified by **{mykey:2}** using the atomic operation **$push**. This allows you to modify keep such structures as queues in Mongo DB. - -Let's have a look at the remove operation for the driver. As before let's start with a piece of code. - -**the requires and and other initializing stuff omitted for brevity** - - db.open(function(err, db) { - if(!err) { - db.collection('test', function(err, collection) { - var docs = [{mykey:1}, {mykey:2}, {mykey:3}]; - - collection.insert(docs, {safe:true}, function(err, result) { - - collection.remove({mykey:1}); - - collection.remove({mykey:2}, {safe:true}, function(err, result) {}); - - collection.remove(); - }); - }); - }; - }); - -Let's examine the 3 remove variants and what they do. - - collection.remove({mykey:1}); - -This leverages the fact that Mongo DB is asynchronous and that it does not return a result for **insert/update/remove** to allow for **synchronous** style execution. This particular remove query will remove the document where **mykey** equals **1**. - - collection.remove({mykey:2}, {safe:true}, function(err, result) {}); - -This remove statement removes the document where **mykey** equals **2** but since we are using **{safe:true}** it will back to Mongo DB to get the status of the remove operation and return the number of documents removed in the result variable. - - collection.remove(); - -This last one will remove all documents in the collection. - -## Time to Query -Queries is of course a fundamental part of interacting with a database and Mongo DB is no exception. Fortunately for us it has a rich query interface with cursors and close to SQL concepts for slicing and dicing your datasets. To build queries we have lots of operators to choose from [Mongo DB advanced queries](http://www.mongodb.org/display/DOCS/Advanced+Queries). There are literarily tons of ways to search and ways to limit the query. Let's look at some simple code for dealing with queries in different ways. - -**the requires and and other initializing stuff omitted for brevity** - - db.open(function(err, db) { - if(!err) { - db.collection('test', function(err, collection) { - var docs = [{mykey:1}, {mykey:2}, {mykey:3}]; - - collection.insert(docs, {safe:true}, function(err, result) { - - collection.find().toArray(function(err, items) {}); - - var stream = collection.find({mykey:{$ne:2}}).streamRecords(); - stream.on("data", function(item) {}); - stream.on("end", function() {}); - - collection.findOne({mykey:1}, function(err, item) {}); - - }); - }); - }; - }); - -Before we start picking apart the code there is one thing that needs to be understood, the **find** method does not execute the actual query. It builds an instance of **Cursor** that you then use to retrieve the data. This lets you manage how you retrieve the data from Mongo DB and keeps state about your current Cursor state on Mongo DB. Now let's pick apart the queries we have here and look at what they do. - - collection.find().toArray(function(err, items) {}); - -This query will fetch all the document in the collection and return them as an array of items. Be careful with the function **toArray** as it might cause a lot of memory usage as it will instantiate all the document into memory before returning the final array of items. If you have a big resultset you could run into memory issues. - - var stream = collection.find({mykey:{$ne:2}}).streamRecords(); - stream.on("data", function(item) {}); - stream.on("end", function() {}); - -This is the preferred way if you have to retrieve a lot of data for streaming, as data is deserialized a **data** event is emitted. This keeps the resident memory usage low as the documents are streamed to you. Very useful if you are pushing documents out via websockets or some other streaming socket protocol. Once there is no more document the driver will emit the **end** event to notify the application that it's done. - - collection.findOne({mykey:1}, function(err, item) {}); - -This is special supported function to retrieve just one specific document bypassing the need for a cursor object. - -That's pretty much it for the quick intro on how to use the database. I have also included a list of links to where to go to find more information and also a sample crude location application I wrote using express JS and mongo DB. - -## Links and stuff -* [The driver examples, good starting point for basic usage](https://github.com/christkv/node-mongodb-native/tree/master/examples) -* [All the integration tests, they have tons of different usage cases](https://github.com/christkv/node-mongodb-native/tree/master/test) -* [The Mongo DB wiki pages such as the advanced query link](http://www.mongodb.org/display/DOCS/Advanced+Queries) -* [A silly simple location based application using Express JS and Mongo DB](https://github.com/christkv/mongodb-hamburg) - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/articles/NodeKOArticle2.md b/docs/articles/NodeKOArticle2.md deleted file mode 100644 index f84fef5ef39..00000000000 --- a/docs/articles/NodeKOArticle2.md +++ /dev/null @@ -1,199 +0,0 @@ -# A primer for GridFS using the Mongo DB driver -In the first tutorial we targeted general usage of the database. But Mongo DB is much more than this. One of the additional very useful features is to act as a file storage system. This is accomplish in Mongo by having a file collection and a chunks collection where each document in the chunks collection makes up a **Block** of the file. In this tutorial we will look at how to use the GridFS functionality and what functions are available. - -## A simple example -Let's dive straight into a simple example on how to write a file to the grid using the simplified Grid class. - - var mongo = require('mongodb'), - Server = mongo.Server, - Db = mongo.Db, - Grid = mongo.Grid; - - var server = new Server('localhost', 27017, {auto_reconnect: true}); - var db = new Db('exampleDb', server); - - db.open(function(err, db) { - if(!err) { - var grid = new Grid(db, 'fs'); - var buffer = new Buffer("Hello world"); - grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) { - if(!err) { - console.log("Finished writing file to Mongo"); - } - }); - } - }); - -All right let's dissect the example. The first thing you'll notice is the statement - - var grid = new Grid(db, 'fs'); - -Since GridFS is actually a special structure stored as collections you'll notice that we are using the db connection that we used in the previous tutorial to operate on collections and documents. The second parameter **'fs'** allows you to change the collections you want to store the data in. In this example the collections would be **fs_files** and **fs_chunks**. - -Having a life grid instance we now go ahead and create some test data stored in a Buffer instance, although you can pass in a string instead. We then write our data to disk. - - var buffer = new Buffer("Hello world"); - grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) { - if(!err) { - console.log("Finished writing file to Mongo"); - } - }); - -Let's deconstruct the call we just made. The **put** call will write the data you passed in as one or more chunks. The second parameter is a hash of options for the Grid class. In this case we wish to annotate the file we are writing to Mongo DB with some metadata and also specify a content type. Each file entry in GridFS has support for metadata documents which might be very useful if you are for example storing images in you Mongo DB and need to store all the data associated with the image. - -One important thing is to take not that the put method return a document containing a **_id**, this is an **ObjectID** identifier that you'll need to use if you wish to retrieve the file contents later. - -Right so we have written out first file, let's look at the other two simple functions supported by the Grid class. - -**the requires and and other initializing stuff omitted for brevity** - - db.open(function(err, db) { - if(!err) { - var grid = new Grid(db, 'fs'); - var buffer = new Buffer("Hello world"); - grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) { - grid.get(fileInfo._id, function(err, data) { - console.log("Retrieved data: " + data.toString()); - grid.delete(fileInfo._id, function(err, result) { - }); - }); - }); - } - }); - -Let's have a look at the two operations **get** and **delete** - - grid.get(fileInfo._id, function(err, data) {}); - -The **get** method takes an ObjectID as the first argument and as we can se in the code we are using the one provided in **fileInfo._id**. This will read all the chunks for the file and return it as a Buffer object. - -The **delete** method also takes an ObjectID as the first argument but will delete the file entry and the chunks associated with the file in Mongo. - -This **api** is the simplest one you can use to interact with GridFS but it's not suitable for all kinds of files. One of it's main drawbacks is you are trying to write large files to Mongo. This api will require you to read the entire file into memory when writing and reading from Mongo which most likely is not feasible if you have to store large files like Video or RAW Pictures. Luckily this is not the only way to work with GridFS. That's not to say this api is not useful. If you are storing tons of small files the memory usage vs the simplicity might be a worthwhile tradeoff. Let's dive into some of the more advanced ways of using GridFS. - -## Advanced GridFS or how not to run out of memory -As we just said controlling memory consumption for you file writing and reading is key if you want to scale up the application. That means not reading in entire files before either writing or reading from Mongo DB. The good news it's supported. Let's throw some code out there straight away and look at how to do chunk sized streaming writes and reads. - -**the requires and and other initializing stuff omitted for brevity** - - var fileId = new ObjectID(); - var gridStore = new GridStore(db, fileId, "w", {root:'fs'}); - gridStore.chunkSize = 1024 * 256; - - gridStore.open(function(err, gridStore) { - Step( - function writeData() { - var group = this.group(); - - for(var i = 0; i < 1000000; i += 5000) { - gridStore.write(new Buffer(5000), group()); - } - }, - - function doneWithWrite() { - gridStore.close(function(err, result) { - console.log("File has been written to GridFS"); - }); - } - ) - }); - -Before we jump into picking apart the code let's look at - - var gridStore = new GridStore(db, fileId, "w", {root:'fs'}); - -Notice the parameter **"w"** this is important. It tells the driver that you are planning to write a new file. The parameters you can use here are. - - * **"r"** - read only. This is the default mode - * **"w"** - write in truncate mode. Existing data will be overwritten - * **"w+"** - write in edit mode - -Right so there is a fair bit to digest here. We are simulating writing a file that's about 1MB big to Mongo DB using GridFS. To do this we are writing it in chunks of 5000 bytes. So to not live with a difficult callback setup we are using the Step library with its' group functionality to ensure that we are notified when all of the writes are done. After all the writes are done Step will invoke the next function (or step) called **doneWithWrite** where we finish up by closing the file that flushes out any remaining data to Mongo DB and updates the file document. - -As we are doing it in chunks of 5000 bytes we will notice that memory consumption is low. This is the trick to write large files to GridFS. In pieces. Also notice this line. - - gridStore.chunkSize = 1024 * 256; - -This allows you to adjust how big the chunks are in bytes that Mongo DB will write. You can tune the Chunk Size to your needs. If you need to write large files to GridFS it might be worthwhile to trade of memory for CPU by setting a larger Chunk Size. - -Now let's see how the actual streaming read works. - - var gridStore = new GridStore(db, fileId, "r"); - gridStore.open(function(err, gridStore) { - var stream = gridStore.stream(true); - - stream.on("data", function(chunk) { - console.log("Chunk of file data"); - }); - - stream.on("end", function() { - console.log("EOF of file"); - }); - - stream.on("close", function() { - console.log("Finished reading the file"); - }); - }); - -Right let's have a quick lock at the streaming functionality supplied with the driver **(make sure you are using 0.9.6-12 or higher as there is a bug fix for custom chunksizes that you need)** - - var stream = gridStore.stream(true); - -This opens a stream to our file, you can pass in a boolean parameter to tell the driver to close the file automatically when it reaches the end. This will fire the **close** event automatically. Otherwise you'll have to handle cleanup when you receive the **end** event. Let's have a look at the events supported. - - stream.on("data", function(chunk) { - console.log("Chunk of file data"); - }); - -The **data** event is called for each chunk read. This means that it's by the chunk size of the written file. So if you file is 1MB big and the file has chunkSize 256K then you'll get 4 calls to the event handler for **data**. The chunk returned is a **Buffer** object. - - stream.on("end", function() { - console.log("EOF of file"); - }); - -The **end** event is called when the driver reaches the end of data for the file. - - stream.on("close", function() { - console.log("Finished reading the file"); - }); - -The **close** event is only called if you the **autoclose** parameter on the **gridStore.stream** method as shown above. If it's false or not set handle cleanup of the streaming in the **end** event handler. - -Right that's it for writing to GridFS in an efficient Manner. I'll outline some other useful function on the Gridstore object. - -## Other useful methods on the Gridstore object -There are some other methods that are useful - - gridStore.writeFile(filename/filedescriptor, function(err fileInfo) {}); - -**writeFile** takes either a file name or a file descriptor and writes it to GridFS. It does this in chunks to ensure the Eventloop is not tied up. - - gridStore.read(length, function(err, data) {}); - -**read/readBuffer** lets you read a #length number of bytes from the current position in the file. - - gridStore.seek(position, seekLocation, function(err, gridStore) {}); - -**seek** lets you navigate the file to read from different positions inside the chunks. The seekLocation allows you to specify how to seek. It can be one of three values. - -* GridStore.IO_SEEK_SET Seek mode where the given length is absolute -* GridStore.IO_SEEK_CUR Seek mode where the given length is an offset to the current read/write head -* GridStore.IO_SEEK_END Seek mode where the given length is an offset to the end of the file - - GridStore.list(dbInstance, collectionName, {id:true}, function(err, files) {}) - -**list** lists all the files in the collection in GridFS. If you have a lot of files the current version will not work very well as it's getting all files into memory first. You can have it return either the filenames or the ids for the files using option. - - gridStore.unlink(function(err, result) {}); - -**unlink** deletes the file from Mongo DB, that's to say all the file info and all the chunks. - -This should be plenty to get you on your way building your first GridFS based application. As in the previous article the following links might be useful for you. Good luck and have fun. - -## Links and stuff -* [The driver examples, good starting point for basic usage](https://github.com/christkv/node-mongodb-native/tree/master/examples) -* [All the integration tests, they have tons of different usage cases](https://github.com/christkv/node-mongodb-native/tree/master/test) - - - - diff --git a/docs/collections.md b/docs/collections.md deleted file mode 100644 index 7180e30fc75..00000000000 --- a/docs/collections.md +++ /dev/null @@ -1,117 +0,0 @@ -Collections -=========== - -See also: - - * [Database](database.md) - * [Queries](queries.md) - -## Collection objects - -Collection object is a pointer to a specific collection in the [database](database.md). If you want to [insert](insert.md) new records or -[query](queries.md) existing ones then you need to have a valid collection object. - -**NB** Collection names can't start or end with a period nor contain a dollar sign! (`.tes$t` is not allowed) - -## Creating collections - -Collections can be created with `createCollection` - - db.createCollection([[name[, options]], callback) - -where `name` is the name of the collection, options a set of configuration parameters and `callback` is a callback function. `db` is the database object. - -The first parameter for the callback is the error object (null if no error) and the second one is the pointer to the newly created collection. If strict mode is on and the table exists, the operation yields in error. With strict mode off (default) the function simple returns the pointer to the existing collection and does not truncate it. - - db.createCollection("test", function(err, collection){ - collection.insert({"test":"value"}); - }); - -## Creating collections options -Several options can be passed to the `createCollection` function with `options` parameter. - - * `raw` - driver returns documents as bson binary Buffer objects, `default:false` - -### Collection properties - - * `collectionName` is the name of the collection (not including the database name as a prefix) - * `db` is the pointer to the corresponding databse object - -Example of usage: - - console.log("Collection name: "+collection.collectionName) - -## List existing collections - -### List names - -Collections can be listed with `collectionNames` - - db.collectionNames(callback); - -`callback` gets two parameters - an error object (if error occured) and an array of collection names as strings. - -Collection names also include database name, so a collection named `posts` in a database `blog` will be listed as `blog.posts`. - -Additionally there's system collections which should not be altered without knowing exactly what you are doing, these sollections can be identified with `system` prefix. For example `posts.system.indexes`. - -Example: - - var mongodb = require("mongodb"), - mongoserver = new mongodb.Server("localhost"), - db_connector = new mongodb.Db("blog", mongoserver); - - db_connector.open(function(err, db){ - db.collectionNames(function(err, collections){ - console.log(collections); // ["blog.posts", "blog.system.indexes"] - }); - }); - -## List collections - -Collection objects can be listed with database method `collections` - - db.collections(callback) - -Where `callback` gets two parameters - an error object (if an error occured) and an array of collection objects. - -## Selecting collections - -Existing collections can be opened with `collection` - - db.collection([[name[, options]], callback); - -If strict mode is off, then a new collection is created if not already present. - -## Selecting collections options -Several options can be passed to the `collection` function with `options` parameter. - - * `raw` - driver returns documents as bson binary Buffer objects, `default:false` - -## Renaming collections - -A collection can be renamed with collection method `rename` - - collection.rename(new_name, callback); - -## Removing records from collections - -Records can be erased from a collection with `remove` - - collection.remove([[query[, options]], callback]); - -Where - - * `query` is the query that records to be removed need to match. If not set all records will be removed - * `options` indicate advanced options. For example use `{safe: true}` when using callbacks - * `callback` callback function that gets two parameters - an error object (if an error occured) and the count of removed records - -## Removing collections - -A collection can be dropped with `drop` - - collection.drop(callback); - -or with `dropCollection` - - db.dropCollection(collection_name, callback) \ No newline at end of file diff --git a/docs/database.md b/docs/database.md deleted file mode 100644 index ed14b85a324..00000000000 --- a/docs/database.md +++ /dev/null @@ -1,120 +0,0 @@ -Database -======== - -The first thing to do in order to make queries to the database is to open one. This can be done with the `Db` constructor. - - var mongodb = require("mongodb"), - mongoserver = new mongodb.Server(host, port, server_options), - db_connector = new mongodb.Db(name, mongoserver, db_options); - - db_connector.open(callback); - -* `host` is a server hostname or IP -* `port` is a MongoDB port, use `mongodb.Connection.DEFAULT_PORT` for default (27017) -* `server_options` see *Server options* -* `name` is the databse name that needs to be opened, database will be created automatically if it doesn't yet exist -* `db_options` see *DB options* - -## Server options -Several options can be passed to the `Server` constructor with `options` parameter. - -* `auto_reconnect` - to reconnect automatically, `default:false` -* `poolSize` - specify the number of connections in the pool `default:1` -* `socketOptions` - a collection of pr socket settings - -## Socket options -Several options can be set for the `socketOptions`. - -* `timeout` = set seconds before connection times out `default:0` -* `noDelay` = Disables the Nagle algorithm `default:true` -* `keepAlive` = Set if keepAlive is used `default:0`, which means no keepAlive, set higher than 0 for keepAlive -* `encoding` = 'ascii'|'utf8'|'base64' `default:null` - -## DB options - -Several options can be passed to the `Db` constructor with `options` parameter. - -* `native_parser` - if true, use native BSON parser -* `strict` - sets *strict mode*, if true then existing collections can't be "recreated" etc. -* `pk` - custom primary key factory to generate `_id` values (see Custom primary keys). -* `forceServerObjectId` - generation of objectid is delegated to the mongodb server instead of the driver. default is false -* `retryMiliSeconds` - specify the number of milliseconds between connection attempts `default:5000` -* `numberOfRetries` - specify the number of retries for connection attempts `default:3` -* `reaper` - enable/disable reaper (true/false) `default:false` -* `reaperInterval` - specify the number of milliseconds between each reaper attempt `default:10000` -* `reaperTimeout` - specify the number of milliseconds for timing out callbacks that don't return `default:30000` -* `raw` - driver expects Buffer raw bson document, `default:false` - -## Opening a database - -Database can be opened with Db method `open`. - - db_connector.open(callback); - -`callback` is a callback function which gets 2 parameters - an error object (or null, if no errors occured) and a database object. - -Resulting database object can be used for creating and selecting [collections](collections.md). - - db_connector.open(function(err, db){ - db.collection(...); - }); - -### Database properties - -* `databaseName` is the name of the database -* `serverConfig` includes information about the server (`serverConfig.host`, `serverConfig.port` etc.) -* `state` indicates if the database is connected or not -* `strict` indicates if *strict mode* is on (true) or off (false, default) -* `version` indicates the version of the MongoDB database - -### Database events - -* `close` to indicate that the connection to the database was closed - -For example - - db.on("close", function(error){ - console.log("Connection to the database was closed!"); - }); - -NB! If `auto_reconnect` was set to true when creating the server, then the connection will be automatically reopened on next database operation. Nevertheless the `close` event will be fired. - -## Sharing the connections over multiple dbs - -To share the connection pool across multiple databases you database instance has method `db` - - db_connector.db(name) - -this returns a new `db` instance that shares the connections off the previous instance but will send all commands to the database `name`. This allows for better control of resource usage in a multiple database scenario. - -## Deleting a database - -To delete a database you need a pointer to it first. Deletion can be done with method `dropDatabase`. - - db_connector.open(function(err, db){ - db.dropDatabase() - }); - -## Custom primary keys - -Every record in the database has an unique primary key called `_id`. Default primary keys are 12 byte hashes but a custom key generator can be used for something else. If you set `_id` "by hand" when inserting records then you can use whatever you want, primary key factory generates `_id` values only for records without ones. - -Example 1: No need to generate primary key, as its already defined: - - collection.insert({name:"Daniel", _id:"12345"}); - -Example 2: No primary key, so it needs to be generated before save: - - collectionn.insert({name:"Daniel"}); - -Custom primary key factory is actually an object with method `createPK` which returns a primary key. The context (value for `this`) for `createPK` is left untouched. - - var CustomPKFactory = { - counter:0, - createPk: function() { - return ++this.counter; - } - } - - db_connector = new mongodb.Db(name, mongoserver, {pk: CustomPKFactory}); - diff --git a/docs/gridfs.md b/docs/gridfs.md deleted file mode 100644 index 2edad692cd5..00000000000 --- a/docs/gridfs.md +++ /dev/null @@ -1,135 +0,0 @@ -GridStore -====== - -GridFS is a scalable MongoDB *filesystem* for storing and retrieving large files. The default limit for a MongoDB record is 16MB, so to store data that is larger than this limit, GridFS can be used. GridFS shards the data into smaller chunks automatically. See [MongoDB documentation](http://www.mongodb.org/display/DOCS/GridFS+Specification) for details. - -GridStore is a single file inside GridFS that can be managed by the script. - -## Open GridStore - -Opening a GridStore (a single file in GridFS) is a bit similar to opening a database. At first you need to create a GridStore object and then `open` it. - - var gs = new mongodb.GridStore(db, filename, mode[, options]) - -Where - - * `db` is the database object - * `filename` is the name of the file in GridFS that needs to be accessed/created - * `mode` indicated the operaion, can be one of: - * "r" (Read): Looks for the file information in fs.files collection, or creates a new id for this object. - * "w" (Write): Erases all chunks if the file already exist. - * "w+" (Append): Finds the last chunk, and keeps writing after it. - * `options` can be used to specify some metadata for the file, for example `content_type`, `metadata` and `chunk_size` - -Example: - - var gs = new mongodb.GridStore(db, "test.png", "w", { - "content_type": "image/png", - "metadata":{ - "author": "Daniel" - }, - "chunk_size": 1024*4 - }); - -When GridStore object is created, it needs to be opened. - - gs.open(callback); - -`callback` gets two parameters - and error object (if error occured) and the GridStore object. - -Opened GridStore object has a set of useful properties - - * `gs.length` - length of the file in bytes - * `gs.contentType` - the content type for the file - * `gs.uploadDate` - when the file was uploaded - * `gs.metadata` - metadata that was saved with the file - * `gs.chunkSize` - chunk size - -Example - - gs.open(function(err, gs){ - console.log("this file was uploaded at "+gs.uploadDate); - }); - -## Writing to GridStore - -Writing can be done with `write` - - gs.write(data, callback) - -where `data` is a `Buffer` or a string, callback gets two parameters - an error object (if error occured) and result value which indicates if the write was successful or not. - -While the GridStore is not closed, every write is appended to the opened GridStore. - -## Writing a file to GridStore - -This functions opens the gridstore, streams the contents of the file into gridstore, and closes the gridstore. - - gs.writeFile( file, callback ) - -where - - * `file` is a file descriptior, or a string file path - * `callback` is a function with two parameters - error object (if error occured) and the GridStore object. - - -## Reading from GridStore - -Reading from GridStore can be done with `read` - - gs.read([size], callback) - -where - - * `size` is the length of the data to be read - * `callback` is a callback function with two parameters - error object (if an error occured) and data (binary string) - -## Streaming from GridStore - -You can stream data as it comes from the database using `stream` - - gs.stream([autoclose=false]) - -where - - * `autoclose` If true current GridStore will be closed when EOF and 'close' event will be fired - -The function returns [read stream](http://nodejs.org/docs/v0.4.12/api/streams.html#readable_Stream) based on this GridStore file. It supports the events 'read', 'error', 'close' and 'end'. - -## Delete a GridStore - -GridStore files can be unlinked with `unlink` - - mongodb.GridStore.unlink(db, name, callback) - -Where - - * `db` is the databse object - * `name` is either the name of a GridStore object or an array of GridStore object names - * `callback` is the callback function - -## Closing the GridStore - -GridStore needs to be closed after usage. This can be done with `close` - - gs.close(callback) - -## Check the existance of a GridStore file - -Checking if a file exists in GridFS can be done with `exist` - - mongodb.GridStore.exist(db, filename, callback) - -Where - - * `db` is the database object - * `filename` is the name of the file to be checked or a regular expression - * `callback` is a callback function with two parameters - an error object (if an error occured) and a boolean value indicating if the file exists or not - -## Seeking in a GridStore - -Seeking can be done with `seek` - - gs.seek(position); - -This function moves the internal pointer to the specified position. \ No newline at end of file diff --git a/docs/indexes.md b/docs/indexes.md deleted file mode 100644 index 8e65a3e0094..00000000000 --- a/docs/indexes.md +++ /dev/null @@ -1,73 +0,0 @@ -Indexes -======= - -Indexes are needed to make queries faster. For example if you need to find records by a field named *username* and the field has a related index set, then the query will be a lot faster compared to if the index was not present. - -See [MongoDB documentation](http://www.mongodb.org/display/DOCS/Indexes) for details. - -## Create indexes with createIndex() - -`createIndex` adds a new index to a collection. For checking if the index was already set, use `ensureIndex` instead. - - collection.createIndex(index[, options], callback) - -or - - db.createIndex(collectionname, index[, options], callback) - -where - - * `index` is the field or fields to be indexed. See *index field* - * `options` are options, for example `{sparse: true}` to include only records that have indexed field set or `{unique: true}` for unique indexes. If the `options` is a boolean value, then it indicates if it's an unique index or not. - * `callback` gets two parameters - an error object (if an error occured) and the name for the newly created index - -## Ensure indexes with ensureIndex() - -Same as `createIndex` with the difference that the index is checked for existence before adding to avoid duplicate indexes. - -## Index field - -Index field can be a simple string like `"username"` to index certain field (in this case, a field named as *username*). - - collection.ensureIndex("username",callback) - -It is possible to index fields inside nested objects, for example `"user.firstname"` to index field named *firstname* inside a document named *user*. - - collection.ensureIndex("user.firstname",callback) - -It is also possible to create mixed indexes to include several fields at once. - - collection.ensureIndex({firstname:1, lastname:1}, callback) - -or with tuples - - collection.ensureIndex([["firstname", 1], ["lastname", 1]], callback) - -The number value indicates direction - if it's 1, then it is an ascending value, if it's -1 then it's descending. For example if you have documents with a field *date* and you want to sort these records in descending order then you might want to add corresponding index - - collection.ensureIndex({date:-1}, callback) - -## Remove indexes with dropIndex() - -All indexes can be dropped at once with `dropIndexes` - - collection.dropIndexes(callback) - -`callback` gets two parameters - an error object (if an error occured) and a boolean value true if operation succeeded. - -## Get index information with indexInformation() - -`indexInformation` can be used to fetch some useful information about collection indexes. - - collection.indexInformation(callback) - -Where `callback` gets two parameters - an error object (if an error occured) and an index information object. - -The keys in the index object are the index names and the values are tuples of included fields. - -For example if a collection has two indexes - as a default an ascending index for the `_id` field and an additonal descending index for `"username"` field, then the index information object would look like the following - - { - "_id":[["_id", 1]], - "username_-1":[["username", -1]] - } \ No newline at end of file diff --git a/docs/insert.md b/docs/insert.md deleted file mode 100644 index bcbf16e49f5..00000000000 --- a/docs/insert.md +++ /dev/null @@ -1,124 +0,0 @@ -Inserting and updating -====================== - -See also: - - * [Database](database.md) - * [Collections](collections.md) - -## Insert - -Records can be inserted to a collection with `insert` - - collection.insert(docs[, options, callback]) - -Where - - * `docs` is a single document object or an array of documents - * `options` is an object of parameters, if you use a callback, set `safe` to true - this way the callback is executed *after* the record is saved to the database, if `safe` is false (default) callback is fired immediately and thus doesn't make much sense. - * `callback` - callback function to run after the record is inserted. Set `safe` to true in `options` when using callback. First parameter for callback is the error object (if an error occured) and the second is an array of records inserted. - -For example - - var document = {name:"David", title:"About MongoDB"}; - collection.insert(document, {safe: true}, function(err, records){ - console.log("Record added as "+records[0]._id); - }); - -If trying to insert a record with an existing `_id` value, then the operation yields in error. - - collection.insert({_id:1}, {safe:true}, function(err, doc){ - // no error, inserted new document, with _id=1 - collection.insert({_id:1}, {safe:true}, function(err, doc){ - // error occured since _id=1 already existed - }); - }); - -## Save - -Shorthand for insert/update is `save` - if `_id` value set, the record is updated if it exists or inserted if it does not; if the `_id` value is not set, then the record is inserted as a new one. - - collection.save({_id:"abc", user:"David"},{safe:true}, callback) - -`callback` gets two parameters - an error object (if an error occured) and the record if it was inserted or `1` if the record was updated. - -## Update - -Updates can be done with `update` - - collection.update(criteria, update[, options[, callback]]); - -Where - - * `criteria` is a query object to find records that need to be updated (see [Queries](queries.md)) - * `update` is the replacement object - * `options` is an options object (see below) - * `callback` is the callback to be run after the records are updated. Has two parameters, the first is an error object (if error occured), the second is the count of records that were modified. - -### Update options - -There are several option values that can be used with an update - - * `safe` - run callback only after the update is done, defaults to false - * `multi` - update all records that match the query object, default is false (only the first one found is updated) - * `upsert` - if true and no records match the query, insert `update` as a new record - * `raw` - driver returns updated document as bson binary Buffer, `default:false` - -### Replacement object - -If the replacement object is a document, the matching documents will be replaced (except the `_id` values if no `_id` is set). - - collection.update({_id:"123"}, {author:"Jessica", title:"Mongo facts"}); - -The example above will replace the document contents of id=123 with the replacement object. - -To update only selected fields, `$set` operator needs to be used. Following replacement object replaces author value but leaves everything else intact. - - collection.update({_id:"123"}, {$set: {author:"Jessica"}}); - -See [MongoDB documentation](http://www.mongodb.org/display/DOCS/Updating) for all possible operators. - -## Find and Modify - -To update and retrieve the contents for one single record you can use `findAndModify`. - - collection.findAndModify(criteria, sort, update[, options, callback]) - -Where - - * `criteria` is the query object to find the record - * `sort` indicates the order of the matches if there's more than one matching record. The first record on the result set will be used. See [Queries->find->options->sort](queries.md) for the format. - * `update` is the replacement object - * `options` define the behavior of the function - * `callback` is the function to run after the update is done. Has two parameters - error object (if error occured) and the record that was updated. - -### Options - -Options object can be used for the following options: - - * `remove` - if set to true (default is false), removes the record from the collection. Callback function still gets the object but it doesn't exist in the collection any more. - * `new` - if set to true, callback function returns the modified record. Default is false (original record is returned) - * `upsert` - if set to true and no record matched to the query, replacement object is inserted as a new record - -### Example - - var mongodb = require('mongodb'), - server = new mongodb.Server("127.0.0.1", 27017, {}); - - new mongodb.Db('test', server, {}).open(function (error, client) { - if (error) throw error; - var collection = new mongodb.Collection(client, 'test_collection'); - collection.findAndModify( - {hello: 'world'}, // query - [['_id','asc']], // sort order - {$set: {hi: 'there'}}, // replacement, replaces only the field "hi" - {}, // options - function(err, object) { - if (err){ - console.warn(err.message); // returns error if no matching object found - }else{ - console.dir(object); - } - }); - }); - \ No newline at end of file diff --git a/docs/queries.md b/docs/queries.md deleted file mode 100644 index bad927b4e78..00000000000 --- a/docs/queries.md +++ /dev/null @@ -1,271 +0,0 @@ -Queries -======= - -See also: - - * [Database](database.md) - * [Collections](collections.md) - -## Making queries with find() - -[Collections](collections.md) can be queried with `find`. - - collection.find(query[[[, fields], options], callback]); - -Where - - * `query` - is a query object, defining the conditions the documents need to apply - * `fields` - indicates which fields should be included in the response (default is all) - * `options` - defines extra logic (sorting options, paging etc.) - * `raw` - driver returns documents as bson binary Buffer objects, `default:false` - -The result for the query is actually a cursor object. This can be used directly or converted to an array. - - var cursor = collection.find({}); - cursor.each(...); - -To indicate which fields must or must no be returned `fields` value can be used. For example the following `fields` value - - { - "name": true, - "title": true - } - -retrieves fields `name` and `title` (and as a default also `_id`) but not any others. - -## Find first occurence with findOne() - -`findOne` is a convinence method finding and returning the first match of a query while regular `find` returns a cursor object instead. Use it when you expect only one record, for example when querying with `_id` or another unique property. - - collection.findOne([query], callback) - -Where - - * `query` is a query object or an `_id` value - * `callback` has two parameters - an error object (if an error occured) and the document object. - -Example: - - collection.findOne({_id: doc_id}, function(err, document) { - console.log(document.name); - }); - -## _id values - -Default `_id` values are 12 byte binary hashes. You can alter the format with custom Primary Key factories (see *Custom Primarky Keys* in [Database](database.md)). - -In order to treat these binary _id values as strings it would be wise to convert binary values to hex strings. This can be done with `toHexString` property. - - var idHex = document._id.toHexString(); - -Hex strings can be reverted back to binary (for example to perform queries) with `ObjectID.createFromHexString` - - {_id: ObjectID.createFromHexString(idHex)} - -When inserting new records it is possible to use custom `_id` values as well which do not need to be binary hashes, for example strings. - - collection.insert({_id: "abc", ...}); - collection.findOne({_id: "abc"},...); - -This way it is not necessary to convert `_id` values to hex strings and back. - -## Query object - -The simplest query object is an empty one `{}` which matches every record in the database. - -To make a simple query where one field must match to a defined value, one can do it as simply as - - {fieldname: "fieldvalue"} - -This query matches all the records that a) have fields called *fieldname* and b) its value is *"fieldvalue"*. - -For example if we have a collection of blog posts where the structure of the records is `{title, author, contents}` and we want to retrieve all the posts for a specific author then we can do it like this: - - posts = pointer_to_collection; - posts.find({author:"Daniel"}).toArray(function(err, results){ - console.log(results); // output all records - }); - -If the queried field is inside an object then that can be queried also. For example if we have a record with the following structure: - - { - user: { - name: "Daniel" - } - } - -Then we can query the "name" field like this: `{"user.name":"Daniel"}` - -### AND - -If more than one fieldname is specified, then it's an AND query - - { - key1: "value1", - name2: "value2" - } - -Whis query matches all records where *key1* is *"value1"* and *key2* is *"value2"* - -### OR - -OR queries are a bit trickier but doable with the `$or` operator. Query operator takes an array which includes a set of query objects and at least one of these must match a document before it is retrieved - - { - $or:[ - {author:"Daniel"}, - {author:"Jessica"} - ] - } - -This query match all the documents where author is Daniel or Jessica. - -To mix AND and OR queries, you just need to use $or as one of regular query fields. - - { - title:"MongoDB", - $or:[ - {author:"Daniel"}, - {author:"Jessica"} - ] - } - -### Conditionals - -Conditional operators `<`, `<=`, `>`, `>=` and `!=` can't be used directly, as the query object format doesn't support it but the same can be achieved with their aliases `$lt`, `$lte`, `$gt`, `$gte` and `$ne`. When a field value needs to match a conditional, the value must be wrapped into a separate object. - - {"fieldname":{$gte:100}} - -This query defines that *fieldname* must be greater than or equal to `100`. - -Conditionals can also be mixed to create ranges. - - {"fieldname": {$lte:10, $gte:100}} - -### Regular expressions in queries - -Queried field values can also be matched with regular expressions - - {author:/^Daniel/} - -### Special query operators - -In addition to OR and conditional there's some more operators: - - * `$in` - specifies an array of possible matches, `{"name":{$in:[1,2,3]}}` - * `$nin` - specifies an array of unwanted matches - * `$all` - array value must match to the condition `{"name":{$all:[1,2,3]}}` - * `$exists` - checks for existence of a field `{"name":{$exists:true}}` - * `$mod` - check for a modulo `{"name":{$mod:{3,2}}` is the same as `"name" % 3 == 2` - * `$size` - checks the size of an array value `{"name": {$size:2}}` matches arrays *name* with 2 elements - - -## Queries inside objects and arrays - -If you have a document with nested objects/arrays then the keys inside these nested objects can still be used for queries. - -For example with the following document - - { - "_id": idvalue, - "author":{ - "firstname":"Daniel", - "lastname": "Defoe" - }, - "books":[ - { - "title":"Robinson Crusoe" - "year": 1714 - } - ] - } - -not only the `_id` field can be used as a query field - also the `firstname` and even `title` can be used. This can be done when using nested field names as strings, concated with periods. - - collection.find({"author.firstname":"Daniel}) - -Works even inside arrays - - collection.find({"books.year":1714}) - -## Query options - -Query options define the behavior of the query. - - var options = { - "limit": 20, - "skip": 10, - "sort": title - } - - collection.find({}, options).toArray(...); - -### Paging - -Paging can be achieved with option parameters `limit` and `skip` - - { - "limit": 20, - "skip" 10 - } - -retrieves 10 elements starting from 20 - -### Sorting - -Sorting can be acieved with option parameter `sort` which takes an array of sort preferences - - { - "sort": [['field1','asc'], ['field2','desc']] - } - -With single ascending field the array can be replaced with the name of the field. - - { - "sort": "name" - } - -### Explain - -Option parameter `explain` turns the query into an explain query. - -## Cursors - -Cursor objects are the results for queries and can be used to fetch individual fields from the database. - -### nextObject - -`cursor.nextObject(function(err, doc){})` retrieves the next record from database. If doc is null, then there weren't any more records. - -### each - -`cursor.each(function(err, doc){})` retrieves all matching records one by one. - -### toArray - -`cursor.toArray(function(err, docs){})` converts the cursor object into an array of all the matching records. Probably the most convenient way to retrieve results but be careful with large datasets as every record is loaded into memory. - - collection.find().toArray(function(err, docs){ - console.log("retrieved records:"); - console.log(docs); - }); - -### rewind - -`cursor.rewind()` resets the internal pointer in the cursor to the beginning. - -## Counting matches - -Counting total number of found matches can be done against cursors with method `count`. - - cursor.count(callback) - -Where - - * `callback` is the callback function with two parameters - an error object (if an error occured) and the number on matches as an integer. - -Example - - cursor.count(function(err, count){ - console.log("Total matches: "+count); - }); diff --git a/docs/replicaset.md b/docs/replicaset.md deleted file mode 100644 index 98f8c0bd00a..00000000000 --- a/docs/replicaset.md +++ /dev/null @@ -1,53 +0,0 @@ -Replicasets -=========== - -## Introduction - -Replica sets is the asynchronous master/slave replication added to Mongodb that takes care off all the failover and recovery for the member nodes. According to the mongodb documentation a replicaset is - -* Two or more nodes that are copies of each other -* Automatic assignment of a primary(master) node if none is available -* Drivers that automatically detect the new master and send writes to it - -More information at [Replicasets](http://www.mongodb.org/display/DOCS/Replica+Sets) - -## Driver usage - -To create a new replicaset follow the instructions on the mongodb site to setup the config and the replicaset instances. Then using the driver. - - var replSet = new ReplSetServers( [ - new Server( 127.0.0.1, 30000, { auto_reconnect: true } ), - new Server( 127.0.0.1, 30001, { auto_reconnect: true } ), - new Server( 127.0.0.1, 30002, { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - // Do you app stuff :) - }) - -The ReplSetSrvers object has the following parameters - - var replSet = new ReplSetSrvers(servers, options) - -Where - -* `servers` is an array of `Server` objects -* `options` can contain the following options - -## Replicaset options -Several options can be passed to the `Replicaset` constructor with `options` parameter. - -* `rs_name` is the name of the replicaset you configured when you started the server, you can have multiple replicasets running on your servers. -* `read_secondary` set's the driver to read from secondary servers (slaves) instead of only from the primary(master) server. -* `socketOptions` - a collection of pr socket settings - -## Socket options -Several options can be set for the `socketOptions`. - -* `timeout` = set seconds before connection times out `default:0` -* `noDelay` = Disables the Nagle algorithm `default:true` -* `keepAlive` = Set if keepAlive is used `default:0`, which means no keepAlive, set higher than 0 for keepAlive -* `encoding` = 'ascii'|'utf8'|'base64' `default:null` \ No newline at end of file diff --git a/docs/sphinx-docs/.gitignore b/docs/sphinx-docs/.gitignore deleted file mode 100644 index b636545b725..00000000000 --- a/docs/sphinx-docs/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -build/ -source/api-generated -source/api-bson-generated -source/api-articles -source/markdown-docs -source/changelog -source/github diff --git a/docs/sphinx-docs/Makefile b/docs/sphinx-docs/Makefile deleted file mode 100644 index 24a59a6cb5c..00000000000 --- a/docs/sphinx-docs/Makefile +++ /dev/null @@ -1,130 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -c ./ -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = build - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - -clean: - -rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MongoDB.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MongoDB.qhc" - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/MongoDB" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MongoDB" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." diff --git a/docs/sphinx-docs/conf.py b/docs/sphinx-docs/conf.py deleted file mode 100644 index a246c9d547a..00000000000 --- a/docs/sphinx-docs/conf.py +++ /dev/null @@ -1,256 +0,0 @@ -# -*- coding: utf-8 -*- -# -# MongoDB documentation build configuration file, created by -# sphinx-quickstart on Mon Oct 3 09:58:40 2011. -# -# This file is execfile()d with the current directory set to its containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys, os - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) - -# -- General configuration ----------------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.todo'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'contents' - -# General information about the project. -project = u'MongoDB Node.JS Driver' -copyright = u'2011, MongoDB Node.JS Team' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '0.9' -# The full version, including alpha/beta/rc tags. -release = '0.9.9.1' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = [] - -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - - -# -- Options for HTML output --------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes... -html_theme = 'mongodb' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = ['themes'] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -html_logo = "source/static/logo-mongodb.png" - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['source/static'] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Output file base name for HTML help builder. -htmlhelp_basename = 'MongoDBdoc' - - -# -- Options for LaTeX output -------------------------------------------------- - -# The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' - -# The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('contents', 'MongoDB.tex', u'MongoDB Node.JS Documentation', - u'MongoDB Node.JS Team', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Additional stuff for the LaTeX preamble. -#latex_preamble = '' - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output -------------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'mongodb', u'MongoDB Node.JS Documentation', - [u'MongoDB Node.JS Team'], 1) -] - - -# -- Options for Epub output --------------------------------------------------- - -# Bibliographic Dublin Core info. -epub_title = u'MongoDB' -epub_author = u'MongoDB Node.JS Team' -epub_publisher = u'MongoDB Node.JS Team' -epub_copyright = u'2011, MongoDB Node.JS Team' - -# The language of the text. It defaults to the language option -# or en if the language is not set. -#epub_language = '' - -# The scheme of the identifier. Typical schemes are ISBN or URL. -#epub_scheme = '' - -# The unique identifier of the text. This can be a ISBN number -# or the project homepage. -#epub_identifier = '' - -# A unique identification for the text. -#epub_uid = '' - -# HTML files that should be inserted before the pages created by sphinx. -# The format is a list of tuples containing the path and title. -#epub_pre_files = [] - -# HTML files shat should be inserted after the pages created by sphinx. -# The format is a list of tuples containing the path and title. -#epub_post_files = [] - -# A list of files that should not be packed into the epub file. -#epub_exclude_files = [] - -# The depth of the table of contents in toc.ncx. -#epub_tocdepth = 3 - -# Allow duplicate toc entries. -#epub_tocdup = True diff --git a/docs/sphinx-docs/npm_dependent_packages.json b/docs/sphinx-docs/npm_dependent_packages.json deleted file mode 100644 index e2d537db84a..00000000000 --- a/docs/sphinx-docs/npm_dependent_packages.json +++ /dev/null @@ -1,266 +0,0 @@ -[ - { - "description" : "Node Web Toolkit, web framework with mongodb support", - "location": "github", - "url": "https://github.com/nwtjs/nwt", - "tag": "webframework" - }, - { - "description" : "ODM for MongoDB/Node.js with CoffeeScript", - "location": "github", - "url": "https://github.com/chrisgibson/noid", - "tag": "odm" - }, - { - "description" : "nodejs Content Repository implementation for mongodb", - "location": "github", - "url": "https://github.com/karacos/nocr-mongo", - "tag": "cms" - }, - { - "description" : "On-the-fly processing framework for Node.js and MongoDB.", - "location": "github", - "url": "https://github.com/scttnlsn/nettle", - "tag": "gridfs" - }, - { - "description" : "Node.JS MongoDB utility library with ORM-like functionality", - "location": "github", - "url": "https://github.com/LearnBoost/mongoose", - "tag": "odm" - }, - { - "description" : "The future layer for node-mongodb-native.", - "location": "github", - "url": "https://github.com/guileen/node-mongoskin", - "tag": "wrapper" - }, - { - "description" : "Use mongoDB like this: mongoq('mongodb://localhost/db').collection('users').find().toArray(function(error, docs){});", - "location": "github", - "url": "https://github.com/zzdhidden/mongoq", - "tag": "wrapper" - }, - { - "description" : "Model for MongoDB (Node.JS)", - "location": "github", - "url": "https://github.com/alexeypetrushin/mongo-model", - "tag": "odm" - }, - { - "description" : "Flexible non-magical layer for the nodejs MongoDB driver", - "location": "github", - "url": "https://github.com/masylum/mongolia", - "tag": "wrapper" - }, - { - "description" : "a simple mongo module that implements the mongo api", - "location": "github", - "url": "https://github.com/gett/mongojs", - "tag": "wrapper" - }, - { - "description" : "Thin wrapper around node-mongodb-native that provides a simpler alternative calling style and provides collection binding.", - "location": "github", - "url": "https://github.com/milewise/mongode", - "tag": "wrapper" - }, - { - "description" : "A wrapper for node-mongodb-native as close as possible to the command-line javascript driver. Why learn two interfaces?", - "location": "github", - "url": "https://github.com/idottv/node-mongodb-wrapper", - "tag": "wrapper" - }, - { - "description" : "REST Server for MongoDB (using node.js)", - "location": "github", - "url": "https://github.com/tdegrunt/mongodb-rest", - "tag": "rest" - }, - { - "description" : "Fixtures for mongodb", - "location": "github", - "url": "https://github.com/tdegrunt/mongodb-fixtures", - "tag": "test" - }, - { - "description" : "MongoDB expressions for fire.js", - "location": "github", - "url": "https://github.com/firebaseco/mongodb-expressions", - "tag": "odm" - }, - { - "description" : "Thin & clean async wrapper for mongodb ", - "location": "github", - "url": "https://github.com/zir/mongodb-async", - "tag": "wrapper" - }, - { - "description" : "MongoDB management web server boosted with nodejs & express", - "location": "github", - "url": "https://github.com/erhangundogan/mon4mongo", - "tag": "manage" - }, - { - "description" : "Node.js job queue backed by MongoDB", - "location": "github", - "url": "https://github.com/wereHamster/mojo", - "tag": "queue" - }, - { - "description" : "simplified mongodb-native api with middleware", - "location": "github", - "url": "https://github.com/ritch/mdoq-mongodb", - "tag": "wrapper" - }, - { - "description" : "LogMeUp Server - View any log files real-time in your web browser.", - "location": "github", - "url": "https://github.com/jprichardson/logmeup-server", - "tag": "logging" - }, - { - "description" : "A MongoDB ORM for Node", - "location": "github", - "url": "https://github.com/colladow/leaf", - "tag": "odm" - }, - { - "description" : "Node.js RESTful web framework.", - "location": "github", - "url": "https://github.com/streets-ahead/lazyBum", - "tag": "rest" - }, - { - "description" : "A ridiculously simple queuing system, with clients in various languages, built on top of MongoDB.", - "location": "github", - "url": "https://github.com/bcoe/karait", - "tag": "queue" - }, - { - "description" : "Informant is a lightweight way to monitor server resources in real-time. It can be used as an Express.JS middleware or standalone. ", - "location": "github", - "url": "https://github.com/base698/Informant", - "tag": "monitoring" - }, - { - "description" : "A lightweight, resource-based API framework for node.js ", - "location": "github", - "url": "https://github.com/Qard/GECK", - "tag": "rest" - }, - { - "description" : "Adorable mongodb library for node.js", - "location": "github", - "url": "https://github.com/Coreh/ferret", - "tag": "wrapper" - }, - { - "description" : "EventStore Implementation in node.js", - "location": "github", - "url": "https://github.com/KABA-CCEAC/nodeEventStore", - "tag": "logging" - }, - { - "description" : "Easy MongoDB", - "location": "github", - "url": "https://github.com/meritt/easymongo", - "tag": "wrapper" - }, - { - "description" : "A media sharing framework.", - "location": "github", - "url": "https://github.com/khwang/DJS", - "tag": "framework" - }, - { - "description" : "dialect-http is a web client to manage your dialect translations.", - "location": "github", - "url": "https://github.com/masylum/dialect-http", - "tag": "translation" - }, - { - "description" : "Dialect is a painless nodejs module to manage your translations.", - "location": "github", - "url": "https://github.com/masylum/dialect", - "tag": "translation" - }, - { - "description" : "dev/null, a powerful logging module for Node.js.. Because logging to dev/null is fast! <3", - "location": "github", - "url": "https://github.com/observing/devnull", - "tag": "logging" - }, - { - "description" : "The simplest way to clean your database after tests", - "location": "github", - "url": "https://github.com/emerleite/node-database-cleaner", - "tag": "test" - }, - { - "description" : "NoSQL abstraction layer for Node.js ", - "location": "github", - "url": "https://github.com/evanp/databank", - "tag": "framework" - }, - { - "description" : "Cube: A system for time series visualization.", - "location": "github", - "url": "https://github.com/square/cube", - "tag": "analytics" - }, - { - "description" : "MongoDB Session Storage for Connect Middleware", - "location": "github", - "url": "https://github.com/bartt/connect-session-mongo", - "tag": "connect" - }, - { - "description" : "SessionStorage for connect's session middleware", - "location": "github", - "url": "https://github.com/masylum/connect-mongodb", - "tag": "connect" - }, - { - "description" : "MongoDB session store for Connect", - "location": "github", - "url": "https://github.com/kcbanner/connect-mongo", - "tag": "connect" - }, - { - "description" : "Simple continuous integration server written with NodeJS and CoffeeScript ", - "location": "github", - "url": "https://github.com/ryankee/concrete", - "tag": "continuosintegration" - }, - { - "description" : "Calipso is a simple NodeJS content management system based on Express, Connect & Mongoose.", - "location": "github", - "url": "https://github.com/cliftonc/calipso", - "tag": "cms" - }, - { - "description" : "Coffeescript-happy express-based server-side MVC framework loosely based on rails ", - "location": "github", - "url": "https://github.com/mattinsler/caboose", - "tag": "webframework" - }, - { - "description" : "file based static website/blog generator", - "location": "github", - "url": "https://github.com/pvorb/node-bread", - "tag": "webframework" - }, - { - "description" : "HTTP and WebSocket application routing", - "location": "github", - "url": "https://github.com/tjanczuk/arrjs", - "tag": "webframework" - }, - { - "description" : "standard blog written in nodejs (express) and mongodb ", - "location": "github", - "url": "https://github.com/dynamicguy/node-mongo-cms", - "tag": "example" - } -] diff --git a/docs/sphinx-docs/source/contents.rst b/docs/sphinx-docs/source/contents.rst deleted file mode 100644 index 52a2786da8e..00000000000 --- a/docs/sphinx-docs/source/contents.rst +++ /dev/null @@ -1,26 +0,0 @@ -====================================== -Node.JS MongoDB Driver Manual Contents -====================================== - -.. toctree:: - :maxdepth: 3 - - api-generated/db - api-generated/collection - api-generated/admin - api-generated/cursor - api-generated/cursorstream - api-generated/grid - api-generated/gridstore - api-generated/readstream - api-bson-generated/bson - api-bson-generated/objectid - api-bson-generated/binary - api-bson-generated/code - api-bson-generated/double - api-bson-generated/long - api-bson-generated/timestamp - api-bson-generated/maxkey - api-bson-generated/symbol - -- :ref:`genindex` diff --git a/docs/sphinx-docs/source/index.rst b/docs/sphinx-docs/source/index.rst deleted file mode 100644 index 3767bf14b7b..00000000000 --- a/docs/sphinx-docs/source/index.rst +++ /dev/null @@ -1,50 +0,0 @@ -================================= -The Node.JS MongoDB Driver Manual -================================= - -Usage ------ - -.. toctree:: - :maxdepth: 1 - - markdown-docs/index - -Tutorials ---------- - -.. toctree:: - :maxdepth: 3 - - api-articles/index - -API Documentation ------------------ - -.. toctree:: - :maxdepth: 2 - - api-generated/index - api-bson-generated/index - -Projects and Libraries using the driver ---------------------------------------- - -.. toctree:: - :maxdepth: 1 - - github/github - -Changelog ---------- - -.. toctree:: - :maxdepth: 1 - - changelog/changelog - -Indices -------- - -- :ref:`genindex` -- :ref:`search` \ No newline at end of file diff --git a/docs/sphinx-docs/source/static/.mongodb b/docs/sphinx-docs/source/static/.mongodb deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/docs/sphinx-docs/source/static/active.png b/docs/sphinx-docs/source/static/active.png deleted file mode 100644 index 2373e4ffb425762e1a6ee27e085a2d6289317398..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1630 zcmV-k2BG4Tx0C)j~RNrgUP!#^!Wu36$i#lf!2|j3%Ze&w*L!7p2SGvtw>Nd9_NSmf@ zT$;ut?S8Na*^6&F#dq-sKKTa>*@JI;k`2ZbVfd_wB24xov!0tYO(#d#()tZ$I5%3%!zLYh@BH>w}XODA7?mkV}ap}jU$$3 zG&Mk)3Bm`(LOM&hKscCb;PVaG&Vdx+MpZJHTQ(R_;DA31$+jOGBoLXk_De?ey1m!ik&_4G zH9n^))_*|$z4!HUisgBd@awc5jn(v9k~&t~+vLrrBg4dZQ9lDnLV}JQWGLW~LJVP= zW5lZXOcog;N~F?hbX0k=IMzETla}oqM|jC!4!B+x^;@#I_Tc-T-6hwKycLDTx1-om z?X`jFy0R0R8-I0SrK4`)H@W4T8*Qr#2vPou<*`U!Wy(*2QP*`g=8#jD{B;Y@GL-Hm zb`n?&x~%YC_$q7)PlXr4m%r4=&fcvN%Ybn#KC7Nn&Bp8{(oE9pWVpYI^+LuN`H(R~ zTAjWmO`M83^4d@fCkA(d>*nHIFV_d2yUbnT`nd?LE^;G|!WZ>Ld?E0@Grm4ww{M7H zr`x{MWb30bTI;*hk-DO>dX$gbC-yy#suLNqvA(f>RtPJ!qGM`Gvvf}Y10`)vm-7Xa z?-7Ixe2A_siI1ydSCCID3U8SVUY86>uSnT0use_K1GZDvUFKY)t}F* z)!pahe+zh{{06Bb3f97*Uorpy010qNS#tmY3ljhU3ljkVnw%H_00QPoL_t(I5q(o@ zNK`=-p1BWqH+R=Hdl(iWDHt2ICA5FClu$w_h1iAaM^Mm@=tqCb1f%thkwuzBFR&#j zwnEw>iYV%j5fYe`4;E2+T9&%8?&IFQGtHUZtFDg@+&OdReCIpgJ##Onl%gdJv-2gB zdX1oO=6PNm4F1gh_Is#=f#*kEt()UJ>JTk!TB#N_B6`Vx#?J^c zlMVGoXl4erwHV~lUlW1STQ6E$zJ~h5Wl|Q=XjGD^OrCyf-}|upMh$Bsu?L3B=fati z0UX+^Zy$c}`m?vdDradLiHLy1f=pxT6kcK6h)$L_pV(=y=)laNAt>MzXMWX%u2UD^ zjCu>qLS|eeQC`f>5hV&XF*Rf10o3`jtzmSce-9J`2@pVML&yE5md8CEWx{kCQX{HF zR47dtB^bq`A;F+5N4;NO*)HF0zM`V(Eu4fcsG;q2{*%7Wo8kC)x>2@L!KAJ;Sn+Df z#N;!5nnI8gG^lD=jSvlMDhXvebN8LUe)drnzXjF@1|#}>E)fW;uN`xiRAt9Y>Lt3n z(V`ZgL-b%>aXsX0mB{8ilxJml3&cl6R>JSMl0z7 z%w!jx0*~(Sb@m!zAc-Tk7FvRmBnL2+5h03zwDidK^`!%lce~vpV8I~f3Sh%jKy#)6 z!)vG+a!&s=8ZN@bfDD58-ML}YIOKgkA7PGTA)fh=AmHXoIFm7L7;6$kD#$2V`W=qS zsbtrgVn8k+NY*2f3LjC-M%kx`%!ajG{$ltA1a`ZJcPQHG8l;LbOd<%SiLn6JrL*%O zu`D29zbq%nvt*3LLeatKA2VS$(G75qefHgT4*g%y;}q|3;~a`C<`2HVLn(==o0RR91 diff --git a/docs/sphinx-docs/source/static/logo-mongodb.png b/docs/sphinx-docs/source/static/logo-mongodb.png deleted file mode 100644 index 859ec93813007aebf0eb2465c4ce488c8021701c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13030 zcmVG0%c3tqfquPZRs9qnzq@= zd;fFO_u7|`bWjk{clcbAzPxwm`Q9_`x%crXib5Q5#L>eeg6jf~IC{7wVE@s!p?|F& zwv?DrhY4L}1fRz{`ROr(L?!vl8&IUxqG@yAL2oTsf*cM9;`8~=Pm9Tf)~;BD*1f+D z&0o3zm6nvCva(XNbj@do;PH@9EQU`4*{l}CBlu|T^2O-?)~-NmKTVb873+%7-1k;Ms{Y=As$% z-$Npi7%iLs7Sd`9(R-^uMgoBl$>egV&m#2R!lh{b;(2H$d{U$X3E^IfBB9PUl%JQ2 z*1x|P{r2+@$VaL2SXW%m!sTn6pSa%3)_#V}P%p7qf(U{@BuOHR#f&6S_XRU1!lx81 zTDcxAeS3zp{>#>FKr5fc|$N zAB7aH-}oC+Ddn!?r!Pa}M#rPc7SJ zLqySv{-Op_MA`mYpz%OO!HFY|{xKl48LX&5kA}+FshvJnMkrS}D2hh{u%wM;uZSDT z#!@zt>s5|8x?hml3^o)R7omzC(fmU~E|^SVqYT?b_@5mqeftJ1_vxV-Mj9Pl&vL|3 zZ9(R+IFP!j28H&Fm?u(;U#CcrU=)QMqyveCB4={g96_pQ{8uTT)I7@pjU$d~0Wt^J zV16z9QS_+hbCiu$a~xKO6JXf2Mrmnhtm(NUR=GPI$qmo6~^=wDEaem3;zMD>|#AIG}OFfvg&`8*L~kE-X51 zVB~npK?ai`sz6nA+F^_&Bg_A)Oc-cFUT;|!^-Ng{rT9^-pK-*|V*xVK>Oek?eNn&@ z!LRXsguO`zRlfMkVR25m|yae|O14VD}14WaOom(vChy$4ykderzk!qMvGxZpU z&4Cy@%qhWmkSj%2fd_RLDB{4w1E0MUZ9=7#wjRb4oFhzqqH+ zU(y4+?-2temL2AzGJ2DS^gq1)fv4j4B2@f=PTjH&QtYjT@1c=n$2+%MaKzDL2{Ige zC=QYH31}!M>7k zS*)a?yghc|J5@xARuMg^j8)3AN|0gOOc)@F6Vwy+xgXmMZ#uoe`?jml~IC{+0 zMI6#0L^7= zO^n0jaN1djqP(k&ObjEvR#q*QOUW2W?J1Ir0^#W2D9Hdhd^x`vq2NbT4$=uGC(yj9 zj8vsXR@L5QUO6@qa=>$9z8XpREf9w>j{cP(1JLj!{3s+L8ep$txtktUtuiv64K|oq zAy&?a5X3B(0oh3;X{Lx0H&ujkUPg}o4J2>{ne&PU2@yeAXmAm<$_Rg9X+>bv5VXq3 zqg6=fEj%ZXsyl51gO;b@M-e_C%}A74)xG$*w; z_dcE%LP~+OAJQ#Iwi-T%%Nq=-1td!?@sdlIcfO`|7PxD6JRzY%d;kof0iUUd!9);L z`8fkDm61oddKpno^*_ofKm8yDRrQDt05)~bLNw-$$fgQNcbS7m5aw}g#!Ne#Vf!2$VVZ&ScO{vpOyHmQYl+05(#|o=Qu$q@BKAP zU(eT<7?-Wz@Y@$~$y{TQ2^-2a!bq7vUXbQdtOaJQG7^<4qq88aG7^->tuC&Oa{CcG zJVb;)Ps|T-g4M$__z=w@BS)j*qh8}U@-ZZ{$%rP;S_q#ewDF_W_Z%1t%#G60^W+Kp zlP*Oy3_h+_DMBI}g#^px5)qCLVt@k^J(ZVVth;?DJF{3{R;p1el^Q>#uUf6ZpGrPK z@EG3!pHFB&AdFo+_vNt;hvTacKi&2YWRr7`=o9c!cCNPMz~SU$@K|_cL~uyGKwn>i zSDqI>_||N(+6uHKdXvd&#T=|u%H;tXrHWvc2j2tzHOh}?PaWC{uFTr@$1y$ofK#s^ zBNRkEP~-e@Krn$&rJKGAmC*r7AQC!HkhR)u&eLOSAkAzA8$ zAA&#gj7D={*G@6*W=|O!->gXkjoEAkegZJ$=*!lAwk=`z{-nbSg%qoTVn_;`%`UGW ztO@GdGqz=Xuh`}d!|VAv&vc?EbdgB-+Pvw*qW~|Hzx{FlC12Jl!jO;f;Nc7BA^iu+ z35N1o%$YiLVCRm_!c0aB5=+JC?8V#JAAG!Z=k;3|X&`C&fH^UMG3=$`Pj~L!qiwVg zwAL`T7fkpVVe#70f$-=?;=gMAfK^Boa{$O2BMkso0!Zh05ssPEs{@7GiwL z2*i`|gE$Z4znV;tu%VqPlSvc@63-`hXd4|E(`KlAzgLU{fl)ZrYKDPoaOl$l+qnZM+lLzl0l4x2f7 zNIw9p03Qc#cQ{aVWJupe4T5%_Id}7jCy=>$7ZD#hHO2C%`-3s*%Ir@7Ap9lqnUBD*_Xi(%~ zKtf7|bPZCHK)^p}GFg88@Y7$`F8grvuR2|+1pru{IRFj7(S5=z{pLLv-&tK+W@2ZJ z|G)>)#NC6#up;POtxWbo&o$1Z+<^wgCLLaDf1E`fThkV{&C zs@slHb*ly$10jkIgK`N5MjjWY9rW)!cObC<#ZD~gMIi32G90-|Hd`(3$M@nGyQ^Re z9sPCZiT?oDwrPt>Du9MxMiCqm@M37N|0`JPcp)ndc$Q}a*qwKec{WEzJ*l#BV05a@2!F*}A+R&Jhy#@>$*e#}{^g+BYfhr^jLdQND9wURqX8?FX z8F7y)N1vle(vqrLm61kOjh(Q(@<@M3M(zlEjvf^82|{Z&TaynQIlmL^rX2iABSvlX zRVg}xP1cRPk5E4Rs-^L-_CsS|?gQTq-W8uH?qFXX5U)!K)9e)|5u=^O>a7Z&z`Ql_TtC`q-*aqnZNb(xyrGPX5 z(jG|rAa$m%heBFP*OQ{vBx|+8C^7Zs9Jdv=%W)dppa-~w<+?&nh6=20>Xu{b3 zXxx~1R9sSqY&JV;6cH?mZ4=c%ER#5K05&5!dg^M@*$cOmBx0e*@o@1j+Oy0BwoFr@ zq=O1kmdbUos=SPhy2#$`au3Sf|8`Jz%7KgsRk`T}J4Jeyl;{V~T)4EIL?&xR@CfED zgI1+Vt@!kd&w7n|{ms?zcUzYS`TTk^g<|=_6>H;-M&pE(n>Vg3U$sMc_?nQvwf`a<<-dni@%6Y9k4_A+pKp+SdC=@uNVDRFV zA6-@`l#@SRy)4n~g?P9g14>Kuy=K0%thq=miGtZ!ihn37%)ik#wo}t%=g;+Q(Yozy zxTIo+ipL`aBC$9wv_W{>yd|qYgufST+p-Dz!`E|N3kw?0efRw(Fh(z86-O$qT+0Eq zM*@Ghhp+8dtlK!(Vzs0h3}rbp7cP^+4>%el(_}PEg~u*1&lG73(2Td=9TgfLv4SA@ zq4&(%kf%f{YX@K3L7%^!ekWz#2TSIE`j<#EK4C8|Hl*IXoq5evV(5i!CM?OwG81~X zPse6gZ=^>ZNW5@MA+P>rl{yAsqvKI(dM=v!#z0htohK9;+T)2<{VYZcl1N49)S2t4 zoB#LcA9?w@REb37s1{^A0$Chojy!vr9SI121*nkA!ZhWwFio<-RTDc5>&j-k4w)VK zi092M$-{52^b?E4W0gwP3+}(-w?p*X z1`$52$6CN7@gp$!)Q?sz-HL&RCnS+b{4At3knSnSVzx-4n#IfuZO|~fDrw~(5I8F= zqG7h(=2&;nEDUvhW9qC{05DwF?igUHw{PYC_P-x4<@IX6JVR!UF&> zuNxf&ZUC?$6PZgH9C}Jgs4BdSMCIm8ie4KdE9@|mvDXDO(2)eNpoCGyS_oG>+0#ss$1lGfAi!#MF*owj>`vawywmFp#a<#fA(T z{!$D8s$!}N46fg^9GDjC*;B_e4(;8QZZa9|oxAl2@BUQphDu-G3NhsCr|B0I95U2y zcl^f_z$Q$e`xFhZ7<}#O#q+t#7tZ=M>C~|#nM`iBTCLLHkdUbH)8_Pje#Gcjz?@8n z1i!Ul$$Tg``^!((99ODT{9k|mKB=&<;L~UN4;t96L+2*Y=8Ad*hlXJ_6s6y}owxJ1 zt=Df}yHXq&RA2dYpZ-xDx;zoW$``#har$$)Ss8n_Z2J1D%C{V^7!V_09UnS<-eRm~ zcE{K5+`3t?eBsP(M-J}&Q?Bqa!$hJ!b>vXr`O7{W7#I|Mk4kH|S<%nme|75cfj!r; zXYQp}-%!n7v}`>9Yz+S0P*!UF?86m_o4@^H4@Eh$L8=iTu>yvUeC6r+OF!tXQmZS* zARsVkN`r=xcWhSs`iCveU^20p%+?%8#XN$iVN^zyk33lEBM+@kWyC6BgV4a{kUp-W z3{GU>`}VDy{chj9HhAIkwF9LxSw-8DlTO}UzF^i)m~}6KdW6?v9Gk!STr>EE zQSl2`tmzLDh+zl?%(SiC#{q|V4IDO7^V*x!$1?yc)$1*rzW8kC$)kt91F3fx<5&dK zc|mUO`6csa+yMNK8#8WF7gjcHd&LhJe)iwUA!@5<6H>_Lv2aIPXFt8qkhIGrfpEsB?chRtMli%vf+$Z<(X|3>4b)rbe z)e3i;okRef7Xc6z(i0XiSe5}dqH33z9WC`ONYKX zbT=*KCXB&3+P*{q^@3jVQTo2f+_!b}e@}k@^~TQu?Uz6W$Fn#O`a!*Q^S3wf`WKAX z^YEvbxqssHxi4r7@(%y-_2=i{`a=U5ey=mAb$Mk5QxU=AMKanGNs)YtB*hP+3_R&* z{FE|C-P*Nk+|A)|eDT32zbyXlrvo|e@2I|4T@(?>dfjkd5H7hOY$R)rkJono<53mw zW+nk(1all5bGRu&-uIPJuAW6?rI4f0dY3G<=ksJ$u0>OOGcVsd;bNuL)Q^$^d?;oJapzkGN zHdpT5^;>Ri=dOVx#*FLE+&f^%h^7~llcM+hvF#?@LU*big@iR21dP^?x$oAEtG936 zxUvuGcZtrke31G4e6yjf;6TD3^+0tDZ_=zqedf0|?K|~s(WZTm^Jh;V0-Fa<45eVh zq?VSJ1VQQwAoIuf<>h1*UAuJtu+d=n10)>2&x$35(Nq?2^x!^8T+cq?(aoBNFaj8C zz+k4EtriQ4j)@VqZr{)JB9QACj1EsSg2oT)=Yp>0z(Z~Zf+>UA<~dJ#M=skh&B z6x+=BSEuigM3qvD23Uoc5mj@>hr1Nh*>lMv`&IaEuHk~C4$^IU;gME331DVHHe`>Z zt+OHFZ~_C^0y&v?@1D4R_0ko$d~npj1=yS^^sVbxFCbPBv&m=_Lz1%x zgLGgOR@IXBaFzr2#F1-fj-NONz%aPi8Ni-%Xy2aS_wCqz%0)U$B$4nNd(I1al~r1k=U`q zEE7PP@$tPojBnejF{%z^_-!l}dxrUhJ>7H>%Q+V}K4PhiEEL&nHm5Gjo+Lct4M1kk zx7@VnSv%X@WZiYfxhQ;b{y%u z8Z*gYK9xwM5o`yOwxA$KTUeL|fbzJX3MPzVQ1wq`q^I6tUstJogTNjQsjVx$Rv?4C z)hb1>uSy>1V9J5EfHW!tVCbq{n}r6;WMY$CDoz2wUZN*wym#z0jL89zU%zkq>A;5X zemRNEnlc34_m!C60E;$;>Ft$;v2Y-w@X;KD=YsZW@!x$evJ;ub-bE*hm#d z(*A_sZzb;EdkZ9PIS_#bm!#mSI8x8tCwUrLm{Daq?r%d?-;M(4JlQrj9yP&bVD7l+~IM_Z)T1M|BH~_B4<2n6U&^6J5Q0F+b_VF_&HE zZDKpdH)-B-@UWL&MWbGS6Xj-WQP;ShszJkE!s}#C$4`E4j_%gAtCvM0fx)f5F1EW` zk2U(9`(|&r_hM!-e!(H3E@2)1Y~Q19%C`*$Dy;*&MIKxMU7 z+Dbx=e?Z{cPrm-q_R*I=6#M#Vrtt*=qNuRIykg<(-#4yb^$pmNcRd=7GBJh72Ed943+xvj z8rTDSgt2472*BIDKk3BzODX5QMP%HUIzdq;sZ=DulB|4hB@da5R)g7OEvqTWu#>__ z>g^XS=SmXnS>}8Shh=$E8R2hc^O{Fh8=n`Vvm2~e%Jw-5t!I#cXGD(?;V`7r$Bt$n zJ-FA!z5oVoSuZ%Gqr(fM;mJrS5XglBVa1|sc4kI)R>s{_uxB22we3okZ}zq=-~BLS z{OGSQo=eL0q}u6qI^+Mo|2k>x@Mk~y{;Lfe!A48sV@Hsy+Dnz_i}L}jdN)sDOqXtP zz9!?n!-=JPZ0F8??K^dGSr9vO;%Mfz%NGltkktFB?k2J z@TX(n7}IYg@S?yORRi|v&b?=jA2@ve51CBj%}G^j!aKLyw~f}cZ5gRXmhw3atEG7b z#W@99eP+!;hTZvMqR4W!Y=`k+(GILOQhaoe%ILmH?4Ehd4j{Z-n&?O|{0>sAptcRg z1JC zFE|Qj{fhX$!w2^ypFH~KX#nnDu?eUYui>TMzVYkj3un(z<%E9O{NJlnUwd);fF7}5 zb!`#;{)%_ze3YJ=^0QbXIgQHC#IU=no)UEV;<*cuZm_SnY8yMCU8gRC^Ycw;_^7dH z$jC9yMSI%8fucalM@Bbm$lRZio|b#_+LcRCCrfp9l_$~`m7sakhojMxhd9CJ(oh(d z!Tq~xCXDSrO(GR_#FIWqEp+PK&GessP5ecxEjcd~@b4+aXtban-CNavvTMsA%4De$ z*Z^QOs9zWK($J?+L18Is*({<LFgsGI!Jz^K%3mV0;weLEO^7+#yB0qmk&83-K zZa;cx-;u)y_B_+~xgk$5*Zl(n`;Hzr>Giyv?D_k49b^qULZe?B8TsL<;dZ-IN!{OJ>rQl-L@ z8m(G17k@ggTu8olaQBY0UApz?$Wm7n)91hYdQMixd60<73aDRci5xwl2($fl@EnzrIu|j(UA`U*{4LqZYc1 ztG*1qIfg)J!!DKy>A=5mcSg(Ed+q!bdR4A z)JsQ>CC7SBztvG>Jqk9Su2!l6NP`vYH^6LTK&Or-Ht^H<2fNIq?PC3-A_JvXtF>Z= zvcU}6uz_0ICbpByz0bcms_F5=2U~#3ldPsA;qhz>Gp)3ByN>?sd&3(=Mk;-Mn@pR# z=(K-8Jv4jL>qz6Tv4JGJwqx5*2V1xA*gQBS%(v2O*XiwVe@O_QH)Y&{;-aE#yuWD3 z3(xs2Uj6YqYClaM#=ZNWPuA@IW7|(Vf$sp=r4wLcA^LsSiOU~- zzWwX`g5pzdp4oC?!}buhZRqb+W1{R-7~fYIuX;9Uf}*3kCC@=PC$%8L4~a_o=w?v{ zDj|(vf)P%Dk=d3!%b!Kx*fUI9KuyG|hPk#No4Ihw$fDAsn@8+g7t(08n(u%LZ4!&cjlj5fK4d5>wQu}rb;9Pa zKmXijvz>r;6gdNUUwK13d+~}HK1$V0=tn;u&-Iuuhuv<1Iu}A4|NHjTaVr%{Rm9RY zpUs5p&oOy>YTx>m?=D*X-g^lRBf|scEPj9Oz+o@GTzl=o@zu)3^A>&i$%om#<=cJ; zv)L3H-L(1hvlp$H*zKua(QZxv5+RFXrc8XaoK{zA z-SSJ~iLJjM{i#@Ab`bKy2*d3*TX%s_sHwVrWK*FKC1?xs%v=8Z#nG_vh|cXgc4=IjzQ_CI<}Fzj2ID*F z>kaE~gY+dO5^3J;o7eU(oj-$kb^O#92M!zA7Sw1y&4|E&l14Z&dECBnt?-La*B;)V z@W(E@&2kI?mc_RBFtZAUf-W+d_yvhb7>c);RJTZvp8?e@f@Sto1qHg2^OsVyb{|Z- zoRoYk$!fKq2Y}&&Z}L4X+Lz}c7Ct9ZNQbkw!PKZsEGTVuhdnp1NdGHHukE`|9EHi^ zoPf{2007JMR9Z3@R$fm*4BUq!sI&Vr#=IoZxP-w(!XACeFYAU(iY~Io;h*!Zo==sT)dl> ziVb}nl#A6I3@}GI0Iet_EF!E!mu^Eq73*dwE0f$CxJn^lZp)?QvwJ{Q+upWA=P)R5 z5U6*}trm;O{fIESeL3gPp8hR4>EvDj1y)6)8$~x6xM10bWzj^IaZo>9$*OSkjxG0gz zum*z}KHHrEEmj+9-ZZ>r+m?+6o2~X%R*O}PRkpxDwNHc4KsBEr_>|j19NykCa%EiwF(&gc3cnwP`GRK@{(#%zaDvvr~lMmfC zTo0j_C=MH)4<1OYo`%z9@vCSbX0{wqZ5=~LzS3&$dn?y~J=@DFK1S%e=>tbHD1M>qFd(2+6+_{6hRIfJzSa$sHhi|rn z%9{?-)2P!H3XdJyk5y|QtJSIw3<_=r_YdqhaA;GOL{~!!K(5DKTj_RVFB&!l6f}bp zbUm52TdG;EA!(*Hu-e3X}O;=?|13l z2KsbnMru|!+pcT;jw^K%Oh^9B4nsCIA4sEWa?-t^omn5^cLMeXwTR6q0m z*qbaSv(%!m95rbl-oZV7`s^+Mm^F-Nar-Yno&xoC6G)?Tv~;o4%!H+q5L8-OM%tZ= z2X_4->C`nYR1*;3lxTW=v0YzWOo9gGjaf_UsI55e10;`vuj)i~iJ^1w2wuL?U{1wn zi2Ep&7Kv1vPmz=barDRtN6jmIeDKmiyGph1_T`dd-6=kw&t7bH&=MJ|Jh|}OmHhnN z;|2M-6%h+Z4(`o7dGv5LNItG(9}&o$b|e^zCXq;jBw{Hk5D07(ccST|1zGtaJ%Q|N zot}776%iR_!W%kW47d_K!cqA+6%|^n5sezlAvwJqbVU9Ykw{?XdbMs;r$|j46j@ek z%r+aXCb2}uC(2)1#`Wr>oHYp~DADU(B5QiZKi6;nu0IBtnj@n0k2R;)xamL*Kpp7_>%melE_>n{Va74b1>(xgHGJGN&NH2>-B6AQt&>s1G zPL4fd5{bpUYnLxxNx607Ze&!G2J~hBWo!R$14&Ws7tENj)<>zzs2>@J=fS{mv z<#HeAStt8;Zolxu*BgJfm`tgV9|y8W2{PxRYN;VlUtF5*qwqBg1wu}eJz|n86x5%4 zcOGpN75(ReWgm`V*53p|AwCu8tq(r^Y8rEh>5RAEl?p|o2quCAFXsTbPHb4e>c1sA z-7x@IG1sGYr~6qabGPYmq;+fBTZ7L+$U@w!CLSp{91fLOBI)|K*N%3o0bwyfZdTNR;JL7Kg&)$h@*$2yK}@5M;ypF z;)nwoM;vj)fs7-LIFNC~5eG7kIO2!{8Alv(AmfOme;YmYh>yg*oAE~kq#=-!@TJGB zk48gEfP{l=@ey@fALH>}MAskh8N)9%-0&Fp|7e=87{W1^1#bKmLEpy^{ym+($52hb z#L?yb0x2!-nUQ~cNjCa11y}&x*?4f`QQZ#*dX$8jC!A)+I8^lkK5UZH_y67cKZ3r# zl}<*Q&nB|&k7OT^P1xQlK)yL02| zSrj)EpS+aDl8Q#Ub7EM(KS_76+(Ul&nSQj2kjVOND4j-lsb@M}uAH6;)7VkrOUcXm&b0$Oje(5W#zSq{#;Un{`W*_bh~4#m=Gh}z;i$S^0$*@a=HNp zZnH--Nb?{~p_wI))d@rCS!o1405jb>DUQ~gN6;O+k{;yO=sf$e@?!=Y-#e9N!Z_9p zSCx&mi@qn#!+rNtj~KcRBk0-l9lC!Q)uYJi3347?j{-N9YbHIxj-V%ziFCV|Iwsbz|4|ha zV}yrEeGxrA@pQR0>6Ze!Zt}l7$UbH@giQ(btic$g0j$|*1pQkK%`5@#{uEYz2`naH zp1;a^CXU4@j3kS#A;_xr>(sIy39Okik#1Y82ek&#jL2?x2iEfjR(XhJu(R8;mA)2G zhxQp*(t`n50;@cxU1@GohTTqfJ(%Yb-TJ757mz(DVr()-qQ=%@l1Zd__;0N)Ze)3g zY9fl|tQq)f9hrn-z#;Su##SpHg%MxiWu~m@^9DBnuzy1y)F5x=qB;UEk!2&rdzh%a z)q^d~ke9a9mBKxY?^QQR_m!84-<#8C&EFklXXt?luc6~0j`j-8W6j`kb!3WP=z5?B zA^z*&_z9>1@Tz(~g4Krs)c`8sAv&BAS$4I|gY*gTG669CzJ>*?hzAI=2%2A(+~=g{ z39toqb$I<<7o+8@0eP~Hc_p#(kkib;R&^HrMQuuCIdj;PNm4DIA3`%x2RFNjVT7R` zJaYv#WX?s^Og?fq$-vlJiC!j3xrchB(VuMldnN1M(WrJV^8l9PsUL0QCVBt`b595Q zo;m~Paquo)MXqZeX)I=7Y^JYRHh|pAy@<}|ss}F$ZhuOz(OCZK!QMw$h;b znB`qu>gN4Rt0F&UEhwJ8Za-M@6b_Msm?Ku3JU(GA^-9=`?YzYC24;-v9xMA?*TeBYP*afrzMytU@k#5583)x5O-P?M;tw5 o;Hh^70HcxFo{RxglK=n!07*qoM6N<$g1G`pLjV8( diff --git a/docs/sphinx-docs/source/static/nonactive.png b/docs/sphinx-docs/source/static/nonactive.png deleted file mode 100644 index 4097e0b1f07546a892568eb6b985f4c7ddfa4e59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 703 zcmV;w0zmzVP)xObkZjG~mn6U&=5=KYxDK+OT1Q05Hb>!@>wA2R8sD0RliZ ze`n1~XZ`f&sTRojAn^D9FR9z#o{2(u3``J}kido;05Tn_fI-dJf&bs{zi@vuvi#t@ z^zbm)8z2inYC!;`9&7;6L>3@shVeHX*{=MD;U~;ShW~6I8Gig?Fa>E~RAdxj^kU=# zs^yx_Zu!Kkv9%*?IpnbNrAkobg*6<^`o+3=9);_ z|Nky%Cg<5Tr(s(;$j=Ph8Sb#(Td{n`%8P9Y|Ni`8$nN{Y0MiVz1q48b%qkaP`0(ok zgRMg3-QM(R!K|zT7eP)38S?W>L}B?imQPaauJ*X0YX%tr68pjafk98){zHCvMGiTm{mC3U&g;Bset~5}k5ultuM+KrQ|c4n(LSOl%Bn zSM$6o^K^xr-)^ZyHGqSaiy^|Yps(@mm6<3qK+Oy=43q$e$;oS5l0$oR{#Z9L{BPl4 z_;1_F@V{?E`KE^-9twig!qkD;FwMvk3=IrSn~pDN@oba$Z`8o>zh+^=g^xczs)E!s z0HYp74>AYYke&Z8a!=S)w<2?@@4M%(Z`(uVP&9+ZKm{{ _('Core Documentation') }}

    -{{ toctree(maxdepth=3) }} diff --git a/docs/sphinx-docs/themes/mongodb/layout.html b/docs/sphinx-docs/themes/mongodb/layout.html deleted file mode 100644 index a05fd9d49f1..00000000000 --- a/docs/sphinx-docs/themes/mongodb/layout.html +++ /dev/null @@ -1,210 +0,0 @@ -{# - basic/layout.html - ~~~~~~~~~~~~~~~~~ - - Master layout template for Sphinx themes. - - :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -#} -{%- block doctype -%} - -{%- endblock %} -{%- set reldelim1 = reldelim1 is not defined and ' »' or reldelim1 %} -{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %} -{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and - (sidebars != []) %} -{%- set url_root = pathto('', 1) %} -{# XXX necessary? #} -{%- if url_root == '#' %}{% set url_root = '' %}{% endif %} -{%- if not embedded and docstitle %} - {%- set titlesuffix = " — "|safe + docstitle|e %} -{%- else %} - {%- set titlesuffix = "" %} -{%- endif %} - -{%- macro relbar() %} - -{%- endmacro %} - -{%- macro sidebar() %} - {%- if render_sidebar %} -
    -
    - {%- block sidebarlogo %} - {%- if logo %} - - {%- endif %} - {%- endblock %} - {%- if sidebars != None %} - {#- new style sidebar: explicitly include/exclude templates #} - {%- for sidebartemplate in sidebars %} - {%- include sidebartemplate %} - {%- endfor %} - {%- else %} - {#- old style sidebars: using blocks -- should be deprecated #} - {%- block sidebartoc %} - {%- include "localtoc.html" %} - {%- include "globaltoc.html" %} - {%- endblock %} - {%- block sidebarsearch %} - {%- include "searchbox.html" %} - {%- endblock %} - {%- if customsidebar %} - {%- include customsidebar %} - {%- endif %} - {%- block sidebarsourcelink %} - {%- include "sourcelink.html" %} - {%- endblock %} - {%- block sidebarrel %} - {%- include "relations.html" %} - {%- endblock %} - - {%- endif %} -
    -
    - {%- endif %} -{%- endmacro %} - -{%- macro script() %} - - {%- for scriptfile in script_files %} - - {%- endfor %} -{%- endmacro %} - -{%- macro css() %} - - - {%- for cssfile in css_files %} - - {%- endfor %} -{%- endmacro %} - - - - - {{ metatags }} - {%- block htmltitle %} - {{ title|striptags|e }}{{ titlesuffix }} - {%- endblock %} - {{ css() }} - {%- if not embedded %} - {{ script() }} - {%- if use_opensearch %} - - {%- endif %} - {%- if favicon %} - - {%- endif %} - {%- endif %} -{%- block linktags %} - {%- if hasdoc('about') %} - - {%- endif %} - {%- if hasdoc('genindex') %} - - {%- endif %} - {%- if hasdoc('search') %} - - {%- endif %} - {%- if hasdoc('copyright') %} - - {%- endif %} - - {%- if parents %} - - {%- endif %} - {%- if next %} - - {%- endif %} - {%- if prev %} - - {%- endif %} -{%- endblock %} -{%- block extrahead %} {% endblock %} - - -{%- block header %}{% endblock %} - -{%- block relbar1 %}{{ relbar() }}{% endblock %} - -{%- block content %} - {%- block sidebar1 %} {# possible location for sidebar #} {% endblock %} - -
    - {%- block document %} -
    - {%- if render_sidebar %} -
    - {%- endif %} -
    - {% block body %} {% endblock %} -
    - {%- if render_sidebar %} -
    - {%- endif %} -
    - {%- endblock %} - - {%- block sidebar2 %}{{ sidebar() }}{% endblock %} -
    -
    -{%- endblock %} - -{%- block relbar2 %}{{ relbar() }}{% endblock %} - -{%- block footer %} - -{%- endblock %} - - - - - diff --git a/docs/sphinx-docs/themes/mongodb/localtoc.html b/docs/sphinx-docs/themes/mongodb/localtoc.html deleted file mode 100644 index 60187929dca..00000000000 --- a/docs/sphinx-docs/themes/mongodb/localtoc.html +++ /dev/null @@ -1,11 +0,0 @@ -{# - basic/localtoc.html - ~~~~~~~~~~~~~~~~~~~ - - Sphinx sidebar template: local table of contents. - - :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -#} -

    {{ _('Page Contents') }}

    -{{ toc }} diff --git a/docs/sphinx-docs/themes/mongodb/relations.html b/docs/sphinx-docs/themes/mongodb/relations.html deleted file mode 100644 index 008a0a07162..00000000000 --- a/docs/sphinx-docs/themes/mongodb/relations.html +++ /dev/null @@ -1,19 +0,0 @@ -{# - basic/relations.html - ~~~~~~~~~~~~~~~~~~~~ - - Sphinx sidebar template: relation links. - - :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -#} -{%- if prev %} -

    {{ _('Previous page') }}

    -

    {{ prev.title }}

    -{%- endif %} -{%- if next %} -

    {{ _('Next page') }}

    -

    {{ next.title }}

    -{%- endif %} diff --git a/docs/sphinx-docs/themes/mongodb/static/mongodb-docs.css_t b/docs/sphinx-docs/themes/mongodb/static/mongodb-docs.css_t deleted file mode 100644 index 8797db98daa..00000000000 --- a/docs/sphinx-docs/themes/mongodb/static/mongodb-docs.css_t +++ /dev/null @@ -1,250 +0,0 @@ -/* - * nature.css_t - * ~~~~~~~~~~~~ - * - * Sphinx stylesheet -- nature theme. - * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -@import url("basic.css"); - -/* -- page layout ----------------------------------------------------------- */ - -body { - font-family: Arial, sans-serif; - font-size: 100%; - background-color: #111; - color: #555; - margin: 0; - padding: 0; -} - -div.documentwrapper { - float: left; - width: 100%; -} - -div.bodywrapper { - margin: 0 0 0 230px; -} - -hr { - border: 1px solid #B1B4B6; -} - -div.document { - background-color: #eee; -} - -div.body { - background-color: #ffffff; - color: #3E4349; - padding: 0 30px 30px 30px; - font-size: 0.9em; -} - -div.footer { - color: #555; - width: 100%; - padding: 13px 0; - text-align: center; - font-size: 75%; -} - -div.footer a { - color: #444; - text-decoration: underline; -} - -div.related { - background-color: #6BA81E; - line-height: 32px; - color: #fff; - text-shadow: 0px 1px 0 #444; - font-size: 0.9em; -} - -div.related a { - color: #E2F3CC; -} - -div.sphinxsidebar { - font-size: 0.75em; - line-height: 1.5em; -} - -div.sphinxsidebarwrapper{ - padding: 20px 0; -} - -div.sphinxsidebar h3, -div.sphinxsidebar h4 { - font-family: Arial, sans-serif; - color: #222; - font-size: 1.2em; - font-weight: normal; - margin: 0; - padding: 5px 10px; - background-color: #ddd; - text-shadow: 1px 1px 0 white -} - -div.sphinxsidebar h4{ - font-size: 1.1em; -} - -div.sphinxsidebar h3 a { - color: #444; -} - -div.sphinxsidebar p { - color: #888; - padding: 5px 20px; -} - -div.sphinxsidebar p.logo { - color: #888; - padding: 0px; - margin-top: -10px; -} - -div.sphinxsidebar p.topless { -} - -div.sphinxsidebar ul { - margin: 10px 20px; - padding: 0; - color: #000; -} - -div.sphinxsidebar a { - color: #444; -} - -div.sphinxsidebar input { - border: 1px solid #ccc; - font-family: sans-serif; - font-size: 1em; -} - -div.sphinxsidebar input[type=text]{ - margin-left: 20px; -} - -/* -- body styles ----------------------------------------------------------- */ - -a { - color: #005B81; - text-decoration: none; -} - -a:hover { - color: #E32E00; - text-decoration: underline; -} - -div.body h1, -div.body h2, -div.body h3, -div.body h4, -div.body h5, -div.body h6 { - font-family: Arial, sans-serif; - background-color: #BED4EB; - font-weight: normal; - color: #212224; - margin: 30px 0px 10px 0px; - padding: 5px 0 5px 10px; - text-shadow: 0px 1px 0 white -} - -div.body h1 { border-top: 20px solid white; margin-top: 0; font-size: 200%; } -div.body h2 { font-size: 150%; background-color: #C8D5E3; } -div.body h3 { font-size: 120%; background-color: #D8DEE3; } -div.body h4 { font-size: 110%; background-color: #D8DEE3; } -div.body h5 { font-size: 100%; background-color: #D8DEE3; } -div.body h6 { font-size: 100%; background-color: #D8DEE3; } - -a.headerlink { - color: #c60f0f; - font-size: 0.8em; - padding: 0 4px 0 4px; - text-decoration: none; -} - -a.headerlink:hover { - background-color: #c60f0f; - color: white; -} - -div.body p, div.body dd, div.body li { - line-height: 1.5em; -} - -div.admonition p.admonition-title + p { - display: inline; -} - -div.highlight{ - background-color: white; -} - -div.note { - background-color: #eee; - border: 1px solid #ccc; -} - -div.seealso { - background-color: #ffc; - border: 1px solid #ff6; -} - -div.topic { - background-color: #eee; -} - -div.warning { - background-color: #ffe4e4; - border: 1px solid #f66; -} - -p.admonition-title { - display: inline; -} - -p.admonition-title:after { - content: ":"; -} - -pre { - padding: 10px; - background-color: White; - color: #222; - line-height: 1.2em; - border: 1px solid #C6C9CB; - font-size: 1.1em; - margin: 1.5em 0 1.5em 0; - -webkit-box-shadow: 1px 1px 1px #d8d8d8; - -moz-box-shadow: 1px 1px 1px #d8d8d8; -} - -tt { - background-color: #ecf0f3; - color: #222; - /* padding: 1px 2px; */ - font-size: 1.1em; - font-family: monospace; -} - -.viewcode-back { - font-family: Arial, sans-serif; -} - -div.viewcode-block:target { - background-color: #f4debf; - border-top: 1px solid #ac9; - border-bottom: 1px solid #ac9; -} diff --git a/docs/sphinx-docs/themes/mongodb/theme.conf b/docs/sphinx-docs/themes/mongodb/theme.conf deleted file mode 100644 index 3493f868640..00000000000 --- a/docs/sphinx-docs/themes/mongodb/theme.conf +++ /dev/null @@ -1,4 +0,0 @@ -[theme] -inherit = basic -stylesheet = mongodb-docs.css -pygments_style = tango diff --git a/examples/admin.js b/examples/admin.js deleted file mode 100644 index 2619e7ea021..00000000000 --- a/examples/admin.js +++ /dev/null @@ -1,53 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log("Connecting to " + host + ":" + port); -var db = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - db.dropDatabase(function(err, result){ - db.dropCollection('test', function(err, result) { - db.createCollection('test', function(err, collection) { - - // Erase all records in collection - collection.remove({}, function(err, r) { - db.admin(function(err, admin) { - - // Profiling level set/get - admin.profilingLevel(function(err, profilingLevel) { - console.log("Profiling level: " + profilingLevel); - }); - - // Start profiling everything - admin.setProfilingLevel('all', function(err, level) { - console.log("Profiling level: " + level); - - // Read records, creating a profiling event - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { - // Stop profiling - admin.setProfilingLevel('off', function(err, level) { - // Print all profiling info - admin.profilingInfo(function(err, info) { - console.dir(info); - - // Validate returns a hash if all is well or return an error hash if there is a - // problem. - admin.validateCollection(collection.collectionName, function(err, result) { - console.dir(result); - db.close(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/examples/blog.js b/examples/blog.js deleted file mode 100644 index ff9c16b61fb..00000000000 --- a/examples/blog.js +++ /dev/null @@ -1,102 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -var LINE_SIZE = 120; - -console.log("Connecting to " + host + ":" + port); -var db = new Db('node-mongo-blog', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - db.dropDatabase(function(err, result) { - console.log("==================================================================================="); - console.log(">> Adding Authors"); - db.collection('authors', function(err, collection) { - collection.createIndex(["meta", ['_id', 1], ['name', 1], ['age', 1]], function(err, indexName) { - console.log("==================================================================================="); - var authors = {}; - - // Insert authors - collection.insert([{'name':'William Shakespeare', 'email':'william@shakespeare.com', 'age':587}, - {'name':'Jorge Luis Borges', 'email':'jorge@borges.com', 'age':123}], function(err, docs) { - docs.forEach(function(doc) { - console.dir(doc); - authors[doc.name] = doc; - }); - }); - - console.log("==================================================================================="); - console.log(">> Authors ordered by age ascending"); - console.log("==================================================================================="); - collection.find({}, {'sort':[['age', 1]]}, function(err, cursor) { - cursor.each(function(err, author) { - if(author != null) { - console.log("[" + author.name + "]:[" + author.email + "]:[" + author.age + "]"); - } else { - console.log("==================================================================================="); - console.log(">> Adding users"); - console.log("==================================================================================="); - db.collection('users', function(err, userCollection) { - var users = {}; - - userCollection.insert([{'login':'jdoe', 'name':'John Doe', 'email':'john@doe.com'}, - {'login':'lsmith', 'name':'Lucy Smith', 'email':'lucy@smith.com'}], function(err, docs) { - docs.forEach(function(doc) { - console.dir(doc); - users[doc.login] = doc; - }); - }); - - console.log("==================================================================================="); - console.log(">> Users ordered by login ascending"); - console.log("==================================================================================="); - userCollection.find({}, {'sort':[['login', 1]]}, function(err, cursor) { - cursor.each(function(err, user) { - if(user != null) { - console.log("[" + user.login + "]:[" + user.name + "]:[" + user.email + "]"); - } else { - console.log("==================================================================================="); - console.log(">> Adding articles"); - console.log("==================================================================================="); - db.collection('articles', function(err, articlesCollection) { - articlesCollection.insert([ - { 'title':'Caminando por Buenos Aires', - 'body':'Las callecitas de Buenos Aires tienen ese no se que...', - 'author_id':authors['Jorge Luis Borges']._id}, - { 'title':'I must have seen thy face before', - 'body':'Thine eyes call me in a new way', - 'author_id':authors['William Shakespeare']._id, - 'comments':[{'user_id':users['jdoe']._id, 'body':"great article!"}] - } - ], function(err, docs) { - docs.forEach(function(doc) { - console.dir(doc); - }); - }) - - console.log("==================================================================================="); - console.log(">> Articles ordered by title ascending"); - console.log("==================================================================================="); - articlesCollection.find({}, {'sort':[['title', 1]]}, function(err, cursor) { - cursor.each(function(err, article) { - if(article != null) { - console.log("[" + article.title + "]:[" + article.body + "]:[" + article.author_id.toHexString() + "]"); - console.log(">> Closing connection"); - db.close(); - } - }); - }); - }); - } - }); - }); - }); - } - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/examples/capped.js b/examples/capped.js deleted file mode 100644 index fb98911d0af..00000000000 --- a/examples/capped.js +++ /dev/null @@ -1,27 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log("Connecting to " + host + ":" + port); -var db = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - db.dropCollection('test', function(err, result) { - // A capped collection has a max size and optionally a max number of records. - // Old records get pushed out by new ones once the size or max num records is - // reached. - db.createCollection('test', {'capped':true, 'size':1024, 'max':12}, function(err, collection) { - for(var i = 0; i < 100; i++) { collection.insert({'a':i}); } - - // We will only see the last 12 records - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { - console.log("The number of records: " + items.length); - db.close(); - }) - }) - }); - }); -}); \ No newline at end of file diff --git a/examples/cursor.js b/examples/cursor.js deleted file mode 100644 index cd5c5f3bc54..00000000000 --- a/examples/cursor.js +++ /dev/null @@ -1,70 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log("Connecting to " + host + ":" + port); -var db = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - db.collection('test', function(err, collection) { - // Erase all records from collection, if any - collection.remove(function(err, result) { - - // Insert 3 records - for(var i = 0; i < 3; i++) { - collection.insert({'a':i}); - } - - // Cursors don't run their queries until you actually attempt to retrieve data - // from them. - - // Find returns a Cursor, which is Enumerable. You can iterate: - collection.find(function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) console.dir(item); - }); - }); - - // You can turn it into an array - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { - console.log("count: " + items.length); - }); - }); - - // You can iterate after turning it into an array (the cursor will iterate over - // the copy of the array that it saves internally.) - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { - cursor.each(function(err, item) { - if(item != null) console.dir(item); - }); - }); - }); - - // You can get the next object - collection.find(function(err, cursor) { - cursor.nextObject(function(err, item) { - if(item != null) console.dir(item); - }); - }); - - // next_object returns null if there are no more objects that match - collection.find(function(err, cursor) { - cursor.nextObject(function(err, item) { - cursor.nextObject(function(err, item) { - cursor.nextObject(function(err, item) { - cursor.nextObject(function(err, item) { - console.log("nextObject returned: "); - console.dir(item); - db.close(); - }); - }); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/examples/gridfs.js b/examples/gridfs.js deleted file mode 100644 index 359af250e29..00000000000 --- a/examples/gridfs.js +++ /dev/null @@ -1,149 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server, - GridStore = require('../lib/mongodb').GridStore; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log(">> Connecting to " + host + ":" + port); -var db1 = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db1.open(function(err, db) { - // Write a new file - var gridStore = new GridStore(db, "foobar", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello world!", function(err, gridStore) { - gridStore.close(function(err, result) { - // Read the file and dump the contents - dump(db, 'foobar'); - - // Append more data - gridStore = new GridStore(db, 'foobar', "w+"); - gridStore.open(function(err, gridStore) { - gridStore.write('\n', function(err, gridStore) { - gridStore.puts('line two', function(err, gridStore) { - gridStore.close(function(err, result) { - dump(db, 'foobar'); - - // Overwrite - gridStore = new GridStore(db, 'foobar', "w"); - gridStore.open(function(err, gridStore) { - gridStore.write('hello, sailor!', function(err, gridStore) { - gridStore.close(function(err, result) { - dump(db, 'foobar', function() { - db.close(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -}); - -var db2 = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db2.open(function(err, db) { - // File existence tests - var gridStore = new GridStore(db, "foobar2", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write( 'hello sailor', function(err, gridStore) { - gridStore.close(function(err, result) { - GridStore.exist(db, 'foobar2', function(err, result) { - console.log("File 'foobar2' exists: " + result); - }); - - GridStore.exist(db, 'does-not-exist', function(err, result) { - console.log("File 'does-not-exist' exists: " + result); - }); - - // Read with offset(uses seek) - GridStore.read(db, 'foobar2', 6, 7, function(err, data) { - console.log(data); - }); - - // Rewind/seek/tell - var gridStore2 = new GridStore(db, 'foobar2', 'w'); - gridStore2.open(function(err, gridStore) { - gridStore.write('hello, world!', function(err, gridStore){}); - gridStore.rewind(function(){}); - gridStore.write('xyzzz', function(err, gridStore){}); - gridStore.tell(function(tell) { - console.log("tell: " + tell); // Should be 5 - }); - gridStore.seek(4, function(err, gridStore){}); - gridStore.write('y', function(){}); - gridStore.close(function() { - dump(db, 'foobar2'); - - // Unlink file (delete) - GridStore.unlink(db, 'foobar2', function(err, gridStore) { - GridStore.exist(db, 'foobar2', function(err, result) { - console.log("File 'foobar2' exists: " + result); - db.close(); - }); - }); - }); - }); - }); - }); - }); -}); - -var db3 = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db3.open(function(err, db) { - // Metadata - var gridStore = new GridStore(db, "foobar3", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write('hello, world!', function(err, gridStore){}); - gridStore.close(function(err, gridStore) { - gridStore = new GridStore(db, 'foobar3', "r"); - gridStore.open(function(err, gridStore) { - console.log("contentType: " + gridStore.contentType); - console.log("uploadDate: " + gridStore.uploadDate); - console.log("chunkSize: " + gridStore.chunkSize); - console.log("metadata: " + gridStore.metadata); - }); - - // Add some metadata - gridStore = new GridStore(db, 'foobar3', "w+"); - gridStore.open(function(err, gridStore) { - gridStore.contentType = 'text/xml'; - gridStore.metadata = {'a':1}; - gridStore.close(function(err, gridStore) { - // Print the metadata - gridStore = new GridStore(db, 'foobar3', "r"); - gridStore.open(function(err, gridStore) { - console.log("contentType: " + gridStore.contentType); - console.log("uploadDate: " + gridStore.uploadDate); - console.log("chunkSize: " + gridStore.chunkSize); - console.log("metadata: " + gridStore.metadata); - db.close(); - }); - }); - }); - }); - }); - - // You can also set meta data when initially writing to a file - // setting root means that the file and its chunks are stored in a different root - // collection: instead of gridfs.files and gridfs.chunks, here we use - // my_files.files and my_files.chunks - var gridStore = new GridStore(db, "foobar3", "w", {'content_type':'text/plain', - 'metadata':{'a':1}, 'chunk_size': 1024*4, 'root':'my_files'}); - gridStore.open(function(err, gridStore) { - gridStore.write('hello, world!', function(err, gridStore){}); - gridStore.close(function() { - }); - }); -}); - -function dump(db, filename, callback) { - GridStore.read(db, filename, function(err, data) { - console.log(data); - if(callback != null) callback(); - }); -} \ No newline at end of file diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 73d3348a857..00000000000 --- a/examples/index.js +++ /dev/null @@ -1,62 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server, - mongo = require('../lib/mongodb'); - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log(">> Connecting to " + host + ":" + port); -var db = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - console.log(">> Dropping collection test"); - db.dropCollection('test', function(err, result) { - console.log("dropped: "); - console.dir(result); - }); - - console.log(">> Creating collection test"); - db.collection('test', function(err, collection) { - console.log("created: "); - console.dir(collection); - - var objectCount = 100; - var objects = []; - var messages = ["hola", "hello", "aloha", "ciao"]; - console.log(">> Generate test data"); - for(var i = 0; i < objectCount; i++) { - objects.push({'number':i, 'rndm':((5*Math.random()) + 1), 'msg':messages[parseInt(4*Math.random())]}) - } - console.log("generated"); - - console.log(">> Inserting data (" + objects.length + ")"); - collection.insert(objects); - console.log("inserted"); - - console.log(">> Creating index") - collection.createIndex([['all'], ['_id', 1], ['number', 1], ['rndm', 1], ['msg', 1]], function(err, indexName) { - console.log("created index: " + indexName); - - console.log(">> Gathering index information"); - - collection.indexInformation(function(err, doc) { - console.log("indexInformation: "); - console.dir(doc); - - console.log(">> Dropping index"); - collection.dropIndex('all_1__id_1_number_1_rndm_1_msg_1', function(err, result) { - console.log("dropped: "); - console.dir(result); - - console.log(">> Gathering index information"); - collection.indexInformation(function(err, doc) { - console.log("indexInformation: "); - console.dir(doc); - console.log(">> Closing connection"); - db.close(); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/examples/info.js b/examples/info.js deleted file mode 100644 index 54ca60ce9ee..00000000000 --- a/examples/info.js +++ /dev/null @@ -1,48 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log("Connecting to " + host + ":" + port); -var db = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - db.collection('test', function(err, collection) { - - // Remove all existing documents in collection - collection.remove(function(err, result) { - - // Insert 3 records - for(var i = 0; i < 3; i++) { - collection.insert({'a':i}); - } - - // Show collection names in the database - db.collectionNames(function(err, names) { - names.forEach(function(name) { - console.dir(name); - }); - }); - - // More information about each collection - db.collectionsInfo(function(err, cursor) { - cursor.toArray(function(err, items) { - items.forEach(function(item) { - console.dir(item); - }); - }); - }) - - // Index information - db.createIndex('test', 'a', function(err, indexName) { - db.indexInformation('test', function(err, doc) { - console.dir(doc); - collection.drop(function(err, result) { - db.close(); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/examples/oplog.js b/examples/oplog.js deleted file mode 100644 index 4441a6135f9..00000000000 --- a/examples/oplog.js +++ /dev/null @@ -1,114 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server, - Cursor = require('../lib/mongodb').Cursor; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -Slave = function() { - this.running = false; - this.callbacks = []; - //no native_parser right now (because timestamps) - //no strict mode (because system db signed with $ db.js line 189) - //connect without dbName for querying not only "local" db - console.log("Connecting to " + host + ":" + port); - this.db = new Db('testing', new Server(host, port, {}), {}); -} - -//start watching -Slave.prototype.start = function() { - var self = this; - if (this.running) return; - - this.db.open(function(err, db) { - if (err) { - console.log('> MongoSlave error' + err); - process.exit(1); - } - - db.collection('local.oplog.$main', function(err, collection) { - if (! collection) { - console.log('> MongoSlave - local.oplog.$main not found'); - self.stop(); - return false; - } - - process.on('SIGINT', function () { - self.stop(); //tailable cursor should be stopped manually - }); - - //get last row for init TS - collection.find({}, {'limit': 1, 'sort': [['$natural', -1]]}, function(err, cursor) { - cursor.toArray(function(err, items) { - if (items.length) { - console.log('> MongoSlave started'); - self.running = true; - self._runSlave(collection, items[0]['ts']); - } else if (err) { - console.log(err); - self.stop(); - } - }); - }); - }); - }); -} - -//stop watching -Slave.prototype.stop = function() { - if (!this.running) return; - console.log('> MongoSlave stopped'); - this.running = false; - this.db.close(); -} - -Slave.prototype._runSlave = function(collection, time) { - - var self = this; - - //watch oplog INFINITE (until Slave.stop()) - collection.find({'ts': {'$gt': time}}, {'tailable': 1, 'sort': [['$natural', 1]]}, function(err, cursor) { - cursor.each(function(err, item) { - if (cursor.state == Cursor.CLOSED) { //broken cursor - self.running && self._runSlave(collection, time); - return; - } - time = item['ts']; - - switch(item['op']) { - case 'i': //inserted - self._emitObj(item['o']); - break; - case 'u': //updated - self.db.collection(item['ns'], function(err, collection) { - collection.findOne(item['o2']['_id'], {}, function(err, item) { - item && self._emitObj(item); - }); - }); - break; - case 'd': //deleted - //nothing to do - break; - } - }); - }); -} - -Slave.prototype._emitObj = function (obj) { - for(var i in this.callbacks) this.callbacks[i].call(this, obj); -} - -Slave.prototype.onObject = function(callback) { - this.callbacks.push(callback); -} - - -//just for example -var watcher = new Slave(); - -watcher.onObject(function(obj) { - console.dir(obj); -}); - -watcher.start(); \ No newline at end of file diff --git a/examples/queries.js b/examples/queries.js deleted file mode 100644 index 19cc4737587..00000000000 --- a/examples/queries.js +++ /dev/null @@ -1,125 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log("Connecting to " + host + ":" + port); - -var db = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - db.dropDatabase(function() { - // Fetch the collection test - db.collection('test', function(err, collection) { - // Remove all records in collection if any - collection.remove(function(err, result) { - // Insert three records - collection.insert([{'a':1}, {'a':2}, {'b':3}], function(docs) { - // Count the number of records - collection.count(function(err, count) { - console.log("There are " + count + " records."); - }); - - // Find all records. find() returns a cursor - collection.find(function(err, cursor) { - // Print each row, each document has an _id field added on insert - // to override the basic behaviour implement a primary key factory - // that provides a 12 byte value - console.log("Printing docs from Cursor Each") - cursor.each(function(err, doc) { - if(doc != null) console.log("Doc from Each "); - console.dir(doc); - }) - }); - // Cursor has an to array method that reads in all the records to memory - collection.find(function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Printing docs from Array") - docs.forEach(function(doc) { - console.log("Doc from Array "); - console.dir(doc); - }); - }); - }); - - // Different methods to access records (no printing of the results) - - // Locate specific document by key - collection.find({'a':1}, function(err, cursor) { - cursor.nextObject(function(err, doc) { - console.log("Returned #1 documents"); - }); - }); - - // Find records sort by 'a', skip 1, limit 2 records - // Sort can be a single name, array, associate array or ordered hash - collection.find({}, {'skip':1, 'limit':1, 'sort':'a'}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }) - }); - - // Find all records with 'a' > 1, you can also use $lt, $gte or $lte - collection.find({'a':{'$gt':1}}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }); - }); - - collection.find({'a':{'$gt':1, '$lte':3}}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }); - }); - - // Find all records with 'a' in a set of values - collection.find({'a':{'$in':[1,2]}}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }); - }); - - // Find by regexp - collection.find({'a':/[1|2]/}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }); - }); - - // Print Query explanation - collection.find({'a':/[1|2]/}, function(err, cursor) { - cursor.explain(function(err, doc) { - console.log("-------------------------- Explanation"); - console.dir(doc); - }) - }); - - // Use a hint with a query, hint's can also be store in the collection - // and will be applied to each query done through the collection. - // Hint's can also be specified by query which will override the - // hint's associated with the collection - collection.createIndex('a', function(err, indexName) { - collection.hint = 'a'; - - // You will see a different explanation now that the hint was set - collection.find({'a':/[1|2]/}, function(err, cursor) { - cursor.explain(function(err, doc) { - console.log("-------------------------- Explanation"); - console.dir(doc); - }) - }); - - collection.find({'a':/[1|2]/}, {'hint':'a'}, function(err, cursor) { - cursor.explain(function(err, doc) { - console.log("-------------------------- Explanation"); - console.dir(doc); - db.close(); - }) - }); - }); - }); - }); - }); - }); -}); diff --git a/examples/replSetServersQueries.js b/examples/replSetServersQueries.js deleted file mode 100644 index ab82ac68142..00000000000 --- a/examples/replSetServersQueries.js +++ /dev/null @@ -1,138 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server, - ReplSetServers = require('../lib/mongodb').ReplSetServers; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -var port1 = 27018; -var port2 = 27019; -var server = new Server(host, port, {}); -var server1 = new Server(host, port1, {}); -var server2 = new Server(host, port2, {}); -var servers = new Array(); -servers[0] = server2; -servers[1] = server1; -servers[2] = server; - -var replStat = new ReplSetServers(servers); -console.log("Connecting to " + host + ":" + port); -console.log("Connecting to " + host1 + ":" + port1); -console.log("Connecting to " + host2 + ":" + port2); -var db = new Db('node-mongo-examples', replStat, {native_parser:true}); -db.open(function(err, db) { - db.dropDatabase(function() { - // Fetch the collection test - db.collection('test', function(err, collection) { - // Remove all records in collection if any - collection.remove(function(err, collection) { - // Insert three records - collection.insert([{'a':1}, {'a':2}, {'b':3}], function(docs) { - // Count the number of records - collection.count(function(err, count) { - console.log("There are " + count + " records."); - }); - - // Find all records. find() returns a cursor - collection.find(function(err, cursor) { - // Print each row, each document has an _id field added on insert - // to override the basic behaviour implement a primary key factory - // that provides a 12 byte value - console.log("Printing docs from Cursor Each") - cursor.each(function(err, doc) { - if(doc != null) console.log("Doc from Each "); - console.dir(doc); - }) - }); - // Cursor has an to array method that reads in all the records to memory - collection.find(function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Printing docs from Array") - docs.forEach(function(doc) { - console.log("Doc from Array "); - console.dir(doc); - }); - }); - }); - - // Different methods to access records (no printing of the results) - - // Locate specific document by key - collection.find({'a':1}, function(err, cursor) { - cursor.nextObject(function(err, doc) { - console.log("Returned #1 documents"); - }); - }); - - // Find records sort by 'a', skip 1, limit 2 records - // Sort can be a single name, array, associate array or ordered hash - collection.find({}, {'skip':1, 'limit':1, 'sort':'a'}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }) - }); - - // Find all records with 'a' > 1, you can also use $lt, $gte or $lte - collection.find({'a':{'$gt':1}}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }); - }); - - collection.find({'a':{'$gt':1, '$lte':3}}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }); - }); - - // Find all records with 'a' in a set of values - collection.find({'a':{'$in':[1,2]}}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }); - }); - - // Find by regexp - collection.find({'a':/[1|2]/}, function(err, cursor) { - cursor.toArray(function(err, docs) { - console.log("Returned #" + docs.length + " documents"); - }); - }); - - // Print Query explanation - collection.find({'a':/[1|2]/}, function(err, cursor) { - cursor.explain(function(err, doc) { - console.log("-------------------------- Explanation"); - console.dir(doc); - }) - }); - - // Use a hint with a query, hint's can also be store in the collection - // and will be applied to each query done through the collection. - // Hint's can also be specified by query which will override the - // hint's associated with the collection - collection.createIndex('a', function(err, indexName) { - collection.hint = 'a'; - - // You will see a different explanation now that the hint was set - collection.find({'a':/[1|2]/}, function(err, cursor) { - cursor.explain(function(err, doc) { - console.log("-------------------------- Explanation"); - console.dir(doc); - }) - }); - - collection.find({'a':/[1|2]/}, {'hint':'a'}, function(err, cursor) { - cursor.explain(function(err, doc) { - console.log("-------------------------- Explanation"); - console.dir(doc); - db.close(); - }) - }); - }); - }); - }); - }); - }); -}); diff --git a/examples/replSetServersSimple.js b/examples/replSetServersSimple.js deleted file mode 100644 index 9ca3f3f78b1..00000000000 --- a/examples/replSetServersSimple.js +++ /dev/null @@ -1,66 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Admin = require('../lib/mongodb').Admin, - DbCommand = require('../lib/mongodb/commands/db_command').DbCommand, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server, - ReplSetServers = require('../lib/mongodb').ReplSetServers, - CheckMaster = require('../lib/mongodb').CheckMaster; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -var port1 = 27018; -var port2 = 27019; - - -console.log("Connecting to " + host + ":" + port); -console.log("Connecting to " + host + ":" + port1); -console.log("Connecting to " + host + ":" + port2); - -var server = new Server(host, port, {}); -var server1 = new Server(host, port1, {}); -var server2 = new Server(host, port2, {}); -var servers = new Array(); -servers[0] = server2; -servers[1] = server1; -servers[2] = server; - -var replStat = new ReplSetServers(servers); - -var db = new Db('mongo-example', replStat, {native_parser:true}); -db.open(function(err, db) { - - db.dropDatabase(function(err, result) { - db.collection('test', function(err, collection) { - collection.remove(function(err, collection) { - // Insert 3 records - for(var i = 0; i < 3; i++) { - collection.insert({'a':i}); - } - - collection.count(function(err, count) { - console.log("There are " + count + " records in the test collection. Here they are:"); - - collection.find(function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) { - console.dir(item); - console.log("created at " + new Date(item._id.generationTime) + "\n") - } - // Null signifies end of iterator - if(item == null) { - // Destory the collection - collection.drop(function(err, collection) { - db.close(); - }); - } - }); - }); - }); - }); - }); - }); -}); - - - diff --git a/examples/simple.js b/examples/simple.js deleted file mode 100644 index 9bcdf250d90..00000000000 --- a/examples/simple.js +++ /dev/null @@ -1,42 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log("Connecting to " + host + ":" + port); -var db = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - db.dropDatabase(function(err, result) { - db.collection('test', function(err, collection) { - // Erase all records from the collection, if any - collection.remove({}, function(err, result) { - // Insert 3 records - for(var i = 0; i < 3; i++) { - collection.insert({'a':i}); - } - - collection.count(function(err, count) { - console.log("There are " + count + " records in the test collection. Here they are:"); - - collection.find(function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) { - console.dir(item); - console.log("created at " + new Date(item._id.generationTime) + "\n") - } - // Null signifies end of iterator - if(item == null) { - // Destory the collection - collection.drop(function(err, collection) { - db.close(); - }); - } - }); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/examples/strict.js b/examples/strict.js deleted file mode 100644 index 45c739c05d9..00000000000 --- a/examples/strict.js +++ /dev/null @@ -1,36 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log("Connecting to " + host + ":" + port); -var db = new Db('node-mongo-examples', new Server(host, port, {}), {native_parser:true}); -db.open(function(err, db) { - db.dropCollection('does-not-exist', function(err, result) { - db.createCollection('test', function(err, collection) { - db.strict = true; - - // Can't reference collections that does not exist in strict mode - db.collection('does-not-exist', function(err, collection) { - if(err instanceof Error) { - console.log("expected error: " + err.message); - } - - // Can't create collections that does not exist in strict mode - db.createCollection('test', function(err, collection) { - if(err instanceof Error) { - console.log("expected error: " + err.message); - } - - // Remove the strict mode - db.strict = false; - db.dropCollection('test', function(err, collection) { - db.close(); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/examples/types.js b/examples/types.js deleted file mode 100644 index efff89a9df6..00000000000 --- a/examples/types.js +++ /dev/null @@ -1,42 +0,0 @@ -var Db = require('../lib/mongodb').Db, - Connection = require('../lib/mongodb').Connection, - Server = require('../lib/mongodb').Server, - BSON = require('../lib/mongodb').BSONPure; - -var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; -var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; - -console.log("Connecting to " + host + ":" + port); -var db = new Db('node-mongo-examples', new Server(host, port, {}), {}); -db.open(function(err, db) { - db.collection('test', function(err, collection) { - // Remove all existing documents in collection - collection.remove(function(err, result) { - // Insert record with all the available types of values - collection.insert({ - 'array':[1,2,3], - 'string':'hello', - 'hash':{'a':1, 'b':2}, - 'date':new Date(), // Stores only milisecond resolution - 'oid':new BSON.ObjectID(), - 'binary':new BSON.Binary("123"), - 'int':42, - 'float':33.3333, - 'regexp':/foobar/i, - 'regexp2':/foobar2/, - 'boolean':true, - 'where':new BSON.Code('this.x == 3'), - 'dbref':new BSON.DBRef(collection.collectionName, new BSON.ObjectID()), - 'null':null - }, function(err, doc) { - // Locate the first document - collection.findOne(function(err, document) { - console.dir(document); - collection.remove(function(err, collection) { - db.close(); - }); - }) - }); - }); - }); -}); \ No newline at end of file diff --git a/examples/url.js b/examples/url.js deleted file mode 100644 index b04c29fe48f..00000000000 --- a/examples/url.js +++ /dev/null @@ -1,12 +0,0 @@ -var Db = require('../lib/mongodb').Db, - connect = require('../lib/mongodb').connect; - -console.log('Connecting to ' + Db.DEFAULT_URL); -connect(Db.DEFAULT_URL, function(err, db) { - db.dropDatabase(function(err, result) { - db.collection('test', function(err, collection) { - collection.insert({'a':1}); - db.close(); - }); - }); -}); diff --git a/external-libs/bson/.gitignore b/external-libs/bson/.gitignore deleted file mode 100644 index 92bdc577731..00000000000 --- a/external-libs/bson/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -build/ -bson.node -.lock-wscript \ No newline at end of file diff --git a/external-libs/bson/Makefile b/external-libs/bson/Makefile deleted file mode 100644 index ad877d4bd3c..00000000000 --- a/external-libs/bson/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -NODE = node -name = all -JOBS = 1 - -all: - rm -rf build .lock-wscript bson.node - node-waf configure build - cp -R ./build/Release/bson.node . || true - @$(NODE) --expose-gc test/test_bson.js - @$(NODE) --expose-gc test/test_full_bson.js - # @$(NODE) --expose-gc test/test_stackless_bson.js - -all_debug: - rm -rf build .lock-wscript bson.node - node-waf --debug configure build - cp -R ./build/Release/bson.node . || true - @$(NODE) --expose-gc test/test_bson.js - @$(NODE) --expose-gc test/test_full_bson.js - # @$(NODE) --expose-gc test/test_stackless_bson.js - -test: - @$(NODE) --expose-gc test/test_bson.js - @$(NODE) --expose-gc test/test_full_bson.js - # @$(NODE) --expose-gc test/test_stackless_bson.js - -clang: - rm -rf build .lock-wscript bson.node - CXX=clang node-waf configure build - cp -R ./build/Release/bson.node . || true - @$(NODE) --expose-gc test/test_bson.js - @$(NODE) --expose-gc test/test_full_bson.js - # @$(NODE) --expose-gc test/test_stackless_bson.js - -clang_debug: - rm -rf build .lock-wscript bson.node - CXX=clang node-waf --debug configure build - cp -R ./build/Release/bson.node . || true - @$(NODE) --expose-gc test/test_bson.js - @$(NODE) --expose-gc test/test_full_bson.js - # @$(NODE) --expose-gc test/test_stackless_bson.js - -clean: - rm -rf build .lock-wscript bson.node - -.PHONY: all \ No newline at end of file diff --git a/external-libs/bson/bson.cc b/external-libs/bson/bson.cc deleted file mode 100644 index decc28f1ac6..00000000000 --- a/external-libs/bson/bson.cc +++ /dev/null @@ -1,2334 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bson.h" - -using namespace v8; -using namespace node; -using namespace std; - -// BSON DATA TYPES -const uint32_t BSON_DATA_NUMBER = 1; -const uint32_t BSON_DATA_STRING = 2; -const uint32_t BSON_DATA_OBJECT = 3; -const uint32_t BSON_DATA_ARRAY = 4; -const uint32_t BSON_DATA_BINARY = 5; -const uint32_t BSON_DATA_OID = 7; -const uint32_t BSON_DATA_BOOLEAN = 8; -const uint32_t BSON_DATA_DATE = 9; -const uint32_t BSON_DATA_NULL = 10; -const uint32_t BSON_DATA_REGEXP = 11; -const uint32_t BSON_DATA_CODE = 13; -const uint32_t BSON_DATA_SYMBOL = 14; -const uint32_t BSON_DATA_CODE_W_SCOPE = 15; -const uint32_t BSON_DATA_INT = 16; -const uint32_t BSON_DATA_TIMESTAMP = 17; -const uint32_t BSON_DATA_LONG = 18; -const uint32_t BSON_DATA_MIN_KEY = 0xff; -const uint32_t BSON_DATA_MAX_KEY = 0x7f; - -const int32_t BSON_INT32_MAX = (int32_t)2147483647L; -const int32_t BSON_INT32_MIN = (int32_t)(-1) * 2147483648L; - -const int64_t BSON_INT64_MAX = ((int64_t)1 << 63) - 1; -const int64_t BSON_INT64_MIN = (int64_t)-1 << 63; - -const int64_t JS_INT_MAX = (int64_t)1 << 53; -const int64_t JS_INT_MIN = (int64_t)-1 << 53; - -static Handle VException(const char *msg) { - HandleScope scope; - return ThrowException(Exception::Error(String::New(msg))); - }; - -Persistent BSON::constructor_template; - -void BSON::Initialize(v8::Handle target) { - // Grab the scope of the call from Node - HandleScope scope; - // Define a new function template - Local t = FunctionTemplate::New(New); - constructor_template = Persistent::New(t); - constructor_template->InstanceTemplate()->SetInternalFieldCount(1); - constructor_template->SetClassName(String::NewSymbol("BSON")); - - // Instance methods - NODE_SET_PROTOTYPE_METHOD(constructor_template, "calculateObjectSize", CalculateObjectSize); - NODE_SET_PROTOTYPE_METHOD(constructor_template, "serialize", BSONSerialize); - NODE_SET_PROTOTYPE_METHOD(constructor_template, "serializeWithBufferAndIndex", SerializeWithBufferAndIndex); - NODE_SET_PROTOTYPE_METHOD(constructor_template, "deserialize", BSONDeserialize); - NODE_SET_PROTOTYPE_METHOD(constructor_template, "deserializeStream", BSONDeserializeStream); - - // Experimental - // NODE_SET_PROTOTYPE_METHOD(constructor_template, "calculateObjectSize2", CalculateObjectSize2); - // NODE_SET_PROTOTYPE_METHOD(constructor_template, "serialize2", BSONSerialize2); - // NODE_SET_METHOD(constructor_template->GetFunction(), "serialize2", BSONSerialize2); - - target->ForceSet(String::NewSymbol("BSON"), constructor_template->GetFunction()); -} - -// Create a new instance of BSON and assing it the existing context -Handle BSON::New(const Arguments &args) { - HandleScope scope; - - // Check that we have an array - if(args.Length() == 1 && args[0]->IsArray()) { - // Cast the array to a local reference - Local array = Local::Cast(args[0]); - - if(array->Length() > 0) { - // Create a bson object instance and return it - BSON *bson = new BSON(); - - // Setup pre-allocated comparision objects - bson->_bsontypeString = Persistent::New(String::New("_bsontype")); - bson->_longLowString = Persistent::New(String::New("low_")); - bson->_longHighString = Persistent::New(String::New("high_")); - bson->_objectIDidString = Persistent::New(String::New("id")); - bson->_binaryPositionString = Persistent::New(String::New("position")); - bson->_binarySubTypeString = Persistent::New(String::New("sub_type")); - bson->_binaryBufferString = Persistent::New(String::New("buffer")); - bson->_doubleValueString = Persistent::New(String::New("value")); - bson->_symbolValueString = Persistent::New(String::New("value")); - bson->_dbRefRefString = Persistent::New(String::New("$ref")); - bson->_dbRefIdRefString = Persistent::New(String::New("$id")); - bson->_dbRefDbRefString = Persistent::New(String::New("$db")); - bson->_dbRefNamespaceString = Persistent::New(String::New("namespace")); - bson->_dbRefDbString = Persistent::New(String::New("db")); - bson->_dbRefOidString = Persistent::New(String::New("oid")); - - // total number of found classes - uint32_t numberOfClasses = 0; - - // Iterate over all entries to save the instantiate funtions - for(uint32_t i = 0; i < array->Length(); i++) { - // Let's get a reference to the function - Local func = Local::Cast(array->Get(i)); - Local functionName = func->GetName()->ToString(); - - // Save the functions making them persistant handles (they don't get collected) - if(functionName->StrictEquals(String::New("Long"))) { - bson->longConstructor = Persistent::New(func); - bson->longString = Persistent::New(String::New("Long")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("ObjectID"))) { - bson->objectIDConstructor = Persistent::New(func); - bson->objectIDString = Persistent::New(String::New("ObjectID")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("Binary"))) { - bson->binaryConstructor = Persistent::New(func); - bson->binaryString = Persistent::New(String::New("Binary")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("Code"))) { - bson->codeConstructor = Persistent::New(func); - bson->codeString = Persistent::New(String::New("Code")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("DBRef"))) { - bson->dbrefConstructor = Persistent::New(func); - bson->dbrefString = Persistent::New(String::New("DBRef")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("Symbol"))) { - bson->symbolConstructor = Persistent::New(func); - bson->symbolString = Persistent::New(String::New("Symbol")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("Double"))) { - bson->doubleConstructor = Persistent::New(func); - bson->doubleString = Persistent::New(String::New("Double")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("Timestamp"))) { - bson->timestampConstructor = Persistent::New(func); - bson->timestampString = Persistent::New(String::New("Timestamp")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("MinKey"))) { - bson->minKeyConstructor = Persistent::New(func); - bson->minKeyString = Persistent::New(String::New("MinKey")); - numberOfClasses = numberOfClasses + 1; - } else if(functionName->StrictEquals(String::New("MaxKey"))) { - bson->maxKeyConstructor = Persistent::New(func); - bson->maxKeyString = Persistent::New(String::New("MaxKey")); - numberOfClasses = numberOfClasses + 1; - } - } - - // Check if we have the right number of constructors otherwise throw an error - if(numberOfClasses != 10) { - // Destroy object - delete(bson); - // Fire exception - return VException("Missing function constructor for either [Long/ObjectID/Binary/Code/DbRef/Symbol/Double/Timestamp/MinKey/MaxKey]"); - } else { - bson->Wrap(args.This()); - return args.This(); - } - } else { - return VException("No types passed in"); - } - } else { - return VException("Argument passed in must be an array of types"); - } -} - -void BSON::write_int32(char *data, uint32_t value) { - // Write the int to the char* - memcpy(data, &value, 4); -} - -void BSON::write_double(char *data, double value) { - // Write the double to the char* - memcpy(data, &value, 8); -} - -void BSON::write_int64(char *data, int64_t value) { - // Write the int to the char* - memcpy(data, &value, 8); -} - -char *BSON::check_key(Local key) { - // Allocate space for they key string - char *key_str = (char *)malloc(key->Utf8Length() * sizeof(char) + 1); - // Error string - char *error_str = (char *)malloc(256 * sizeof(char)); - // Decode the key - ssize_t len = DecodeBytes(key, BINARY); - ssize_t written = DecodeWrite(key_str, len, key, BINARY); - *(key_str + key->Utf8Length()) = '\0'; - // Check if we have a valid key - if(key->Utf8Length() > 0 && *(key_str) == '$') { - // Create the string - sprintf(error_str, "key %s must not start with '$'", key_str); - // Free up memory - free(key_str); - // Throw exception with string - throw error_str; - } else if(key->Utf8Length() > 0 && strchr(key_str, '.') != NULL) { - // Create the string - sprintf(error_str, "key %s must not contain '.'", key_str); - // Free up memory - free(key_str); - // Throw exception with string - throw error_str; - } - // Free allocated space - free(key_str); - free(error_str); - // Return No check key error - return NULL; -} - -const char* BSON::ToCString(const v8::String::Utf8Value& value) { - return *value ? *value : ""; -} - -Handle BSON::decodeDBref(BSON *bson, Local ref, Local oid, Local db) { - HandleScope scope; - Local argv[] = {ref, oid, db}; - Handle dbrefObj = bson->dbrefConstructor->NewInstance(3, argv); - return scope.Close(dbrefObj); -} - -Handle BSON::decodeCode(BSON *bson, char *code, Handle scope_object) { - HandleScope scope; - - Local argv[] = {String::New(code), scope_object->ToObject()}; - Handle codeObj = bson->codeConstructor->NewInstance(2, argv); - return scope.Close(codeObj); -} - -Handle BSON::decodeBinary(BSON *bson, uint32_t sub_type, uint32_t number_of_bytes, char *data) { - HandleScope scope; - - // Create a buffer object that wraps the raw stream - Buffer *bufferObj = Buffer::New(data, number_of_bytes); - // Arguments to be passed to create the binary - Handle argv[] = {bufferObj->handle_, Uint32::New(sub_type)}; - // Return the buffer handle - Local bufferObjHandle = bson->binaryConstructor->NewInstance(2, argv); - // Close the scope - return scope.Close(bufferObjHandle); -} - -Handle BSON::decodeOid(BSON *bson, char *oid) { - HandleScope scope; - - // Encode the string (string - null termiating character) - Local bin_value = Encode(oid, 12, BINARY)->ToString(); - - // Return the id object - Local argv[] = {bin_value}; - Local oidObj = bson->objectIDConstructor->NewInstance(1, argv); - return scope.Close(oidObj); -} - -Handle BSON::decodeLong(BSON *bson, char *data, uint32_t index) { - HandleScope scope; - - // Decode the integer value - int32_t lowBits = 0; - int32_t highBits = 0; - memcpy(&lowBits, (data + index), 4); - memcpy(&highBits, (data + index + 4), 4); - - // Decode 64bit value - int64_t value = 0; - memcpy(&value, (data + index), 8); - - // If value is < 2^53 and >-2^53 - if((highBits < 0x200000 || (highBits == 0x200000 && lowBits == 0)) && highBits >= -0x200000) { - int64_t finalValue = 0; - memcpy(&finalValue, (data + index), 8); - return scope.Close(Number::New(finalValue)); - } - - // Instantiate the js object and pass it back - Local argv[] = {Int32::New(lowBits), Int32::New(highBits)}; - Local longObject = bson->longConstructor->NewInstance(2, argv); - return scope.Close(longObject); -} - -Handle BSON::decodeTimestamp(BSON *bson, char *data, uint32_t index) { - HandleScope scope; - - // Decode the integer value - int32_t lowBits = 0; - int32_t highBits = 0; - memcpy(&lowBits, (data + index), 4); - memcpy(&highBits, (data + index + 4), 4); - - // Build timestamp - Local argv[] = {Int32::New(lowBits), Int32::New(highBits)}; - Handle timestamp_obj = bson->timestampConstructor->NewInstance(2, argv); - return scope.Close(timestamp_obj); -} - -// Search for 0 terminated C string and return the string -char* BSON::extract_string(char *data, uint32_t offset) { - char *prt = strchr((data + offset), '\0'); - if(prt == NULL) return NULL; - // Figure out the length of the string - uint32_t length = (prt - data) - offset; - // Allocate memory for the new string - char *string_name = (char *)malloc((length * sizeof(char)) + 1); - // Copy the variable into the string_name - strncpy(string_name, (data + offset), length); - // Ensure the string is null terminated - *(string_name + length) = '\0'; - // Return the unpacked string - return string_name; -} - -// Decode a byte -uint16_t BSON::deserialize_int8(char *data, uint32_t offset) { - uint16_t value = 0; - value |= *(data + offset + 0); - return value; -} - -// Requires a 4 byte char array -uint32_t BSON::deserialize_int32(char* data, uint32_t offset) { - uint32_t value = 0; - memcpy(&value, (data + offset), 4); - return value; -} - -//------------------------------------------------------------------------------------------------ -// -// Experimental -// -//------------------------------------------------------------------------------------------------ -Handle BSON::CalculateObjectSize2(const Arguments &args) { - HandleScope scope; - // Ensure we have a valid object - if(args.Length() == 1 && !args[0]->IsObject()) return VException("One argument required - [object]"); - if(args.Length() > 1) return VException("One argument required - [object]"); - // Calculate size of the object - uint32_t object_size = BSON::calculate_object_size2(args[0]); - // Return the object size - return scope.Close(Uint32::New(object_size)); -} - -uint32_t BSON::calculate_object_size2(Handle value) { - // Final object size - uint32_t object_size = (4 + 1); - uint32_t stackIndex = 0; - // Controls the flow - bool done = false; - bool finished = false; - bool isObject = false; - - // Define a local vector that keeps the stack - // vector > > stack;// = new vector > >(0); - - // My own stack max of 1024 objects deep - Local *stack[64]; - - // Current object we are processing - Local currentObject = value->ToObject(); - - // Current list of object keys - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6 - Local keys = currentObject->GetPropertyNames(); - #else - Local keys = currentObject->GetOwnPropertyNames(); - #endif - - // Contains pointer to keysIndex - uint32_t keysIndex = 0; - uint32_t keysLength = keys->Length(); - - // printf("=================================================================================\n"); - // printf("Start serializing\n"); - - while(!done) { - // If the index is bigger than the number of keys for the object - // we finished up the previous object and are ready for the next one - if(keysIndex >= keysLength) { - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6 - keys = currentObject->GetPropertyNames(); - #else - keys = currentObject->GetOwnPropertyNames(); - #endif - keysLength = keys->Length(); - } - - // Iterate over all the keys - while(keysIndex < keysLength) { - // Fetch the key name - Local name = keys->Get(keysIndex++)->ToString(); - // Fetch the object related to the key - Local value = currentObject->Get(name); - // Add size of the name, plus zero, plus type - object_size += name->Utf8Length() + 1 + 1; - - // If we have a string - if(value->IsString()) { - object_size += value->ToString()->Utf8Length() + 1 + 4; - } else if(value->IsNumber()) { - // Check if we have a float value or a long value - Local number = value->ToNumber(); - double d_number = number->NumberValue(); - int64_t l_number = number->IntegerValue(); - // Check if we have a double value and not a int64 - double d_result = d_number - l_number; - // If we have a value after subtracting the integer value we have a float - if(d_result > 0 || d_result < 0) { - object_size = object_size + 8; - } else if(l_number <= BSON_INT32_MAX && l_number >= BSON_INT32_MIN) { - object_size = object_size + 4; - } else { - object_size = object_size + 8; - } - } else if(value->IsBoolean()) { - object_size = object_size + 1; - } else if(value->IsDate()) { - object_size = object_size + 8; - } else if(value->IsRegExp()) { - // Fetch the string for the regexp - Handle regExp = Handle::Cast(value); - ssize_t len = DecodeBytes(regExp->GetSource(), UTF8); - int flags = regExp->GetFlags(); - - // global - if((flags & (1 << 0)) != 0) len++; - // ignorecase - if((flags & (1 << 1)) != 0) len++; - //multiline - if((flags & (1 << 2)) != 0) len++; - // if((flags & (1 << 2)) != 0) len++; - // Calculate the space needed for the regexp: size of string - 2 for the /'ses +2 for null termiations - object_size = object_size + len + 2; - } else if(value->IsNull() || value->IsUndefined()) { - } - // } else if(value->IsNumber()) { - // // Check if we have a float value or a long value - // Local number = value->ToNumber(); - // double d_number = number->NumberValue(); - // int64_t l_number = number->IntegerValue(); - // // Check if we have a double value and not a int64 - // double d_result = d_number - l_number; - // // If we have a value after subtracting the integer value we have a float - // if(d_result > 0 || d_result < 0) { - // object_size = name->Utf8Length() + 1 + object_size + 8 + 1; - // } else if(l_number <= BSON_INT32_MAX && l_number >= BSON_INT32_MIN) { - // object_size = name->Utf8Length() + 1 + object_size + 4 + 1; - // } else { - // object_size = name->Utf8Length() + 1 + object_size + 8 + 1; - // } - // } else if(value->IsObject()) { - // printf("------------- hello\n"); - // } - } - - // If we have finished all the keys - if(keysIndex == keysLength) { - finished = false; - } - - // Validate the stack - if(stackIndex == 0) { - // printf("======================================================================== 3\n"); - done = true; - } else if(finished || keysIndex == keysLength) { - // Pop off the stack - stackIndex = stackIndex - 1; - // Fetch the current object stack - // vector > currentObjectStored = stack.back(); - // stack.pop_back(); - // // Unroll the current object - // currentObject = currentObjectStored.back()->ToObject(); - // currentObjectStored.pop_back(); - // // Unroll the keysIndex - // keys = Local::Cast(currentObjectStored.back()->ToObject()); - // currentObjectStored.pop_back(); - // // Unroll the keysIndex - // keysIndex = currentObjectStored.back()->ToUint32()->Value(); - // currentObjectStored.pop_back(); - // // Check if we finished up - // if(keysIndex == keys->Length()) { - // finished = true; - // } - } - } - - return object_size; -} - -Handle BSON::BSONSerialize2(const Arguments &args) { - HandleScope scope; - - if(args.Length() == 1 && !args[0]->IsObject()) return VException("One, two or tree arguments required - [object] or [object, boolean] or [object, boolean, boolean]"); - if(args.Length() == 2 && !args[0]->IsObject() && !args[1]->IsBoolean()) return VException("One, two or tree arguments required - [object] or [object, boolean] or [object, boolean, boolean]"); - if(args.Length() == 3 && !args[0]->IsObject() && !args[1]->IsBoolean() && !args[2]->IsBoolean()) return VException("One, two or tree arguments required - [object] or [object, boolean] or [object, boolean, boolean]"); - if(args.Length() > 3) return VException("One, two or tree arguments required - [object] or [object, boolean] or [object, boolean, boolean]"); - - // Calculate the total size of the document in binary form to ensure we only allocate memory once - uint32_t object_size = BSON::calculate_object_size2(args[0]); - // Allocate the memory needed for the serializtion - char *serialized_object = (char *)malloc(object_size * sizeof(char)); - // Catch any errors - try { - // Check if we have a boolean value - bool check_key = false; - if(args.Length() == 3 && args[1]->IsBoolean()) { - check_key = args[1]->BooleanValue(); - } - - // Serialize the object - BSON::serialize2(serialized_object, 0, Null(), args[0], object_size, check_key); - } catch(char *err_msg) { - // Free up serialized object space - free(serialized_object); - V8::AdjustAmountOfExternalAllocatedMemory(-object_size); - // Throw exception with the string - Handle error = VException(err_msg); - // free error message - free(err_msg); - // Return error - return error; - } - - // Write the object size - BSON::write_int32((serialized_object), object_size); - - // If we have 3 arguments - if(args.Length() == 3) { - // Local asBuffer = args[2]->ToBoolean(); - Buffer *buffer = Buffer::New(serialized_object, object_size); - // Release the serialized string - free(serialized_object); - return scope.Close(buffer->handle_); - } else { - // Encode the string (string - null termiating character) - Local bin_value = Encode(serialized_object, object_size, BINARY)->ToString(); - // Return the serialized content - return bin_value; - } -} - -uint32_t BSON::serialize2(char *serialized_object, uint32_t index, Handle name, Handle value, uint32_t objectSize, bool check_key) { - // Scope for method execution - HandleScope scope; - - // Final object size - uint32_t object_size = (4 + 1); - uint32_t stackIndex = 0; - // Controls the flow - bool done = false; - bool finished = false; - bool isObject = false; - - // Define a local vector that keeps the stack - // vector > > stack;// = new vector > >(0); - - // My own stack max of 1024 objects deep - Local *stack[64]; - - // Current object we are processing - Local currentObject = value->ToObject(); - // Current list of object keys - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6 - Local keys = currentObject->GetPropertyNames(); - #else - Local keys = currentObject->GetOwnPropertyNames(); - #endif - - // Contains pointer to keysIndex - uint32_t keysIndex = 0; - uint32_t keysLength = keys->Length(); - // Add pointer to start of new object - index = index + 4; - - // printf("=================================================================================\n"); - // printf("Start serializing\n"); - - while(!done) { - // If the index is bigger than the number of keys for the object - // we finished up the previous object and are ready for the next one - if(keysIndex >= keysLength) { - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6 - keys = currentObject->GetPropertyNames(); - #else - keys = currentObject->GetOwnPropertyNames(); - #endif - - keysLength = keys->Length(); - } - - // Iterate over all the keys - while(keysIndex < keysLength) { - // Fetch the key name - Local name = keys->Get(keysIndex++)->ToString(); - // Fetch the object related to the key - Local value = currentObject->Get(name); - - // If it's a string - if(value->IsString()) { - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_STRING; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - - // Write the actual string into the char array - Local str = value->ToString(); - // Let's fetch the int value - uint32_t utf8_length = str->Utf8Length(); - // Write the integer to the char * - BSON::write_int32((serialized_object + index), utf8_length + 1); - // Adjust the index - index = index + 4; - // Write string to char in utf8 format - written = DecodeWrite((serialized_object + index), utf8_length, str, BINARY); - // Add the null termination - *(serialized_object + index + utf8_length) = '\0'; - // Adjust the index - index = index + utf8_length + 1; - } - } - - // If we have finished all the keys - if(keysIndex == keysLength) { - finished = false; - } - - // Validate the stack - if(stackIndex == 0) { - // printf("======================================================================== 3\n"); - done = true; - // Set last byte to zero - *(serialized_object + objectSize - 1) = 0x00; - } else if(finished || keysIndex == keysLength) { - // printf("======================================================================== 4\n"); - // Pop off the stack - stackIndex = stackIndex - 1; - // Set last byte to zero - *(serialized_object + objectSize - 1) = 0x00; - - // Fetch the current object stack - // vector > currentObjectStored = stack.back(); - // stack.pop_back(); - // // Unroll the current object - // currentObject = currentObjectStored.back()->ToObject(); - // currentObjectStored.pop_back(); - // // Unroll the keysIndex - // keys = Local::Cast(currentObjectStored.back()->ToObject()); - // currentObjectStored.pop_back(); - // // Unroll the keysIndex - // keysIndex = currentObjectStored.back()->ToUint32()->Value(); - // currentObjectStored.pop_back(); - // // Check if we finished up - // if(keysIndex == keys->Length()) { - // finished = true; - // } - } - } - - return 0; -} - -//------------------------------------------------------------------------------------------------ -//------------------------------------------------------------------------------------------------ -//------------------------------------------------------------------------------------------------ -//------------------------------------------------------------------------------------------------ -Handle BSON::BSONDeserialize(const Arguments &args) { - HandleScope scope; - - // Ensure that we have an parameter - if(Buffer::HasInstance(args[0]) && args.Length() > 1) return VException("One argument required - buffer1."); - if(args[0]->IsString() && args.Length() > 1) return VException("One argument required - string1."); - // Throw an exception if the argument is not of type Buffer - if(!Buffer::HasInstance(args[0]) && !args[0]->IsString()) return VException("Argument must be a Buffer or String."); - - // Define pointer to data - char *data; - uint32_t length; - Local obj = args[0]->ToObject(); - - // Unpack the BSON parser instance - BSON *bson = ObjectWrap::Unwrap(args.This()); - - // If we passed in a buffer, let's unpack it, otherwise let's unpack the string - if(Buffer::HasInstance(obj)) { - - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 3 - Buffer *buffer = ObjectWrap::Unwrap(obj); - data = buffer->data(); - uint32_t length = buffer->length(); - #else - data = Buffer::Data(obj); - uint32_t length = Buffer::Length(obj); - #endif - - // Validate that we have at least 5 bytes - if(length < 5) { - return VException("corrupt bson message < 5 bytes long"); - } - - // Deserialize the data - return BSON::deserialize(bson, data, length, 0, NULL); - } else { - // The length of the data for this encoding - ssize_t len = DecodeBytes(args[0], BINARY); - - // Validate that we have at least 5 bytes - if(len < 5) { - return VException("corrupt bson message < 5 bytes long"); - } - - // Let's define the buffer size - data = (char *)malloc(len); - // Write the data to the buffer from the string object - ssize_t written = DecodeWrite(data, len, args[0], BINARY); - // Assert that we wrote the same number of bytes as we have length - assert(written == len); - // Get result - Handle result = BSON::deserialize(bson, data, len, 0, NULL); - // Free memory - free(data); - // Deserialize the content - return result; - } -} - -// Deserialize the stream -Handle BSON::deserialize(BSON *bson, char *data, uint32_t inDataLength, uint32_t startIndex, bool is_array_item) { - HandleScope scope; - // Holds references to the objects that are going to be returned - Local return_data = Object::New(); - Local return_array = Array::New(); - // The current index in the char data - uint32_t index = startIndex; - // Decode the size of the BSON data structure - uint32_t size = BSON::deserialize_int32(data, index); - - // If we have an illegal message size - if(size < 0 || size > inDataLength) return VException("corrupt bson message"); - - // Data length - uint32_t dataLength = index + size; - - // Adjust the index to point to next piece - index = index + 4; - - // While we have data left let's decode - while(index < dataLength) { - // Read the first to bytes to indicate the type of object we are decoding - uint8_t type = BSON::deserialize_int8(data, index); - // Handles the internal size of the object - uint32_t insert_index = 0; - // Adjust index to skip type byte - index = index + 1; - - if(type == BSON_DATA_STRING) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Read the length of the string (next 4 bytes) - uint32_t string_size = BSON::deserialize_int32(data, index); - // Adjust index to point to start of string - index = index + 4; - // Decode the string and add zero terminating value at the end of the string - char *value = (char *)malloc((string_size * sizeof(char))); - strncpy(value, (data + index), string_size); - // Encode the string (string - null termiating character) - Local utf8_encoded_str = Encode(value, string_size - 1, UTF8)->ToString(); - // Add the value to the data - if(is_array_item) { - return_array->Set(Number::New(insert_index), utf8_encoded_str); - } else { - return_data->ForceSet(String::New(string_name), utf8_encoded_str); - } - - // Adjust index - index = index + string_size; - // Free up the memory - free(value); - free(string_name); - } else if(type == BSON_DATA_INT) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Decode the integer value - uint32_t value = 0; - memcpy(&value, (data + index), 4); - - // Adjust the index for the size of the value - index = index + 4; - // Add the element to the object - if(is_array_item) { - return_array->Set(Integer::New(insert_index), Integer::New(value)); - } else { - return_data->ForceSet(String::New(string_name), Integer::New(value)); - } - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_TIMESTAMP) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), BSON::decodeTimestamp(bson, data, index)); - } else { - return_data->ForceSet(String::New(string_name), BSON::decodeTimestamp(bson, data, index)); - } - - // Adjust the index for the size of the value - index = index + 8; - - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_LONG) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), BSON::decodeLong(bson, data, index)); - } else { - return_data->ForceSet(String::New(string_name), BSON::decodeLong(bson, data, index)); - } - - // Adjust the index for the size of the value - index = index + 8; - - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_NUMBER) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Decode the integer value - double value = 0; - memcpy(&value, (data + index), 8); - // Adjust the index for the size of the value - index = index + 8; - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), Number::New(value)); - } else { - return_data->ForceSet(String::New(string_name), Number::New(value)); - } - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_MIN_KEY) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Create new MinKey - Local minKey = bson->minKeyConstructor->NewInstance(); - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), minKey); - } else { - return_data->ForceSet(String::New(string_name), minKey); - } - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_MAX_KEY) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Create new MinKey - Local maxKey = bson->maxKeyConstructor->NewInstance(); - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), maxKey); - } else { - return_data->ForceSet(String::New(string_name), maxKey); - } - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_NULL) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), Null()); - } else { - return_data->ForceSet(String::New(string_name), Null()); - } - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_BOOLEAN) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Decode the boolean value - char bool_value = *(data + index); - // Adjust the index for the size of the value - index = index + 1; - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), bool_value == 1 ? Boolean::New(true) : Boolean::New(false)); - } else { - return_data->ForceSet(String::New(string_name), bool_value == 1 ? Boolean::New(true) : Boolean::New(false)); - } - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_DATE) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Decode the value 64 bit integer - int64_t value = 0; - memcpy(&value, (data + index), 8); - // Adjust the index for the size of the value - index = index + 8; - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), Date::New((double)value)); - } else { - return_data->ForceSet(String::New(string_name), Date::New((double)value)); - } - // Free up the memory - free(string_name); - } else if(type == BSON_DATA_REGEXP) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Length variable - int32_t length_regexp = 0; - int32_t start_index = index; - char chr; - - // Locate end of the regexp expression \0 - while((chr = *(data + index + length_regexp)) != '\0') { - length_regexp = length_regexp + 1; - } - - // Contains the reg exp - char *reg_exp = (char *)malloc(length_regexp * sizeof(char) + 2); - // Copy the regexp from the data to the char * - memcpy(reg_exp, (data + index), (length_regexp + 1)); - // Adjust the index to skip the first part of the regular expression - index = index + length_regexp + 1; - - // Reset the length - int32_t options_length = 0; - // Locate the end of the options for the regexp terminated with a '\0' - while((chr = *(data + index + options_length)) != '\0') { - options_length = options_length + 1; - } - - // Contains the reg exp - char *options = (char *)malloc(options_length * sizeof(char) + 1); - // Copy the options from the data to the char * - memcpy(options, (data + index), (options_length + 1)); - // Adjust the index to skip the option part of the regular expression - index = index + options_length + 1; - // ARRRRGH Google does not expose regular expressions through the v8 api - // Have to use Script to instantiate the object (slower) - - // Generate the string for execution in the string context - int flag = 0; - - for(int i = 0; i < options_length; i++) { - // Multiline - if(*(options + i) == 'm') { - flag = flag | 4; - } else if(*(options + i) == 'i') { - flag = flag | 2; - } - } - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), RegExp::New(String::New(reg_exp), (v8::RegExp::Flags)flag)); - } else { - return_data->ForceSet(String::New(string_name), RegExp::New(String::New(reg_exp), (v8::RegExp::Flags)flag)); - } - - // Free memory - free(reg_exp); - free(options); - free(string_name); - } else if(type == BSON_DATA_OID) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // The id string - char *oid_string = (char *)malloc(12 * sizeof(char)); - // Copy the options from the data to the char * - memcpy(oid_string, (data + index), 12); - - // Adjust the index - index = index + 12; - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), BSON::decodeOid(bson, oid_string)); - } else { - return_data->ForceSet(String::New(string_name), BSON::decodeOid(bson, oid_string)); - } - - // Free memory - free(oid_string); - free(string_name); - } else if(type == BSON_DATA_BINARY) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Read the binary data size - uint32_t number_of_bytes = BSON::deserialize_int32(data, index); - // Adjust the index - index = index + 4; - // Decode the subtype, ensure it's positive - uint32_t sub_type = (int)*(data + index) & 0xff; - // Adjust the index - index = index + 1; - // Copy the binary data into a buffer - char *buffer = (char *)malloc(number_of_bytes * sizeof(char) + 1); - memcpy(buffer, (data + index), number_of_bytes); - *(buffer + number_of_bytes) = '\0'; - - // Adjust the index - index = index + number_of_bytes; - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), BSON::decodeBinary(bson, sub_type, number_of_bytes, buffer)); - } else { - return_data->ForceSet(String::New(string_name), BSON::decodeBinary(bson, sub_type, number_of_bytes, buffer)); - } - // Free memory - free(buffer); - free(string_name); - } else if(type == BSON_DATA_SYMBOL) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Read the length of the string (next 4 bytes) - uint32_t string_size = BSON::deserialize_int32(data, index); - // Adjust index to point to start of string - index = index + 4; - // Decode the string and add zero terminating value at the end of the string - char *value = (char *)malloc((string_size * sizeof(char))); - strncpy(value, (data + index), string_size); - // Encode the string (string - null termiating character) - Local utf8_encoded_str = Encode(value, string_size - 1, UTF8)->ToString(); - - // Wrap up the string in a Symbol Object - Local argv[] = {utf8_encoded_str}; - Handle symbolObj = bson->symbolConstructor->NewInstance(1, argv); - - // Add the value to the data - if(is_array_item) { - return_array->Set(Number::New(insert_index), symbolObj); - } else { - return_data->ForceSet(String::New(string_name), symbolObj); - } - - // Adjust index - index = index + string_size; - // Free up the memory - free(value); - free(string_name); - } else if(type == BSON_DATA_CODE) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Read the string size - uint32_t string_size = BSON::deserialize_int32(data, index); - // Adjust the index - index = index + 4; - // Read the string - char *code = (char *)malloc(string_size * sizeof(char) + 1); - // Copy string + terminating 0 - memcpy(code, (data + index), string_size); - - // Define empty scope object - Handle scope_object = Object::New(); - - // Define the try catch block - TryCatch try_catch; - // Decode the code object - Handle obj = BSON::decodeCode(bson, code, scope_object); - // If an error was thrown push it up the chain - if(try_catch.HasCaught()) { - free(string_name); - free(code); - // Rethrow exception - return try_catch.ReThrow(); - } - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), obj); - } else { - return_data->ForceSet(String::New(string_name), obj); - } - - // Clean up memory allocation - free(code); - free(string_name); - } else if(type == BSON_DATA_CODE_W_SCOPE) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Total number of bytes after array index - uint32_t total_code_size = BSON::deserialize_int32(data, index); - // Adjust the index - index = index + 4; - // Read the string size - uint32_t string_size = BSON::deserialize_int32(data, index); - // Adjust the index - index = index + 4; - // Read the string - char *code = (char *)malloc(string_size * sizeof(char) + 1); - // Copy string + terminating 0 - memcpy(code, (data + index), string_size); - // Adjust the index - index = index + string_size; - // Get the scope object (bson object) - uint32_t bson_object_size = total_code_size - string_size - 8; - // Allocate bson object buffer and copy out the content - char *bson_buffer = (char *)malloc(bson_object_size * sizeof(char)); - memcpy(bson_buffer, (data + index), bson_object_size); - // Adjust the index - index = index + bson_object_size; - // Parse the bson object - Handle scope_object = BSON::deserialize(bson, bson_buffer, inDataLength, 0, false); - // Define the try catch block - TryCatch try_catch; - // Decode the code object - Handle obj = BSON::decodeCode(bson, code, scope_object); - // If an error was thrown push it up the chain - if(try_catch.HasCaught()) { - // Clean up memory allocation - free(string_name); - free(bson_buffer); - free(code); - // Rethrow exception - return try_catch.ReThrow(); - } - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), obj); - } else { - return_data->ForceSet(String::New(string_name), obj); - } - - // Clean up memory allocation - free(code); - free(bson_buffer); - free(string_name); - } else if(type == BSON_DATA_OBJECT) { - // If this is the top level object we need to skip the undecoding - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Get the object size - uint32_t bson_object_size = BSON::deserialize_int32(data, index); - // Define the try catch block - TryCatch try_catch; - // Decode the code object - Handle obj = BSON::deserialize(bson, data + index, inDataLength, 0, false); - // Adjust the index - index = index + bson_object_size; - // If an error was thrown push it up the chain - if(try_catch.HasCaught()) { - // Rethrow exception - return try_catch.ReThrow(); - } - - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), obj); - } else { - return_data->ForceSet(String::New(string_name), obj); - } - - // Clean up memory allocation - free(string_name); - } else if(type == BSON_DATA_ARRAY) { - // Read the null terminated index String - char *string_name = BSON::extract_string(data, index); - if(string_name == NULL) return VException("Invalid C String found."); - // Let's create a new string - index = index + strlen(string_name) + 1; - // Handle array value if applicable - uint32_t insert_index = 0; - if(is_array_item) { - insert_index = atoi(string_name); - } - - // Get the size - uint32_t array_size = BSON::deserialize_int32(data, index); - // Define the try catch block - TryCatch try_catch; - - // Decode the code object - Handle obj = BSON::deserialize(bson, data + index, inDataLength, 0, true); - // If an error was thrown push it up the chain - if(try_catch.HasCaught()) { - // Rethrow exception - return try_catch.ReThrow(); - } - // Adjust the index for the next value - index = index + array_size; - // Add the element to the object - if(is_array_item) { - return_array->Set(Number::New(insert_index), obj); - } else { - return_data->ForceSet(String::New(string_name), obj); - } - // Clean up memory allocation - free(string_name); - } - } - - // Check if we have a db reference - if(!is_array_item && return_data->Has(String::New("$ref")) && return_data->Has(String::New("$id"))) { - Handle dbrefValue = BSON::decodeDBref(bson, return_data->Get(String::New("$ref")), return_data->Get(String::New("$id")), return_data->Get(String::New("$db"))); - return scope.Close(dbrefValue); - } - - // Return the data object to javascript - if(is_array_item) { - return scope.Close(return_array); - } else { - return scope.Close(return_data); - } -} - -Handle BSON::BSONSerialize(const Arguments &args) { - HandleScope scope; - - if(args.Length() == 1 && !args[0]->IsObject()) return VException("One, two or tree arguments required - [object] or [object, boolean] or [object, boolean, boolean]"); - if(args.Length() == 2 && !args[0]->IsObject() && !args[1]->IsBoolean()) return VException("One, two or tree arguments required - [object] or [object, boolean] or [object, boolean, boolean]"); - if(args.Length() == 3 && !args[0]->IsObject() && !args[1]->IsBoolean() && !args[2]->IsBoolean()) return VException("One, two or tree arguments required - [object] or [object, boolean] or [object, boolean, boolean]"); - if(args.Length() == 4 && !args[0]->IsObject() && !args[1]->IsBoolean() && !args[2]->IsBoolean() && !args[3]->IsBoolean()) return VException("One, two or tree arguments required - [object] or [object, boolean] or [object, boolean, boolean] or [object, boolean, boolean, boolean]"); - if(args.Length() > 4) return VException("One, two, tree or four arguments required - [object] or [object, boolean] or [object, boolean, boolean] or [object, boolean, boolean, boolean]"); - - // Unpack the BSON parser instance - BSON *bson = ObjectWrap::Unwrap(args.This()); - - uint32_t object_size = 0; - // Calculate the total size of the document in binary form to ensure we only allocate memory once - // With serialize function - if(args.Length() == 4) { - object_size = BSON::calculate_object_size(bson, args[0], args[3]->BooleanValue()); - } else { - object_size = BSON::calculate_object_size(bson, args[0], false); - } - - // Allocate the memory needed for the serializtion - char *serialized_object = (char *)malloc(object_size * sizeof(char)); - // Catch any errors - try { - // Check if we have a boolean value - bool check_key = false; - if(args.Length() >= 3 && args[1]->IsBoolean()) { - check_key = args[1]->BooleanValue(); - } - - // Check if we have a boolean value - bool serializeFunctions = false; - if(args.Length() == 4 && args[1]->IsBoolean()) { - serializeFunctions = args[3]->BooleanValue(); - } - - // Serialize the object - BSON::serialize(bson, serialized_object, 0, Null(), args[0], check_key, serializeFunctions); - } catch(char *err_msg) { - // Free up serialized object space - free(serialized_object); - V8::AdjustAmountOfExternalAllocatedMemory(-object_size); - // Throw exception with the string - Handle error = VException(err_msg); - // free error message - free(err_msg); - // Return error - return error; - } - - // Write the object size - BSON::write_int32((serialized_object), object_size); - - // If we have 3 arguments - if(args.Length() == 3 || args.Length() == 4) { - // Local asBuffer = args[2]->ToBoolean(); - Buffer *buffer = Buffer::New(serialized_object, object_size); - // Release the serialized string - free(serialized_object); - return scope.Close(buffer->handle_); - } else { - // Encode the string (string - null termiating character) - Local bin_value = Encode(serialized_object, object_size, BINARY)->ToString(); - // Return the serialized content - return bin_value; - } -} - -Handle BSON::CalculateObjectSize(const Arguments &args) { - HandleScope scope; - // Ensure we have a valid object - if(args.Length() == 1 && !args[0]->IsObject()) return VException("One argument required - [object]"); - if(args.Length() == 2 && !args[0]->IsObject() && !args[1]->IsBoolean()) return VException("Two arguments required - [object, boolean]"); - if(args.Length() > 3) return VException("One or two arguments required - [object] or [object, boolean]"); - - // Unpack the BSON parser instance - BSON *bson = ObjectWrap::Unwrap(args.This()); - - // Object size - uint32_t object_size = 0; - // Check if we have our argument, calculate size of the object - if(args.Length() == 2) { - object_size = BSON::calculate_object_size(bson, args[0], args[1]->BooleanValue()); - } else { - object_size = BSON::calculate_object_size(bson, args[0], false); - } - - // Return the object size - return scope.Close(Uint32::New(object_size)); -} - -uint32_t BSON::calculate_object_size(BSON *bson, Handle value, bool serializeFunctions) { - uint32_t object_size = 0; - - // If we have an object let's unwrap it and calculate the sub sections - if(value->IsString()) { - // Let's calculate the size the string adds, length + type(1 byte) + size(4 bytes) - object_size += value->ToString()->Utf8Length() + 1 + 4; - } else if(value->IsNumber()) { - // Check if we have a float value or a long value - Local number = value->ToNumber(); - double d_number = number->NumberValue(); - int64_t l_number = number->IntegerValue(); - // Check if we have a double value and not a int64 - double d_result = d_number - l_number; - // If we have a value after subtracting the integer value we have a float - if(d_result > 0 || d_result < 0) { - object_size = object_size + 8; - } else if(l_number <= BSON_INT32_MAX && l_number >= BSON_INT32_MIN) { - object_size = object_size + 4; - } else { - object_size = object_size + 8; - } - } else if(value->IsBoolean()) { - object_size = object_size + 1; - } else if(value->IsDate()) { - object_size = object_size + 8; - } else if(value->IsRegExp()) { - // Fetch the string for the regexp - Handle regExp = Handle::Cast(value); - ssize_t len = DecodeBytes(regExp->GetSource(), UTF8); - int flags = regExp->GetFlags(); - - // global - if((flags & (1 << 0)) != 0) len++; - // ignorecase - if((flags & (1 << 1)) != 0) len++; - //multiline - if((flags & (1 << 2)) != 0) len++; - // if((flags & (1 << 2)) != 0) len++; - // Calculate the space needed for the regexp: size of string - 2 for the /'ses +2 for null termiations - object_size = object_size + len + 2; - } else if(value->IsNull() || value->IsUndefined()) { - } else if(value->IsArray()) { - // Cast to array - Local array = Local::Cast(value->ToObject()); - // Turn length into string to calculate the size of all the strings needed - char *length_str = (char *)malloc(256 * sizeof(char)); - // Calculate the size of each element - for(uint32_t i = 0; i < array->Length(); i++) { - // Add "index" string size for each element - sprintf(length_str, "%d", i); - // Add the size of the string length - uint32_t label_length = strlen(length_str) + 1; - // Add the type definition size for each item - object_size = object_size + label_length + 1; - // Add size of the object - uint32_t object_length = BSON::calculate_object_size(bson, array->Get(Integer::New(i)), serializeFunctions); - object_size = object_size + object_length; - } - // Add the object size - object_size = object_size + 4 + 1; - // Free up memory - free(length_str); - } else if(value->IsFunction()) { - if(serializeFunctions) { - object_size += value->ToString()->Utf8Length() + 4 + 1; - } - } else if(value->ToObject()->Has(bson->_bsontypeString)) { - // Handle holder - Local constructorString = value->ToObject()->GetConstructorName(); - - // BSON type object, avoid non-needed checking unless we have a type - if(bson->longString->StrictEquals(constructorString)) { - object_size = object_size + 8; - } else if(bson->timestampString->StrictEquals(constructorString)) { - object_size = object_size + 8; - } else if(bson->objectIDString->StrictEquals(constructorString)) { - object_size = object_size + 12; - } else if(bson->binaryString->StrictEquals(constructorString)) { - // Unpack the object and encode - Local positionObj = value->ToObject()->Get(String::New("position"))->ToUint32(); - // Adjust the object_size, binary content lengt + total size int32 + binary size int32 + subtype - object_size += positionObj->Value() + 4 + 1; - } else if(bson->codeString->StrictEquals(constructorString)) { - // Unpack the object and encode - Local obj = value->ToObject(); - // Get the function - Local function = obj->Get(String::New("code"))->ToString(); - // Get the scope object - Local scope = obj->Get(String::New("scope"))->ToObject(); - - // For Node < 0.6.X use the GetPropertyNames - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6 - uint32_t propertyNameLength = scope->GetPropertyNames()->Length(); - #else - uint32_t propertyNameLength = scope->GetOwnPropertyNames()->Length(); - #endif - - // Check if the scope has any parameters - // Let's calculate the size the code object adds adds - if(propertyNameLength > 0) { - object_size += function->Utf8Length() + 4 + BSON::calculate_object_size(bson, scope, serializeFunctions) + 4 + 1; - } else { - object_size += function->Utf8Length() + 4 + 1; - } - } else if(bson->dbrefString->StrictEquals(constructorString)) { - // Unpack the dbref - Local dbref = value->ToObject(); - // Create an object containing the right namespace variables - Local obj = Object::New(); - // Build the new object - obj->Set(bson->_dbRefRefString, dbref->Get(bson->_dbRefNamespaceString)); - obj->Set(bson->_dbRefIdRefString, dbref->Get(bson->_dbRefOidString)); - if(!dbref->Get(bson->_dbRefDbString)->IsNull() && !dbref->Get(bson->_dbRefDbString)->IsUndefined()) obj->Set(bson->_dbRefDbRefString, dbref->Get(bson->_dbRefDbString)); - // Calculate size - object_size += BSON::calculate_object_size(bson, obj, serializeFunctions); - } else if(bson->minKeyString->StrictEquals(constructorString) || bson->maxKeyString->Equals(constructorString)) { - } else if(bson->symbolString->StrictEquals(constructorString)) { - // Get string - Local str = value->ToObject()->Get(String::New("value"))->ToString(); - // Get the utf8 length - uint32_t utf8_length = str->Utf8Length(); - // Check if we have a utf8 encoded string or not - if(utf8_length != str->Length()) { - // Let's calculate the size the string adds, length + type(1 byte) + size(4 bytes) - object_size += str->Utf8Length() + 1 + 4; - } else { - object_size += str->Length() + 1 + 4; - } - } else if(bson->doubleString->StrictEquals(constructorString)) { - object_size = object_size + 8; - } - } else if(value->IsObject()) { - // Unwrap the object - Local object = value->ToObject(); - - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6 - Local property_names = object->GetPropertyNames(); - #else - Local property_names = object->GetOwnPropertyNames(); - #endif - - // Length of the property - uint32_t propertyLength = property_names->Length(); - - // Process all the properties on the object - for(uint32_t index = 0; index < propertyLength; index++) { - // Fetch the property name - Local property_name = property_names->Get(index)->ToString(); - - // Fetch the object for the property - Local property = object->Get(property_name); - // Get size of property (property + property name length + 1 for terminating 0) - if(!property->IsFunction() || (property->IsFunction() && serializeFunctions)) { - // Convert name to char* - object_size += BSON::calculate_object_size(bson, property, serializeFunctions) + property_name->Utf8Length() + 1 + 1; - } - } - - object_size = object_size + 4 + 1; - } - - return object_size; -} - -uint32_t BSON::serialize(BSON *bson, char *serialized_object, uint32_t index, Handle name, Handle value, bool check_key, bool serializeFunctions) { - // Scope for method execution - HandleScope scope; - - // If we have a name check that key is valid - if(!name->IsNull() && check_key) { - if(BSON::check_key(name->ToString()) != NULL) return -1; - } - - // If we have an object let's serialize it - if(value->IsString()) { - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_STRING; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - - // Write the actual string into the char array - Local str = value->ToString(); - // Let's fetch the int value - uint32_t utf8_length = str->Utf8Length(); - - // Write the integer to the char * - BSON::write_int32((serialized_object + index), utf8_length + 1); - // Adjust the index - index = index + 4; - // Write string to char in utf8 format - str->WriteUtf8((serialized_object + index), utf8_length); - // Add the null termination - *(serialized_object + index + utf8_length) = '\0'; - // Adjust the index - index = index + utf8_length + 1; - } else if(value->IsNumber()) { - uint32_t first_pointer = index; - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_INT; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - - Local number = value->ToNumber(); - // Get the values - double d_number = number->NumberValue(); - int64_t l_number = number->IntegerValue(); - - // Check if we have a double value and not a int64 - double d_result = d_number - l_number; - // If we have a value after subtracting the integer value we have a float - if(d_result > 0 || d_result < 0) { - // Write the double to the char array - BSON::write_double((serialized_object + index), d_number); - // Adjust type to be double - *(serialized_object + first_pointer) = BSON_DATA_NUMBER; - // Adjust index for double - index = index + 8; - } else if(l_number <= BSON_INT32_MAX && l_number >= BSON_INT32_MIN) { - // Smaller than 32 bit, write as 32 bit value - BSON::write_int32(serialized_object + index, value->ToInt32()->Value()); - // Adjust the size of the index - index = index + 4; - } else if(l_number <= JS_INT_MAX && l_number >= JS_INT_MIN) { - // Write the double to the char array - BSON::write_double((serialized_object + index), d_number); - // Adjust type to be double - *(serialized_object + first_pointer) = BSON_DATA_NUMBER; - // Adjust index for double - index = index + 8; - } else { - BSON::write_double((serialized_object + index), d_number); - // Adjust type to be double - *(serialized_object + first_pointer) = BSON_DATA_NUMBER; - // Adjust the size of the index - index = index + 8; - } - } else if(value->IsBoolean()) { - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_BOOLEAN; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - - // Save the boolean value - *(serialized_object + index) = value->BooleanValue() ? '\1' : '\0'; - // Adjust the index - index = index + 1; - } else if(value->IsDate()) { - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_DATE; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - - // Fetch the Integer value - int64_t integer_value = value->IntegerValue(); - BSON::write_int64((serialized_object + index), integer_value); - // Adjust the index - index = index + 8; - } else if(value->IsNull() || value->IsUndefined()) { - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_NULL; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - } else if(value->IsArray()) { - // Cast to array - Local array = Local::Cast(value->ToObject()); - // Turn length into string to calculate the size of all the strings needed - char *length_str = (char *)malloc(256 * sizeof(char)); - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_ARRAY; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - // Object size - uint32_t object_size = BSON::calculate_object_size(bson, value, serializeFunctions); - // Write the size of the object - BSON::write_int32((serialized_object + index), object_size); - // Adjust the index - index = index + 4; - // Write out all the elements - for(uint32_t i = 0; i < array->Length(); i++) { - // Add "index" string size for each element - sprintf(length_str, "%d", i); - // Encode the values - index = BSON::serialize(bson, serialized_object, index, String::New(length_str), array->Get(Integer::New(i)), check_key, serializeFunctions); - // Write trailing '\0' for object - *(serialized_object + index) = '\0'; - } - - // Pad the last item - *(serialized_object + index) = '\0'; - index = index + 1; - // Free up memory - free(length_str); - } else if(value->IsRegExp()) { - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_REGEXP; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - - // Fetch the string for the regexp - Handle regExp = Handle::Cast(value); - len = DecodeBytes(regExp->GetSource(), UTF8); - written = DecodeWrite((serialized_object + index), len, regExp->GetSource(), UTF8); - int flags = regExp->GetFlags(); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - - // global - if((flags & (1 << 0)) != 0) { - *(serialized_object + index) = 's'; - index = index + 1; - } - - // ignorecase - if((flags & (1 << 1)) != 0) { - *(serialized_object + index) = 'i'; - index = index + 1; - } - - //multiline - if((flags & (1 << 2)) != 0) { - *(serialized_object + index) = 'm'; - index = index + 1; - } - - // Add null termiation for the string - *(serialized_object + index) = '\0'; - // Adjust the index - index = index + 1; - } else if(value->IsFunction()) { - if(serializeFunctions) { - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_CODE; - - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - - // Function String - Local function = value->ToString(); - - // Decode the function - len = DecodeBytes(function, BINARY); - // Write the size of the code string + 0 byte end of cString - BSON::write_int32((serialized_object + index), len + 1); - // Adjust the index - index = index + 4; - - // Write the data into the serialization stream - written = DecodeWrite((serialized_object + index), len, function, BINARY); - // Write \0 for string - *(serialized_object + index + len) = 0x00; - // Adjust the index - index = index + len + 1; - } - } else if(value->ToObject()->Has(bson->_bsontypeString)) { - // Handle holder - Local constructorString = value->ToObject()->GetConstructorName(); - uint32_t originalIndex = index; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = 0x00; - // Adjust the index - index = index + len + 1; - - // BSON type object, avoid non-needed checking unless we have a type - if(bson->longString->StrictEquals(constructorString)) { - // Save the string at the offset provided - *(serialized_object + originalIndex) = BSON_DATA_LONG; - // Object reference - Local longObject = value->ToObject(); - - // Fetch the low and high bits - int32_t lowBits = longObject->Get(bson->_longLowString)->ToInt32()->Value(); - int32_t highBits = longObject->Get(bson->_longHighString)->ToInt32()->Value(); - - // Write the content to the char array - BSON::write_int32((serialized_object + index), lowBits); - BSON::write_int32((serialized_object + index + 4), highBits); - // Adjust the index - index = index + 8; - } else if(bson->timestampString->StrictEquals(constructorString)) { - // Save the string at the offset provided - *(serialized_object + originalIndex) = BSON_DATA_TIMESTAMP; - // Object reference - Local timestampObject = value->ToObject(); - - // Fetch the low and high bits - int32_t lowBits = timestampObject->Get(bson->_longLowString)->ToInt32()->Value(); - int32_t highBits = timestampObject->Get(bson->_longHighString)->ToInt32()->Value(); - - // Write the content to the char array - BSON::write_int32((serialized_object + index), lowBits); - BSON::write_int32((serialized_object + index + 4), highBits); - // Adjust the index - index = index + 8; - } else if(bson->objectIDString->StrictEquals(constructorString)) { - // Save the string at the offset provided - *(serialized_object + originalIndex) = BSON_DATA_OID; - // Convert to object - Local objectIDObject = value->ToObject(); - // Let's grab the id - Local idString = objectIDObject->Get(bson->_objectIDidString)->ToString(); - // Let's decode the raw chars from the string - len = DecodeBytes(idString, BINARY); - written = DecodeWrite((serialized_object + index), len, idString, BINARY); - // Adjust the index - index = index + 12; - } else if(bson->binaryString->StrictEquals(constructorString)) { - // Save the string at the offset provided - *(serialized_object + originalIndex) = BSON_DATA_BINARY; - - // Let's get the binary object - Local binaryObject = value->ToObject(); - - // Grab the size(position of the binary) - uint32_t position = value->ToObject()->Get(bson->_binaryPositionString)->ToUint32()->Value(); - // Grab the subtype - uint32_t subType = value->ToObject()->Get(bson->_binarySubTypeString)->ToUint32()->Value(); - // Grab the buffer object - Local bufferObj = value->ToObject()->Get(bson->_binaryBufferString)->ToObject(); - - // Buffer data pointers - char *data; - uint32_t length; - - // Unpack the buffer variable - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 3 - Buffer *buffer = ObjectWrap::Unwrap(bufferObj); - data = buffer->data(); - length = buffer->length(); - #else - data = Buffer::Data(bufferObj); - length = Buffer::Length(bufferObj); - #endif - - // Write the size of the buffer out - BSON::write_int32((serialized_object + index), position); - // Adjust index - index = index + 4; - // Write subtype - *(serialized_object + index) = (char)subType; - // Adjust index - index = index + 1; - // Write binary content - memcpy((serialized_object + index), data, position); - // Adjust index.rar">_ - index = index + position; - } else if(bson->doubleString->StrictEquals(constructorString)) { - // Save the string at the offset provided - *(serialized_object + originalIndex) = BSON_DATA_NUMBER; - - // Unpack the double - Local doubleObject = value->ToObject(); - - // Fetch the double value - Local doubleValue = doubleObject->Get(bson->_doubleValueString)->ToNumber(); - // Write the double to the char array - BSON::write_double((serialized_object + index), doubleValue->NumberValue()); - // Adjust index for double - index = index + 8; - } else if(bson->symbolString->StrictEquals(constructorString)) { - // Save the string at the offset provided - *(serialized_object + originalIndex) = BSON_DATA_SYMBOL; - // Unpack symbol object - Local symbolObj = value->ToObject(); - - // Grab the actual string - Local str = symbolObj->Get(bson->_symbolValueString)->ToString(); - // Let's fetch the int value - uint32_t utf8_length = str->Utf8Length(); - - // If the Utf8 length is different from the string length then we - // have a UTF8 encoded string, otherwise write it as ascii - if(utf8_length != str->Length()) { - // Write the integer to the char * - BSON::write_int32((serialized_object + index), utf8_length + 1); - // Adjust the index - index = index + 4; - // Write string to char in utf8 format - str->WriteUtf8((serialized_object + index), utf8_length); - // Add the null termination - *(serialized_object + index + utf8_length) = '\0'; - // Adjust the index - index = index + utf8_length + 1; - } else { - // Write the integer to the char * - BSON::write_int32((serialized_object + index), str->Length() + 1); - // Adjust the index - index = index + 4; - // Write string to char in utf8 format - written = DecodeWrite((serialized_object + index), str->Length(), str, BINARY); - // Add the null termination - *(serialized_object + index + str->Length()) = '\0'; - // Adjust the index - index = index + str->Length() + 1; - } - } else if(bson->codeString->StrictEquals(constructorString)) { - // Unpack the object and encode - Local obj = value->ToObject(); - // Get the function - Local function = obj->Get(String::New("code"))->ToString(); - // Get the scope object - Local scope = obj->Get(String::New("scope"))->ToObject(); - - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6 - uint32_t propertyNameLength = scope->GetPropertyNames()->Length(); - #else - uint32_t propertyNameLength = scope->GetOwnPropertyNames()->Length(); - #endif - - // Set the right type if we have a scope or not - if(propertyNameLength > 0) { - // Set basic data code object with scope object - *(serialized_object + originalIndex) = BSON_DATA_CODE_W_SCOPE; - - // Calculate the size of the whole object - uint32_t scopeSize = BSON::calculate_object_size(bson, scope, false); - // Decode the function length - ssize_t len = DecodeBytes(function, UTF8); - // Calculate total size - uint32_t size = 4 + len + 1 + 4 + scopeSize; - - // Write the total size - BSON::write_int32((serialized_object + index), size); - // Adjust the index - index = index + 4; - - // Write the function size - BSON::write_int32((serialized_object + index), len + 1); - // Adjust the index - index = index + 4; - - // Write the data into the serialization stream - ssize_t written = DecodeWrite((serialized_object + index), len, function, UTF8); - // Write \0 for string - *(serialized_object + index + len) = 0x00; - // Adjust the index with the length of the function - index = index + len + 1; - // Write the scope object - BSON::serialize(bson, (serialized_object + index), 0, Null(), scope, check_key, serializeFunctions); - // Adjust the index - index = index + scopeSize; - } else { - // Set basic data code object - *(serialized_object + originalIndex) = BSON_DATA_CODE; - // Decode the function - ssize_t len = DecodeBytes(function, BINARY); - // Write the size of the code string + 0 byte end of cString - BSON::write_int32((serialized_object + index), len + 1); - // Adjust the index - index = index + 4; - - // Write the data into the serialization stream - ssize_t written = DecodeWrite((serialized_object + index), len, function, BINARY); - // Write \0 for string - *(serialized_object + index + len) = 0x00; - // Adjust the index - index = index + len + 1; - } - } else if(bson->dbrefString->StrictEquals(constructorString)) { - // Unpack the dbref - Local dbref = value->ToObject(); - // Create an object containing the right namespace variables - Local obj = Object::New(); - - // Build the new object - obj->Set(bson->_dbRefRefString, dbref->Get(bson->_dbRefNamespaceString)); - obj->Set(bson->_dbRefIdRefString, dbref->Get(bson->_dbRefOidString)); - if(!dbref->Get(bson->_dbRefDbString)->IsNull() && !dbref->Get(bson->_dbRefDbString)->IsUndefined()) obj->Set(bson->_dbRefDbRefString, dbref->Get(bson->_dbRefDbString)); - - // Encode the variable - index = BSON::serialize(bson, serialized_object, originalIndex, name, obj, false, serializeFunctions); - } else if(bson->minKeyString->StrictEquals(constructorString)) { - // Save the string at the offset provided - *(serialized_object + originalIndex) = BSON_DATA_MIN_KEY; - } else if(bson->maxKeyString->StrictEquals(constructorString)) { - *(serialized_object + originalIndex) = BSON_DATA_MAX_KEY; - } - } else if(value->IsObject()) { - if(!name->IsNull()) { - // Save the string at the offset provided - *(serialized_object + index) = BSON_DATA_OBJECT; - // Adjust writing position for the first byte - index = index + 1; - // Convert name to char* - ssize_t len = DecodeBytes(name, UTF8); - ssize_t written = DecodeWrite((serialized_object + index), len, name, UTF8); - // Add null termiation for the string - *(serialized_object + index + len) = '\0'; - // Adjust the index - index = index + len + 1; - } - - // Unwrap the object - Local object = value->ToObject(); - - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6 - Local property_names = object->GetPropertyNames(); - #else - Local property_names = object->GetOwnPropertyNames(); - #endif - - // Calculate size of the total object - uint32_t object_size = BSON::calculate_object_size(bson, value, serializeFunctions); - // Write the size - BSON::write_int32((serialized_object + index), object_size); - // Adjust size - index = index + 4; - - // Process all the properties on the object - for(uint32_t i = 0; i < property_names->Length(); i++) { - // Fetch the property name - Local property_name = property_names->Get(i)->ToString(); - // Fetch the object for the property - Local property = object->Get(property_name); - // Write the next serialized object - // printf("========== !property->IsFunction() || (property->IsFunction() && serializeFunctions) = %d\n", !property->IsFunction() || (property->IsFunction() && serializeFunctions) == true ? 1 : 0); - if(!property->IsFunction() || (property->IsFunction() && serializeFunctions)) { - // Convert name to char* - ssize_t len = DecodeBytes(property_name, UTF8); - // char *data = new char[len]; - char *data = (char *)malloc(len + 1); - *(data + len) = '\0'; - ssize_t written = DecodeWrite(data, len, property_name, UTF8); - // Serialize the content - index = BSON::serialize(bson, serialized_object, index, property_name, property, check_key, serializeFunctions); - // Free up memory of data - free(data); - } - } - // Pad the last item - *(serialized_object + index) = '\0'; - index = index + 1; - - // Null out reminding fields if we have a toplevel object and nested levels - if(name->IsNull()) { - for(uint32_t i = 0; i < (object_size - index); i++) { - *(serialized_object + index + i) = '\0'; - } - } - } - - return index; -} - -Handle BSON::SerializeWithBufferAndIndex(const Arguments &args) { - HandleScope scope; - - //BSON.serializeWithBufferAndIndex = function serializeWithBufferAndIndex(object, checkKeys, buffer, index) { - // Ensure we have the correct values - if(args.Length() > 5) return VException("Four or five parameters required [object, boolean, Buffer, int] or [object, boolean, Buffer, int, boolean]"); - if(args.Length() == 4 && !args[0]->IsObject() && !args[1]->IsBoolean() && !Buffer::HasInstance(args[2]) && !args[3]->IsUint32()) return VException("Four parameters required [object, boolean, Buffer, int]"); - if(args.Length() == 5 && !args[0]->IsObject() && !args[1]->IsBoolean() && !Buffer::HasInstance(args[2]) && !args[3]->IsUint32() && !args[4]->IsBoolean()) return VException("Four parameters required [object, boolean, Buffer, int, boolean]"); - - // Unpack the BSON parser instance - BSON *bson = ObjectWrap::Unwrap(args.This()); - - // Define pointer to data - char *data; - uint32_t length; - // Unpack the object - Local obj = args[2]->ToObject(); - - // Unpack the buffer object and get pointers to structures - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 3 - Buffer *buffer = ObjectWrap::Unwrap(obj); - data = buffer->data(); - length = buffer->length(); - #else - data = Buffer::Data(obj); - length = Buffer::Length(obj); - #endif - - uint32_t object_size = 0; - // Calculate the total size of the document in binary form to ensure we only allocate memory once - if(args.Length() == 5) { - object_size = BSON::calculate_object_size(bson, args[0], args[4]->BooleanValue()); - } else { - object_size = BSON::calculate_object_size(bson, args[0], false); - } - - // Unpack the index variable - Local indexObject = args[3]->ToUint32(); - uint32_t index = indexObject->Value(); - - // Allocate the memory needed for the serializtion - char *serialized_object = (char *)malloc(object_size * sizeof(char)); - - // Catch any errors - try { - // Check if we have a boolean value - bool check_key = false; - if(args.Length() >= 4 && args[1]->IsBoolean()) { - check_key = args[1]->BooleanValue(); - } - - bool serializeFunctions = false; - if(args.Length() == 5) { - serializeFunctions = args[4]->BooleanValue(); - } - - // Serialize the object - BSON::serialize(bson, serialized_object, 0, Null(), args[0], check_key, serializeFunctions); - } catch(char *err_msg) { - // Free up serialized object space - free(serialized_object); - V8::AdjustAmountOfExternalAllocatedMemory(-object_size); - // Throw exception with the string - Handle error = VException(err_msg); - // free error message - free(err_msg); - // Return error - return error; - } - - for(int i = 0; i < object_size; i++) { - *(data + index + i) = *(serialized_object + i); - } - - return scope.Close(Uint32::New(index + object_size - 1)); -} - -Handle BSON::BSONDeserializeStream(const Arguments &args) { - HandleScope scope; - - // At least 3 arguments required - if(args.Length() < 5) VException("Arguments required (Buffer(data), Number(index in data), Number(number of documents to deserialize), Array(results), Number(index in the array), Object(optional))"); - - // If the number of argumets equals 3 - if(args.Length() >= 5) { - if(!Buffer::HasInstance(args[0])) return VException("First argument must be Buffer instance"); - if(!args[1]->IsUint32()) return VException("Second argument must be a positive index number"); - if(!args[2]->IsUint32()) return VException("Third argument must be a positive number of documents to deserialize"); - if(!args[3]->IsArray()) return VException("Fourth argument must be an array the size of documents to deserialize"); - if(!args[4]->IsUint32()) return VException("Sixth argument must be a positive index number"); - } - - // If we have 4 arguments - if(args.Length() == 6 && !args[5]->IsObject()) return VException("Fifth argument must be an object with options"); - - // Define pointer to data - char *data; - uint32_t length; - Local obj = args[0]->ToObject(); - uint32_t numberOfDocuments = args[2]->ToUint32()->Value(); - uint32_t index = args[1]->ToUint32()->Value(); - uint32_t resultIndex = args[4]->ToUint32()->Value(); - - // Unpack the BSON parser instance - BSON *bson = ObjectWrap::Unwrap(args.This()); - - // Unpack the buffer variable - #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 3 - Buffer *buffer = ObjectWrap::Unwrap(obj); - data = buffer->data(); - length = buffer->length(); - #else - data = Buffer::Data(obj); - length = Buffer::Length(obj); - #endif - - // Fetch the documents - Local documents = args[3]->ToObject(); - - for(uint32_t i = 0; i < numberOfDocuments; i++) { - // Decode the size of the BSON data structure - uint32_t size = BSON::deserialize_int32(data, index); - - // Get result - Handle result = BSON::deserialize(bson, data, size, index, NULL); - - // Add result to array - documents->Set(i + resultIndex, result); - - // Adjust the index for next pass - index = index + size; - } - - // Return new index of parsing - return scope.Close(Uint32::New(index)); -} - -// Exporting function -extern "C" void init(Handle target) { - HandleScope scope; - BSON::Initialize(target); -} - -// NODE_MODULE(bson, BSON::Initialize); -// NODE_MODULE(l, Long::Initialize); diff --git a/external-libs/bson/bson.h b/external-libs/bson/bson.h deleted file mode 100644 index dcf21d17af6..00000000000 --- a/external-libs/bson/bson.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef BSON_H_ -#define BSON_H_ - -#include -#include -#include - -using namespace v8; -using namespace node; - -class BSON : public ObjectWrap { - public: - BSON() : ObjectWrap() {} - ~BSON() {} - - static void Initialize(Handle target); - static Handle BSONDeserializeStream(const Arguments &args); - - // JS based objects - static Handle BSONSerialize(const Arguments &args); - static Handle BSONDeserialize(const Arguments &args); - - // Calculate size of function - static Handle CalculateObjectSize(const Arguments &args); - static Handle SerializeWithBufferAndIndex(const Arguments &args); - - // Experimental - static Handle CalculateObjectSize2(const Arguments &args); - static Handle BSONSerialize2(const Arguments &args); - - // Constructor used for creating new BSON objects from C++ - static Persistent constructor_template; - - private: - static Handle New(const Arguments &args); - static Handle deserialize(BSON *bson, char *data, uint32_t dataLength, uint32_t startIndex, bool is_array_item); - static uint32_t serialize(BSON *bson, char *serialized_object, uint32_t index, Handle name, Handle value, bool check_key, bool serializeFunctions); - - static char* extract_string(char *data, uint32_t offset); - static const char* ToCString(const v8::String::Utf8Value& value); - static uint32_t calculate_object_size(BSON *bson, Handle object, bool serializeFunctions); - - static void write_int32(char *data, uint32_t value); - static void write_int64(char *data, int64_t value); - static void write_double(char *data, double value); - static uint16_t deserialize_int8(char *data, uint32_t offset); - static uint32_t deserialize_int32(char* data, uint32_t offset); - static char *check_key(Local key); - - // BSON type instantiate functions - Persistent longConstructor; - Persistent objectIDConstructor; - Persistent binaryConstructor; - Persistent codeConstructor; - Persistent dbrefConstructor; - Persistent symbolConstructor; - Persistent doubleConstructor; - Persistent timestampConstructor; - Persistent minKeyConstructor; - Persistent maxKeyConstructor; - - // Equality Objects - Persistent longString; - Persistent objectIDString; - Persistent binaryString; - Persistent codeString; - Persistent dbrefString; - Persistent symbolString; - Persistent doubleString; - Persistent timestampString; - Persistent minKeyString; - Persistent maxKeyString; - - // Equality speed up comparision objects - Persistent _bsontypeString; - Persistent _longLowString; - Persistent _longHighString; - Persistent _objectIDidString; - Persistent _binaryPositionString; - Persistent _binarySubTypeString; - Persistent _binaryBufferString; - Persistent _doubleValueString; - Persistent _symbolValueString; - - Persistent _dbRefRefString; - Persistent _dbRefIdRefString; - Persistent _dbRefDbRefString; - Persistent _dbRefNamespaceString; - Persistent _dbRefDbString; - Persistent _dbRefOidString; - - // Decode JS function - static Handle decodeLong(BSON *bson, char *data, uint32_t index); - static Handle decodeTimestamp(BSON *bson, char *data, uint32_t index); - static Handle decodeOid(BSON *bson, char *oid); - static Handle decodeBinary(BSON *bson, uint32_t sub_type, uint32_t number_of_bytes, char *data); - static Handle decodeCode(BSON *bson, char *code, Handle scope); - static Handle decodeDBref(BSON *bson, Local ref, Local oid, Local db); - - // Experimental - static uint32_t calculate_object_size2(Handle object); - static uint32_t serialize2(char *serialized_object, uint32_t index, Handle name, Handle value, uint32_t object_size, bool check_key); -}; - -#endif // BSON_H_ diff --git a/external-libs/bson/index.js b/external-libs/bson/index.js deleted file mode 100644 index 2c66dee6cca..00000000000 --- a/external-libs/bson/index.js +++ /dev/null @@ -1,20 +0,0 @@ -var bson = require('./bson'); -exports.BSON = bson.BSON; -exports.Long = require('../../lib/mongodb/bson/long').Long; -exports.ObjectID = require('../../lib/mongodb/bson/objectid').ObjectID; -exports.DBRef = require('../../lib/mongodb/bson/db_ref').DBRef; -exports.Code = require('../../lib/mongodb/bson/code').Code; -exports.Timestamp = require('../../lib/mongodb/bson/timestamp').Timestamp; -exports.Binary = require('../../lib/mongodb/bson/binary').Binary; -exports.Double = require('../../lib/mongodb/bson/double').Double; -exports.MaxKey = require('../../lib/mongodb/bson/max_key').MaxKey; -exports.MinKey = require('../../lib/mongodb/bson/min_key').MinKey; -exports.Symbol = require('../../lib/mongodb/bson/symbol').Symbol; - -// Just add constants tot he Native BSON parser -exports.BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -exports.BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -exports.BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -exports.BSON.BSON_BINARY_SUBTYPE_UUID = 3; -exports.BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -exports.BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; diff --git a/external-libs/bson/test/test_bson.js b/external-libs/bson/test/test_bson.js deleted file mode 100644 index a3c096e0f8e..00000000000 --- a/external-libs/bson/test/test_bson.js +++ /dev/null @@ -1,347 +0,0 @@ -var sys = require('util'), - debug = require('util').debug, - inspect = require('util').inspect, - Buffer = require('buffer').Buffer, - BSON = require('../bson').BSON, - Buffer = require('buffer').Buffer, - BSONJS = require('../../../lib/mongodb/bson/bson').BSON, - BinaryParser = require('../../../lib/mongodb/bson/binary_parser').BinaryParser, - Long = require('../../../lib/mongodb/bson/long').Long, - ObjectID = require('../../../lib/mongodb/bson/bson').ObjectID, - Binary = require('../../../lib/mongodb/bson/bson').Binary, - Code = require('../../../lib/mongodb/bson/bson').Code, - DBRef = require('../../../lib/mongodb/bson/bson').DBRef, - Symbol = require('../../../lib/mongodb/bson/bson').Symbol, - Double = require('../../../lib/mongodb/bson/bson').Double, - MaxKey = require('../../../lib/mongodb/bson/bson').MaxKey, - MinKey = require('../../../lib/mongodb/bson/bson').MinKey, - Timestamp = require('../../../lib/mongodb/bson/bson').Timestamp, - assert = require('assert'); - -sys.puts("=== EXECUTING TEST_BSON ==="); - -// Should fail due to illegal key -assert.throws(function() { new ObjectID('foo'); }) -assert.throws(function() { new ObjectID('foo'); }) - -// Parsers -var bsonC = new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); -var bsonJS = new BSONJS([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); - -// Simple serialization and deserialization of edge value -var doc = {doc:0x1ffffffffffffe}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -var doc = {doc:-0x1ffffffffffffe}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// -// Assert correct toJSON -// -var a = Long.fromNumber(10); -assert.equal(10, a); - -var a = Long.fromNumber(9223372036854775807); -assert.equal(9223372036854775807, a); - -// Simple serialization and deserialization test for a Single String value -var doc = {doc:'Serialize'}; -var simple_string_serialized = bsonC.serialize(doc, true, false); - -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// Nested doc -var doc = {a:{b:{c:1}}}; -var simple_string_serialized = bsonC.serialize(doc, false, true); - -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// Simple integer serialization/deserialization test, including testing boundary conditions -var doc = {doc:-1}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -var doc = {doc:2147483648}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -var doc = {doc:-2147483648}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// Simple serialization and deserialization test for a Long value -var doc = {doc:Long.fromNumber(9223372036854775807)}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize({doc:Long.fromNumber(9223372036854775807)}, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -var doc = {doc:Long.fromNumber(-9223372036854775807)}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize({doc:Long.fromNumber(-9223372036854775807)}, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// Simple serialization and deserialization for a Float value -var doc = {doc:2222.3333}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -var doc = {doc:-2222.3333}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// Simple serialization and deserialization for a null value -var doc = {doc:null}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// Simple serialization and deserialization for a boolean value -var doc = {doc:true}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// Simple serialization and deserialization for a date value -var date = new Date(); -var doc = {doc:date}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')), bsonC.deserialize(simple_string_serialized)); - -// Simple serialization and deserialization for a boolean value -var doc = {doc:/abcd/mi}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.equal(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')).doc.toString(), bsonC.deserialize(simple_string_serialized).doc.toString()); - -var doc = {doc:/abcd/}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc, false, true)); -assert.equal(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')).doc.toString(), bsonC.deserialize(simple_string_serialized).doc.toString()); - -// Simple serialization and deserialization for a objectId value -var doc = {doc:new ObjectID()}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -var doc2 = {doc:ObjectID.createFromHexString(doc.doc.toHexString())}; - -assert.deepEqual(simple_string_serialized, bsonJS.serialize(doc2, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')).doc.toString(), bsonC.deserialize(simple_string_serialized).doc.toString()); - -// Simple serialization and deserialization for a Binary value -var binary = new Binary(); -var string = 'binstring' -for(var index = 0; index < string.length; index++) { binary.put(string.charAt(index)); } - -var Binary = new Binary(); -var string = 'binstring' -for(var index = 0; index < string.length; index++) { Binary.put(string.charAt(index)); } - -var simple_string_serialized = bsonC.serialize({doc:binary}, false, true); -assert.deepEqual(simple_string_serialized, bsonJS.serialize({doc:Binary}, false, true)); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized, 'binary')).doc.value(), bsonC.deserialize(simple_string_serialized).doc.value()); - -// Simple serialization and deserialization for a Code value -var code = new Code('this.a > i', {'i': 1}); -var Code = new Code('this.a > i', {'i': 1}); -var simple_string_serialized_2 = bsonJS.serialize({doc:Code}, false, true); -var simple_string_serialized = bsonC.serialize({doc:code}, false, true); - -assert.deepEqual(simple_string_serialized, simple_string_serialized_2); -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized_2, 'binary')).doc.scope, bsonC.deserialize(simple_string_serialized).doc.scope); - -// Simple serialization and deserialization for an Object -var simple_string_serialized = bsonC.serialize({doc:{a:1, b:{c:2}}}, false, true); -var simple_string_serialized_2 = bsonJS.serialize({doc:{a:1, b:{c:2}}}, false, true); -assert.deepEqual(simple_string_serialized, simple_string_serialized_2) -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized_2, 'binary')).doc, bsonC.deserialize(simple_string_serialized).doc); - -// Simple serialization and deserialization for an Array -var simple_string_serialized = bsonC.serialize({doc:[9, 9, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1]}, false, true); -var simple_string_serialized_2 = bsonJS.serialize({doc:[9, 9, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1]}, false, true); - -assert.deepEqual(simple_string_serialized, simple_string_serialized_2) -assert.deepEqual(bsonJS.deserialize(new Buffer(simple_string_serialized_2, 'binary')).doc, bsonC.deserialize(simple_string_serialized).doc); - -// Simple serialization and deserialization for a DBRef -var oid = new ObjectID() -var oid2 = new ObjectID.createFromHexString(oid.toHexString()) -var simple_string_serialized = bsonJS.serialize({doc:new DBRef('namespace', oid2, 'integration_tests_')}, false, true); -var simple_string_serialized_2 = bsonC.serialize({doc:new DBRef('namespace', oid, 'integration_tests_')}, false, true); - -assert.deepEqual(simple_string_serialized, simple_string_serialized_2) -// Ensure we have the same values for the dbref -var object_js = bsonJS.deserialize(new Buffer(simple_string_serialized_2, 'binary')); -var object_c = bsonC.deserialize(simple_string_serialized); - -assert.equal(object_js.doc.namespace, object_c.doc.namespace); -assert.equal(object_js.doc.oid.toHexString(), object_c.doc.oid.toHexString()); -assert.equal(object_js.doc.db, object_c.doc.db); - -// Serialized document -var bytes = [47,0,0,0,2,110,97,109,101,0,6,0,0,0,80,97,116,116,121,0,16,97,103,101,0,34,0,0,0,7,95,105,100,0,76,100,12,23,11,30,39,8,89,0,0,1,0]; -var serialized_data = ''; -// Convert to chars -for(var i = 0; i < bytes.length; i++) { - serialized_data = serialized_data + BinaryParser.fromByte(bytes[i]); -} -var object = bsonC.deserialize(new Buffer(serialized_data, 'binary')); -assert.equal('Patty', object.name) -assert.equal(34, object.age) -assert.equal('4c640c170b1e270859000001', object._id.toHexString()) - -// Serialize utf8 -var doc = { "name" : "本荘由利地域に洪水警報", "name1" : "öüóőúéáűíÖÜÓŐÚÉÁŰÍ", "name2" : "abcdedede"}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -var simple_string_serialized2 = bsonJS.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, simple_string_serialized2) - -var object = bsonC.deserialize(simple_string_serialized); -assert.equal(doc.name, object.name) -assert.equal(doc.name1, object.name1) -assert.equal(doc.name2, object.name2) - -// Serialize object with array -var doc = {b:[1, 2, 3]}; -var simple_string_serialized = bsonC.serialize(doc, false, true); -var simple_string_serialized_2 = bsonJS.serialize(doc, false, true); -assert.deepEqual(simple_string_serialized, simple_string_serialized_2) - -var object = bsonC.deserialize(simple_string_serialized); -assert.deepEqual(doc, object) - -// Test equality of an object ID -var object_id = new ObjectID(); -var object_id_2 = new ObjectID(); -assert.ok(object_id.equals(object_id)); -assert.ok(!(object_id.equals(object_id_2))) - -// Test same serialization for Object ID -var object_id = new ObjectID(); -var object_id2 = ObjectID.createFromHexString(object_id.toString()) -var simple_string_serialized = bsonJS.serialize({doc:object_id}, false, true); -var simple_string_serialized_2 = bsonC.serialize({doc:object_id2}, false, true); - -assert.equal(simple_string_serialized_2.length, simple_string_serialized.length); -assert.deepEqual(simple_string_serialized, simple_string_serialized_2) -var object = bsonJS.deserialize(new Buffer(simple_string_serialized_2, 'binary')); -var object2 = bsonC.deserialize(simple_string_serialized); -assert.equal(object.doc.id, object2.doc.id) - -// JS Object -var c1 = { _id: new ObjectID, comments: [], title: 'number 1' }; -var c2 = { _id: new ObjectID, comments: [], title: 'number 2' }; -var doc = { - numbers: [] - , owners: [] - , comments: [c1, c2] - , _id: new ObjectID -}; - -var simple_string_serialized = bsonJS.serialize(doc, false, true); - -// C++ Object -var c1 = { _id: ObjectID.createFromHexString(c1._id.toHexString()), comments: [], title: 'number 1' }; -var c2 = { _id: ObjectID.createFromHexString(c2._id.toHexString()), comments: [], title: 'number 2' }; -var doc = { - numbers: [] - , owners: [] - , comments: [c1, c2] - , _id: ObjectID.createFromHexString(doc._id.toHexString()) -}; - -var simple_string_serialized_2 = bsonC.serialize(doc, false, true); - -for(var i = 0; i < simple_string_serialized_2.length; i++) { - // debug(i + "[" + simple_string_serialized_2[i] + "] = [" + simple_string_serialized[i] + "]") - assert.equal(simple_string_serialized_2[i], simple_string_serialized[i]); -} - -// Deserialize the string -var doc1 = bsonJS.deserialize(new Buffer(simple_string_serialized_2)); -var doc2 = bsonC.deserialize(new Buffer(simple_string_serialized_2)); -assert.equal(doc._id.id, doc1._id.id) -assert.equal(doc._id.id, doc2._id.id) -assert.equal(doc1._id.id, doc2._id.id) - -var doc = { - _id: 'testid', - key1: { code: 'test1', time: {start:1309323402727,end:1309323402727}, x:10, y:5 }, - key2: { code: 'test1', time: {start:1309323402727,end:1309323402727}, x:10, y:5 } -}; - -var simple_string_serialized = bsonJS.serialize(doc, false, true); -var simple_string_serialized_2 = bsonC.serialize(doc, false, true); - -// Deserialize the string -var doc1 = bsonJS.deserialize(new Buffer(simple_string_serialized_2)); -var doc2 = bsonC.deserialize(new Buffer(simple_string_serialized_2)); -assert.deepEqual(doc2, doc1) -assert.deepEqual(doc, doc2) -assert.deepEqual(doc, doc1) - -// Serialize function -var doc = { - _id: 'testid', - key1: function() {} -} - -var simple_string_serialized = bsonJS.serialize(doc, false, true, true); -var simple_string_serialized_2 = bsonC.serialize(doc, false, true, true); - -// Deserialize the string -var doc1 = bsonJS.deserialize(new Buffer(simple_string_serialized_2)); -var doc2 = bsonC.deserialize(new Buffer(simple_string_serialized_2)); -assert.equal(doc1.key1.code.toString(), doc2.key1.code.toString()) - -var doc = {"user_id":"4e9fc8d55883d90100000003","lc_status":{"$ne":"deleted"},"owner_rating":{"$exists":false}}; -var simple_string_serialized = bsonJS.serialize(doc, false, true, true); -var simple_string_serialized_2 = bsonC.serialize(doc, false, true, true); - -// Should serialize to the same value -assert.equal(simple_string_serialized_2.toString('hex'), simple_string_serialized.toString('hex')) -var doc1 = bsonJS.deserialize(simple_string_serialized_2); -var doc2 = bsonC.deserialize(simple_string_serialized); -assert.deepEqual(doc1, doc2) - -// Hex Id -var hexId = new ObjectID().toString(); -var docJS = {_id: ObjectID.createFromHexString(hexId), 'funds.remaining': {$gte: 1.222}, 'transactions.id': {$ne: ObjectID.createFromHexString(hexId)}}; -var docC = {_id: ObjectID.createFromHexString(hexId), 'funds.remaining': {$gte: 1.222}, 'transactions.id': {$ne: ObjectID.createFromHexString(hexId)}}; -var docJSBin = bsonJS.serialize(docJS, false, true, true); -var docCBin = bsonC.serialize(docC, false, true, true); -assert.equal(docCBin.toString('hex'), docJSBin.toString('hex')); - -// // Complex document serialization -// doc = {"DateTime": "Tue Nov 40 2011 17:27:55 GMT+0000 (WEST)","isActive": true,"Media": {"URL": "http://videos.sapo.pt/Tc85NsjaKjj8o5aV7Ubb"},"Title": "Lisboa fecha a ganhar 0.19%","SetPosition": 60,"Type": "videos","Thumbnail": [{"URL": "http://rd3.videos.sapo.pt/Tc85NsjaKjj8o5aV7Ubb/pic/320x240","Dimensions": {"Height": 240,"Width": 320}}],"Source": {"URL": "http://videos.sapo.pt","SetID": "1288","SourceID": "http://videos.sapo.pt/tvnet/rss2","SetURL": "http://noticias.sapo.pt/videos/tv-net_1288/","ItemID": "Tc85NsjaKjj8o5aV7Ubb","Name": "SAPO Vídeos"},"Category": "Tec_ciencia","Description": "Lisboa fecha a ganhar 0.19%","GalleryID": new ObjectID("4eea2a634ce8573200000000"),"InternalRefs": {"RegisterDate": "Thu Dec 15 2011 17:12:51 GMT+0000 (WEST)","ChangeDate": "Thu Dec 15 2011 17:12:51 GMT+0000 (WEST)","Hash": 332279244514},"_id": new ObjectID("4eea2a96e52778160000003a")} -// var docJSBin = bsonJS.serialize(docJS, false, true, true); -// var docCBin = bsonC.serialize(docC, false, true, true); -// -// - -// // Force garbage collect -// global.gc(); - - - - - - - - - - - - - - - diff --git a/external-libs/bson/test/test_full_bson.js b/external-libs/bson/test/test_full_bson.js deleted file mode 100644 index 3efee430250..00000000000 --- a/external-libs/bson/test/test_full_bson.js +++ /dev/null @@ -1,216 +0,0 @@ -var sys = require('util'), - fs = require('fs'), - Buffer = require('buffer').Buffer, - BSON = require('../bson').BSON, - Buffer = require('buffer').Buffer, - assert = require('assert'), - BinaryParser = require('../../../lib/mongodb/bson/binary_parser').BinaryParser, - BSONJS = require('../../../lib/mongodb/bson/bson').BSON, - Long = require('../../../lib/mongodb/bson/long').Long, - ObjectID = require('../../../lib/mongodb/bson/bson').ObjectID, - Binary = require('../../../lib/mongodb/bson/bson').Binary, - Code = require('../../../lib/mongodb/bson/bson').Code, - DBRef = require('../../../lib/mongodb/bson/bson').DBRef, - Symbol = require('../../../lib/mongodb/bson/bson').Symbol, - Double = require('../../../lib/mongodb/bson/bson').Double, - MaxKey = require('../../../lib/mongodb/bson/bson').MaxKey, - MinKey = require('../../../lib/mongodb/bson/bson').MinKey, - Timestamp = require('../../../lib/mongodb/bson/bson').Timestamp; - -sys.puts("=== EXECUTING TEST_FULL_BSON ==="); - -// Parsers -var bsonC = new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); -var bsonJS = new BSONJS([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); - -// Should Correctly Deserialize object -var bytes = [95,0,0,0,2,110,115,0,42,0,0,0,105,110,116,101,103,114,97,116,105,111,110,95,116,101,115,116,115,95,46,116,101,115,116,95,105,110,100,101,120,95,105,110,102,111,114,109,97,116,105,111,110,0,8,117,110,105,113,117,101,0,0,3,107,101,121,0,12,0,0,0,16,97,0,1,0,0,0,0,2,110,97,109,101,0,4,0,0,0,97,95,49,0,0]; -var serialized_data = ''; -// Convert to chars -for(var i = 0; i < bytes.length; i++) { - serialized_data = serialized_data + BinaryParser.fromByte(bytes[i]); -} -var object = bsonC.deserialize(serialized_data); -assert.equal("a_1", object.name); -assert.equal(false, object.unique); -assert.equal(1, object.key.a); - -// Should Correctly Deserialize object with all types -var bytes = [26,1,0,0,7,95,105,100,0,161,190,98,75,118,169,3,0,0,3,0,0,4,97,114,114,97,121,0,26,0,0,0,16,48,0,1,0,0,0,16,49,0,2,0,0,0,16,50,0,3,0,0,0,0,2,115,116,114,105,110,103,0,6,0,0,0,104,101,108,108,111,0,3,104,97,115,104,0,19,0,0,0,16,97,0,1,0,0,0,16,98,0,2,0,0,0,0,9,100,97,116,101,0,161,190,98,75,0,0,0,0,7,111,105,100,0,161,190,98,75,90,217,18,0,0,1,0,0,5,98,105,110,97,114,121,0,7,0,0,0,2,3,0,0,0,49,50,51,16,105,110,116,0,42,0,0,0,1,102,108,111,97,116,0,223,224,11,147,169,170,64,64,11,114,101,103,101,120,112,0,102,111,111,98,97,114,0,105,0,8,98,111,111,108,101,97,110,0,1,15,119,104,101,114,101,0,25,0,0,0,12,0,0,0,116,104,105,115,46,120,32,61,61,32,51,0,5,0,0,0,0,3,100,98,114,101,102,0,37,0,0,0,2,36,114,101,102,0,5,0,0,0,116,101,115,116,0,7,36,105,100,0,161,190,98,75,2,180,1,0,0,2,0,0,0,10,110,117,108,108,0,0]; -var serialized_data = ''; -// Convert to chars -for(var i = 0; i < bytes.length; i++) { - serialized_data = serialized_data + BinaryParser.fromByte(bytes[i]); -} - -var object = bsonJS.deserialize(new Buffer(serialized_data, 'binary')); -assert.equal("hello", object.string); -assert.deepEqual([1, 2, 3], object.array); -assert.equal(1, object.hash.a); -assert.equal(2, object.hash.b); -assert.ok(object.date != null); -assert.ok(object.oid != null); -assert.ok(object.binary != null); -assert.equal(42, object.int); -assert.equal(33.3333, object.float); -assert.ok(object.regexp != null); -assert.equal(true, object.boolean); -assert.ok(object.where != null); -assert.ok(object.dbref != null); -assert.ok(object['null'] == null); - -// Should Serialize and Deserialze String -var test_string = {hello: 'world'} -var serialized_data = bsonC.serialize(test_string) -assert.deepEqual(test_string, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize Integer -var test_number = {doc: 5} -var serialized_data = bsonC.serialize(test_number) -assert.deepEqual(test_number, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize null value -var test_null = {doc:null} -var serialized_data = bsonC.serialize(test_null) -var object = bsonC.deserialize(serialized_data); -assert.deepEqual(test_null, object); - -// Should Correctly Serialize and Deserialize undefined value -var test_undefined = {doc:undefined} -var serialized_data = bsonC.serialize(test_undefined) -var object = bsonJS.deserialize(new Buffer(serialized_data, 'binary')); -assert.equal(null, object.doc) - -// Should Correctly Serialize and Deserialize Number -var test_number = {doc: 5.5} -var serialized_data = bsonC.serialize(test_number) -assert.deepEqual(test_number, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize Integer -var test_int = {doc: 42} -var serialized_data = bsonC.serialize(test_int) -assert.deepEqual(test_int, bsonC.deserialize(serialized_data)); - -test_int = {doc: -5600} -serialized_data = bsonC.serialize(test_int) -assert.deepEqual(test_int, bsonC.deserialize(serialized_data)); - -test_int = {doc: 2147483647} -serialized_data = bsonC.serialize(test_int) -assert.deepEqual(test_int, bsonC.deserialize(serialized_data)); - -test_int = {doc: -2147483648} -serialized_data = bsonC.serialize(test_int) -assert.deepEqual(test_int, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize Object -var doc = {doc: {age: 42, name: 'Spongebob', shoe_size: 9.5}} -var serialized_data = bsonC.serialize(doc) -assert.deepEqual(doc, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize Array -var doc = {doc: [1, 2, 'a', 'b']} -var serialized_data = bsonC.serialize(doc) -assert.deepEqual(doc, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize Array with added on functions -var doc = {doc: [1, 2, 'a', 'b']} -var serialized_data = bsonC.serialize(doc) -assert.deepEqual(doc, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize A Boolean -var doc = {doc: true} -var serialized_data = bsonC.serialize(doc) -assert.deepEqual(doc, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize a Date -var date = new Date() -//(2009, 11, 12, 12, 00, 30) -date.setUTCDate(12) -date.setUTCFullYear(2009) -date.setUTCMonth(11 - 1) -date.setUTCHours(12) -date.setUTCMinutes(0) -date.setUTCSeconds(30) -var doc = {doc: date} -var serialized_data = bsonC.serialize(doc) -assert.deepEqual(doc, bsonC.deserialize(serialized_data)); - -// // Should Correctly Serialize and Deserialize Oid -var doc = {doc: new ObjectID()} -var serialized_data = bsonC.serialize(doc) -assert.deepEqual(doc.doc.toHexString(), bsonC.deserialize(serialized_data).doc.toHexString()) - -// Should Correctly encode Empty Hash -var test_code = {} -var serialized_data = bsonC.serialize(test_code) -assert.deepEqual(test_code, bsonC.deserialize(serialized_data)); - -// Should Correctly Serialize and Deserialize Ordered Hash -var doc = {doc: {b:1, a:2, c:3, d:4}} -var serialized_data = bsonC.serialize(doc) -var decoded_hash = bsonC.deserialize(serialized_data).doc -var keys = [] -for(name in decoded_hash) keys.push(name) -assert.deepEqual(['b', 'a', 'c', 'd'], keys) - -// Should Correctly Serialize and Deserialize Regular Expression -// Serialize the regular expression -var doc = {doc: /foobar/mi} -var serialized_data = bsonC.serialize(doc) -var doc2 = bsonC.deserialize(serialized_data); -assert.equal(doc.doc.toString(), doc2.doc.toString()) - -// Should Correctly Serialize and Deserialize a Binary object -var bin = new Binary() -var string = 'binstring' -for(var index = 0; index < string.length; index++) { - bin.put(string.charAt(index)) -} -var doc = {doc: bin} -var serialized_data = bsonC.serialize(doc) -var deserialized_data = bsonC.deserialize(serialized_data); -assert.equal(doc.doc.value(), deserialized_data.doc.value()) - -// Should Correctly Serialize and Deserialize a big Binary object -var data = fs.readFileSync("../../test/gridstore/test_gs_weird_bug.png", 'binary'); -var bin = new Binary() -bin.write(data) -var doc = {doc: bin} -var serialized_data = bsonC.serialize(doc) -var deserialized_data = bsonC.deserialize(serialized_data); -assert.equal(doc.doc.value(), deserialized_data.doc.value()) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/external-libs/bson/test/test_stackless_bson.js b/external-libs/bson/test/test_stackless_bson.js deleted file mode 100644 index 5f43c4702b9..00000000000 --- a/external-libs/bson/test/test_stackless_bson.js +++ /dev/null @@ -1,130 +0,0 @@ -var Buffer = require('buffer').Buffer, - BSON = require('../bson').BSON, - Buffer = require('buffer').Buffer, - BSONJS = require('../../../lib/mongodb/bson/bson').BSON, - BinaryParser = require('../../../lib/mongodb/bson/binary_parser').BinaryParser, - Long = require('../../../lib/mongodb/bson/long').Long, - ObjectID = require('../../../lib/mongodb/bson/bson').ObjectID, - Binary = require('../../../lib/mongodb/bson/bson').Binary, - Code = require('../../../lib/mongodb/bson/bson').Code, - DBRef = require('../../../lib/mongodb/bson/bson').DBRef, - Symbol = require('../../../lib/mongodb/bson/bson').Symbol, - Double = require('../../../lib/mongodb/bson/bson').Double, - MaxKey = require('../../../lib/mongodb/bson/bson').MaxKey, - MinKey = require('../../../lib/mongodb/bson/bson').MinKey, - Timestamp = require('../../../lib/mongodb/bson/bson').Timestamp; - assert = require('assert'); - -console.log("=== EXECUTING TEST_STACKLESS_BSON ==="); - -// Parsers -var bsonC = new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); -var bsonJS = new BSONJS([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); - -// Number of iterations for the benchmark -var COUNT = 10000; -// var COUNT = 1; -// Sample simple doc -var doc = {key:"Hello world", key2:"šđžčćŠĐŽČĆ", key3:'客家话', key4:'how are you doing dog!!'}; -// var doc = {}; -// for(var i = 0; i < 100; i++) { -// doc['string' + i] = "dumdyms fsdfdsfdsfdsfsdfdsfsdfsdfsdfsdfsdfsdfsdffsfsdfs"; -// } - -// // Calculate size -console.log(bsonC.calculateObjectSize2(doc)); -console.log(bsonJS.calculateObjectSize(doc)); -// assert.equal(bsonJS.calculateObjectSize(doc), bsonC.calculateObjectSize2(doc)); - -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- -// Benchmark calculateObjectSize -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- - -// Benchmark 1 JS BSON -console.log(COUNT + "x (objectBSON = bsonC.calculateObjectSize(object))") -start = new Date - -for (j=COUNT; --j>=0; ) { - var objectBSON = bsonJS.calculateObjectSize(doc); -} - -end = new Date -var opsprsecond = COUNT / ((end - start)/1000); -console.log("time = ", end - start, "ms -", COUNT / ((end - start)/1000), " ops/sec"); - -// Benchmark 2 C++ BSON calculateObjectSize -console.log(COUNT + "x (objectBSON = bsonC.calculateObjectSize(object))") -start = new Date - -for (j=COUNT; --j>=0; ) { - var objectBSON = bsonC.calculateObjectSize(doc); -} - -end = new Date -var opsprsecond = COUNT / ((end - start)/1000); -console.log("time = ", end - start, "ms -", COUNT / ((end - start)/1000), " ops/sec"); - -// Benchmark 3 C++ BSON calculateObjectSize2 -console.log(COUNT + "x (objectBSON = bsonC.calculateObjectSize2(object))") -start = new Date - -for (j=COUNT; --j>=0; ) { - var objectBSON = bsonC.calculateObjectSize2(doc); -} - -end = new Date -var opsprsecond = COUNT / ((end - start)/1000); -console.log("time = ", end - start, "ms -", COUNT / ((end - start)/1000), " ops/sec"); - -// // Serialize the content -// var _serializedDoc1 = bsonJS.serialize(doc, true, false); -// var _serializedDoc2 = bsonC.serialize2(doc, true, false); -// console.dir(_serializedDoc1); -// console.dir(_serializedDoc2); -// assert.equal(_serializedDoc1.toString('hex'), _serializedDoc2.toString('hex')) -// -// -// // Benchmark 1 -// console.log(COUNT + "x (objectBSON = bsonC.serialize(object))") -// start = new Date -// -// for (j=COUNT; --j>=0; ) { -// // var objectBSON = bsonC.serialize2(doc, true, false); -// var objectBSON = bsonJS.serialize(doc, true, false); -// } -// -// end = new Date -// var opsprsecond = COUNT / ((end - start)/1000); -// console.log("bson size (bytes): ", objectbsonC.length); -// console.log("time = ", end - start, "ms -", COUNT / ((end - start)/1000), " ops/sec"); -// console.log("MB/s = " + ((opsprsecond*objectbsonC.length)/1024)); -// -// // Benchmark 2 -// console.log(COUNT + "x (objectBSON = bsonC.serialize(object))") -// start = new Date -// -// for (j=COUNT; --j>=0; ) { -// var objectBSON = bsonC.serialize2(doc, true, false); -// } -// -// end = new Date -// var opsprsecond = COUNT / ((end - start)/1000); -// console.log("bson size (bytes): ", objectbsonC.length); -// console.log("time = ", end - start, "ms -", COUNT / ((end - start)/1000), " ops/sec"); -// console.log("MB/s = " + ((opsprsecond*objectbsonC.length)/1024)); -// -// // Benchmark 3 -// console.log(COUNT + "x (objectBSON = bsonC.serialize(object))") -// start = new Date -// -// for (j=COUNT; --j>=0; ) { -// var objectBSON = bsonC.serialize(doc, true, false); -// } -// -// end = new Date -// var opsprsecond = COUNT / ((end - start)/1000); -// console.log("bson size (bytes): ", objectbsonC.length); -// console.log("time = ", end - start, "ms -", COUNT / ((end - start)/1000), " ops/sec"); -// console.log("MB/s = " + ((opsprsecond*objectbsonC.length)/1024)); diff --git a/external-libs/bson/wscript b/external-libs/bson/wscript deleted file mode 100644 index 40f5317f116..00000000000 --- a/external-libs/bson/wscript +++ /dev/null @@ -1,39 +0,0 @@ -import Options -from os import unlink, symlink, popen -from os.path import exists - -srcdir = "." -blddir = "build" -VERSION = "0.1.0" - -def set_options(opt): - opt.tool_options("compiler_cxx") - opt.add_option( '--debug' - , action='store_true' - , default=False - , help='Build debug variant [Default: False]' - , dest='debug' - ) - -def configure(conf): - conf.check_tool("compiler_cxx") - conf.check_tool("node_addon") - conf.env.append_value('CXXFLAGS', ['-O3', '-funroll-loops']) - - # conf.env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra']) - # conf.check(lib='node', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='NODE') - -def build(bld): - obj = bld.new_task_gen("cxx", "shlib", "node_addon") - obj.target = "bson" - obj.source = ["bson.cc"] - # obj.uselib = "NODE" - -def shutdown(): - # HACK to get compress.node out of build directory. - # better way to do this? - if Options.commands['clean']: - if exists('bson.node'): unlink('bson.node') - else: - if exists('build/default/bson.node') and not exists('bson.node'): - symlink('build/default/bson.node', 'bson.node') diff --git a/genindex.html b/genindex.html index 75fc6e1514a..287fae5caf3 100644 --- a/genindex.html +++ b/genindex.html @@ -161,7 +161,7 @@

    C

    -
    close() (built-in function), [1], [2] +
    close() (built-in function), [1], [2]
    @@ -195,7 +195,7 @@

    C

    -
    count() (built-in function), [1] +
    count() (built-in function), [1]
    @@ -203,7 +203,7 @@

    C

    -
    createIndex() (built-in function), [1] +
    createIndex() (built-in function), [1]
    @@ -291,7 +291,7 @@

    D

    -
    dropIndex() (built-in function), [1] +
    dropIndex() (built-in function), [1]
    @@ -305,7 +305,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -453,7 +453,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -681,7 +681,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    diff --git a/getting-started.html b/getting-started.html deleted file mode 100644 index 2fb3c70dd20..00000000000 --- a/getting-started.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - Getting Started With MongoDB — MongoDB Node.JS Driver 1.0.0 documentation - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Getting Started With MongoDB

    -
    -

    About MongoDB and this Manual

    -
      -
    • What’s New in 2.2?
    • -
    • Getting Involved in the MongoDB Project (contributions, bug reports, etc.)
    • -
    • About this Documentation
    • -
    • MongoDB Resources
    • -
    -
    -
    -

    Introduction to MongoDB

    -
      -
    • What is MongoDB?
    • -
    • Installation
    • -
    • Drivers
    • -
    • Basic Concepts
    • -
    -
    -
    - - -
    -
    -
    -
    -
    - -

    Page Contents

    - - - -

    Core Documentation

    - - - - -

    This Page

    - -

    Previous page

    -

    MongoDB Manual Contents

    -
    -
    -
    -
    - - - - - - - - \ No newline at end of file diff --git a/index.html b/index.html index 3aa15e7f97a..8ae702a6cad 100644 --- a/index.html +++ b/index.html @@ -83,28 +83,6 @@

    Tutorials -

    Presentations

    - -

    API Documentation

    @@ -136,6 +114,43 @@

    API Documentation +

    External Tutorials

    +
    +
    +
    +

    +

    Projects and Libraries using the driver

    @@ -144,6 +159,31 @@

    Projects and Libraries using the driver +

    MongoDB in General

    +

    There are two main places to learn about MongoDB itself. I’ve included links below.

    +
    +
    +
    +

    There are also some very good books out these days

    +
    +
    +

    Changelog

    @@ -179,15 +219,17 @@

    Page Contents

  • Tutorials
  • -
  • Presentations
      +
    • API Documentation
    • -
    • API Documentation
        +
      • External Tutorials
      • +
      • Video Presentations about different topics around the MongoDB and Node.js
      • Projects and Libraries using the driver
      • +
      • MongoDB in General
      • Changelog
      • diff --git a/index.js b/index.js deleted file mode 100755 index 4f59e9d9262..00000000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/mongodb'); diff --git a/install.js b/install.js deleted file mode 100644 index a6bebfa6720..00000000000 --- a/install.js +++ /dev/null @@ -1,41 +0,0 @@ -var spawn = require('child_process').spawn, - exec = require('child_process').exec; - -process.stdout.write("================================================================================\n"); -process.stdout.write("= =\n"); -process.stdout.write("= To install with C++ bson parser do =\n"); -process.stdout.write("= =\n"); -process.stdout.write("================================================================================\n"); - -// Check if we want to build the native code -var build_native = process.env['npm_package_config_native'] != null ? process.env['npm_package_config_native'] : 'false'; -build_native = build_native == 'true' ? true : false; - -// If we are building the native bson extension ensure we use gmake if available -if(build_native) { - // Check if we need to use gmake - exec('which gmake', function(err, stdout, stderr) { - // Set up spawn command - var make = null; - // No gmake build using make - if(err != null) { - make = spawn('make', ['total']); - } else { - make = spawn('gmake', ['total']); - } - - // Execute spawn - make.stdout.on('data', function(data) { - process.stdout.write(data); - }) - - make.stderr.on('data', function(data) { - process.stdout.write(data); - }) - - make.on('exit', function(code) { - process.stdout.write('child process exited with code ' + code + "\n"); - }) - }); -} - diff --git a/lib/mongodb/admin.js b/lib/mongodb/admin.js deleted file mode 100644 index 89ca706c24a..00000000000 --- a/lib/mongodb/admin.js +++ /dev/null @@ -1,342 +0,0 @@ -/*! - * Module dependencies. - */ -var Collection = require('./collection').Collection, - Cursor = require('./cursor').Cursor, - DbCommand = require('./commands/db_command').DbCommand; - -/** - * Allows the user to access the admin functionality of MongoDB - * - * @class Represents the Admin methods of MongoDB. - * @param {Object} db Current db instance we wish to perform Admin operations on. - * @return {Function} Constructor for Admin type. - */ -function Admin(db) { - this.db = db; -}; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.buildInfo = function(callback) { - this.serverInfo(callback); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api private - */ -Admin.prototype.serverInfo = function(callback) { - var self = this; - var command = {buildinfo:1}; - this.command(command, function(err, doc) { - if(err != null) return callback(err, null); - return callback(null, doc.documents[0]); - }); -} - -/** - * Retrieve the current profiling Level for MongoDB - * - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.profilingLevel = function(callback) { - var self = this; - var command = {profile:-1}; - - this.command(command, function(err, doc) { - doc = doc.documents[0]; - - if(err == null && (doc.ok == 1 || typeof doc.was === 'number')) { - var was = doc.was; - if(was == 0) { - callback(null, "off"); - } else if(was == 1) { - callback(null, "slow_only"); - } else if(was == 2) { - callback(null, "all"); - } else { - callback(new Error("Error: illegal profiling level value " + was), null); - } - } else { - err != null ? callback(err, null) : callback(new Error("Error with profile command"), null); - } - }); -}; - -/** - * Ping the MongoDB server and retrieve results - * - * @param {Object} [options] Optional parameters to the command. - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.ping = function(options, callback) { - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - options = args.length ? args.shift() : {}; - // Set self - var self = this; - var databaseName = this.db.databaseName; - this.db.databaseName = 'admin'; - this.db.executeDbCommand({ping:1}, options, function(err, result) { - self.db.databaseName = databaseName; - return callback(err, result); - }) -} - -/** - * Authenticate against MongoDB - * - * @param {String} username The user name for the authentication. - * @param {String} password The password for the authentication. - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.authenticate = function(username, password, callback) { - var self = this; - var databaseName = this.db.databaseName; - this.db.databaseName = 'admin'; - this.db.authenticate(username, password, function(err, result) { - self.db.databaseName = databaseName; - return callback(err, result); - }) -} - -/** - * Logout current authenticated user - * - * @param {Object} [options] Optional parameters to the command. - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.logout = function(callback) { - var self = this; - var databaseName = this.db.databaseName; - this.db.databaseName = 'admin'; - this.db.logout(function(err, result) { - return callback(err, result); - }) - - self.db.databaseName = databaseName; -} - -/** - * Add a user to the MongoDB server, if the user exists it will - * overwrite the current password - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - * @param {String} username The user name for the authentication. - * @param {String} password The password for the authentication. - * @param {Object} [options] additional options during update. - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.addUser = function(username, password, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - var self = this; - var databaseName = this.db.databaseName; - this.db.databaseName = 'admin'; - this.db.addUser(username, password, options, function(err, result) { - self.db.databaseName = databaseName; - return callback(err, result); - }) -} - -/** - * Remove a user from the MongoDB server - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - * @param {String} username The user name for the authentication. - * @param {Object} [options] additional options during update. - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.removeUser = function(username, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - var self = this; - var databaseName = this.db.databaseName; - this.db.databaseName = 'admin'; - this.db.removeUser(username, options, function(err, result) { - self.db.databaseName = databaseName; - return callback(err, result); - }) -} - -/** - * Set the current profiling level of MongoDB - * - * @param {String} level The new profiling level (off, slow_only, all) - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.setProfilingLevel = function(level, callback) { - var self = this; - var command = {}; - var profile = 0; - - if(level == "off") { - profile = 0; - } else if(level == "slow_only") { - profile = 1; - } else if(level == "all") { - profile = 2; - } else { - return callback(new Error("Error: illegal profiling level value " + level)); - } - - // Set up the profile number - command['profile'] = profile; - // Execute the command to set the profiling level - this.command(command, function(err, doc) { - doc = doc.documents[0]; - - if(err == null && (doc.ok == 1 || typeof doc.was === 'number')) { - return callback(null, level); - } else { - return err != null ? callback(err, null) : callback(new Error("Error with profile command"), null); - } - }); -}; - -/** - * Retrive the current profiling information for MongoDB - * - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.profilingInfo = function(callback) { - var self = this; - var databaseName = this.db.databaseName; - this.db.databaseName = 'admin'; - - try { - new Cursor(this.db, new Collection(this.db, DbCommand.SYSTEM_PROFILE_COLLECTION), {}).toArray(function(err, items) { - return callback(err, items); - }); - } catch (err) { - return callback(err, null); - } - - self.db.databaseName = databaseName; -}; - -/** - * Execute a db command against the Admin database - * - * @param {Object} command A command object `{ping:1}`. - * @param {Object} [options] Optional parameters to the command. - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.command = function(command, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - // Execute a command - this.db.executeDbAdminCommand(command, options, function(err, result) { - // Ensure change before event loop executes - return callback != null ? callback(err, result) : null; - }); -} - -/** - * Validate an existing collection - * - * @param {String} collectionName The name of the collection to validate. - * @param {Object} [options] Optional parameters to the command. - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.validateCollection = function(collectionName, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - var self = this; - var command = {validate: collectionName}; - var keys = Object.keys(options); - - // Decorate command with extra options - for(var i = 0; i < keys.length; i++) { - if(options.hasOwnProperty(keys[i])) { - command[keys[i]] = options[keys[i]]; - } - } - - this.db.executeDbCommand(command, function(err, doc) { - if(err != null) return callback(err, null); - doc = doc.documents[0]; - - if(doc.ok == 0) { - return callback(new Error("Error with validate command"), null); - } else if(doc.result != null && doc.result.constructor != String) { - return callback(new Error("Error with validation data"), null); - } else if(doc.result != null && doc.result.match(/exception|corrupt/) != null) { - return callback(new Error("Error: invalid collection " + collectionName), null); - } else if(doc.valid != null && !doc.valid) { - return callback(new Error("Error: invalid collection " + collectionName), null); - } else { - return callback(null, doc); - } - }); -}; - -/** - * List the available databases - * - * @param {Function} callback Callback function of format `function(err, result) {}`. - * @return {null} Returns no result - * @api public - */ -Admin.prototype.listDatabases = function(callback) { - // Execute the listAllDatabases command - this.db.executeDbAdminCommand({listDatabases:1}, {}, function(err, result) { - if(err != null) { - callback(err, null); - } else { - callback(null, result.documents[0]); - } - }); -} - -/** - * @ignore - */ -exports.Admin = Admin; diff --git a/lib/mongodb/bson/binary.js b/lib/mongodb/bson/binary.js deleted file mode 100644 index 7df0f36b647..00000000000 --- a/lib/mongodb/bson/binary.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Module dependencies. - */ -var Buffer = require('buffer').Buffer; // TODO just use global Buffer -var bson = require('./bson'); - -/** - * A class representation of the BSON Binary type. - * - * Sub types - * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. - * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. - * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. - * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. - * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. - * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. - * - * @class Represents the Binary BSON type. - * @param {Buffer} buffer a buffer object containing the binary data. - * @param {Number} [subType] the option binary type. - * @return {Grid} - */ -function Binary(buffer, subType) { - this._bsontype = 'Binary'; - - if(buffer instanceof Number) { - this.sub_type = buffer; - this.position = 0; - } else { - this.sub_type = subType == null ? bson.BSON.BSON_BINARY_SUBTYPE_DEFAULT : subType; - this.position = 0; - } - - if(buffer != null && !(buffer instanceof Number)) { - this.buffer = typeof buffer == 'string' ? new Buffer(buffer) : buffer; - this.position = buffer.length; - } else { - this.buffer = new Buffer(Binary.BUFFER_SIZE); - this.position = 0; - } -}; - -/** - * Updates this binary with byte_value. - * - * @param {Character} byte_value a single byte we wish to write. - * @api public - */ -Binary.prototype.put = function put (byte_value) { - if(this.buffer.length > this.position) { - this.buffer[this.position++] = byte_value.charCodeAt(0); - } else { - // Create additional overflow buffer - var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length); - // Combine the two buffers together - this.buffer.copy(buffer, 0, 0, this.buffer.length); - this.buffer = buffer; - this.buffer[this.position++] = byte_value.charCodeAt(0); - } -}; - -/** - * Writes. - * - * @param {Buffer|String} string a string or buffer to be written to the Binary BSON object. - * @param {Number} offset specify the binary of where to write the content. - * @api public - */ -Binary.prototype.write = function write(string, offset) { - offset = offset ? offset : this.position; - - // If the buffer is to small let's extend the buffer - if (this.buffer.length < offset + string.length) { - var buffer = new Buffer(this.buffer.length + string.length); - this.buffer.copy(buffer, 0, 0, this.buffer.length); - // Assign the new buffer - this.buffer = buffer; - } - - if (string instanceof Buffer) { - string.copy(this.buffer, offset, 0, string.length); - } else { - this.buffer.write(string, 'binary', offset); - } - - this.position = offset + string.length; -}; - -/** - * Reads **length** bytes starting at **position**. - * - * @param {Number} position read from the given position in the Binary. - * @param {Number} length the number of bytes to read. - * @return {Buffer} - * @api public - */ -Binary.prototype.read = function read(position, length) { - length = length && length > 0 - ? length - : this.position; - - // Return the buffer - return this.buffer.slice(position, position + length); -}; - -/** - * Returns the value of this binary as a string. - * - * @return {String} - * @api public - */ -Binary.prototype.value = function value(asRaw) { - asRaw = asRaw == null ? false : asRaw; - return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position); -}; - -/** - * Length. - * - * @return {Number} the length of the binary. - * @api public - */ -Binary.prototype.length = function length() { - return this.position; -}; - -/** - * @ignore - * @api private - */ -Binary.prototype.toJSON = function() { - return this.buffer != null ? this.buffer.toString('base64') : ''; -} - -/** - * @ignore - * @api private - */ -Binary.prototype.toString = function(format) { - return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : ''; -} - -Binary.BUFFER_SIZE = 256; - -/** - * Default BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_DEFAULT = 0; -/** - * Function BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_FUNCTION = 1; -/** - * Byte Array BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_BYTE_ARRAY = 2; -/** - * UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID = 3; -/** - * MD5 BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_MD5 = 4; -/** - * User BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_USER_DEFINED = 128; - -/** - * Expose. - */ -exports.Binary = Binary; - diff --git a/lib/mongodb/bson/binary_parser.js b/lib/mongodb/bson/binary_parser.js deleted file mode 100644 index 1d6b07ce8a0..00000000000 --- a/lib/mongodb/bson/binary_parser.js +++ /dev/null @@ -1,392 +0,0 @@ - -/** - * Module dependencies. - */ - -var sys = require('util'); - -/** - * Binary Parser. - * Jonas Raoni Soares Silva - * http://jsfromhell.com/classes/binary-parser [v1.0] - */ - -var chr = String.fromCharCode; - -var maxBits = []; -for (var i = 0; i < 64; i++) { - maxBits[i] = Math.pow(2, i); -} - -function BinaryParser (bigEndian, allowExceptions) { - this.bigEndian = bigEndian; - this.allowExceptions = allowExceptions; -}; - -BinaryParser.warn = function warn (msg) { - if (this.allowExceptions) { - throw new Error(msg); - } - - return 1; -}; - -BinaryParser.decodeFloat = function decodeFloat (data, precisionBits, exponentBits) { - var b = new this.Buffer(this.bigEndian, data); - - b.checkBuffer(precisionBits + exponentBits + 1); - - var bias = maxBits[exponentBits - 1] - 1 - , signal = b.readBits(precisionBits + exponentBits, 1) - , exponent = b.readBits(precisionBits, exponentBits) - , significand = 0 - , divisor = 2 - , curByte = b.buffer.length + (-precisionBits >> 3) - 1; - - do { - for (var byteValue = b.buffer[ ++curByte ], startBit = precisionBits % 8 || 8, mask = 1 << startBit; mask >>= 1; ( byteValue & mask ) && ( significand += 1 / divisor ), divisor *= 2 ); - } while (precisionBits -= startBit); - - return exponent == ( bias << 1 ) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity : ( 1 + signal * -2 ) * ( exponent || significand ? !exponent ? Math.pow( 2, -bias + 1 ) * significand : Math.pow( 2, exponent - bias ) * ( 1 + significand ) : 0 ); -}; - -BinaryParser.decodeInt = function decodeInt (data, bits, signed, forceBigEndian) { - var b = new this.Buffer(this.bigEndian || forceBigEndian, data) - , x = b.readBits(0, bits) - , max = maxBits[bits]; //max = Math.pow( 2, bits ); - - return signed && x >= max / 2 - ? x - max - : x; -}; - -BinaryParser.encodeFloat = function encodeFloat (data, precisionBits, exponentBits) { - var bias = maxBits[exponentBits - 1] - 1 - , minExp = -bias + 1 - , maxExp = bias - , minUnnormExp = minExp - precisionBits - , n = parseFloat(data) - , status = isNaN(n) || n == -Infinity || n == +Infinity ? n : 0 - , exp = 0 - , len = 2 * bias + 1 + precisionBits + 3 - , bin = new Array(len) - , signal = (n = status !== 0 ? 0 : n) < 0 - , intPart = Math.floor(n = Math.abs(n)) - , floatPart = n - intPart - , lastBit - , rounded - , result - , i - , j; - - for (i = len; i; bin[--i] = 0); - - for (i = bias + 2; intPart && i; bin[--i] = intPart % 2, intPart = Math.floor(intPart / 2)); - - for (i = bias + 1; floatPart > 0 && i; (bin[++i] = ((floatPart *= 2) >= 1) - 0 ) && --floatPart); - - for (i = -1; ++i < len && !bin[i];); - - if (bin[(lastBit = precisionBits - 1 + (i = (exp = bias + 1 - i) >= minExp && exp <= maxExp ? i + 1 : bias + 1 - (exp = minExp - 1))) + 1]) { - if (!(rounded = bin[lastBit])) { - for (j = lastBit + 2; !rounded && j < len; rounded = bin[j++]); - } - - for (j = lastBit + 1; rounded && --j >= 0; (bin[j] = !bin[j] - 0) && (rounded = 0)); - } - - for (i = i - 2 < 0 ? -1 : i - 3; ++i < len && !bin[i];); - - if ((exp = bias + 1 - i) >= minExp && exp <= maxExp) { - ++i; - } else if (exp < minExp) { - exp != bias + 1 - len && exp < minUnnormExp && this.warn("encodeFloat::float underflow"); - i = bias + 1 - (exp = minExp - 1); - } - - if (intPart || status !== 0) { - this.warn(intPart ? "encodeFloat::float overflow" : "encodeFloat::" + status); - exp = maxExp + 1; - i = bias + 2; - - if (status == -Infinity) { - signal = 1; - } else if (isNaN(status)) { - bin[i] = 1; - } - } - - for (n = Math.abs(exp + bias), j = exponentBits + 1, result = ""; --j; result = (n % 2) + result, n = n >>= 1); - - for (n = 0, j = 0, i = (result = (signal ? "1" : "0") + result + bin.slice(i, i + precisionBits).join("")).length, r = []; i; j = (j + 1) % 8) { - n += (1 << j) * result.charAt(--i); - if (j == 7) { - r[r.length] = String.fromCharCode(n); - n = 0; - } - } - - r[r.length] = n - ? String.fromCharCode(n) - : ""; - - return (this.bigEndian ? r.reverse() : r).join(""); -}; - -BinaryParser.encodeInt = function encodeInt (data, bits, signed, forceBigEndian) { - var max = maxBits[bits]; - - if (data >= max || data < -(max / 2)) { - this.warn("encodeInt::overflow"); - data = 0; - } - - if (data < 0) { - data += max; - } - - for (var r = []; data; r[r.length] = String.fromCharCode(data % 256), data = Math.floor(data / 256)); - - for (bits = -(-bits >> 3) - r.length; bits--; r[r.length] = "\0"); - - return ((this.bigEndian || forceBigEndian) ? r.reverse() : r).join(""); -}; - -BinaryParser.toSmall = function( data ){ return this.decodeInt( data, 8, true ); }; -BinaryParser.fromSmall = function( data ){ return this.encodeInt( data, 8, true ); }; -BinaryParser.toByte = function( data ){ return this.decodeInt( data, 8, false ); }; -BinaryParser.fromByte = function( data ){ return this.encodeInt( data, 8, false ); }; -BinaryParser.toShort = function( data ){ return this.decodeInt( data, 16, true ); }; -BinaryParser.fromShort = function( data ){ return this.encodeInt( data, 16, true ); }; -BinaryParser.toWord = function( data ){ return this.decodeInt( data, 16, false ); }; -BinaryParser.fromWord = function( data ){ return this.encodeInt( data, 16, false ); }; -BinaryParser.toInt = function( data ){ return this.decodeInt( data, 32, true ); }; -BinaryParser.fromInt = function( data ){ return this.encodeInt( data, 32, true ); }; -BinaryParser.toLong = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromLong = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toDWord = function( data ){ return this.decodeInt( data, 32, false ); }; -BinaryParser.fromDWord = function( data ){ return this.encodeInt( data, 32, false ); }; -BinaryParser.toQWord = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromQWord = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toFloat = function( data ){ return this.decodeFloat( data, 23, 8 ); }; -BinaryParser.fromFloat = function( data ){ return this.encodeFloat( data, 23, 8 ); }; -BinaryParser.toDouble = function( data ){ return this.decodeFloat( data, 52, 11 ); }; -BinaryParser.fromDouble = function( data ){ return this.encodeFloat( data, 52, 11 ); }; - -// Factor out the encode so it can be shared by add_header and push_int32 -BinaryParser.encode_int32 = function encode_int32 (number, asArray) { - var a, b, c, d, unsigned; - unsigned = (number < 0) ? (number + 0x100000000) : number; - a = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - b = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - c = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - d = Math.floor(unsigned); - return asArray ? [chr(a), chr(b), chr(c), chr(d)] : chr(a) + chr(b) + chr(c) + chr(d); -}; - -BinaryParser.encode_int64 = function encode_int64 (number) { - var a, b, c, d, e, f, g, h, unsigned; - unsigned = (number < 0) ? (number + 0x10000000000000000) : number; - a = Math.floor(unsigned / 0xffffffffffffff); - unsigned &= 0xffffffffffffff; - b = Math.floor(unsigned / 0xffffffffffff); - unsigned &= 0xffffffffffff; - c = Math.floor(unsigned / 0xffffffffff); - unsigned &= 0xffffffffff; - d = Math.floor(unsigned / 0xffffffff); - unsigned &= 0xffffffff; - e = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - f = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - g = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - h = Math.floor(unsigned); - return chr(a) + chr(b) + chr(c) + chr(d) + chr(e) + chr(f) + chr(g) + chr(h); -}; - -/** - * UTF8 methods - */ - -// Take a raw binary string and return a utf8 string -BinaryParser.decode_utf8 = function decode_utf8 (binaryStr) { - var len = binaryStr.length - , decoded = '' - , i = 0 - , c = 0 - , c1 = 0 - , c2 = 0 - , c3; - - while (i < len) { - c = binaryStr.charCodeAt(i); - if (c < 128) { - decoded += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = binaryStr.charCodeAt(i+1); - decoded += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = binaryStr.charCodeAt(i+1); - c3 = binaryStr.charCodeAt(i+2); - decoded += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - - return decoded; -}; - -// Encode a cstring -BinaryParser.encode_cstring = function encode_cstring (s) { - return unescape(encodeURIComponent(s)) + BinaryParser.fromByte(0); -}; - -// Take a utf8 string and return a binary string -BinaryParser.encode_utf8 = function encode_utf8 (s) { - var a = "" - , c; - - for (var n = 0, len = s.length; n < len; n++) { - c = s.charCodeAt(n); - - if (c < 128) { - a += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - a += String.fromCharCode((c>>6) | 192) ; - a += String.fromCharCode((c&63) | 128); - } else { - a += String.fromCharCode((c>>12) | 224); - a += String.fromCharCode(((c>>6) & 63) | 128); - a += String.fromCharCode((c&63) | 128); - } - } - - return a; -}; - -BinaryParser.hprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } - } - - process.stdout.write("\n\n"); -}; - -BinaryParser.ilprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - - sys.debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - sys.debug(number+' : '+ s.charAt(i)); - } - } -}; - -BinaryParser.hlprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - sys.debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - sys.debug(number+' : '+ s.charAt(i)); - } - } -}; - -/** - * BinaryParser buffer constructor. - */ - -function BinaryParserBuffer (bigEndian, buffer) { - this.bigEndian = bigEndian || 0; - this.buffer = []; - this.setBuffer(buffer); -}; - -BinaryParserBuffer.prototype.setBuffer = function setBuffer (data) { - var l, i, b; - - if (data) { - i = l = data.length; - b = this.buffer = new Array(l); - for (; i; b[l - i] = data.charCodeAt(--i)); - this.bigEndian && b.reverse(); - } -}; - -BinaryParserBuffer.prototype.hasNeededBits = function hasNeededBits (neededBits) { - return this.buffer.length >= -(-neededBits >> 3); -}; - -BinaryParserBuffer.prototype.checkBuffer = function checkBuffer (neededBits) { - if (!this.hasNeededBits(neededBits)) { - throw new Error("checkBuffer::missing bytes"); - } -}; - -BinaryParserBuffer.prototype.readBits = function readBits (start, length) { - //shl fix: Henri Torgemane ~1996 (compressed by Jonas Raoni) - - function shl (a, b) { - for (; b--; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1); - return a; - } - - if (start < 0 || length <= 0) { - return 0; - } - - this.checkBuffer(start + length); - - var offsetLeft - , offsetRight = start % 8 - , curByte = this.buffer.length - ( start >> 3 ) - 1 - , lastByte = this.buffer.length + ( -( start + length ) >> 3 ) - , diff = curByte - lastByte - , sum = ((this.buffer[ curByte ] >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1)) + (diff && (offsetLeft = (start + length) % 8) ? (this.buffer[lastByte++] & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight : 0); - - for(; diff; sum += shl(this.buffer[lastByte++], (diff-- << 3) - offsetRight)); - - return sum; -}; - -/** - * Expose. - */ - -exports.BinaryParser = BinaryParser; -BinaryParser.Buffer = BinaryParserBuffer; diff --git a/lib/mongodb/bson/binary_utils.js b/lib/mongodb/bson/binary_utils.js deleted file mode 100644 index c52accdf724..00000000000 --- a/lib/mongodb/bson/binary_utils.js +++ /dev/null @@ -1,29 +0,0 @@ -exports.encodeInt = function(value) { - var buffer = new Buffer(4); - buffer[3] = (value >> 24) & 0xff; - buffer[2] = (value >> 16) & 0xff; - buffer[1] = (value >> 8) & 0xff; - buffer[0] = value & 0xff; - return buffer; -} - -exports.encodeIntInPlace = function(value, buffer, index) { - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; -} - -exports.encodeCString = function(string) { - var buf = new Buffer(string, 'utf8'); - return [buf, new Buffer([0])]; -} - -exports.decodeUInt32 = function(array, index) { - return array[index] | array[index + 1] << 8 | array[index + 2] << 16 | array[index + 3] << 24; -} - -// Decode the int -exports.decodeUInt8 = function(array, index) { - return array[index]; -} diff --git a/lib/mongodb/bson/bson.js b/lib/mongodb/bson/bson.js deleted file mode 100644 index 53eec196ba4..00000000000 --- a/lib/mongodb/bson/bson.js +++ /dev/null @@ -1,1344 +0,0 @@ -/** - * Module dependencies. - * @ignore - */ -var BinaryParser = require('./binary_parser').BinaryParser - , Long = require('./long').Long - , Double = require('./double').Double - , Timestamp = require('./timestamp').Timestamp - , ObjectID = require('./objectid').ObjectID - , Symbol = require('./symbol').Symbol - , Code = require('./code').Code - , MinKey = require('./min_key').MinKey - , MaxKey = require('./max_key').MaxKey - , DBRef = require('./db_ref').DBRef - , Binary = require('./binary').Binary - , debug = require('util').debug - , crypto = require('crypto') - , inspect = require('util').inspect - , inherits = require('util').inherits - , ieee754 = require('./float_parser'); - - -/** - * Create a new BSON instance - * - * @class Represents the BSON Parser - * @return {BSON} instance of BSON Parser. - */ -function BSON () {}; - -/** - * @ignore - * @api private - */ -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.calculateObjectSize = function calculateObjectSize(object, serializeFunctions) { - var totalLength = (4 + 1); - - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - totalLength += calculateElement(i.toString(), object[i], serializeFunctions) - } - } else { - for(var key in object) { - totalLength += calculateElement(key, object[key], serializeFunctions) - } - } - - return totalLength; -} - -/** - * @ignore - * @api private - */ -function calculateElement(name, value, serializeFunctions) { - switch(typeof value) { - case 'string': - return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1; - case 'number': - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (4 + 1); - } else { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (8 + 1); - } - } else { // 64 bit - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (8 + 1); - } - case 'undefined': - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (1); - case 'boolean': - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (1 + 1); - case 'object': - if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (1); - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (12 + 1); - } else if(value instanceof Date) { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (8 + 1); - } else if(Buffer.isBuffer(value)) { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (1 + 4 + 1) + value.length; - } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp - || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (8 + 1); - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - // Calculate size depending on the availability of a scope - if(value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + BSON.calculateObjectSize(value.scope); - } else { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (value.position + 1 + 4 + 1); - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + (Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1); - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + 1 + BSON.calculateObjectSize(ordered_values, serializeFunctions); - } else if(value instanceof RegExp || toString.call(value) === '[object RegExp]') { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + BSON.calculateObjectSize(value, serializeFunctions) + 1; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || toString.call(value) === '[object RegExp]') { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + BSON.calculateObjectSize(value.scope); - } else if(serializeFunctions) { - return (name != null ? (Buffer.byteLength(name) + 1) : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1; - } - } - } - - return 0; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.serializeWithBufferAndIndex = function serializeWithBufferAndIndex(object, checkKeys, buffer, index, serializeFunctions) { - // Default setting false - serializeFunctions = serializeFunctions == null ? false : serializeFunctions; - // Write end information (length of the object) - var size = buffer.length; - // Write the size of the object - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return serializeObject(object, checkKeys, buffer, index, serializeFunctions) - 1; -} - -/** - * @ignore - * @api private - */ -var serializeObject = function(object, checkKeys, buffer, index, serializeFunctions) { - // Process the object - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - index = packElement(i.toString(), object[i], checkKeys, buffer, index, serializeFunctions); - } - } else { - for(var key in object) { - // Check the key and throw error if it's illegal - if(checkKeys == true && (key != '$db' && key != '$ref' && key != '$id')) { - BSON.checkKey(key); - } - - // Pack the element - index = packElement(key, object[key], checkKeys, buffer, index, serializeFunctions); - } - } - - // Write zero - buffer[index++] = 0; - return index; -} - -/** - * @ignore - * @api private - */ -var packElement = function(name, value, checkKeys, buffer, index, serializeFunctions) { - // console.log("packElement: " + name + " :: " + value) - var startIndex = index; - - switch(typeof value) { - case 'string': - // Encode String type - buffer[index++] = BSON.BSON_DATA_STRING; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - - // Calculate size - var size = Buffer.byteLength(value) + 1; - // Write the size of the string to buffer - buffer[index + 3] = (size >> 24) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index] = size & 0xff; - // Ajust the index - index = index + 4; - // Write the string - buffer.write(value, index, 'utf8'); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - // Return index - return index; - case 'number': - // We have an integer value - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // If the value fits in 32 bits encode as int, if it fits in a double - // encode it as a double, otherwise long - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { - // Set int type 32 bits or less - buffer[index++] = BSON.BSON_DATA_INT; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Write the int value - buffer[index++] = value & 0xff; - buffer[index++] = (value >> 8) & 0xff; - buffer[index++] = (value >> 16) & 0xff; - buffer[index++] = (value >> 24) & 0xff; - } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Write float - ieee754.writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } else { - // Set long type - buffer[index++] = BSON.BSON_DATA_LONG; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - var longVal = Long.fromNumber(value); - var lowBits = longVal.getLowBits(); - var highBits = longVal.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - } - } else { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Write float - ieee754.writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } - - return index; - case 'undefined': - // Set long type - buffer[index++] = BSON.BSON_DATA_NULL; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - return index; - case 'boolean': - // Write the type - buffer[index++] = BSON.BSON_DATA_BOOLEAN; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Encode the boolean value - buffer[index++] = value ? 1 : 0; - return index; - case 'object': - if(value === null || value instanceof MinKey || value instanceof MaxKey - || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - // Write the type of either min or max key - if(value === null) { - buffer[index++] = BSON.BSON_DATA_NULL; - } else if(value instanceof MinKey) { - buffer[index++] = BSON.BSON_DATA_MIN_KEY; - } else { - buffer[index++] = BSON.BSON_DATA_MAX_KEY; - } - - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - return index; - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - // Write the type - buffer[index++] = BSON.BSON_DATA_OID; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Write objectid - buffer.write(value.id, index, 'binary'); - // Ajust index - index = index + 12; - return index; - } else if(value instanceof Date) { - // Write the type - buffer[index++] = BSON.BSON_DATA_DATE; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - - // Write the date - var dateInMilis = Long.fromNumber(value.getTime()); - var lowBits = dateInMilis.getLowBits(); - var highBits = dateInMilis.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(Buffer.isBuffer(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Get size of the buffer (current write point) - var size = value.length; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the default subtype - buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; - // Copy the content form the binary field to the buffer - value.copy(buffer, index, 0, size); - // Adjust the index - index = index + size; - return index; - } else if(value instanceof Long || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - // Write the type - buffer[index++] = value instanceof Long ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Write the date - var lowBits = value.getLowBits(); - var highBits = value.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(value instanceof Double || value['_bsontype'] == 'Double') { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Write float - ieee754.writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - return index; - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - if(value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope); - // Function string - var functionString = value.code.toString(); - // Function Size - var codeSize = Buffer.byteLength(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize + 4; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - buffer.write(functionString, index, 'utf8'); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = new Buffer(scopeSize); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - scopeObjectBuffer.copy(buffer, index, 0, scopeSize); - - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else { - buffer[index++] = BSON.BSON_DATA_CODE; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.code.toString(); - // Function Size - var size = Buffer.byteLength(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - buffer.write(functionString, index, 'utf8'); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Extract the buffer - var data = value.value(true); - // Calculate size - var size = value.position; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the subtype to the buffer - buffer[index++] = value.sub_type; - // Write the data to the object - data.copy(buffer, index, 0, value.position); - // Ajust index - index = index + value.position; - return index; - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - // Write the type - buffer[index++] = BSON.BSON_DATA_SYMBOL; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Calculate size - size = Buffer.byteLength(value.value) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - buffer.write(value.value, index, 'utf8'); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0x00; - return index; - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Write the type - buffer[index++] = BSON.BSON_DATA_OBJECT; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - // Message size - var size = BSON.calculateObjectSize(ordered_values); - // Serialize the object - var endIndex = BSON.serializeWithBufferAndIndex(ordered_values, checkKeys, buffer, index, serializeFunctions); - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write zero for object - buffer[endIndex++] = 0x00; - // Return the end index - return endIndex; - } else if(value instanceof RegExp || toString.call(value) === '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - buffer.write(value.source, index, 'utf8'); - // Adjust the index - index = index + Buffer.byteLength(value.source); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - // Write the type - buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Serialize the object - var endIndex = serializeObject(value, checkKeys, buffer, index + 4, serializeFunctions); - // Write size - var size = endIndex - index; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return endIndex; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || toString.call(value) === '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - buffer.write(value.source, index, 'utf8'); - // Adjust the index - index = index + Buffer.byteLength(value.source); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope); - // Function string - var functionString = value.toString(); - // Function Size - var codeSize = Buffer.byteLength(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - buffer.write(functionString, index, 'utf8'); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = new Buffer(scopeSize); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize - 4; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - scopeObjectBuffer.copy(buffer, index, 0, scopeSize); - - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else if(serializeFunctions) { - buffer[index++] = BSON.BSON_DATA_CODE; - // Encode the name - index = index + buffer.write(name, index, 'utf8') + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.toString(); - // Function Size - var size = Buffer.byteLength(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - buffer.write(functionString, index, 'utf8'); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } - } - - // If no value to serialize - return index; -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - var buffer = new Buffer(BSON.calculateObjectSize(object, serializeFunctions)); - BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, 0, serializeFunctions); - return buffer; -} - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Crc state variables shared by function - * - * @ignore - * @api private - */ -var table = [0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D]; - -/** - * CRC32 hash method, Fast and enough versitility for our usage - * - * @ignore - * @api private - */ -var crc32 = function(string, start, end) { - var crc = 0 - var x = 0; - var y = 0; - crc = crc ^ (-1); - - for(var i = start, iTop = end; i < iTop;i++) { - y = (crc ^ string[i]) & 0xFF; - x = table[y]; - crc = (crc >>> 8) ^ x; - } - - return crc ^ (-1); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents"); - options = options != null ? options : {}; - var index = startIndex; - // Loop over all documents - for(var i = 0; i < numberOfDocuments; i++) { - // Find size of the document - var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24; - // Update options with index - options['index'] = index; - // Parse the document at this point - documents[docStartIndex + i] = BSON.deserialize(data, options); - // Adjust index by the document size - index = index + size; - } - - // Return object containing end index of parsing and list of documents - return index; -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEvalWithHash = function(functionCache, hash, functionString, object) { - // Contains the value we are going to set - var value = null; - - // Check for cache hit, eval if missing and return cached function - if(functionCache[hash] == null) { - eval("value = " + functionString); - functionCache[hash] = value; - } - // Set the object - return functionCache[hash].bind(object); -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEval = function(functionString) { - // Contains the value we are going to set - var value = null; - // Eval the function - eval("value = " + functionString); - return value; -} - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.deserialize = function(buffer, options, isArray) { - // Options - options = options == null ? {} : options; - var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; - var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; - var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; - - // Validate that we have at least 4 bytes of buffer - if(buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long"); - - // Set up index - var index = typeof options['index'] == 'number' ? options['index'] : 0; - // Reads in a C style string - var readCStyleString = function() { - // Get the start search index - var i = index; - // Locate the end of the c string - while(buffer[i] !== 0x00) { i++ } - // Grab utf8 encoded string - var string = buffer.toString('utf8', index, i); - // Update index position - index = i + 1; - // Return string - return string; - } - - // Create holding object - var object = isArray ? [] : {}; - - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 0 || size > buffer.length) throw new Error("corrupt bson message"); - - // While we have more left data left keep parsing - while(true) { - // Read the type - var elementType = buffer[index++]; - // If we get a zero it's the last byte, exit - if(elementType == 0) break; - // Read the name of the field - var name = readCStyleString(); - // Switch on the type - switch(elementType) { - case BSON.BSON_DATA_OID: - // Decode the oid - object[name] = new ObjectID(buffer.toString('binary', index, index + 12)); - // Update index - index = index + 12; - break; - case BSON.BSON_DATA_STRING: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = buffer.toString('utf8', index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_INT: - // Decode the 32bit value - object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - break; - case BSON.BSON_DATA_NUMBER: - // Decode the double value - object[name] = ieee754.readIEEE754(buffer, index, 'little', 52, 8); - // Update the index - index = index + 8; - break; - case BSON.BSON_DATA_DATE: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set date object - object[name] = new Date(new Long(lowBits, highBits).toNumber()); - break; - case BSON.BSON_DATA_BOOLEAN: - // Parse the boolean value - object[name] = buffer[index++] == 1; - break; - case BSON.BSON_DATA_NULL: - // Parse the boolean value - object[name] = null; - break; - case BSON.BSON_DATA_BINARY: - // Decode the size of the binary blob - var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Decode the subtype - var subType = buffer[index++]; - // Decode as raw Buffer object if options specifies it - object[name] = new Binary(buffer.slice(index, index + binarySize), subType); - // Update the index - index = index + binarySize; - break; - case BSON.BSON_DATA_ARRAY: - options['index'] = index; - // Decode the size of the array document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, true); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_OBJECT: - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_REGEXP: - // Create the regexp - var source = readCStyleString(); - var regExpOptions = readCStyleString(); - // For each option add the corresponding one for javascript - var optionsArray = new Array(regExpOptions.length); - - // Parse options - for(var i = 0; i < regExpOptions.length; i++) { - switch(regExpOptions[i]) { - case 'm': - optionsArray[i] = 'm'; - break; - case 's': - optionsArray[i] = 'g'; - break; - case 'i': - optionsArray[i] = 'i'; - break; - } - } - - object[name] = new RegExp(source, optionsArray.join('')); - break; - case BSON.BSON_DATA_LONG: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Create long object - var long = new Long(lowBits, highBits); - // Set the object - object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long; - break; - case BSON.BSON_DATA_SYMBOL: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_TIMESTAMP: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set the object - object[name] = new Timestamp(lowBits, highBits); - break; - case BSON.BSON_DATA_MIN_KEY: - // Parse the object - object[name] = new MinKey(); - break; - case BSON.BSON_DATA_MAX_KEY: - // Parse the object - object[name] = new MaxKey(); - break; - case BSON.BSON_DATA_CODE: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Function string - var functionString = buffer.toString('utf8', index, index + stringSize - 1); - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - } else { - object[name] = new Code(functionString, {}); - } - - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_CODE_W_SCOPE: - // Read the content of the field - var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Javascript function - var functionString = buffer.toString('utf8', index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - // Parse the element - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Decode the scope object - var scopeObject = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - - // Set the scope on the object - object[name].scope = scopeObject; - } else { - object[name] = new Code(functionString, scopeObject); - } - - // Add string to object - break; - } - } - - // Check if we have a db ref object - if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); - - // Return the final objects - return object; -} - -/** - * Check if key name is valid. - * - * @ignore - * @api private - */ -BSON.checkKey = function checkKey (key) { - if (!key.length) return; - // Check if we have a legal key for the object - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.prototype.deserialize = function(data, options) { - return BSON.deserialize(data, options); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - return BSON.deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options); -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.prototype.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - return BSON.serialize(object, checkKeys, asBuffer, serializeFunctions); -} - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.prototype.calculateObjectSize = function(object, serializeFunctions) { - return BSON.calculateObjectSize(object, serializeFunctions); -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.prototype.serializeWithBufferAndIndex = function(object, checkKeys, buffer, startIndex, serializeFunctions) { - return BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, startIndex, serializeFunctions); -} - -/** - * @ignore - * @api private - */ -exports.Code = Code; -exports.Symbol = Symbol; -exports.BSON = BSON; -exports.DBRef = DBRef; -exports.Binary = Binary; -exports.ObjectID = ObjectID; -exports.Long = Long; -exports.Timestamp = Timestamp; -exports.Double = Double; -exports.MinKey = MinKey; -exports.MaxKey = MaxKey; diff --git a/lib/mongodb/bson/code.js b/lib/mongodb/bson/code.js deleted file mode 100644 index b2675385506..00000000000 --- a/lib/mongodb/bson/code.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * A class representation of the BSON Code type. - * - * @class Represents the BSON Code type. - * @param {String|Function} code a string or function. - * @param {Object} [scope] an optional scope for the function. - * @return {Code} - */ -function Code(code, scope) { - this._bsontype = 'Code'; - this.code = code; - this.scope = scope == null ? {} : scope; -}; - -/** - * @ignore - * @api private - */ -Code.prototype.toJSON = function() { - return {scope:this.scope, code:this.code}; -} - -exports.Code = Code; \ No newline at end of file diff --git a/lib/mongodb/bson/db_ref.js b/lib/mongodb/bson/db_ref.js deleted file mode 100644 index d44abb02423..00000000000 --- a/lib/mongodb/bson/db_ref.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * A class representation of the BSON DBRef type. - * - * @class Represents the BSON DBRef type. - * @param {String} namespace the collection name. - * @param {ObjectID} oid the reference ObjectID. - * @param {String} [db] optional db name, if omitted the reference is local to the current db. - * @return {DBRef} - */ -function DBRef(namespace, oid, db) { - this._bsontype = 'DBRef'; - this.namespace = namespace; - this.oid = oid; - this.db = db; -}; - -/** - * @ignore - * @api private - */ -DBRef.prototype.toJSON = function() { - return { - '$ref':this.namespace, - '$id':this.oid, - '$db':this.db == null ? '' : this.db - }; -} - -exports.DBRef = DBRef; \ No newline at end of file diff --git a/lib/mongodb/bson/double.js b/lib/mongodb/bson/double.js deleted file mode 100644 index d77bc718670..00000000000 --- a/lib/mongodb/bson/double.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * A class representation of the BSON Double type. - * - * @class Represents the BSON Double type. - * @param {Number} value the number we want to represent as a double. - * @return {Double} - */ -function Double(value) { - this._bsontype = 'Double'; - this.value = value; -} - -/** - * Access the number value. - * - * @return {Number} returns the wrapped double number. - * @api public - */ -Double.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - * @api private - */ -Double.prototype.toJSON = function() { - return this.value; -} - -exports.Double = Double; \ No newline at end of file diff --git a/lib/mongodb/bson/float_parser.js b/lib/mongodb/bson/float_parser.js deleted file mode 100644 index 5d2af613b94..00000000000 --- a/lib/mongodb/bson/float_parser.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2008, Fair Oaks Labs, Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// -// Modifications to writeIEEE754 to support negative zeroes made by Brian White - -exports.readIEEE754 = function(buffer, offset, endian, mLen, nBytes) { - var e, m, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - nBits = -7, - i = bBE ? 0 : (nBytes - 1), - d = bBE ? 1 : -1, - s = buffer[offset + i]; - - i += d; - - e = s & ((1 << (-nBits)) - 1); - s >>= (-nBits); - nBits += eLen; - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - - m = e & ((1 << (-nBits)) - 1); - e >>= (-nBits); - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity); - } else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; - -exports.writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) { - var e, m, c, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), - i = bBE ? (nBytes-1) : 0, - d = bBE ? -1 : 1, - s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; - - value = Math.abs(value); - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e+eBias >= 1) { - value += rt / c; - } else { - value += rt * Math.pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - - e = (e << mLen) | m; - eLen += mLen; - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - - buffer[offset + i - d] |= s * 128; -}; diff --git a/lib/mongodb/bson/long.js b/lib/mongodb/bson/long.js deleted file mode 100644 index a3c7e0763ab..00000000000 --- a/lib/mongodb/bson/long.js +++ /dev/null @@ -1,852 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * Defines a Long class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Long". This - * implementation is derived from LongLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Longs. - * - * The internal representation of a Long is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class Represents the BSON Long type. - * @param {Number} low the low (signed) 32 bits of the Long. - * @param {Number} high the high (signed) 32 bits of the Long. - */ -function Long(low, high) { - this._bsontype = 'Long'; - /** - * @type {number} - * @api private - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @api private - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @return {Number} the value, assuming it is a 32-bit integer. - * @api public - */ -Long.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @return {Number} the closest floating-point representation to this value. - * @api public - */ -Long.prototype.toNumber = function() { - return this.high_ * Long.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @return {String} the JSON representation. - * @api public - */ -Long.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @param {Number} [opt_radix] the radix in which the text should be written. - * @return {String} the textual representation of this value. - * @api public - */ -Long.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - // We need to change the Long value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixLong = Long.fromNumber(radix); - var div = this.div(radixLong); - var rem = div.multiply(radixLong).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @return {Number} the high 32-bits as a signed value. - * @api public - */ -Long.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @return {Number} the low 32-bits as a signed value. - * @api public - */ -Long.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @return {Number} the low 32-bits as an unsigned value. - * @api public - */ -Long.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Long. - * - * @return {Number} Returns the number of bits needed to represent the absolute value of this Long. - * @api public - */ -Long.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @return {Boolean} whether this value is zero. - * @api public - */ -Long.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @return {Boolean} whether this value is negative. - * @api public - */ -Long.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @return {Boolean} whether this value is odd. - * @api public - */ -Long.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Long equals the other - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long equals the other - * @api public - */ -Long.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Long does not equal the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long does not equal the other. - * @api public - */ -Long.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Long is less than the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is less than the other. - * @api public - */ -Long.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Long is less than or equal to the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is less than or equal to the other. - * @api public - */ -Long.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Long is greater than the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is greater than the other. - * @api public - */ -Long.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Long is greater than or equal to the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is greater than or equal to the other. - * @api public - */ -Long.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Long with the given one. - * - * @param {Long} other Long to compare against. - * @return {Boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - * @api public - */ -Long.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @return {Long} the negation of this value. - * @api public - */ -Long.prototype.negate = function() { - if (this.equals(Long.MIN_VALUE)) { - return Long.MIN_VALUE; - } else { - return this.not().add(Long.ONE); - } -}; - -/** - * Returns the sum of this and the given Long. - * - * @param {Long} other Long to add to this one. - * @return {Long} the sum of this and the given Long. - * @api public - */ -Long.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Long. - * - * @param {Long} other Long to subtract from this. - * @return {Long} the difference of this and the given Long. - * @api public - */ -Long.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Long. - * - * @param {Long} other Long to multiply with this. - * @return {Long} the product of this and the other. - * @api public - */ -Long.prototype.multiply = function(other) { - if (this.isZero()) { - return Long.ZERO; - } else if (other.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } else if (other.equals(Long.MIN_VALUE)) { - return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Longs are small, use float multiplication - if (this.lessThan(Long.TWO_PWR_24_) && - other.lessThan(Long.TWO_PWR_24_)) { - return Long.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Long divided by the given one. - * - * @param {Long} other Long by which to divide. - * @return {Long} this Long divided by the given one. - * @api public - */ -Long.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - if (other.equals(Long.ONE) || - other.equals(Long.NEG_ONE)) { - return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Long.ZERO)) { - return other.isNegative() ? Long.ONE : Long.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Long.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Long.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Long.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Long.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Long modulo the given one. - * - * @param {Long} other Long by which to mod. - * @return {Long} this Long modulo the given one. - * @api public - */ -Long.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @return {Long} the bitwise-NOT of this value. - * @api public - */ -Long.prototype.not = function() { - return Long.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Long and the given one. - * - * @param {Long} other the Long with which to AND. - * @return {Long} the bitwise-AND of this and the other. - * @api public - */ -Long.prototype.and = function(other) { - return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Long and the given one. - * - * @param {Long} other the Long with which to OR. - * @return {Long} the bitwise-OR of this and the other. - * @api public - */ -Long.prototype.or = function(other) { - return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Long and the given one. - * - * @param {Long} other the Long with which to XOR. - * @return {Long} the bitwise-XOR of this and the other. - * @api public - */ -Long.prototype.xor = function(other) { - return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Long with bits shifted to the left by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the left by the given amount. - * @api public - */ -Long.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Long.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Long.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount. - * @api public - */ -Long.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Long.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. - * @api public - */ -Long.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Long.fromBits(high, 0); - } else { - return Long.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Long representing the given (32-bit) integer value. - * - * @param {Number} value the 32-bit integer in question. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Long.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Long(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Long.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @param {Number} value the number in question. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Long.ZERO; - } else if (value <= -Long.TWO_PWR_63_DBL_) { - return Long.MIN_VALUE; - } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { - return Long.MAX_VALUE; - } else if (value < 0) { - return Long.fromNumber(-value).negate(); - } else { - return new Long( - (value % Long.TWO_PWR_32_DBL_) | 0, - (value / Long.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @param {Number} lowBits the low 32-bits. - * @param {Number} highBits the high 32-bits. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromBits = function(lowBits, highBits) { - return new Long(lowBits, highBits); -}; - -/** - * Returns a Long representation of the given string, written using the given radix. - * - * @param {String} str the textual representation of the Long. - * @param {Number} opt_radix the radix in which the text is written. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Long.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 8)); - - var result = Long.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Long.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Long.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Long.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Long representations of small integer values. - * @type {Object} - * @api private - */ -Long.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @api private - */ -Long.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; - -/** @type {Long} */ -Long.ZERO = Long.fromInt(0); - -/** @type {Long} */ -Long.ONE = Long.fromInt(1); - -/** @type {Long} */ -Long.NEG_ONE = Long.fromInt(-1); - -/** @type {Long} */ -Long.MAX_VALUE = - Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Long} */ -Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); - -/** - * @type {Long} - * @api private - */ -Long.TWO_PWR_24_ = Long.fromInt(1 << 24); - -/** - * Expose. - */ -exports.Long = Long; \ No newline at end of file diff --git a/lib/mongodb/bson/max_key.js b/lib/mongodb/bson/max_key.js deleted file mode 100644 index 20b4586cdd0..00000000000 --- a/lib/mongodb/bson/max_key.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * A class representation of the BSON MaxKey type. - * - * @class Represents the BSON MaxKey type. - * @return {MaxKey} - */ -function MaxKey() { - this._bsontype = 'MaxKey'; -} - -exports.MaxKey = MaxKey; \ No newline at end of file diff --git a/lib/mongodb/bson/min_key.js b/lib/mongodb/bson/min_key.js deleted file mode 100644 index 265e563acb9..00000000000 --- a/lib/mongodb/bson/min_key.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * A class representation of the BSON MinKey type. - * - * @class Represents the BSON MinKey type. - * @return {MinKey} - */ -function MinKey() { - this._bsontype = 'MinKey'; -} - -exports.MinKey = MinKey; \ No newline at end of file diff --git a/lib/mongodb/bson/objectid.js b/lib/mongodb/bson/objectid.js deleted file mode 100644 index a78b2637dd1..00000000000 --- a/lib/mongodb/bson/objectid.js +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Module dependencies. - */ -var BinaryParser = require('./binary_parser').BinaryParser, - inspect = require('util').inspect, - debug = require('util').debug; - -/** - * Machine id. - * - * Create a random 3-byte value (i.e. unique for this - * process). Other drivers use a md5 of the machine id here, but - * that would mean an asyc call to gethostname, so we don't bother. - */ -var MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10); - -// Regular expression that checks for hex value -var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$"); - -/** -* Create a new ObjectID instance -* -* @class Represents the BSON ObjectID type -* @param {String|Number} id Can be a 24 byte hex string, 12 byte binary string or a Number. -* @return {Object} instance of ObjectID. -*/ -function ObjectID(id) { - this._bsontype = 'ObjectID'; - - var self = this; - // Throw an error if it's not a valid setup - if(id != null && 'number' != typeof id && (id.length != 12 && id.length != 24)) throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters in hex format"); - // Generate id based on the input - if(id == null || typeof id == 'number') { - this.id = this.generate(id); - } else if(id != null && id.length === 12) { - this.id = id; - } else if(checkForHexRegExp.test(id)) { - return ObjectID.createFromHexString(id); - } else { - this.id = id; - } - - /** - * Returns the generation time in seconds that this ID was generated. - * - * @field generationTime - * @type {Number} - * @getter - * @setter - * @property return number of seconds in the timestamp part of the 12 byte id. - */ - Object.defineProperty(this, "generationTime", { - enumerable: true - , get: function () { - return Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)); - } - , set: function (value) { - var value = BinaryParser.encodeInt(value, 32, true, true); - this.id = value + this.id.substr(4); - } - }); -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @return {Number} returns next index value. -* @api private -*/ -ObjectID.prototype.get_inc = function() { - return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @return {Number} returns next index value. -* @api private -*/ -ObjectID.prototype.getInc = function() { - return this.get_inc(); -}; - -/** -* Generate a 12 byte id string used in ObjectID's -* -* @param {Number} [time] optional parameter allowing to pass in a second based timestamp. -* @return {String} return the 12 byte id binary string. -* @api private -*/ -ObjectID.prototype.generate = function(time) { - if ('number' == typeof time) { - var time4Bytes = BinaryParser.encodeInt(time, 32, true, true); - /* for time-based ObjectID the bytes following the time will be zeroed */ - var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false); - var pid2Bytes = BinaryParser.fromShort(process.pid); - var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true); - } else { - var unixTime = parseInt(Date.now()/1000,10); - var time4Bytes = BinaryParser.encodeInt(unixTime, 32, true, true); - var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false); - var pid2Bytes = BinaryParser.fromShort(process.pid); - var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true); - } - - return time4Bytes + machine3Bytes + pid2Bytes + index3Bytes; -}; - -/** -* Return the ObjectID id as a 24 byte hex string representation -* -* @return {String} return the 24 byte hex string representation. -* @api public -*/ -ObjectID.prototype.toHexString = function() { - if(this.__id) return this.__id; - - var hexString = '' - , number - , value; - - for (var index = 0, len = this.id.length; index < len; index++) { - value = BinaryParser.toByte(this.id[index]); - number = value <= 15 - ? '0' + value.toString(16) - : value.toString(16); - hexString = hexString + number; - } - - return this.__id = hexString; -}; - -/** -* Converts the id into a 24 byte hex string for printing -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.toString = function() { - return this.toHexString(); -}; - -/** -* Converts to a string representation of this Id. -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.inspect = ObjectID.prototype.toString; - -/** -* Converts to its JSON representation. -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.toJSON = function() { - return this.toHexString(); -}; - -/** -* Compares the equality of this ObjectID with `otherID`. -* -* @param {Object} otherID ObjectID instance to compare against. -* @return {Bool} the result of comparing two ObjectID's -* @api public -*/ -ObjectID.prototype.equals = function equals (otherID) { - var id = (otherID instanceof ObjectID || otherID.toHexString) - ? otherID.id - : ObjectID.createFromHexString(otherID).id; - - return this.id === id; -} - -/** -* Returns the generation time in seconds that this ID was generated. -* -* @return {Number} return number of seconds in the timestamp part of the 12 byte id. -* @api public -*/ -ObjectID.prototype.getTimestamp = function() { - var timestamp = new Date(); - timestamp.setTime(Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)) * 1000); - return timestamp; -} - -/** -* @ignore -* @api private -*/ -ObjectID.index = 0; - -ObjectID.createPk = function createPk () { - return new ObjectID(); -}; - -/** -* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. -* -* @param {Number} time an integer number representing a number of seconds. -* @return {ObjectID} return the created ObjectID -* @api public -*/ -ObjectID.createFromTime = function createFromHexString(time) { - var time4Bytes = BinaryParser.encodeInt(time, 32, true, true); - var objectID = new ObjectID(); - objectID.id = BinaryParser.encodeInt(time, 32, true, true) + BinaryParser.encodeInt(0, 64, true, true) - return objectID; -}; - -/** -* Creates an ObjectID from a hex string representation of an ObjectID. -* -* @param {String} hexString create a ObjectID from a passed in 24 byte hexstring. -* @return {ObjectID} return the created ObjectID -* @api public -*/ -ObjectID.createFromHexString = function createFromHexString (hexString) { - // Throw an error if it's not a valid setup - if(hexString != null && hexString.length != 24) throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters in hex format"); - - var len = hexString.length; - - if(len > 12*2) { - throw new Error('Id cannot be longer than 12 bytes'); - } - - var result = '' - , string - , number; - - for (var index = 0; index < len; index += 2) { - string = hexString.substr(index, 2); - number = parseInt(string, 16); - result += BinaryParser.fromByte(number); - } - - return new ObjectID(result); -}; - -/** - * Expose. - */ -exports.ObjectID = ObjectID; - diff --git a/lib/mongodb/bson/symbol.js b/lib/mongodb/bson/symbol.js deleted file mode 100644 index 67174157617..00000000000 --- a/lib/mongodb/bson/symbol.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * A class representation of the BSON Symbol type. - * - * @class Represents the BSON Symbol type. - * @param {String} value the string representing the symbol. - * @return {Symbol} - */ -function Symbol(value) { - this._bsontype = 'Symbol'; - this.value = value; -} - -/** - * Access the wrapped string value. - * - * @return {String} returns the wrapped string. - * @api public - */ -Symbol.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - * @api private - */ -Symbol.prototype.toString = function() { - return this.value; -} - -/** - * @ignore - * @api private - */ -Symbol.prototype.inspect = function() { - return this.value; -} - -/** - * @ignore - * @api private - */ -Symbol.prototype.toJSON = function() { - return this.value; -} - -exports.Symbol = Symbol; \ No newline at end of file diff --git a/lib/mongodb/bson/timestamp.js b/lib/mongodb/bson/timestamp.js deleted file mode 100644 index db6003c03e1..00000000000 --- a/lib/mongodb/bson/timestamp.js +++ /dev/null @@ -1,852 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * Defines a Timestamp class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Timestamp". This - * implementation is derived from TimestampLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Timestamps. - * - * The internal representation of a Timestamp is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class Represents the BSON Timestamp type. - * @param {Number} low the low (signed) 32 bits of the Timestamp. - * @param {Number} high the high (signed) 32 bits of the Timestamp. - */ -function Timestamp(low, high) { - this._bsontype = 'Timestamp'; - /** - * @type {number} - * @api private - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @api private - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @return {Number} the value, assuming it is a 32-bit integer. - * @api public - */ -Timestamp.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @return {Number} the closest floating-point representation to this value. - * @api public - */ -Timestamp.prototype.toNumber = function() { - return this.high_ * Timestamp.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @return {String} the JSON representation. - * @api public - */ -Timestamp.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @param {Number} [opt_radix] the radix in which the text should be written. - * @return {String} the textual representation of this value. - * @api public - */ -Timestamp.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - // We need to change the Timestamp value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixTimestamp = Timestamp.fromNumber(radix); - var div = this.div(radixTimestamp); - var rem = div.multiply(radixTimestamp).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @return {Number} the high 32-bits as a signed value. - * @api public - */ -Timestamp.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @return {Number} the low 32-bits as a signed value. - * @api public - */ -Timestamp.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @return {Number} the low 32-bits as an unsigned value. - * @api public - */ -Timestamp.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Timestamp. - * - * @return {Number} Returns the number of bits needed to represent the absolute value of this Timestamp. - * @api public - */ -Timestamp.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @return {Boolean} whether this value is zero. - * @api public - */ -Timestamp.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @return {Boolean} whether this value is negative. - * @api public - */ -Timestamp.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @return {Boolean} whether this value is odd. - * @api public - */ -Timestamp.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Timestamp equals the other - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp equals the other - * @api public - */ -Timestamp.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Timestamp does not equal the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp does not equal the other. - * @api public - */ -Timestamp.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Timestamp is less than the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is less than the other. - * @api public - */ -Timestamp.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Timestamp is less than or equal to the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is less than or equal to the other. - * @api public - */ -Timestamp.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Timestamp is greater than the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is greater than the other. - * @api public - */ -Timestamp.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Timestamp is greater than or equal to the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is greater than or equal to the other. - * @api public - */ -Timestamp.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Timestamp with the given one. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - * @api public - */ -Timestamp.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @return {Timestamp} the negation of this value. - * @api public - */ -Timestamp.prototype.negate = function() { - if (this.equals(Timestamp.MIN_VALUE)) { - return Timestamp.MIN_VALUE; - } else { - return this.not().add(Timestamp.ONE); - } -}; - -/** - * Returns the sum of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to add to this one. - * @return {Timestamp} the sum of this and the given Timestamp. - * @api public - */ -Timestamp.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to subtract from this. - * @return {Timestamp} the difference of this and the given Timestamp. - * @api public - */ -Timestamp.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to multiply with this. - * @return {Timestamp} the product of this and the other. - * @api public - */ -Timestamp.prototype.multiply = function(other) { - if (this.isZero()) { - return Timestamp.ZERO; - } else if (other.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } else if (other.equals(Timestamp.MIN_VALUE)) { - return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Timestamps are small, use float multiplication - if (this.lessThan(Timestamp.TWO_PWR_24_) && - other.lessThan(Timestamp.TWO_PWR_24_)) { - return Timestamp.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Timestamp divided by the given one. - * - * @param {Timestamp} other Timestamp by which to divide. - * @return {Timestamp} this Timestamp divided by the given one. - * @api public - */ -Timestamp.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - if (other.equals(Timestamp.ONE) || - other.equals(Timestamp.NEG_ONE)) { - return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Timestamp.ZERO)) { - return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Timestamp.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Timestamp.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Timestamp.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Timestamp.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Timestamp modulo the given one. - * - * @param {Timestamp} other Timestamp by which to mod. - * @return {Timestamp} this Timestamp modulo the given one. - * @api public - */ -Timestamp.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @return {Timestamp} the bitwise-NOT of this value. - * @api public - */ -Timestamp.prototype.not = function() { - return Timestamp.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to AND. - * @return {Timestamp} the bitwise-AND of this and the other. - * @api public - */ -Timestamp.prototype.and = function(other) { - return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to OR. - * @return {Timestamp} the bitwise-OR of this and the other. - * @api public - */ -Timestamp.prototype.or = function(other) { - return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to XOR. - * @return {Timestamp} the bitwise-XOR of this and the other. - * @api public - */ -Timestamp.prototype.xor = function(other) { - return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Timestamp with bits shifted to the left by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the left by the given amount. - * @api public - */ -Timestamp.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Timestamp.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Timestamp.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount. - * @api public - */ -Timestamp.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Timestamp.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. - * @api public - */ -Timestamp.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Timestamp.fromBits(high, 0); - } else { - return Timestamp.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Timestamp representing the given (32-bit) integer value. - * - * @param {Number} value the 32-bit integer in question. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Timestamp.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Timestamp.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @param {Number} value the number in question. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Timestamp.ZERO; - } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MIN_VALUE; - } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MAX_VALUE; - } else if (value < 0) { - return Timestamp.fromNumber(-value).negate(); - } else { - return new Timestamp( - (value % Timestamp.TWO_PWR_32_DBL_) | 0, - (value / Timestamp.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @param {Number} lowBits the low 32-bits. - * @param {Number} highBits the high 32-bits. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromBits = function(lowBits, highBits) { - return new Timestamp(lowBits, highBits); -}; - -/** - * Returns a Timestamp representation of the given string, written using the given radix. - * - * @param {String} str the textual representation of the Timestamp. - * @param {Number} opt_radix the radix in which the text is written. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Timestamp.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); - - var result = Timestamp.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Timestamp.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Timestamp.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Timestamp.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Timestamp representations of small integer values. - * @type {Object} - * @api private - */ -Timestamp.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; - -/** @type {Timestamp} */ -Timestamp.ZERO = Timestamp.fromInt(0); - -/** @type {Timestamp} */ -Timestamp.ONE = Timestamp.fromInt(1); - -/** @type {Timestamp} */ -Timestamp.NEG_ONE = Timestamp.fromInt(-1); - -/** @type {Timestamp} */ -Timestamp.MAX_VALUE = - Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Timestamp} */ -Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); - -/** - * @type {Timestamp} - * @api private - */ -Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); - -/** - * Expose. - */ -exports.Timestamp = Timestamp; \ No newline at end of file diff --git a/lib/mongodb/collection.js b/lib/mongodb/collection.js deleted file mode 100644 index f875bd3d1e4..00000000000 --- a/lib/mongodb/collection.js +++ /dev/null @@ -1,1432 +0,0 @@ -/** - * Module dependencies. - * @ignore - */ -var InsertCommand = require('./commands/insert_command').InsertCommand - , QueryCommand = require('./commands/query_command').QueryCommand - , DeleteCommand = require('./commands/delete_command').DeleteCommand - , UpdateCommand = require('./commands/update_command').UpdateCommand - , DbCommand = require('./commands/db_command').DbCommand - , BinaryParser = require('./bson/binary_parser').BinaryParser - , ObjectID = require('./bson/objectid').ObjectID - , Code = require('./bson/code').Code - , Cursor = require('./cursor').Cursor - , debug = require('util').debug - , inspect = require('util').inspect - , utils = require('./utils'); - -/** - * Precompiled regexes - * @ignore -**/ -const eErrorMessages = /No matching object found/; - -/** - * toString helper. - * @ignore - */ -var toString = Object.prototype.toString; - -/** - * Create a new Collection instance - * - * Options - * - **slaveOk** {Boolean, default:false}, Allow reads from secondaries. - * - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. - * - **raw** {Boolean, default:false}, perform all operations using raw bson objects. - * - **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. - * - * @class Represents a Collection - * @param {Object} db db instance. - * @param {String} collectionName collection name. - * @param {Object} [pkFactory] alternative primary key factory. - * @param {Object} [options] additional options for the collection. - * @return {Object} a collection instance. - */ -function Collection (db, collectionName, pkFactory, options) { - checkCollectionName(collectionName); - - this.db = db; - this.collectionName = collectionName; - this.internalHint; - this.opts = options != null && ('object' === typeof options) ? options : {}; - this.slaveOk = options == null || options.slaveOk == null ? db.slaveOk : options.slaveOk; - this.serializeFunctions = options == null || options.serializeFunctions == null ? db.serializeFunctions : options.serializeFunctions; - this.raw = options == null || options.raw == null ? db.raw : options.raw; - this.pkFactory = pkFactory == null - ? ObjectID - : pkFactory; - - var self = this - Object.defineProperty(this, "hint", { - enumerable: true - , get: function () { - return this.internalHint; - } - , set: function (v) { - this.internalHint = normalizeHintField(v); - } - }); -}; - -/** - * Inserts a single document or a an array of documents into MongoDB. - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - **keepGoing** {Boolean, default:false}, keep inserting documents even if one document has an error, *mongodb 1.9.1 >*. - * - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. - * - * @param {Array|Object} docs - * @param {Object} [options] optional options for insert command - * @param {Function} [callback] optional callback for the function, must be provided when using `safe` or `strict` mode - * @return {null} - * @api public - */ -Collection.prototype.insert = function insert (docs, options, callback) { - if ('function' === typeof options) callback = options, options = {}; - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - var self = this; - insertAll(self, Array.isArray(docs) ? docs : [docs], options, callback); - return this; -}; - -/** - * @ignore - */ -var checkCollectionName = function checkCollectionName (collectionName) { - if ('string' !== typeof collectionName) { - throw Error("collection name must be a String"); - } - - if (!collectionName || collectionName.indexOf('..') != -1) { - throw Error("collection names cannot be empty"); - } - - if (collectionName.indexOf('$') != -1 && - collectionName.match(/((^\$cmd)|(oplog\.\$main))/) == null) { - throw Error("collection names must not contain '$'"); - } - - if (collectionName.match(/^\.|\.$/) != null) { - throw Error("collection names must not start or end with '.'"); - } -}; - -/** - * Removes documents specified by `selector` from the db. - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - * @param {Object} [selector] optional select, no selector is equivalent to removing all documents. - * @param {Object} [options] additional options during remove. - * @param {Function} [callback] must be provided if you performing a safe remove - * @return {null} - * @api public - */ -Collection.prototype.remove = function remove(selector, options, callback) { - if ('function' === typeof selector) { - callback = selector; - selector = options = {}; - } else if ('function' === typeof options) { - callback = options; - options = {}; - } - - // Ensure options - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - // Ensure we have at least an empty selector - selector = selector == null ? {} : selector; - - var deleteCommand = new DeleteCommand( - this.db - , this.db.databaseName + "." + this.collectionName - , selector); - - var self = this; - var errorOptions = options.safe != null ? options.safe : null; - errorOptions = errorOptions == null && this.opts.safe != null ? this.opts.safe : errorOptions; - errorOptions = errorOptions == null && this.db.strict != null ? this.db.strict : errorOptions; - - // Execute the command, do not add a callback as it's async - if (options && options.safe || this.opts.safe != null || this.db.strict) { - // Insert options - var commandOptions = {read:false}; - // If we have safe set set async to false - if(errorOptions == null) commandOptions['async'] = true; - // Set safe option - commandOptions['safe'] = true; - // If we have an error option - if(typeof errorOptions == 'object') { - var keys = Object.keys(errorOptions); - for(var i = 0; i < keys.length; i++) { - commandOptions[keys[i]] = errorOptions[keys[i]]; - } - } - - // Execute command with safe options (rolls up both command and safe command into one and executes them on the same connection) - this.db._executeRemoveCommand(deleteCommand, commandOptions, function (err, error) { - error = error && error.documents; - if(!callback) return; - - if (err) { - callback(err); - } else if (error[0].err) { - callback(self.db.wrap(error[0])); - } else { - callback(null, error[0].n); - } - }); - } else { - var result = this.db._executeRemoveCommand(deleteCommand); - // If no callback just return - if (!callback) return; - // If error return error - if (result instanceof Error) { - return callback(result); - } - // Otherwise just return - return callback(); - } -}; - -/** - * Renames the collection. - * - * @param {String} newName the new name of the collection. - * @param {Function} callback the callback accepting the result - * @return {null} - * @api public - */ -Collection.prototype.rename = function rename (newName, callback) { - var self = this; - // Ensure the new name is valid - checkCollectionName(newName); - // Execute the command, return the new renamed collection if successful - self.db._executeQueryCommand(DbCommand.createRenameCollectionCommand(self.db, self.collectionName, newName), function(err, result) { - if(err == null && result.documents[0].ok == 1) { - if(callback != null) { - // Set current object to point to the new name - self.collectionName = newName; - // Return the current collection - callback(null, self); - } - } else if(result.documents[0].errmsg != null) { - if(callback != null) { - err != null ? callback(err, null) : callback(self.db.wrap(result.documents[0]), null); - } - } - }); -}; - -/** - * @ignore - */ -var insertAll = function insertAll (self, docs, options, callback) { - if('function' === typeof options) callback = options, options = {}; - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - - // Insert options (flags for insert) - var insertFlags = {}; - // If we have a mongodb version >= 1.9.1 support keepGoing attribute - if(options['keepGoing'] != null) { - insertFlags['keepGoing'] = options['keepGoing']; - } - - // Either use override on the function, or go back to default on either the collection - // level or db - if(options['serializeFunctions'] != null) { - insertFlags['serializeFunctions'] = options['serializeFunctions']; - } else { - insertFlags['serializeFunctions'] = self.serializeFunctions; - } - - // Pass in options - var insertCommand = new InsertCommand( - self.db - , self.db.databaseName + "." + self.collectionName, true, insertFlags); - - // Add the documents and decorate them with id's if they have none - for (var index = 0, len = docs.length; index < len; ++index) { - var doc = docs[index]; - - // Add id to each document if it's not already defined - if (!(doc instanceof Buffer) && !doc['_id'] && self.db.forceServerObjectId != true) { - doc['_id'] = self.pkFactory.createPk(); - } - - insertCommand.add(doc); - } - - // Collect errorOptions - var errorOptions = options.safe != null ? options.safe : null; - errorOptions = errorOptions == null && self.opts.safe != null ? self.opts.safe : errorOptions; - errorOptions = errorOptions == null && self.db.strict != null ? self.db.strict : errorOptions; - - // Default command options - var commandOptions = {}; - // If safe is defined check for error message - // if(options != null && (options.safe == true || this.db.strict == true || this.opts.safe == true)) { - if(errorOptions && errorOptions != false) { - // Insert options - commandOptions['read'] = false; - // If we have safe set set async to false - if(errorOptions == null) commandOptions['async'] = true; - - // Set safe option - commandOptions['safe'] = errorOptions; - // If we have an error option - if(typeof errorOptions == 'object') { - var keys = Object.keys(errorOptions); - for(var i = 0; i < keys.length; i++) { - commandOptions[keys[i]] = errorOptions[keys[i]]; - } - } - - // Execute command with safe options (rolls up both command and safe command into one and executes them on the same connection) - self.db._executeInsertCommand(insertCommand, commandOptions, function (err, error) { - error = error && error.documents; - if(!callback) return; - - if (err) { - callback(err); - } else if (error[0].err) { - callback(self.db.wrap(error[0])); - } else { - callback(null, docs); - } - }); - } else { - var result = self.db._executeInsertCommand(insertCommand, commandOptions); - // If no callback just return - if(!callback) return; - // If error return error - if(result instanceof Error) { - return callback(result); - } - // Otherwise just return - return callback(null, docs); - } -}; - -/** - * Save a document. Simple full document replacement function. Not recommended for efficiency, use atomic - * operators and update instead for more efficient operations. - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - * @param {Object} [doc] the document to save - * @param {Object} [options] additional options during remove. - * @param {Function} [callback] must be provided if you performing a safe save - * @return {null} - * @api public - */ -Collection.prototype.save = function save(doc, options, callback) { - if('function' === typeof options) callback = options, options = null; - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - - var errorOptions = options.safe != null ? options.safe : false; - errorOptions = errorOptions == null && this.opts.safe != null ? this.opts.safe : errorOptions; - // Extract the id, if we have one we need to do a update command - var id = doc['_id']; - - if(id) { - this.update({ _id: id }, doc, { upsert: true, safe: errorOptions }, callback); - } else { - this.insert(doc, { safe: errorOptions }, callback && function (err, docs) { - if (err) return callback(err, null); - - if (Array.isArray(docs)) { - callback(err, docs[0]); - } else { - callback(err, docs); - } - }); - } -}; - -/** - * Updates documents. - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - **upsert** {Boolean, default:false}, perform an upsert operation. - * - **multi** {Boolean, default:false}, update all documents matching the selector. - * - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. - * - * @param {Object} selector the query to select the document/documents to be updated - * @param {Object} document the fields/vals to be updated, or in the case of an upsert operation, inserted. - * @param {Object} [options] additional options during update. - * @param {Function} [callback] must be provided if you performing a safe update - * @return {null} - * @api public - */ -Collection.prototype.update = function update(selector, document, options, callback) { - if('function' === typeof options) callback = options, options = null; - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - - // Either use override on the function, or go back to default on either the collection - // level or db - if(options['serializeFunctions'] != null) { - options['serializeFunctions'] = options['serializeFunctions']; - } else { - options['serializeFunctions'] = this.serializeFunctions; - } - - var updateCommand = new UpdateCommand( - this.db - , this.db.databaseName + "." + this.collectionName - , selector - , document - , options); - - var self = this; - // Unpack the error options if any - var errorOptions = (options && options.safe != null) ? options.safe : null; - errorOptions = errorOptions == null && this.opts.safe != null ? this.opts.safe : errorOptions; - errorOptions = errorOptions == null && this.db.strict != null ? this.db.strict : errorOptions; - - // If we are executing in strict mode or safe both the update and the safe command must happen on the same line - if(errorOptions && errorOptions != false) { - // Insert options - var commandOptions = {read:false}; - // If we have safe set set async to false - if(errorOptions == null) commandOptions['async'] = true; - // Set safe option - commandOptions['safe'] = true; - // If we have an error option - if(typeof errorOptions == 'object') { - var keys = Object.keys(errorOptions); - for(var i = 0; i < keys.length; i++) { - commandOptions[keys[i]] = errorOptions[keys[i]]; - } - } - - // Execute command with safe options (rolls up both command and safe command into one and executes them on the same connection) - this.db._executeUpdateCommand(updateCommand, commandOptions, function (err, error) { - error = error && error.documents; - if(!callback) return; - - if (err) { - callback(err); - } else if (error[0].err) { - callback(self.db.wrap(error[0])); - } else { - callback(null, error[0].n); - } - }); - } else { - // Execute update - var result = this.db._executeUpdateCommand(updateCommand); - // If no callback just return - if (!callback) return; - // If error return error - if (result instanceof Error) { - return callback(result); - } - // Otherwise just return - return callback(); - } -}; - -/** - * The distinct command returns returns a list of distinct values for the given key across a collection. - * - * @param {String} key key to run distinct against. - * @param {Object} [query] option query to narrow the returned objects. - * @param {Function} callback must be provided. - * @return {null} - * @api public - */ -Collection.prototype.distinct = function distinct(key, query, callback) { - if ('function' === typeof query) callback = query, query = {}; - - var mapCommandHash = { - distinct: this.collectionName - , query: query - , key: key - }; - - var cmd = DbCommand.createDbSlaveOkCommand(this.db, mapCommandHash); - - this.db._executeQueryCommand(cmd, {read:true}, function (err, result) { - if (err) { - return callback(err); - } - - if (result.documents[0].ok != 1) { - return callback(new Error(result.documents[0].errmsg)); - } - - callback(null, result.documents[0].values); - }); -}; - -/** - * Count number of matching documents in the db to a query. - * - * @param {Object} [query] query to filter by before performing count. - * @param {Function} callback must be provided. - * @return {null} - * @api public - */ -Collection.prototype.count = function count (query, callback) { - if ('function' === typeof query) callback = query, query = {}; - - var final_query = { - count: this.collectionName - , query: query - , fields: null - }; - - var queryOptions = QueryCommand.OPTS_NO_CURSOR_TIMEOUT; - if (this.slaveOk || this.db.slaveOk) { - queryOptions |= QueryCommand.OPTS_SLAVE; - } - - var queryCommand = new QueryCommand( - this.db - , this.db.databaseName + ".$cmd" - , queryOptions - , 0 - , -1 - , final_query - , null - ); - - var self = this; - this.db._executeQueryCommand(queryCommand, {read:true}, function (err, result) { - result = result && result.documents; - if(!callback) return; - - if (err) { - callback(err); - } else if (result[0].ok != 1) { - callback(self.db.wrap(result[0])); - } else { - callback(null, result[0].n); - } - }); -}; - - -/** - * Drop the collection - * - * @param {Function} [callback] provide a callback to be notified when command finished executing - * @return {null} - * @api public - */ -Collection.prototype.drop = function drop(callback) { - this.db.dropCollection(this.collectionName, callback); -}; - -/** - * Find and update a document. - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - **remove** {Boolean, default:false}, set to true to remove the object before returning. - * - **upsert** {Boolean, default:false}, perform an upsert operation. - * - **new** {Boolean, default:false}, set to true if you want to return the modified object rather than the original. Ignored for remove. - * - * @param {Object} query query object to locate the object to modify - * @param {Array} sort - if multiple docs match, choose the first one in the specified sort order as the object to manipulate - * @param {Object} doc - the fields/vals to be updated - * @param {Object} [options] additional options during update. - * @param {Function} [callback] returns results. - * @return {null} - * @api public - */ -Collection.prototype.findAndModify = function findAndModify (query, sort, doc, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - sort = args.length ? args.shift() : []; - doc = args.length ? args.shift() : null; - options = args.length ? args.shift() : {}; - var self = this; - - var queryObject = { - 'findandmodify': this.collectionName - , 'query': query - , 'sort': utils.formattedOrderClause(sort) - }; - - queryObject.new = options.new ? 1 : 0; - queryObject.remove = options.remove ? 1 : 0; - queryObject.upsert = options.upsert ? 1 : 0; - - if (options.fields) { - queryObject.fields = options.fields; - } - - if (doc && !options.remove) { - queryObject.update = doc; - } - - // Either use override on the function, or go back to default on either the collection - // level or db - if(options['serializeFunctions'] != null) { - options['serializeFunctions'] = options['serializeFunctions']; - } else { - options['serializeFunctions'] = this.serializeFunctions; - } - - // Unpack the error options if any - var errorOptions = (options && options.safe != null) ? options.safe : null; - errorOptions = errorOptions == null && this.opts.safe != null ? this.opts.safe : errorOptions; - errorOptions = errorOptions == null && this.db.strict != null ? this.db.strict : errorOptions; - - // Commands to send - var commands = []; - // Add the find and modify command - commands.push(DbCommand.createDbSlaveOkCommand(this.db, queryObject, options)); - // If we have safe defined we need to return both call results - var chainedCommands = errorOptions != null ? true : false; - // Add error command if we have one - if(chainedCommands) { - commands.push(DbCommand.createGetLastErrorCommand(errorOptions, this.db)); - } - - // Fire commands and - this.db._executeQueryCommand(commands, function(err, result) { - result = result && result.documents; - - if(err != null) { - callback(err); - } else if(result[0].err != null) { - callback(self.db.wrap(result[0]), null); - } else if(result[0].errmsg != null && !result[0].errmsg.match(eErrorMessages)) { - // Workaround due to 1.8.X returning an error on no matching object - // while 2.0.X does not not, making 2.0.X behaviour standard - callback(self.db.wrap(result[0]), null); - } else { - return callback(null, result[0].value); - } - }); -} - -/** - * Find and remove a document - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - * @param {Object} query query object to locate the object to modify - * @param {Array} sort - if multiple docs match, choose the first one in the specified sort order as the object to manipulate - * @param {Object} [options] additional options during update. - * @param {Function} [callback] returns results. - * @return {null} - * @api public - */ -Collection.prototype.findAndRemove = function(query, sort, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - sort = args.length ? args.shift() : []; - options = args.length ? args.shift() : {}; - // Add the remove option - options['remove'] = true; - // Execute the callback - this.findAndModify(query, sort, null, options, callback); -} - -var testForFields = {'limit' : 1, 'sort' : 1, 'fields' : 1, 'skip' : 1, 'hint' : 1, 'explain' : 1, 'snapshot' : 1 - , 'timeout' : 1, 'tailable' : 1, 'batchSize' : 1, 'raw' : 1, 'read' : 1 - , 'returnKey' : 1, 'maxScan' : 1, 'min' : 1, 'max' : 1, 'showDiskLoc' : 1, 'comment' : 1}; - -/** - * Creates a cursor for a query that can be used to iterate over results from MongoDB - * - * Various argument possibilities - * - callback? - * - selector, callback?, - * - selector, fields, callback? - * - selector, options, callback? - * - selector, fields, options, callback? - * - selector, fields, skip, limit, callback? - * - selector, fields, skip, limit, timeout, callback? - * - * Options - * - **limit** {Number, default:0}, sets the limit of documents returned in the query. - * - **sort** {Array | Object}, set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc. - * - **fields** {Object}, the fields to return in the query. Object of fields to include or exclude (not both), {'a':1} - * - **skip** {Number, default:0}, set to skip N documents ahead in your query (useful for pagination). - * - **hint** {Object}, tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1} - * - **explain** {Boolean, default:false}, explain the query instead of returning the data. - * - **snapshot** {Boolean, default:false}, snapshot query. - * - **timeout** {Boolean, default:false}, specify if the cursor can timeout. - * - **tailable** {Boolean, default:false}, specify if the cursor is tailable. - * - **batchSize** {Number, default:0}, set the batchSize for the getMoreCommand when iterating over the query results. - * - **returnKey** {Boolean, default:false}, only return the index key. - * - **maxScan** {Number}, Limit the number of items to scan. - * - **min** {Number}, Set index bounds. - * - **max** {Number}, Set index bounds. - * - **showDiskLoc** {Boolean, default:false}, Show disk location of results. - * - **comment** {String}, You can put a $comment field on a query to make looking in the profiler logs simpler. - * - **raw** {Boolean, default:false}, Return all BSON documents as Raw Buffer documents. - * - **read** {Boolean, default:false}, Tell the query to read from a secondary server. - * - * @param {Object} query query object to locate the object to modify - * @param {Object} [options] additional options during update. - * @param {Function} [callback] optional callback for cursor. - * @return {Cursor} returns a cursor to the query - * @api public - */ -Collection.prototype.find = function find () { - var options - , args = Array.prototype.slice.call(arguments, 0) - , has_callback = typeof args[args.length - 1] === 'function' - , has_weird_callback = typeof args[0] === 'function' - , callback = has_callback ? args.pop() : (has_weird_callback ? args.shift() : null) - , len = args.length - , selector = len >= 1 ? args[0] : {} - , fields = len >= 2 ? args[1] : undefined; - - if(len === 1 && has_weird_callback) { - // backwards compat for callback?, options case - selector = {}; - options = args[0]; - } - - if(len === 2 && !Array.isArray(fields)) { - var fieldKeys = Object.getOwnPropertyNames(fields); - var is_option = false; - - for(var i = 0; i < fieldKeys.length; i++) { - if(testForFields[fieldKeys[i]] != null) { - is_option = true; - break; - } - } - - if(is_option) { - options = fields; - fields = undefined; - } else { - options = {}; - } - } else if(len === 2 && Array.isArray(fields) && !Array.isArray(fields[0])) { - var newFields = {}; - // Rewrite the array - for(var i = 0; i < fields.length; i++) { - newFields[fields[i]] = 1; - } - // Set the fields - fields = newFields; - } - - if(3 === len) { - options = args[2]; - } - - // Ensure selector is not null - selector = selector == null ? {} : selector; - // Validate correctness off the selector - var object = selector; - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("query selector raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - // Validate correctness of the field selector - var object = fields; - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("query fields raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - // Check special case where we are using an objectId - if(selector instanceof ObjectID) { - selector = {_id:selector}; - } - - // If it's a serialized fields field we need to just let it through - // user be warned it better be good - if(options && options.fields && !(options.fields instanceof Buffer)) { - fields = {}; - - if(Array.isArray(options.fields)) { - if(!options.fields.length) { - fields['_id'] = 1; - } else { - for (var i = 0, l = options.fields.length; i < l; i++) { - fields[options.fields[i]] = 1; - } - } - } else { - fields = options.fields; - } - } - - if (!options) options = {}; - options.skip = len > 3 ? args[2] : options.skip ? options.skip : 0; - options.limit = len > 3 ? args[3] : options.limit ? options.limit : 0; - options.raw = options.raw != null && typeof options.raw === 'boolean' ? options.raw : this.raw; - options.hint = options.hint != null ? normalizeHintField(options.hint) : this.internalHint; - options.timeout = len == 5 ? args[4] : typeof options.timeout === 'undefined' ? undefined : options.timeout; - // If we have overridden slaveOk otherwise use the default db setting - options.slaveOk = options.slaveOk != null ? options.slaveOk : this.db.slaveOk; - var o = options; - - // callback for backward compatibility - if(callback) { - // TODO refactor Cursor args - callback(null, new Cursor(this.db, this, selector, fields, o.skip, o.limit - , o.sort, o.hint, o.explain, o.snapshot, o.timeout, o.tailable, o.batchSize - , o.slaveOk, o.raw, o.read, o.returnKey, o.maxScan, o.min, o.max, o.showDiskLoc, o.comment)); - } else { - return new Cursor(this.db, this, selector, fields, o.skip, o.limit - , o.sort, o.hint, o.explain, o.snapshot, o.timeout, o.tailable, o.batchSize - , o.slaveOk, o.raw, o.read, o.returnKey, o.maxScan, o.min, o.max, o.showDiskLoc, o.comment); - } -}; - -/** - * Normalizes a `hint` argument. - * - * @param {String|Object|Array} hint - * @return {Object} - * @api private - */ -var normalizeHintField = function normalizeHintField(hint) { - var finalHint = null; - - if (null != hint) { - switch (hint.constructor) { - case String: - finalHint = {}; - finalHint[hint] = 1; - break; - case Object: - finalHint = {}; - for (var name in hint) { - finalHint[name] = hint[name]; - } - break; - case Array: - finalHint = {}; - hint.forEach(function(param) { - finalHint[param] = 1; - }); - break; - } - } - - return finalHint; -}; - -/** - * Finds a single document based on the query - * - * Various argument possibilities - * - callback? - * - selector, callback?, - * - selector, fields, callback? - * - selector, options, callback? - * - selector, fields, options, callback? - * - selector, fields, skip, limit, callback? - * - selector, fields, skip, limit, timeout, callback? - * - * Options - * - **limit** {Number, default:0}, sets the limit of documents returned in the query. - * - **sort** {Array | Object}, set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc. - * - **fields** {Object}, the fields to return in the query. Object of fields to include or exclude (not both), {'a':1} - * - **skip** {Number, default:0}, set to skip N documents ahead in your query (useful for pagination). - * - **hint** {Object}, tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1} - * - **explain** {Boolean, default:false}, explain the query instead of returning the data. - * - **snapshot** {Boolean, default:false}, snapshot query. - * - **timeout** {Boolean, default:false}, specify if the cursor can timeout. - * - **tailable** {Boolean, default:false}, specify if the cursor is tailable. - * - **batchSize** {Number, default:0}, set the batchSize for the getMoreCommand when iterating over the query results. - * - **returnKey** {Boolean, default:false}, only return the index key. - * - **maxScan** {Number}, Limit the number of items to scan. - * - **min** {Number}, Set index bounds. - * - **max** {Number}, Set index bounds. - * - **showDiskLoc** {Boolean, default:false}, Show disk location of results. - * - **comment** {String}, You can put a $comment field on a query to make looking in the profiler logs simpler. - * - **raw** {Boolean, default:false}, Return all BSON documents as Raw Buffer documents. - * - **read** {Boolean, default:false}, Tell the query to read from a secondary server. - * - * @param {Object} query query object to locate the object to modify - * @param {Object} [options] additional options during update. - * @param {Function} [callback] optional callback for cursor. - * @return {Cursor} returns a cursor to the query - * @api public - */ -Collection.prototype.findOne = function findOne () { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - var callback = args.pop(); - var cursor = this.find.apply(this, args).limit(1).batchSize(1); - // Return the item - cursor.toArray(function(err, items) { - if(err != null) return callback(err instanceof Error ? err : self.db.wrap(new Error(err)), null); - if(items.length == 1) return callback(null, items[0]); - callback(null, null); - }); -}; - -/** - * Creates an index on the collection. - * - * Options - * - **unique** {Boolean, default:false}, creates an unique index. - * - **sparse** {Boolean, default:false}, creates a sparse index. - * - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. - * - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. - * - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. - * - * @param {Object} fieldOrSpec fieldOrSpec that defines the index. - * @param {Object} [options] additional options during update. - * @param {Function} callback for results. - * @return {null} - * @api public - */ -Collection.prototype.createIndex = function createIndex (fieldOrSpec, options, callback) { - // Clean up call - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - // Execute create index - this.db.createIndex(this.collectionName, fieldOrSpec, options, callback); -}; - -/** - * Ensures that an index exists, if it does not it creates it - * - * Options - * - **unique** {Boolean, default:false}, creates an unique index. - * - **sparse** {Boolean, default:false}, creates a sparse index. - * - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. - * - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. - * - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. - * - **v** {Number}, specify the format version of the indexes. - * - * @param {Object} fieldOrSpec fieldOrSpec that defines the index. - * @param {Object} [options] additional options during update. - * @param {Function} callback for results. - * @return {null} - * @api public - */ -Collection.prototype.ensureIndex = function ensureIndex (fieldOrSpec, options, callback) { - // Clean up call - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - // Execute create index - this.db.ensureIndex(this.collectionName, fieldOrSpec, options, callback); -}; - -/** - * Retrieves this collections index info. - * - * Options - * - **full** {Boolean, default:false}, returns the full raw index information. - * - * @param {Object} [options] additional options during update. - * @param {Function} callback returns the index information. - * @return {null} - * @api public - */ -Collection.prototype.indexInformation = function indexInformation (options, callback) { - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - options = args.length ? args.shift() : {}; - // Call the index information - this.db.indexInformation(this.collectionName, options, callback); -}; - -/** - * Drops an index from this collection. - * - * @param {String} name - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Collection.prototype.dropIndex = function dropIndex (name, callback) { - this.db.dropIndex(this.collectionName, name, callback); -}; - -/** - * Drops all indexes from this collection. - * - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Collection.prototype.dropAllIndexes = function dropIndexes (callback) { - this.db.dropIndex(this.collectionName, '*', function (err, result) { - if(err != null) { - callback(err, false); - } else if(result.documents[0].errmsg == null) { - callback(null, true); - } else { - callback(new Error(result.documents[0].errmsg), false); - } - }); -}; - -/** - * Drops all indexes from this collection. - * - * @deprecated - * @param {Function} callback returns the results. - * @return {null} - * @api private - */ -Collection.prototype.dropIndexes = Collection.prototype.dropAllIndexes; - -/** - * Reindex all indexes on the collection - * Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections. - * - * @param {Function} callback returns the results. - * @return {null} - * @api public -**/ -Collection.prototype.reIndex = function(callback) { - this.db.reIndex(this.collectionName, callback); -} - -/** - * Run Map Reduce across a collection. - * - * Options - * - **out** {Object, default:*{inline:1}*}, sets the output target for the map reduce job. *{inline:1} | {replace:'collectionName'} | {merge:'collectionName'} | {reduce:'collectionName'}* - * - **query** {Object}, query filter object. - * - **sort** {Object}, sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces. - * - **limit** {Number}, number of objects to return from collection. - * - **keeptemp** {Boolean, default:false}, keep temporary data. - * - **finalize** {Function | String}, finalize function. - * - **scope** {Object}, can pass in variables that can be access from map/reduce/finalize. - * - **jsMode** {Boolean, default:false}, it is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X. - * - **verbose** {Boolean, default:false}, provide statistics on job execution time. - * - * @param {Function|String} map the mapping function. - * @param {Function|String} reduce the reduce function. - * @param {Objects} [options] options for the map reduce job. - * @param {Function} callback returns the result of the map reduce job. - * @return {null} - * @api public - */ -Collection.prototype.mapReduce = function mapReduce (map, reduce, options, callback) { - if ('function' === typeof options) callback = options, options = {}; - // Out must allways be defined (make sure we don't break weirdly on pre 1.8+ servers) - if(null == options.out) { - throw new Error("the out option parameter must be defined, see mongodb docs for possible values"); - } - - if ('function' === typeof map) { - map = map.toString(); - } - - if ('function' === typeof reduce) { - reduce = reduce.toString(); - } - - if ('function' === typeof options.finalize) { - options.finalize = options.finalize.toString(); - } - - var mapCommandHash = { - mapreduce: this.collectionName - , map: map - , reduce: reduce - }; - - // Add any other options passed in - for (var name in options) { - mapCommandHash[name] = options[name]; - } - - var self = this; - var cmd = DbCommand.createDbSlaveOkCommand(this.db, mapCommandHash); - - this.db._executeQueryCommand(cmd, {read:true}, function (err, result) { - if (err) { - return callback(err); - } - - if (1 != result.documents[0].ok) { - return callback(result.documents[0]); - } - - // invoked with inline? - if (result.documents[0].results) { - return callback(null, result.documents[0].results); - } - - // Create a collection object that wraps the result collection - self.db.collection(result.documents[0].result, function (err, collection) { - if (!options.include_statistics) { - return callback(err, collection); - } - - var stats = { - processtime: result.documents[0].timeMillis - , counts: result.documents[0].counts - }; - - callback(err, collection, stats); - }); - }); -}; - -/** - * Group function helper - * @ignore - */ -var groupFunction = function () { - var c = db[ns].find(condition); - var map = new Map(); - var reduce_function = reduce; - - while (c.hasNext()) { - var obj = c.next(); - var key = {}; - - for (var i = 0, len = keys.length; i < len; ++i) { - var k = keys[i]; - key[k] = obj[k]; - } - - var aggObj = map.get(key); - - if (aggObj == null) { - var newObj = Object.extend({}, key); - aggObj = Object.extend(newObj, initial); - map.put(key, aggObj); - } - - reduce_function(obj, aggObj); - } - - return { "result": map.values() }; -}.toString(); - -/** - * Run a group command across a collection - * - * @param {Object|Array|Function|Code} keys an object, array or function expressing the keys to group by. - * @param {Object} condition an optional condition that must be true for a row to be considered. - * @param {Object} initial initial value of the aggregation counter object. - * @param {Function|Code} reduce the reduce function aggregates (reduces) the objects iterated - * @param {Function|Code} finalize an optional function to be run on each item in the result set just before the item is returned. - * @param {Boolean} command specify if you wish to run using the internal group command or using eval, default is true. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Collection.prototype.group = function group(keys, condition, initial, reduce, finalize, command, callback) { - var args = Array.prototype.slice.call(arguments, 3); - callback = args.pop(); - // Fetch all commands - reduce = args.length ? args.shift() : null; - finalize = args.length ? args.shift() : null; - command = args.length ? args.shift() : null; - - // Make sure we are backward compatible - if(!(typeof finalize == 'function')) { - command = finalize; - finalize = null; - } - - if (!Array.isArray(keys) && keys instanceof Object && typeof(keys) !== 'function') { - keys = Object.keys(keys); - } - - if(reduce instanceof Function) { - reduce = reduce.toString(); - } - - if(finalize instanceof Function) { - finalize = finalize.toString(); - } - - // Set up the command as default - command = command == null ? true : command; - - // Execute using the command - if(command) { - var reduceFunction = reduce instanceof Code - ? reduce - : new Code(reduce); - - var selector = { - group: { - 'ns': this.collectionName - , '$reduce': reduceFunction - , 'cond': condition - , 'initial': initial - , 'out': "inline" - } - }; - - // if finalize is defined - if(finalize != null) selector.group['finalize'] = finalize; - // Set up group selector - if ('function' === typeof keys) { - selector.group.$keyf = keys instanceof Code - ? keys - : new Code(keys); - } else { - var hash = {}; - keys.forEach(function (key) { - hash[key] = 1; - }); - selector.group.key = hash; - } - - var cmd = DbCommand.createDbSlaveOkCommand(this.db, selector); - - this.db._executeQueryCommand(cmd, {read:true}, function (err, result) { - if(err != null) return callback(err); - - var document = result.documents[0]; - if (null == document.retval) { - return callback(new Error("group command failed: " + document.errmsg)); - } - - callback(null, document.retval); - }); - - } else { - // Create execution scope - var scope = reduce != null && reduce instanceof Code - ? reduce.scope - : {}; - - scope.ns = this.collectionName; - scope.keys = keys; - scope.condition = condition; - scope.initial = initial; - - // Pass in the function text to execute within mongodb. - var groupfn = groupFunction.replace(/ reduce;/, reduce.toString() + ';'); - - this.db.eval(new Code(groupfn, scope), function (err, results) { - if (err) return callback(err, null); - callback(null, results.result || results); - }); - } -}; - -/** - * Returns the options of the collection. - * - * @param {Function} callback returns option results. - * @return {null} - * @api public - */ -Collection.prototype.options = function options(callback) { - this.db.collectionsInfo(this.collectionName, function (err, cursor) { - if (err) return callback(err); - cursor.nextObject(function (err, document) { - callback(err, document && document.options || null); - }); - }); -}; - -/** - * Returns if the collection is a capped collection - * - * @param {Function} callback returns if collection is capped. - * @return {null} - * @api public - */ -Collection.prototype.isCapped = function isCapped(callback) { - this.options(function(err, document) { - if(err != null) { - callback(err); - } else { - callback(null, document.capped); - } - }); -}; - -/** - * Checks if one or more indexes exist on the collection - * - * @param {String|Array} indexNames check if one or more indexes exist on the collection. - * @param {Function} callback returns if the indexes exist. - * @return {null} - * @api public - */ -Collection.prototype.indexExists = function indexExists(indexes, callback) { - this.indexInformation(function(err, indexInformation) { - // If we have an error return - if(err != null) return callback(err, null); - // Let's check for the index names - if(Array.isArray(indexes)) { - for(var i = 0; i < indexes.length; i++) { - if(indexInformation[indexes[i]] == null) { - return callback(null, false); - } - } - - // All keys found return true - return callback(null, true); - } else { - return callback(null, indexInformation[indexes] != null); - } - }); -} - -/** - * Execute the geoNear command to search for items in the collection - * - * Options - * - **num** {Number}, max number of results to return. - * - **maxDistance** {Number}, include results up to maxDistance from the point. - * - **distanceMultiplier** {Number}, include a value to multiply the distances with allowing for range conversions. - * - **query** {Object}, filter the results by a query. - * - **spherical** {Boolean, default:false}, perform query using a spherical model. - * - **uniqueDocs** {Boolean, default:false}, the closest location in a document to the center of the search region will always be returned MongoDB > 2.X. - * - **includeLocs** {Boolean, default:false}, include the location data fields in the top level of the results MongoDB > 2.X. - * - * @param {Number} x point to search on the x axis, ensure the indexes are ordered in the same order. - * @param {Number} y point to search on the y axis, ensure the indexes are ordered in the same order. - * @param {Objects} [options] options for the map reduce job. - * @param {Function} callback returns matching documents. - * @return {null} - * @api public - */ -Collection.prototype.geoNear = function geoNear(x, y, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - // Fetch all commands - options = args.length ? args.shift() : {}; - - // Build command object - var commandObject = { - geoNear:this.collectionName, - near: [x, y] - } - - // Decorate object if any with known properties - if(options['num'] != null) commandObject['num'] = options['num']; - if(options['maxDistance'] != null) commandObject['maxDistance'] = options['maxDistance']; - if(options['distanceMultiplier'] != null) commandObject['distanceMultiplier'] = options['distanceMultiplier']; - if(options['query'] != null) commandObject['query'] = options['query']; - if(options['spherical'] != null) commandObject['spherical'] = options['spherical']; - if(options['uniqueDocs'] != null) commandObject['uniqueDocs'] = options['uniqueDocs']; - if(options['includeLocs'] != null) commandObject['includeLocs'] = options['includeLocs']; - - // Execute the command - this.db.command(commandObject, callback); -} - -/** - * Execute a geo search using a geo haystack index on a collection. - * - * Options - * - **maxDistance** {Number}, include results up to maxDistance from the point. - * - **search** {Object}, filter the results by a query. - * - **limit** {Number}, max number of results to return. - * - * @param {Number} x point to search on the x axis, ensure the indexes are ordered in the same order. - * @param {Number} y point to search on the y axis, ensure the indexes are ordered in the same order. - * @param {Objects} [options] options for the map reduce job. - * @param {Function} callback returns matching documents. - * @return {null} - * @api public - */ -Collection.prototype.geoHaystackSearch = function geoHaystackSearch(x, y, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - // Fetch all commands - options = args.length ? args.shift() : {}; - - // Build command object - var commandObject = { - geoSearch:this.collectionName, - near: [x, y] - } - - // Decorate object if any with known properties - if(options['maxDistance'] != null) commandObject['maxDistance'] = options['maxDistance']; - if(options['query'] != null) commandObject['search'] = options['query']; - if(options['search'] != null) commandObject['search'] = options['search']; - if(options['limit'] != null) commandObject['limit'] = options['limit']; - - // Execute the command - this.db.command(commandObject, callback); -} - -/** - * Retrieve all the indexes on the collection. - * - * @param {Function} callback returns index information. - * @return {null} - * @api public - */ -Collection.prototype.indexes = function indexes(callback) { - // Return all the index information - this.db.indexInformation(this.collectionName, {full:true}, callback); -} - -/** - * Get all the collection statistics. - * - * Options - * - **scale** {Number}, divide the returned sizes by scale value. - * - * @param {Objects} [options] options for the map reduce job. - * @param {Function} callback returns statistical information for the collection. - * @return {null} - * @api public - */ -Collection.prototype.stats = function stats(options, callback) { - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - // Fetch all commands - options = args.length ? args.shift() : {}; - - // Build command object - var commandObject = { - collStats:this.collectionName, - } - - // Check if we have the scale value - if(options['scale'] != null) commandObject['scale'] = options['scale']; - - // Execute the command - this.db.command(commandObject, callback); -} - -/** - * Expose. - */ -exports.Collection = Collection; - - - - - - - - - - - - - diff --git a/lib/mongodb/commands/base_command.js b/lib/mongodb/commands/base_command.js deleted file mode 100644 index 0142671b954..00000000000 --- a/lib/mongodb/commands/base_command.js +++ /dev/null @@ -1,31 +0,0 @@ -var BinaryParser = require('../bson/binary_parser').BinaryParser, - debug = require('util').debug, - inspect = require('util').inspect; - -/** - Base object used for common functionality -**/ -var BaseCommand = exports.BaseCommand = function() { -}; - -var id = 1; -BaseCommand.prototype.getRequestId = function() { - if (!this.requestId) this.requestId = id++; - return this.requestId; -}; - -BaseCommand.prototype.updateRequestId = function() { - this.requestId = id++; - return this.requestId; -}; - -// OpCodes -BaseCommand.OP_REPLY = 1; -BaseCommand.OP_MSG = 1000; -BaseCommand.OP_UPDATE = 2001; -BaseCommand.OP_INSERT = 2002; -BaseCommand.OP_GET_BY_OID = 2003; -BaseCommand.OP_QUERY = 2004; -BaseCommand.OP_GET_MORE = 2005; -BaseCommand.OP_DELETE = 2006; -BaseCommand.OP_KILL_CURSORS = 2007; \ No newline at end of file diff --git a/lib/mongodb/commands/db_command.js b/lib/mongodb/commands/db_command.js deleted file mode 100644 index ce50e97bc40..00000000000 --- a/lib/mongodb/commands/db_command.js +++ /dev/null @@ -1,207 +0,0 @@ -var QueryCommand = require('./query_command').QueryCommand, - InsertCommand = require('./insert_command').InsertCommand, - inherits = require('util').inherits, - debug = require('util').debug, - crypto = require('crypto'), - inspect = require('util').inspect; - -/** - Db Command -**/ -var DbCommand = exports.DbCommand = function(dbInstance, collectionName, queryOptions, numberToSkip, numberToReturn, query, returnFieldSelector, options) { - QueryCommand.call(this); - this.collectionName = collectionName; - this.queryOptions = queryOptions; - this.numberToSkip = numberToSkip; - this.numberToReturn = numberToReturn; - this.query = query; - this.returnFieldSelector = returnFieldSelector; - this.db = dbInstance; - - // Make sure we don't get a null exception - options = options == null ? {} : options; - // Let us defined on a command basis if we want functions to be serialized or not - if(options['serializeFunctions'] != null && options['serializeFunctions']) { - this.serializeFunctions = true; - } -}; - -inherits(DbCommand, QueryCommand); - -// Constants -DbCommand.SYSTEM_NAMESPACE_COLLECTION = "system.namespaces"; -DbCommand.SYSTEM_INDEX_COLLECTION = "system.indexes"; -DbCommand.SYSTEM_PROFILE_COLLECTION = "system.profile"; -DbCommand.SYSTEM_USER_COLLECTION = "system.users"; -DbCommand.SYSTEM_COMMAND_COLLECTION = "$cmd"; - -// New commands -DbCommand.NcreateIsMasterCommand = function(db, databaseName) { - return new DbCommand(db, databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'ismaster':1}, null); -}; - -// Provide constructors for different db commands -DbCommand.createIsMasterCommand = function(db) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'ismaster':1}, null); -}; - -DbCommand.createCollectionInfoCommand = function(db, selector) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_NAMESPACE_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, 0, selector, null); -}; - -DbCommand.createGetNonceCommand = function(db) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'getnonce':1}, null); -}; - -DbCommand.createAuthenticationCommand = function(db, username, password, nonce) { - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - var hash_password = md5.digest('hex'); - // Final key - md5 = crypto.createHash('md5'); - md5.update(nonce + username + hash_password); - var key = md5.digest('hex'); - // Creat selector - var selector = {'authenticate':1, 'user':username, 'nonce':nonce, 'key':key}; - // Create db command - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NONE, 0, -1, selector, null); -}; - -DbCommand.createLogoutCommand = function(db) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'logout':1}, null); -}; - -DbCommand.createCreateCollectionCommand = function(db, collectionName, options) { - var selector = {'create':collectionName}; - // Modify the options to ensure correct behaviour - for(var name in options) { - if(options[name] != null && options[name].constructor != Function) selector[name] = options[name]; - } - // Execute the command - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, selector, null); -}; - -DbCommand.createDropCollectionCommand = function(db, collectionName) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'drop':collectionName}, null); -}; - -DbCommand.createRenameCollectionCommand = function(db, fromCollectionName, toCollectionName) { - var renameCollection = db.databaseName + "." + fromCollectionName; - var toCollection = db.databaseName + "." + toCollectionName; - return new DbCommand(db, "admin." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'renameCollection':renameCollection, 'to':toCollection}, null); -}; - -DbCommand.createGetLastErrorCommand = function(options, db) { - var args = Array.prototype.slice.call(arguments, 0); - db = args.pop(); - options = args.length ? args.shift() : {}; - // Final command - var command = {'getlasterror':1}; - // If we have an options Object let's merge in the fields (fsync/wtimeout/w) - if('object' === typeof options) { - for(var name in options) { - command[name] = options[name] - } - } - - // Execute command - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command, null); -}; - -DbCommand.createGetLastStatusCommand = DbCommand.createGetLastErrorCommand; - -DbCommand.createGetPreviousErrorsCommand = function(db) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'getpreverror':1}, null); -}; - -DbCommand.createResetErrorHistoryCommand = function(db) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'reseterror':1}, null); -}; - -DbCommand.createCreateIndexCommand = function(db, collectionName, fieldOrSpec, options) { - var fieldHash = {}; - var indexes = []; - var keys; - - // Get all the fields accordingly - if (fieldOrSpec.constructor === String) { // 'type' - indexes.push(fieldOrSpec + '_' + 1); - fieldHash[fieldOrSpec] = 1; - } else if (fieldOrSpec.constructor === Array) { // [{location:'2d'}, ...] - fieldOrSpec.forEach(function(f) { - if (f.constructor === String) { // [{location:'2d'}, 'type'] - indexes.push(f + '_' + 1); - fieldHash[f] = 1; - } else if (f.constructor === Array) { // [['location', '2d'],['type', 1]] - indexes.push(f[0] + '_' + (f[1] || 1)); - fieldHash[f[0]] = f[1] || 1; - } else if (f.constructor === Object) { // [{location:'2d'}, {type:1}] - keys = Object.keys(f); - keys.forEach(function(k) { - indexes.push(k + '_' + f[k]); - fieldHash[k] = f[k]; - }); - } else { - // undefined - } - }); - } else if (fieldOrSpec.constructor === Object) { // {location:'2d', type:1} - keys = Object.keys(fieldOrSpec); - keys.forEach(function(key) { - indexes.push(key + '_' + fieldOrSpec[key]); - fieldHash[key] = fieldOrSpec[key]; - }); - } - - // Generate the index name - var indexName = indexes.join("_"); - // Build the selector - var selector = {'ns':(db.databaseName + "." + collectionName), 'key':fieldHash, 'name':indexName}; - - // Ensure we have a correct finalUnique - var finalUnique = options == null || 'object' === typeof options ? false : options; - // Set up options - options = options == null || typeof options == 'boolean' ? {} : options; - - // Add all the options - var keys = Object.keys(options); - // Add all the fields to the selector - for(var i = 0; i < keys.length; i++) { - selector[keys[i]] = options[keys[i]]; - } - - // If we don't have the unique property set on the selector - if(selector['unique'] == null) selector['unique'] = finalUnique; - // Create the insert command for the index and return the document - return new InsertCommand(db, db.databaseName + "." + DbCommand.SYSTEM_INDEX_COLLECTION, false).add(selector); -}; - -DbCommand.logoutCommand = function(db, command_hash) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command_hash, null); -} - -DbCommand.createDropIndexCommand = function(db, collectionName, indexName) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'deleteIndexes':collectionName, 'index':indexName}, null); -}; - -DbCommand.createReIndexCommand = function(db, collectionName) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'reIndex':collectionName}, null); -}; - -DbCommand.createDropDatabaseCommand = function(db) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'dropDatabase':1}, null); -}; - -DbCommand.createDbCommand = function(db, command_hash, options) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command_hash, null, options); -}; - -DbCommand.createAdminDbCommand = function(db, command_hash) { - return new DbCommand(db, "admin." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command_hash, null); -}; - -DbCommand.createDbSlaveOkCommand = function(db, command_hash, options) { - return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT | QueryCommand.OPTS_SLAVE, 0, -1, command_hash, null, options); -}; diff --git a/lib/mongodb/commands/delete_command.js b/lib/mongodb/commands/delete_command.js deleted file mode 100644 index c4b7a70ecbb..00000000000 --- a/lib/mongodb/commands/delete_command.js +++ /dev/null @@ -1,113 +0,0 @@ -var BaseCommand = require('./base_command').BaseCommand, - inherits = require('util').inherits, - debug = require('util').debug, - inspect = require('util').inspect; - -/** - Insert Document Command -**/ -var DeleteCommand = exports.DeleteCommand = function(db, collectionName, selector) { - BaseCommand.call(this); - - // Validate correctness off the selector - var object = selector; - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("delete raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - this.collectionName = collectionName; - this.selector = selector; - this.db = db; -}; - -inherits(DeleteCommand, BaseCommand); - -DeleteCommand.OP_DELETE = 2006; - -/* -struct { - MsgHeader header; // standard message header - int32 ZERO; // 0 - reserved for future use - cstring fullCollectionName; // "dbname.collectionname" - int32 ZERO; // 0 - reserved for future use - mongo.BSON selector; // query object. See below for details. -} -*/ -DeleteCommand.prototype.toBinary = function() { - // Calculate total length of the document - var totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + 4 + this.db.bson.calculateObjectSize(this.selector) + (4 * 4); - // Let's build the single pass buffer command - var _index = 0; - var _command = new Buffer(totalLengthOfCommand); - // Write the header information to the buffer - _command[_index + 3] = (totalLengthOfCommand >> 24) & 0xff; - _command[_index + 2] = (totalLengthOfCommand >> 16) & 0xff; - _command[_index + 1] = (totalLengthOfCommand >> 8) & 0xff; - _command[_index] = totalLengthOfCommand & 0xff; - // Adjust index - _index = _index + 4; - // Write the request ID - _command[_index + 3] = (this.requestId >> 24) & 0xff; - _command[_index + 2] = (this.requestId >> 16) & 0xff; - _command[_index + 1] = (this.requestId >> 8) & 0xff; - _command[_index] = this.requestId & 0xff; - // Adjust index - _index = _index + 4; - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - // Write the op_code for the command - _command[_index + 3] = (DeleteCommand.OP_DELETE >> 24) & 0xff; - _command[_index + 2] = (DeleteCommand.OP_DELETE >> 16) & 0xff; - _command[_index + 1] = (DeleteCommand.OP_DELETE >> 8) & 0xff; - _command[_index] = DeleteCommand.OP_DELETE & 0xff; - // Adjust index - _index = _index + 4; - - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - - // Write the collection name to the command - _index = _index + _command.write(this.collectionName, _index, 'utf8') + 1; - _command[_index - 1] = 0; - - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - - // Document binary length - var documentLength = 0 - - // Serialize the selector - // If we are passing a raw buffer, do minimal validation - if(this.selector instanceof Buffer) { - documentLength = this.selector.length; - // Copy the data into the current buffer - this.selector.copy(_command, _index); - } else { - documentLength = this.db.bson.serializeWithBufferAndIndex(this.selector, this.checkKeys, _command, _index) - _index + 1; - } - - // Write the length to the document - _command[_index + 3] = (documentLength >> 24) & 0xff; - _command[_index + 2] = (documentLength >> 16) & 0xff; - _command[_index + 1] = (documentLength >> 8) & 0xff; - _command[_index] = documentLength & 0xff; - // Update index in buffer - _index = _index + documentLength; - // Add terminating 0 for the object - _command[_index - 1] = 0; - return _command; -}; \ No newline at end of file diff --git a/lib/mongodb/commands/get_more_command.js b/lib/mongodb/commands/get_more_command.js deleted file mode 100644 index 03856308f37..00000000000 --- a/lib/mongodb/commands/get_more_command.js +++ /dev/null @@ -1,85 +0,0 @@ -var BaseCommand = require('./base_command').BaseCommand, - inherits = require('util').inherits, - debug = require('util').debug, - inspect = require('util').inspect, - binaryutils = require('../bson/binary_utils'); - -/** - Get More Document Command -**/ -var GetMoreCommand = exports.GetMoreCommand = function(db, collectionName, numberToReturn, cursorId) { - BaseCommand.call(this); - - this.collectionName = collectionName; - this.numberToReturn = numberToReturn; - this.cursorId = cursorId; - this.db = db; -}; - -inherits(GetMoreCommand, BaseCommand); - -GetMoreCommand.OP_GET_MORE = 2005; - -GetMoreCommand.prototype.toBinary = function() { - // Calculate total length of the document - var totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + 4 + 8 + (4 * 4); - // Let's build the single pass buffer command - var _index = 0; - var _command = new Buffer(totalLengthOfCommand); - // Write the header information to the buffer - _command[_index++] = totalLengthOfCommand & 0xff; - _command[_index++] = (totalLengthOfCommand >> 8) & 0xff; - _command[_index++] = (totalLengthOfCommand >> 16) & 0xff; - _command[_index++] = (totalLengthOfCommand >> 24) & 0xff; - - // Write the request ID - _command[_index++] = this.requestId & 0xff; - _command[_index++] = (this.requestId >> 8) & 0xff; - _command[_index++] = (this.requestId >> 16) & 0xff; - _command[_index++] = (this.requestId >> 24) & 0xff; - - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - - // Write the op_code for the command - _command[_index++] = GetMoreCommand.OP_GET_MORE & 0xff; - _command[_index++] = (GetMoreCommand.OP_GET_MORE >> 8) & 0xff; - _command[_index++] = (GetMoreCommand.OP_GET_MORE >> 16) & 0xff; - _command[_index++] = (GetMoreCommand.OP_GET_MORE >> 24) & 0xff; - - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - - // Write the collection name to the command - _index = _index + _command.write(this.collectionName, _index, 'utf8') + 1; - _command[_index - 1] = 0; - - // Number of documents to return - _command[_index++] = this.numberToReturn & 0xff; - _command[_index++] = (this.numberToReturn >> 8) & 0xff; - _command[_index++] = (this.numberToReturn >> 16) & 0xff; - _command[_index++] = (this.numberToReturn >> 24) & 0xff; - - // Encode the cursor id - var low_bits = this.cursorId.getLowBits(); - // Encode low bits - _command[_index++] = low_bits & 0xff; - _command[_index++] = (low_bits >> 8) & 0xff; - _command[_index++] = (low_bits >> 16) & 0xff; - _command[_index++] = (low_bits >> 24) & 0xff; - - var high_bits = this.cursorId.getHighBits(); - // Encode high bits - _command[_index++] = high_bits & 0xff; - _command[_index++] = (high_bits >> 8) & 0xff; - _command[_index++] = (high_bits >> 16) & 0xff; - _command[_index++] = (high_bits >> 24) & 0xff; - // Return command - return _command; -}; \ No newline at end of file diff --git a/lib/mongodb/commands/insert_command.js b/lib/mongodb/commands/insert_command.js deleted file mode 100644 index b32ca888437..00000000000 --- a/lib/mongodb/commands/insert_command.js +++ /dev/null @@ -1,143 +0,0 @@ -var BaseCommand = require('./base_command').BaseCommand, - inherits = require('util').inherits, - debug = require('util').debug, - inspect = require('util').inspect; - -/** - Insert Document Command -**/ -var InsertCommand = exports.InsertCommand = function(db, collectionName, checkKeys, options) { - BaseCommand.call(this); - - this.collectionName = collectionName; - this.documents = []; - this.checkKeys = checkKeys == null ? true : checkKeys; - this.db = db; - this.flags = 0; - this.serializeFunctions = false; - - // Ensure valid options hash - options = options == null ? {} : options; - - // Check if we have keepGoing set -> set flag if it's the case - if(options['keepGoing'] != null && options['keepGoing']) { - // This will finish inserting all non-index violating documents even if it returns an error - this.flags = 1; - } - - // Let us defined on a command basis if we want functions to be serialized or not - if(options['serializeFunctions'] != null && options['serializeFunctions']) { - this.serializeFunctions = true; - } -}; - -inherits(InsertCommand, BaseCommand); - -// OpCodes -InsertCommand.OP_INSERT = 2002; - -InsertCommand.prototype.add = function(document) { - if(document instanceof Buffer) { - var object_size = document[0] | document[1] << 8 | document[2] << 16 | document[3] << 24; - if(object_size != document.length) { - var error = new Error("insert raw message size does not match message header size [" + document.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - this.documents.push(document); - return this; -}; - -/* -struct { - MsgHeader header; // standard message header - int32 ZERO; // 0 - reserved for future use - cstring fullCollectionName; // "dbname.collectionname" - BSON[] documents; // one or more documents to insert into the collection -} -*/ -InsertCommand.prototype.toBinary = function() { - // Calculate total length of the document - var totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + (4 * 4); - // var docLength = 0 - for(var i = 0; i < this.documents.length; i++) { - if(this.documents[i] instanceof Buffer) { - totalLengthOfCommand += this.documents[i].length; - } else { - // Calculate size of document - totalLengthOfCommand += this.db.bson.calculateObjectSize(this.documents[i], this.serializeFunctions); - } - } - - // Let's build the single pass buffer command - var _index = 0; - var _command = new Buffer(totalLengthOfCommand); - // Write the header information to the buffer - _command[_index + 3] = (totalLengthOfCommand >> 24) & 0xff; - _command[_index + 2] = (totalLengthOfCommand >> 16) & 0xff; - _command[_index + 1] = (totalLengthOfCommand >> 8) & 0xff; - _command[_index] = totalLengthOfCommand & 0xff; - // Adjust index - _index = _index + 4; - // Write the request ID - _command[_index + 3] = (this.requestId >> 24) & 0xff; - _command[_index + 2] = (this.requestId >> 16) & 0xff; - _command[_index + 1] = (this.requestId >> 8) & 0xff; - _command[_index] = this.requestId & 0xff; - // Adjust index - _index = _index + 4; - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - // Write the op_code for the command - _command[_index + 3] = (InsertCommand.OP_INSERT >> 24) & 0xff; - _command[_index + 2] = (InsertCommand.OP_INSERT >> 16) & 0xff; - _command[_index + 1] = (InsertCommand.OP_INSERT >> 8) & 0xff; - _command[_index] = InsertCommand.OP_INSERT & 0xff; - // Adjust index - _index = _index + 4; - // Write flags if any - _command[_index + 3] = (this.flags >> 24) & 0xff; - _command[_index + 2] = (this.flags >> 16) & 0xff; - _command[_index + 1] = (this.flags >> 8) & 0xff; - _command[_index] = this.flags & 0xff; - // Adjust index - _index = _index + 4; - // Write the collection name to the command - _index = _index + _command.write(this.collectionName, _index, 'utf8') + 1; - _command[_index - 1] = 0; - - // Write all the bson documents to the buffer at the index offset - for(var i = 0; i < this.documents.length; i++) { - // Document binary length - var documentLength = 0 - var object = this.documents[i]; - - // Serialize the selector - // If we are passing a raw buffer, do minimal validation - if(object instanceof Buffer) { - documentLength = object.length; - // Copy the data into the current buffer - object.copy(_command, _index); - } else { - // Serialize the document straight to the buffer - documentLength = this.db.bson.serializeWithBufferAndIndex(object, this.checkKeys, _command, _index, this.serializeFunctions) - _index + 1; - } - - // Write the length to the document - _command[_index + 3] = (documentLength >> 24) & 0xff; - _command[_index + 2] = (documentLength >> 16) & 0xff; - _command[_index + 1] = (documentLength >> 8) & 0xff; - _command[_index] = documentLength & 0xff; - // Update index in buffer - _index = _index + documentLength; - // Add terminating 0 for the object - _command[_index - 1] = 0; - } - - return _command; -}; diff --git a/lib/mongodb/commands/kill_cursor_command.js b/lib/mongodb/commands/kill_cursor_command.js deleted file mode 100644 index 9778848a279..00000000000 --- a/lib/mongodb/commands/kill_cursor_command.js +++ /dev/null @@ -1,100 +0,0 @@ -var BaseCommand = require('./base_command').BaseCommand, - inherits = require('util').inherits, - binaryutils = require('../bson/binary_utils'), - debug = require('util').debug, - inspect = require('util').inspect; - -/** - Insert Document Command -**/ -var KillCursorCommand = exports.KillCursorCommand = function(db, cursorIds) { - BaseCommand.call(this); - - this.cursorIds = cursorIds; - this.db = db; -}; - -inherits(KillCursorCommand, BaseCommand); - -KillCursorCommand.OP_KILL_CURSORS = 2007; - -/* -struct { - MsgHeader header; // standard message header - int32 ZERO; // 0 - reserved for future use - int32 numberOfCursorIDs; // number of cursorIDs in message - int64[] cursorIDs; // array of cursorIDs to close -} -*/ -KillCursorCommand.prototype.toBinary = function() { - // Calculate total length of the document - var totalLengthOfCommand = 4 + 4 + (4 * 4) + (this.cursorIds.length * 8); - // Let's build the single pass buffer command - var _index = 0; - var _command = new Buffer(totalLengthOfCommand); - // Write the header information to the buffer - _command[_index + 3] = (totalLengthOfCommand >> 24) & 0xff; - _command[_index + 2] = (totalLengthOfCommand >> 16) & 0xff; - _command[_index + 1] = (totalLengthOfCommand >> 8) & 0xff; - _command[_index] = totalLengthOfCommand & 0xff; - // Adjust index - _index = _index + 4; - // Write the request ID - _command[_index + 3] = (this.requestId >> 24) & 0xff; - _command[_index + 2] = (this.requestId >> 16) & 0xff; - _command[_index + 1] = (this.requestId >> 8) & 0xff; - _command[_index] = this.requestId & 0xff; - // Adjust index - _index = _index + 4; - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - // Write the op_code for the command - _command[_index + 3] = (KillCursorCommand.OP_KILL_CURSORS >> 24) & 0xff; - _command[_index + 2] = (KillCursorCommand.OP_KILL_CURSORS >> 16) & 0xff; - _command[_index + 1] = (KillCursorCommand.OP_KILL_CURSORS >> 8) & 0xff; - _command[_index] = KillCursorCommand.OP_KILL_CURSORS & 0xff; - // Adjust index - _index = _index + 4; - - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - - // Number of cursors to kill - var numberOfCursors = this.cursorIds.length; - _command[_index + 3] = (numberOfCursors >> 24) & 0xff; - _command[_index + 2] = (numberOfCursors >> 16) & 0xff; - _command[_index + 1] = (numberOfCursors >> 8) & 0xff; - _command[_index] = numberOfCursors & 0xff; - // Adjust index - _index = _index + 4; - - // Encode all the cursors - for(var i = 0; i < this.cursorIds.length; i++) { - // Encode the cursor id - var low_bits = this.cursorIds[i].getLowBits(); - // Encode low bits - _command[_index + 3] = (low_bits >> 24) & 0xff; - _command[_index + 2] = (low_bits >> 16) & 0xff; - _command[_index + 1] = (low_bits >> 8) & 0xff; - _command[_index] = low_bits & 0xff; - // Adjust index - _index = _index + 4; - - var high_bits = this.cursorIds[i].getHighBits(); - // Encode high bits - _command[_index + 3] = (high_bits >> 24) & 0xff; - _command[_index + 2] = (high_bits >> 16) & 0xff; - _command[_index + 1] = (high_bits >> 8) & 0xff; - _command[_index] = high_bits & 0xff; - // Adjust index - _index = _index + 4; - } - - return _command; -}; \ No newline at end of file diff --git a/lib/mongodb/commands/query_command.js b/lib/mongodb/commands/query_command.js deleted file mode 100644 index a44d8a2430a..00000000000 --- a/lib/mongodb/commands/query_command.js +++ /dev/null @@ -1,212 +0,0 @@ -var BaseCommand = require('./base_command').BaseCommand, - BinaryParser = require('../bson/binary_parser').BinaryParser, - inherits = require('util').inherits, - debug = require('util').debug, - inspect = require('util').inspect; - -/** - Insert Document Command -**/ -var QueryCommand = exports.QueryCommand = function(db, collectionName, queryOptions, numberToSkip, numberToReturn, query, returnFieldSelector, options) { - BaseCommand.call(this); - - // Validate correctness off the selector - var object = query; - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("query selector raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - var object = returnFieldSelector; - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("query fields raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - // Make sure we don't get a null exception - options = options == null ? {} : options; - // Set up options - this.collectionName = collectionName; - this.queryOptions = queryOptions; - this.numberToSkip = numberToSkip; - this.numberToReturn = numberToReturn; - this.query = query; - this.returnFieldSelector = returnFieldSelector; - this.db = db; - - // Let us defined on a command basis if we want functions to be serialized or not - if(options['serializeFunctions'] != null && options['serializeFunctions']) { - this.serializeFunctions = true; - } -}; - -inherits(QueryCommand, BaseCommand); - -QueryCommand.OP_QUERY = 2004; - -/* -struct { - MsgHeader header; // standard message header - int32 opts; // query options. See below for details. - cstring fullCollectionName; // "dbname.collectionname" - int32 numberToSkip; // number of documents to skip when returning results - int32 numberToReturn; // number of documents to return in the first OP_REPLY - BSON query ; // query object. See below for details. - [ BSON returnFieldSelector; ] // OPTIONAL : selector indicating the fields to return. See below for details. -} -*/ -QueryCommand.prototype.toBinary = function() { - var totalLengthOfCommand = 0; - // Calculate total length of the document - if(this.query instanceof Buffer) { - totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + 4 + 4 + this.query.length + (4 * 4); - } else { - totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + 4 + 4 + this.db.bson.calculateObjectSize(this.query, this.serializeFunctions) + (4 * 4); - } - - // Calculate extra fields size - if(this.returnFieldSelector != null && !(this.returnFieldSelector instanceof Buffer)) { - if(Object.keys(this.returnFieldSelector).length > 0) { - totalLengthOfCommand += this.db.bson.calculateObjectSize(this.returnFieldSelector, this.serializeFunctions); - } - } else if(this.returnFieldSelector instanceof Buffer) { - totalLengthOfCommand += this.returnFieldSelector.length; - } - - // Let's build the single pass buffer command - var _index = 0; - var _command = new Buffer(totalLengthOfCommand); - // Write the header information to the buffer - _command[_index + 3] = (totalLengthOfCommand >> 24) & 0xff; - _command[_index + 2] = (totalLengthOfCommand >> 16) & 0xff; - _command[_index + 1] = (totalLengthOfCommand >> 8) & 0xff; - _command[_index] = totalLengthOfCommand & 0xff; - // Adjust index - _index = _index + 4; - // Write the request ID - _command[_index + 3] = (this.requestId >> 24) & 0xff; - _command[_index + 2] = (this.requestId >> 16) & 0xff; - _command[_index + 1] = (this.requestId >> 8) & 0xff; - _command[_index] = this.requestId & 0xff; - // Adjust index - _index = _index + 4; - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - // Write the op_code for the command - _command[_index + 3] = (QueryCommand.OP_QUERY >> 24) & 0xff; - _command[_index + 2] = (QueryCommand.OP_QUERY >> 16) & 0xff; - _command[_index + 1] = (QueryCommand.OP_QUERY >> 8) & 0xff; - _command[_index] = QueryCommand.OP_QUERY & 0xff; - // Adjust index - _index = _index + 4; - - // Write the query options - _command[_index + 3] = (this.queryOptions >> 24) & 0xff; - _command[_index + 2] = (this.queryOptions >> 16) & 0xff; - _command[_index + 1] = (this.queryOptions >> 8) & 0xff; - _command[_index] = this.queryOptions & 0xff; - // Adjust index - _index = _index + 4; - - // Write the collection name to the command - _index = _index + _command.write(this.collectionName, _index, 'utf8') + 1; - _command[_index - 1] = 0; - - // Write the number of documents to skip - _command[_index + 3] = (this.numberToSkip >> 24) & 0xff; - _command[_index + 2] = (this.numberToSkip >> 16) & 0xff; - _command[_index + 1] = (this.numberToSkip >> 8) & 0xff; - _command[_index] = this.numberToSkip & 0xff; - // Adjust index - _index = _index + 4; - - // Write the number of documents to return - _command[_index + 3] = (this.numberToReturn >> 24) & 0xff; - _command[_index + 2] = (this.numberToReturn >> 16) & 0xff; - _command[_index + 1] = (this.numberToReturn >> 8) & 0xff; - _command[_index] = this.numberToReturn & 0xff; - // Adjust index - _index = _index + 4; - - // Document binary length - var documentLength = 0 - var object = this.query; - - // Serialize the selector - if(object instanceof Buffer) { - documentLength = object.length; - // Copy the data into the current buffer - object.copy(_command, _index); - } else { - // Serialize the document straight to the buffer - documentLength = this.db.bson.serializeWithBufferAndIndex(object, this.checkKeys, _command, _index, this.serializeFunctions) - _index + 1; - } - - // Write the length to the document - _command[_index + 3] = (documentLength >> 24) & 0xff; - _command[_index + 2] = (documentLength >> 16) & 0xff; - _command[_index + 1] = (documentLength >> 8) & 0xff; - _command[_index] = documentLength & 0xff; - // Update index in buffer - _index = _index + documentLength; - // Add terminating 0 for the object - _command[_index - 1] = 0; - - // Push field selector if available - if(this.returnFieldSelector != null && !(this.returnFieldSelector instanceof Buffer)) { - if(Object.keys(this.returnFieldSelector).length > 0) { - var documentLength = this.db.bson.serializeWithBufferAndIndex(this.returnFieldSelector, this.checkKeys, _command, _index, this.serializeFunctions) - _index + 1; - // Write the length to the document - _command[_index + 3] = (documentLength >> 24) & 0xff; - _command[_index + 2] = (documentLength >> 16) & 0xff; - _command[_index + 1] = (documentLength >> 8) & 0xff; - _command[_index] = documentLength & 0xff; - // Update index in buffer - _index = _index + documentLength; - // Add terminating 0 for the object - _command[_index - 1] = 0; - } - } if(this.returnFieldSelector != null && this.returnFieldSelector instanceof Buffer) { - // Document binary length - var documentLength = 0 - var object = this.returnFieldSelector; - - // Serialize the selector - documentLength = object.length; - // Copy the data into the current buffer - object.copy(_command, _index); - - // Write the length to the document - _command[_index + 3] = (documentLength >> 24) & 0xff; - _command[_index + 2] = (documentLength >> 16) & 0xff; - _command[_index + 1] = (documentLength >> 8) & 0xff; - _command[_index] = documentLength & 0xff; - // Update index in buffer - _index = _index + documentLength; - // Add terminating 0 for the object - _command[_index - 1] = 0; - } - - // Return finished command - return _command; -}; - -// Constants -QueryCommand.OPTS_NONE = 0; -QueryCommand.OPTS_TAILABLE_CURSOR = 2; -QueryCommand.OPTS_SLAVE = 4; -QueryCommand.OPTS_OPLOG_REPLY = 8; -QueryCommand.OPTS_NO_CURSOR_TIMEOUT = 16; -QueryCommand.OPTS_AWAIT_DATA = 32; -QueryCommand.OPTS_EXHAUST = 64; \ No newline at end of file diff --git a/lib/mongodb/commands/update_command.js b/lib/mongodb/commands/update_command.js deleted file mode 100644 index 83684d9e858..00000000000 --- a/lib/mongodb/commands/update_command.js +++ /dev/null @@ -1,176 +0,0 @@ -var BaseCommand = require('./base_command').BaseCommand, - inherits = require('util').inherits, - debug = require('util').debug, - inspect = require('util').inspect; - -/** - Update Document Command -**/ -var UpdateCommand = exports.UpdateCommand = function(db, collectionName, spec, document, options) { - BaseCommand.call(this); - - var object = spec; - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("update spec raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - var object = document; - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("update document raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - this.collectionName = collectionName; - this.spec = spec; - this.document = document; - this.db = db; - this.serializeFunctions = false; - - // Generate correct flags - var db_upsert = 0; - var db_multi_update = 0; - db_upsert = options != null && options['upsert'] != null ? (options['upsert'] == true ? 1 : 0) : db_upsert; - db_multi_update = options != null && options['multi'] != null ? (options['multi'] == true ? 1 : 0) : db_multi_update; - - // Flags - this.flags = parseInt(db_multi_update.toString() + db_upsert.toString(), 2); - // Let us defined on a command basis if we want functions to be serialized or not - if(options['serializeFunctions'] != null && options['serializeFunctions']) { - this.serializeFunctions = true; - } -}; - -inherits(UpdateCommand, BaseCommand); - -UpdateCommand.OP_UPDATE = 2001; - -/* -struct { - MsgHeader header; // standard message header - int32 ZERO; // 0 - reserved for future use - cstring fullCollectionName; // "dbname.collectionname" - int32 flags; // bit vector. see below - BSON spec; // the query to select the document - BSON document; // the document data to update with or insert -} -*/ -UpdateCommand.prototype.toBinary = function() { - // Calculate total length of the document - var totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + 4 + this.db.bson.calculateObjectSize(this.spec, false) + - this.db.bson.calculateObjectSize(this.document, this.serializeFunctions) + (4 * 4); - - // Let's build the single pass buffer command - var _index = 0; - var _command = new Buffer(totalLengthOfCommand); - // Write the header information to the buffer - _command[_index + 3] = (totalLengthOfCommand >> 24) & 0xff; - _command[_index + 2] = (totalLengthOfCommand >> 16) & 0xff; - _command[_index + 1] = (totalLengthOfCommand >> 8) & 0xff; - _command[_index] = totalLengthOfCommand & 0xff; - // Adjust index - _index = _index + 4; - // Write the request ID - _command[_index + 3] = (this.requestId >> 24) & 0xff; - _command[_index + 2] = (this.requestId >> 16) & 0xff; - _command[_index + 1] = (this.requestId >> 8) & 0xff; - _command[_index] = this.requestId & 0xff; - // Adjust index - _index = _index + 4; - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - // Write the op_code for the command - _command[_index + 3] = (UpdateCommand.OP_UPDATE >> 24) & 0xff; - _command[_index + 2] = (UpdateCommand.OP_UPDATE >> 16) & 0xff; - _command[_index + 1] = (UpdateCommand.OP_UPDATE >> 8) & 0xff; - _command[_index] = UpdateCommand.OP_UPDATE & 0xff; - // Adjust index - _index = _index + 4; - - // Write zero - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - _command[_index++] = 0; - - // Write the collection name to the command - _index = _index + _command.write(this.collectionName, _index, 'utf8') + 1; - _command[_index - 1] = 0; - - // Write the update flags - _command[_index + 3] = (this.flags >> 24) & 0xff; - _command[_index + 2] = (this.flags >> 16) & 0xff; - _command[_index + 1] = (this.flags >> 8) & 0xff; - _command[_index] = this.flags & 0xff; - // Adjust index - _index = _index + 4; - - // Document binary length - var documentLength = 0 - var object = this.spec; - - // Serialize the selector - // If we are passing a raw buffer, do minimal validation - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) throw new Error("raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - documentLength = object.length; - // Copy the data into the current buffer - object.copy(_command, _index); - } else { - documentLength = this.db.bson.serializeWithBufferAndIndex(object, this.checkKeys, _command, _index, false) - _index + 1; - } - - // Write the length to the document - _command[_index + 3] = (documentLength >> 24) & 0xff; - _command[_index + 2] = (documentLength >> 16) & 0xff; - _command[_index + 1] = (documentLength >> 8) & 0xff; - _command[_index] = documentLength & 0xff; - // Update index in buffer - _index = _index + documentLength; - // Add terminating 0 for the object - _command[_index - 1] = 0; - - // Document binary length - var documentLength = 0 - var object = this.document; - - // Serialize the document - // If we are passing a raw buffer, do minimal validation - if(object instanceof Buffer) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) throw new Error("raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - documentLength = object.length; - // Copy the data into the current buffer - object.copy(_command, _index); - } else { - documentLength = this.db.bson.serializeWithBufferAndIndex(object, this.checkKeys, _command, _index, this.serializeFunctions) - _index + 1; - } - - // Write the length to the document - _command[_index + 3] = (documentLength >> 24) & 0xff; - _command[_index + 2] = (documentLength >> 16) & 0xff; - _command[_index + 1] = (documentLength >> 8) & 0xff; - _command[_index] = documentLength & 0xff; - // Update index in buffer - _index = _index + documentLength; - // Add terminating 0 for the object - _command[_index - 1] = 0; - - return _command; -}; - -// Constants -UpdateCommand.DB_UPSERT = 0; -UpdateCommand.DB_MULTI_UPDATE = 1; \ No newline at end of file diff --git a/lib/mongodb/connection/connection.js b/lib/mongodb/connection/connection.js deleted file mode 100644 index 0c549c2b329..00000000000 --- a/lib/mongodb/connection/connection.js +++ /dev/null @@ -1,417 +0,0 @@ -var utils = require('./connection_utils'), - inherits = require('util').inherits, - net = require('net'), - debug = require('util').debug, - inspect = require('util').inspect, - EventEmitter = require('events').EventEmitter, - inherits = require('util').inherits, - binaryutils = require('../bson/binary_utils'), - tls = require('tls'); - -var Connection = exports.Connection = function(id, socketOptions) { - // Set up event emitter - EventEmitter.call(this); - // Store all socket options - this.socketOptions = socketOptions ? socketOptions : {host:'localhost', port:27017}; - // Id for the connection - this.id = id; - // State of the connection - this.connected = false; - - // - // Connection parsing state - // - this.maxBsonSize = socketOptions.maxBsonSize ? socketOptions.maxBsonSize : Connection.DEFAULT_MAX_BSON_SIZE; - // Contains the current message bytes - this.buffer = null; - // Contains the current message size - this.sizeOfMessage = 0; - // Contains the readIndex for the messaage - this.bytesRead = 0; - // Contains spill over bytes from additional messages - this.stubBuffer = 0; - - // Just keeps list of events we allow - this.eventHandlers = {error:[], parseError:[], poolReady:[], message:[], close:[], timeout:[], end:[]}; - - // Just keeps list of events we allow - resetHandlers(this, false); -} - -// Set max bson size -Connection.DEFAULT_MAX_BSON_SIZE = 4 * 1024 * 1024 * 4 * 3; - -// Inherit event emitter so we can emit stuff wohoo -// inherits(Connection, SimpleEmitter); -inherits(Connection, EventEmitter); - -Connection.prototype.start = function() { - // If we have a normal connection - if(this.socketOptions.ssl) { - // Create a new stream - this.connection = new net.Socket(); - // Set options on the socket - this.connection.setTimeout(this.socketOptions.timeout); - // Work around for 0.4.X - if(process.version.indexOf("v0.4") == -1) this.connection.setNoDelay(this.socketOptions.noDelay); - // Set keep alive if defined - if(process.version.indexOf("v0.4") == -1) { - if(this.socketOptions.keepAlive > 0) { - this.connection.setKeepAlive(true, this.socketOptions.keepAlive); - } else { - this.connection.setKeepAlive(false); - } - } - - // Set up pair for tls with server, accept self-signed certificates as well - var pair = this.pair = tls.createSecurePair(false); - // Set up encrypted streams - this.pair.encrypted.pipe(this.connection); - this.connection.pipe(this.pair.encrypted); - - // Setup clearText stream - this.writeSteam = this.pair.cleartext; - // Add all handlers to the socket to manage it - this.pair.on("secure", connectHandler(this)); - this.pair.cleartext.on("data", createDataHandler(this)); - // Add handlers - this.connection.on("error", errorHandler(this)); - // this.connection.on("connect", connectHandler(this)); - this.connection.on("end", endHandler(this)); - this.connection.on("timeout", timeoutHandler(this)); - this.connection.on("drain", drainHandler(this)); - this.writeSteam.on("close", closeHandler(this)); - // Start socket - this.connection.connect(this.socketOptions.port, this.socketOptions.host); - } else { - // // Create a new stream - // this.connection = new net.Stream(); - // // Create new connection instance - // this.connection = new net.Socket(); - this.connection = net.createConnection(this.socketOptions.port, this.socketOptions.host); - // Set options on the socket - this.connection.setTimeout(this.socketOptions.timeout); - // Work around for 0.4.X - if(process.version.indexOf("v0.4") == -1) this.connection.setNoDelay(this.socketOptions.noDelay); - // Set keep alive if defined - if(process.version.indexOf("v0.4") == -1) { - if(this.socketOptions.keepAlive > 0) { - this.connection.setKeepAlive(true, this.socketOptions.keepAlive); - } else { - this.connection.setKeepAlive(false); - } - } - - // Set up write stream - this.writeSteam = this.connection; - // Add handlers - this.connection.on("error", errorHandler(this)); - // Add all handlers to the socket to manage it - this.connection.on("connect", connectHandler(this)); - // this.connection.on("end", endHandler(this)); - this.connection.on("data", createDataHandler(this)); - this.connection.on("timeout", timeoutHandler(this)); - this.connection.on("drain", drainHandler(this)); - this.connection.on("close", closeHandler(this)); - // // Start socket - // this.connection.connect(this.socketOptions.port, this.socketOptions.host); - } -} - -// Check if the sockets are live -Connection.prototype.isConnected = function() { - return this.connected && !this.connection.destroyed && this.connection.writable && this.connection.readable; -} - -// Write the data out to the socket -Connection.prototype.write = function(command, callback) { - try { - // If we have a list off commands to be executed on the same socket - if(Array.isArray(command)) { - for(var i = 0; i < command.length; i++) { - var binaryCommand = command[i].toBinary() - if(this.logger != null && this.logger.doDebug) this.logger.debug("writing command to mongodb", binaryCommand); - var r = this.writeSteam.write(binaryCommand); - } - } else { - var binaryCommand = command.toBinary() - if(this.logger != null && this.logger.doDebug) this.logger.debug("writing command to mongodb", binaryCommand); - var r = this.writeSteam.write(binaryCommand); - } - } catch (err) { - if(typeof callback === 'function') callback(err); - } -} - -// Force the closure of the connection -Connection.prototype.close = function() { - // clear out all the listeners - resetHandlers(this, true); - // Add a dummy error listener to catch any weird last moment errors (and ignore them) - this.connection.on("error", function() {}) - // destroy connection - this.connection.destroy(); -} - -// Reset all handlers -var resetHandlers = function(self, clearListeners) { - self.eventHandlers = {error:[], connect:[], close:[], end:[], timeout:[], parseError:[], message:[]}; - - // If we want to clear all the listeners - if(clearListeners && self.connection != null) { - var keys = Object.keys(self.eventHandlers); - // Remove all listeners - for(var i = 0; i < keys.length; i++) { - self.connection.removeAllListeners(keys[i]); - } - } -} - -// -// Handlers -// - -// Connect handler -var connectHandler = function(self) { - return function() { - // Set connected - self.connected = true; - // Emit the connect event with no error - self.emit("connect", null, self); - } -} - -var createDataHandler = exports.Connection.createDataHandler = function(self) { - // We need to handle the parsing of the data - // and emit the messages when there is a complete one - return function(data) { - // Parse until we are done with the data - while(data.length > 0) { - // If we still have bytes to read on the current message - if(self.bytesRead > 0 && self.sizeOfMessage > 0) { - // Calculate the amount of remaining bytes - var remainingBytesToRead = self.sizeOfMessage - self.bytesRead; - // Check if the current chunk contains the rest of the message - if(remainingBytesToRead > data.length) { - // Copy the new data into the exiting buffer (should have been allocated when we know the message size) - data.copy(self.buffer, self.bytesRead); - // Adjust the number of bytes read so it point to the correct index in the buffer - self.bytesRead = self.bytesRead + data.length; - - // Reset state of buffer - data = new Buffer(0); - } else { - // Copy the missing part of the data into our current buffer - data.copy(self.buffer, self.bytesRead, 0, remainingBytesToRead); - // Slice the overflow into a new buffer that we will then re-parse - data = data.slice(remainingBytesToRead); - - // Emit current complete message - try { - self.emit("message", self.buffer, self); - - } catch(err) { - var errorObject = {err:"socketHandler", trace:err, bin:buffer, parseState:{ - sizeOfMessage:self.sizeOfMessage, - bytesRead:self.bytesRead, - stubBuffer:self.stubBuffer}}; - if(self.logger != null && self.logger.doError) self.logger.error("parseError", errorObject); - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - } - - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - } - } else { - // Stub buffer is kept in case we don't get enough bytes to determine the - // size of the message (< 4 bytes) - if(self.stubBuffer != null && self.stubBuffer.length > 0) { - - // If we have enough bytes to determine the message size let's do it - if(self.stubBuffer.length + data.length > 4) { - // Prepad the data - var newData = new Buffer(self.stubBuffer.length + data.length); - self.stubBuffer.copy(newData, 0); - data.copy(newData, self.stubBuffer.length); - // Reassign for parsing - data = newData; - - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - - } else { - - // Add the the bytes to the stub buffer - var newStubBuffer = new Buffer(self.stubBuffer.length + data.length); - // Copy existing stub buffer - self.stubBuffer.copy(newStubBuffer, 0); - // Copy missing part of the data - data.copy(newStubBuffer, self.stubBuffer.length); - // Exit parsing loop - data = new Buffer(0); - } - } else { - if(data.length > 4) { - // Retrieve the message size - var sizeOfMessage = binaryutils.decodeUInt32(data, 0); - // If we have a negative sizeOfMessage emit error and return - if(sizeOfMessage < 0 || sizeOfMessage > self.maxBsonSize) { - var errorObject = {err:"socketHandler", trace:'', bin:self.buffer, parseState:{ - sizeOfMessage:sizeOfMessage, - bytesRead:self.bytesRead, - stubBuffer:self.stubBuffer}}; - if(self.logger != null && self.logger.doError) self.logger.error("parseError", errorObject); - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - return; - } - - // Ensure that the size of message is larger than 0 and less than the max allowed - if(sizeOfMessage > 4 && sizeOfMessage < self.maxBsonSize && sizeOfMessage > data.length) { - self.buffer = new Buffer(sizeOfMessage); - // Copy all the data into the buffer - data.copy(self.buffer, 0); - // Update bytes read - self.bytesRead = data.length; - // Update sizeOfMessage - self.sizeOfMessage = sizeOfMessage; - // Ensure stub buffer is null - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - - } else if(sizeOfMessage > 4 && sizeOfMessage < self.maxBsonSize && sizeOfMessage == data.length) { - try { - self.emit("message", data, self); - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - - } catch (err) { - var errorObject = {err:"socketHandler", trace:err, bin:self.buffer, parseState:{ - sizeOfMessage:self.sizeOfMessage, - bytesRead:self.bytesRead, - stubBuffer:self.stubBuffer}}; - if(self.logger != null && self.logger.doError) self.logger.error("parseError", errorObject); - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - } - } else if(sizeOfMessage <= 4 || sizeOfMessage > self.maxBsonSize) { - var errorObject = {err:"socketHandler", trace:null, bin:data, parseState:{ - sizeOfMessage:sizeOfMessage, - bytesRead:0, - buffer:null, - stubBuffer:null}}; - if(self.logger != null && self.logger.doError) self.logger.error("parseError", errorObject); - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - - // Clear out the state of the parser - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - - } else { - try { - self.emit("message", data.slice(0, sizeOfMessage), self); - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Copy rest of message - data = data.slice(sizeOfMessage); - } catch (err) { - var errorObject = {err:"socketHandler", trace:err, bin:self.buffer, parseState:{ - sizeOfMessage:sizeOfMessage, - bytesRead:self.bytesRead, - stubBuffer:self.stubBuffer}}; - if(self.logger != null && self.logger.doError) self.logger.error("parseError", errorObject); - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - } - - } - } else { - // Create a buffer that contains the space for the non-complete message - self.stubBuffer = new Buffer(data.length) - // Copy the data to the stub buffer - data.copy(self.stubBuffer, 0); - // Exit parsing loop - data = new Buffer(0); - } - } - } - } - } -} - -var endHandler = function(self) { - return function() { - // Set connected to false - self.connected = false; - // Emit end event - self.emit("end", {err: 'connection received Fin packet from [' + self.socketOptions.host + ':' + self.socketOptions.port + ']'}, self); - } -} - -var timeoutHandler = function(self) { - return function() { - self.emit("timeout", {err: 'connection to [' + self.socketOptions.host + ':' + self.socketOptions.port + '] timed out'}, self); - } -} - -var drainHandler = function(self) { - return function() { - } -} - -var errorHandler = function(self) { - return function(err) { - // Set connected to false - self.connected = false; - // Emit error - self.emit("error", {err: 'failed to connect to [' + self.socketOptions.host + ':' + self.socketOptions.port + ']'}, self); - } -} - -var closeHandler = function(self) { - return function(hadError) { - // If we have an error during the connection phase - if(hadError && !self.connected) { - // Set disconnected - self.connected = false; - // Emit error - self.emit("error", {err: 'failed to connect to [' + self.socketOptions.host + ':' + self.socketOptions.port + ']'}, self); - } else { - // Set disconnected - self.connected = false; - // Emit close - self.emit("close", {err: 'connection closed to [' + self.socketOptions.host + ':' + self.socketOptions.port + ']'}, self); - } - } -} - -// Some basic defaults -Connection.DEFAULT_PORT = 27017; - - - - - - - diff --git a/lib/mongodb/connection/connection_pool.js b/lib/mongodb/connection/connection_pool.js deleted file mode 100644 index 421d1bd9557..00000000000 --- a/lib/mongodb/connection/connection_pool.js +++ /dev/null @@ -1,259 +0,0 @@ -var utils = require('./connection_utils'), - inherits = require('util').inherits, - net = require('net'), - EventEmitter = require('events').EventEmitter, - inherits = require('util').inherits, - MongoReply = require("../responses/mongo_reply").MongoReply, - Connection = require("./connection").Connection; - -var ConnectionPool = exports.ConnectionPool = function(host, port, poolSize, bson, socketOptions) { - if(typeof host !== 'string' || typeof port !== 'number') throw "host and port must be specified [" + host + ":" + port + "]"; - // Set up event emitter - EventEmitter.call(this); - // Keep all options for the socket in a specific collection allowing the user to specify the - // Wished upon socket connection parameters - this.socketOptions = typeof socketOptions === 'object' ? socketOptions : {}; - this.socketOptions.host = host; - this.socketOptions.port = port; - this.bson = bson; - // PoolSize is always + 1 for special reserved "measurment" socket (like ping, stats etc) - this.poolSize = poolSize; - - // Set default settings for the socket options - utils.setIntegerParameter(this.socketOptions, 'timeout', 0); - // Delay before writing out the data to the server - utils.setBooleanParameter(this.socketOptions, 'noDelay', true); - // Delay before writing out the data to the server - utils.setIntegerParameter(this.socketOptions, 'keepAlive', 0); - // Set the encoding of the data read, default is binary == null - utils.setStringParameter(this.socketOptions, 'encoding', null); - // Allows you to set a throttling bufferSize if you need to stop overflows - utils.setIntegerParameter(this.socketOptions, 'bufferSize', 0); - - // Internal structures - this.openConnections = []; - this.connections = []; - - // Assign connection id's - this.connectionId = 0; - - // Current index for selection of pool connection - this.currentConnectionIndex = 0; - // The pool state - this._poolState = 'disconnected'; - // timeout control - this._timeout = false; -} - -inherits(ConnectionPool, EventEmitter); - -ConnectionPool.prototype.setMaxBsonSize = function(maxBsonSize) { - if(maxBsonSize == null){ - maxBsonSize = Connection.DEFAULT_MAX_BSON_SIZE; - } - - for(var i = 0; i < this.openConnections.length; i++) { - this.openConnections[i].maxBsonSize = maxBsonSize; - } -} - -// Start a function -var _connect = function(_self) { - return new function() { - var connectionStatus = _self._poolState; - // Create a new connection instance - var connection = new Connection(_self.connectionId++, _self.socketOptions); - // Set logger on pool - connection.logger = _self.logger; - // Connect handler - connection.on("connect", function(err, connection) { - // Add connection to list of open connections - _self.openConnections.push(connection); - _self.connections.push(connection) - - // If the number of open connections is equal to the poolSize signal ready pool - if(_self.connections.length === _self.poolSize && _self._poolState !== 'disconnected') { - // Set connected - _self._poolState = 'connected'; - // Emit pool ready - _self.emit("poolReady"); - } else if(_self.connections.length < _self.poolSize) { - // We need to open another connection, make sure it's in the next - // tick so we don't get a cascade of errors - process.nextTick(function() { - _connect(_self); - }); - } - }); - - var numberOfErrors = 0 - - // Error handler - connection.on("error", function(err, connection) { - numberOfErrors++; - // If we are already disconnected ignore the event - if(connectionStatus != 'disconnected' && _self.listeners("error").length > 0) { - _self.emit("error", err); - } - - // Set disconnected - connectionStatus = 'disconnected'; - // Set disconnected - _self._poolState = 'disconnected'; - // Clean up - _self.openConnections = []; - _self.connections = []; - }); - - // Close handler - connection.on("close", function() { - // If we are already disconnected ignore the event - if(connectionStatus !== 'disconnected' && _self.listeners("close").length > 0) { - _self.emit("close"); - } - - // Set disconnected - connectionStatus = 'disconnected'; - // Set disconnected - _self._poolState = 'disconnected'; - // Clean up - _self.openConnections = []; - _self.connections = []; - }); - - // Timeout handler - connection.on("timeout", function(err, connection) { - // If we are already disconnected ignore the event - if(connectionStatus !== 'disconnected' && _self.listeners("timeout").length > 0) { - _self.emit("timeout", err); - } - - // Set disconnected - connectionStatus = 'disconnected'; - // Set disconnected - _self._poolState = 'disconnected'; - // Clean up - _self.openConnections = []; - _self.connections = []; - }); - - // Parse error, needs a complete shutdown of the pool - connection.on("parseError", function() { - // If we are already disconnected ignore the event - if(connectionStatus !== 'disconnected' && _self.listeners("parseError").length > 0) { - // if(connectionStatus == 'connected') { - _self.emit("parseError", new Error("parseError occured")); - } - - // Set disconnected - connectionStatus = 'disconnected'; - _self.stop(); - }); - - connection.on("message", function(message) { - _self.emit("message", message); - }); - - // Start connection in the next tick - connection.start(); - }(); -} - - -// Start method, will throw error if no listeners are available -// Pass in an instance of the listener that contains the api for -// finding callbacks for a given message etc. -ConnectionPool.prototype.start = function() { - var markerDate = new Date().getTime(); - var self = this; - - if(this.listeners("poolReady").length == 0) { - throw "pool must have at least one listener ready that responds to the [poolReady] event"; - } - - // Set pool state to connecting - this._poolState = 'connecting'; - this._timeout = false; - - _connect(self); -} - -// Restart a connection pool (on a close the pool might be in a wrong state) -ConnectionPool.prototype.restart = function() { - // Close all connections - this.stop(false); - // Now restart the pool - this.start(); -} - -// Stop the connections in the pool -ConnectionPool.prototype.stop = function(removeListeners) { - removeListeners = removeListeners == null ? true : removeListeners; - // Set disconnected - this._poolState = 'disconnected'; - - // Clear all listeners if specified - if(removeListeners) { - this.removeAllEventListeners(); - } - - // Close all connections - for(var i = 0; i < this.connections.length; i++) { - this.connections[i].close(); - } - - // Clean up - // this.connectionsWithErrors = []; - this.openConnections = []; - this.connections = []; -} - -// Check the status of the connection -ConnectionPool.prototype.isConnected = function() { - return this._poolState === 'connected'; -} - -// Checkout a connection from the pool for usage, or grab a specific pool instance -ConnectionPool.prototype.checkoutConnection = function(id) { - var index = (this.currentConnectionIndex++ % (this.openConnections.length)); - var connection = this.openConnections[index]; - return connection; -} - -ConnectionPool.prototype.getAllConnections = function() { - return this.connections; -} - -// Remove all non-needed event listeners -ConnectionPool.prototype.removeAllEventListeners = function() { - this.removeAllListeners("close"); - this.removeAllListeners("error"); - this.removeAllListeners("timeout"); - this.removeAllListeners("connect"); - this.removeAllListeners("end"); - this.removeAllListeners("parseError"); - this.removeAllListeners("message"); - this.removeAllListeners("poolReady"); -} - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/mongodb/connection/connection_utils.js b/lib/mongodb/connection/connection_utils.js deleted file mode 100644 index 591092495a8..00000000000 --- a/lib/mongodb/connection/connection_utils.js +++ /dev/null @@ -1,23 +0,0 @@ -exports.setIntegerParameter = function(object, field, defaultValue) { - if(object[field] == null) { - object[field] = defaultValue; - } else if(typeof object[field] !== "number" && object[field] !== parseInt(object[field], 10)) { - throw "object field [" + field + "] must be a numeric integer value, attempted to set to [" + object[field] + "] type of [" + typeof object[field] + "]"; - } -} - -exports.setBooleanParameter = function(object, field, defaultValue) { - if(object[field] == null) { - object[field] = defaultValue; - } else if(typeof object[field] !== "boolean") { - throw "object field [" + field + "] must be a boolean value, attempted to set to [" + object[field] + "] type of [" + typeof object[field] + "]"; - } -} - -exports.setStringParameter = function(object, field, defaultValue) { - if(object[field] == null) { - object[field] = defaultValue; - } else if(typeof object[field] !== "string") { - throw "object field [" + field + "] must be a string value, attempted to set to [" + object[field] + "] type of [" + typeof object[field] + "]"; - } -} \ No newline at end of file diff --git a/lib/mongodb/connection/repl_set_servers.js b/lib/mongodb/connection/repl_set_servers.js deleted file mode 100644 index 28662821e94..00000000000 --- a/lib/mongodb/connection/repl_set_servers.js +++ /dev/null @@ -1,968 +0,0 @@ -var Connection = require('./connection').Connection, - DbCommand = require('../commands/db_command').DbCommand, - MongoReply = require('../responses/mongo_reply').MongoReply, - debug = require('util').debug, - SimpleEmitter = require('./simple_emitter').SimpleEmitter, - inherits = require('util').inherits, - inspect = require('util').inspect, - Server = require('./server').Server, - format = require('util').format, - PingStrategy = require('./strategies/ping_strategy').PingStrategy, - StatisticsStrategy = require('./strategies/statistics_strategy').StatisticsStrategy; - -const STATE_STARTING_PHASE_1 = 0; -const STATE_PRIMARY = 1; -const STATE_SECONDARY = 2; -const STATE_RECOVERING = 3; -const STATE_FATAL_ERROR = 4; -const STATE_STARTING_PHASE_2 = 5; -const STATE_UNKNOWN = 6; -const STATE_ARBITER = 7; -const STATE_DOWN = 8; -const STATE_ROLLBACK = 9; - -/** -* ReplSetServers constructor provides master-slave functionality -* -* @param serverArr{Array of type Server} -* @return constructor of ServerCluster -* -*/ -var ReplSetServers = exports.ReplSetServers = function(servers, options) { - var self = this; - // Contains the master server entry - this.options = options == null ? {} : options; - this.reconnectWait = this.options["reconnectWait"] != null ? this.options["reconnectWait"] : 1000; - this.retries = this.options["retries"] != null ? this.options["retries"] : 30; - this.replicaSet = this.options["rs_name"]; - - // Are we allowing reads from secondaries ? - this.readSecondary = this.options["read_secondary"]; - this.slaveOk = true; - this.closedConnectionCount = 0; - this._used = false; - - // Default poolSize for new server instances - this.poolSize = this.options.poolSize == null ? 1 : this.options.poolSize; - - // Set up ssl connections - this.ssl = this.options.ssl == null ? false : this.options.ssl; - - // Just keeps list of events we allow - this.eventHandlers = {error:[], parseError:[], poolReady:[], message:[], close:[], timeout:[]}; - // Internal state of server connection - this._serverState = 'disconnected'; - // Read preference - this._readPreference = null; - // Do we record server stats or not - this.recordQueryStats = false; - - // Get the readPreference - var readPreference = this.options['readPreference']; - // Read preference setting - if(readPreference != null) { - if(readPreference != Server.READ_PRIMARY && readPreference != Server.READ_SECONDARY_ONLY - && readPreference != Server.READ_SECONDARY) { - throw new Error("Illegal readPreference mode specified, " + readPreference); - } - - // Set read Preference - this._readPreference = readPreference; - } else { - this._readPreference = null; - } - - // Strategy for picking a secondary - this.strategy = this.options['strategy'] == null ? 'statistical' : this.options['strategy']; - // Make sure strategy is one of the two allowed - if(this.strategy != null && (this.strategy != 'ping' && this.strategy != 'statistical')) throw new Error("Only ping or statistical strategies allowed"); - // Let's set up our strategy object for picking secodaries - if(this.strategy == 'ping') { - // Create a new instance - this.strategyInstance = new PingStrategy(this); - } else if(this.strategy == 'statistical') { - // Set strategy as statistical - this.strategyInstance = new StatisticsStrategy(this); - // Add enable query information - this.enableRecordQueryStats(true); - } - - // Set default connection pool options - this.socketOptions = this.options.socketOptions != null ? this.options.socketOptions : {}; - - // Set up logger if any set - this.logger = this.options.logger != null - && (typeof this.options.logger.debug == 'function') - && (typeof this.options.logger.error == 'function') - && (typeof this.options.logger.debug == 'function') - ? this.options.logger : {error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}}; - - // Ensure all the instances are of type server and auto_reconnect is false - if(!Array.isArray(servers) || servers.length == 0) { - throw Error("The parameter must be an array of servers and contain at least one server"); - } else if(Array.isArray(servers) || servers.length > 0) { - var count = 0; - servers.forEach(function(server) { - if(server instanceof Server) count = count + 1; - // Ensure no server has reconnect on - server.options.auto_reconnect = false; - }); - - if(count < servers.length) { - throw Error("All server entries must be of type Server"); - } else { - this.servers = servers; - } - } - - // Auto Reconnect property - Object.defineProperty(this, "autoReconnect", { enumerable: true - , get: function () { - return true; - } - }); - - // Get Read Preference method - Object.defineProperty(this, "readPreference", { enumerable: true - , get: function () { - if(this._readPreference == null && this.readSecondary) { - return Server.READ_SECONDARY; - } else if(this._readPreference == null && !this.readSecondary) { - return Server.READ_PRIMARY; - } else { - return this._readPreference; - } - } - }); - - // Db Instances - Object.defineProperty(this, "dbInstances", {enumerable:true - , get: function() { - var servers = this.allServerInstances(); - return servers[0].dbInstances; - } - }) - - // Auto Reconnect property - Object.defineProperty(this, "host", { enumerable: true - , get: function () { - if (this.primary != null) return this.primary.host; - } - }); - - Object.defineProperty(this, "port", { enumerable: true - , get: function () { - if (this.primary != null) return this.primary.port; - } - }); - - Object.defineProperty(this, "read", { enumerable: true - , get: function () { - return this.secondaries.length > 0 ? this.secondaries[0] : null; - } - }); - - // Get list of secondaries - Object.defineProperty(this, "secondaries", {enumerable: true - , get: function() { - var keys = Object.keys(this._state.secondaries); - var array = new Array(keys.length); - // Convert secondaries to array - for(var i = 0; i < keys.length; i++) { - array[i] = this._state.secondaries[keys[i]]; - } - return array; - } - }); - - // Get list of all secondaries including passives - Object.defineProperty(this, "allSecondaries", {enumerable: true - , get: function() { - return this.secondaries.concat(this.passives); - } - }); - - // Get list of arbiters - Object.defineProperty(this, "arbiters", {enumerable: true - , get: function() { - var keys = Object.keys(this._state.arbiters); - var array = new Array(keys.length); - // Convert arbiters to array - for(var i = 0; i < keys.length; i++) { - array[i] = this._state.arbiters[keys[i]]; - } - return array; - } - }); - - // Get list of passives - Object.defineProperty(this, "passives", {enumerable: true - , get: function() { - var keys = Object.keys(this._state.passives); - var array = new Array(keys.length); - // Convert arbiters to array - for(var i = 0; i < keys.length; i++) { - array[i] = this._state.passives[keys[i]]; - } - return array; - } - }); - - // Master connection property - Object.defineProperty(this, "primary", { enumerable: true - , get: function () { - return this._state != null ? this._state.master : null; - } - }); -}; - -inherits(ReplSetServers, SimpleEmitter); - -// Allow setting the read preference at the replicaset level -ReplSetServers.prototype.setReadPreference = function(preference) { - // Set read preference - this._readPreference = preference; - // Ensure slaveOk is correct for secodnaries read preference and tags - if((this._readPreference == Server.READ_SECONDARY || this._readPreference == Server.READ_SECONDARY_ONLY) - || (this._readPreference != null && typeof this._readPreference == 'object')) { - this.slaveOk = true; - } -} - -// Return the used state -ReplSetServers.prototype._isUsed = function() { - return this._used; -} - -ReplSetServers.prototype.setTarget = function(target) { - this.target = target; -}; - -ReplSetServers.prototype.isConnected = function() { - // Return the state of the replicaset server - return this.primary != null && this._state.master != null && this._state.master.isConnected(); -} - -Server.prototype.isSetMember = function() { - return false; -} - -ReplSetServers.prototype.isPrimary = function(config) { - return this.readSecondary && this.secondaries.length > 0 ? false : true; -} - -ReplSetServers.prototype.isReadPrimary = ReplSetServers.prototype.isPrimary; - -// Clean up dead connections -var cleanupConnections = ReplSetServers.cleanupConnections = function(connections, addresses, byTags) { - // Ensure we don't have entries in our set with dead connections - var keys = Object.keys(connections); - for(var i = 0; i < keys.length; i++) { - var server = connections[keys[i]]; - // If it's not connected remove it from the list - if(!server.isConnected()) { - // Remove from connections and addresses - delete connections[keys[i]]; - delete addresses[keys[i]]; - // Clean up tags if needed - if(server.tags != null && typeof server.tags === 'object') { - cleanupTags(server, byTags); - } - } - } -} - -var cleanupTags = ReplSetServers._cleanupTags = function(server, byTags) { - var serverTagKeys = Object.keys(server.tags); - // Iterate over all server tags and remove any instances for that tag that matches the current - // server - for(var i = 0; i < serverTagKeys.length; i++) { - // Fetch the value for the tag key - var value = server.tags[serverTagKeys[i]]; - - // If we got an instance of the server - if(byTags[serverTagKeys[i]] != null - && byTags[serverTagKeys[i]][value] != null - && Array.isArray(byTags[serverTagKeys[i]][value])) { - // List of clean servers - var cleanInstances = []; - // We got instances for the particular tag set - var instances = byTags[serverTagKeys[i]][value]; - for(var j = 0; j < instances.length; j++) { - var serverInstance = instances[j]; - // If we did not find an instance add it to the clean instances - if((serverInstance.host + ":" + serverInstance.port) !== (server.host + ":" + server.port)) { - cleanInstances.push(serverInstance); - } - } - - // Update the byTags list - byTags[serverTagKeys[i]][value] = cleanInstances; - } - } -} - -ReplSetServers.prototype.allServerInstances = function() { - var self = this; - // Close all the servers (concatenate entire list of servers first for ease) - var allServers = self._state.master != null ? [self._state.master] : []; - - // Secondary keys - var keys = Object.keys(self._state.secondaries); - // Add all secondaries - for(var i = 0; i < keys.length; i++) { - allServers.push(self._state.secondaries[keys[i]]); - } - - // Arbiter keys - var keys = Object.keys(self._state.arbiters); - // Add all arbiters - for(var i = 0; i < keys.length; i++) { - allServers.push(self._state.arbiters[keys[i]]); - } - - // Passive keys - var keys = Object.keys(self._state.passives); - // Add all arbiters - for(var i = 0; i < keys.length; i++) { - allServers.push(self._state.passives[keys[i]]); - } - - // Return complete list of all servers - return allServers; -} - -// Ensure no callback is left hanging when we have an error -var __executeAllCallbacksWithError = function(dbInstance, error) { - var keys = Object.keys(dbInstance._callBackStore._notReplied); - // Iterate over all callbacks - for(var i = 0; i < keys.length; i++) { - // Delete info object - delete dbInstance._callBackStore._notReplied[keys[i]]; - // Emit the error - dbInstance._callBackStore.emit(keys[i], error); - } -} - -ReplSetServers.prototype.connect = function(parent, options, callback) { - var self = this; - var dateStamp = new Date().getTime(); - if('function' === typeof options) callback = options, options = {}; - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - - // Keep reference to parent - this.db = parent; - // Set server state to connecting - this._serverState = 'connecting'; - // Reference to the instance - var replSetSelf = this; - var serverConnections = this.servers; - // Ensure parent can do a slave query if it's set - parent.slaveOk = this.slaveOk ? this.slaveOk : parent.slaveOk; - // Number of total servers that need to initialized (known servers) - var numberOfServersLeftToInitialize = serverConnections.length; - - // Clean up state - replSetSelf._state = {'master':null, 'secondaries':{}, 'arbiters':{}, 'passives':{}, 'errors':{}, 'addresses':{}, 'byTags':{}, 'setName':null, 'errorMessages':[], 'members':[]}; - - // Create a connection handler - var connectionHandler = function(instanceServer) { - return function(err, result) { - // Don't attempt to connect if we are done - // if(replSetSelf._serverState === 'disconnected') return; - // Remove a server from the list of intialized servers we need to perform - numberOfServersLeftToInitialize = numberOfServersLeftToInitialize - 1; - // Add enable query information - instanceServer.enableRecordQueryStats(replSetSelf.recordQueryStats); - - if(err == null && result.documents[0].hosts != null) { - // Fetch the isMaster command result - var document = result.documents[0]; - // Break out the results - var setName = document.setName; - var isMaster = document.ismaster; - var secondary = document.secondary; - var passive = document.passive; - var arbiterOnly = document.arbiterOnly; - var hosts = Array.isArray(document.hosts) ? document.hosts : []; - var arbiters = Array.isArray(document.arbiters) ? document.arbiters : []; - var passives = Array.isArray(document.passives) ? document.passives : []; - var tags = document.tags ? document.tags : {}; - var primary = document.primary; - var me = document.me; - - // Only add server to our internal list if it's a master, secondary or arbiter - if(isMaster == true || secondary == true || arbiterOnly == true) { - // Handle a closed connection - var closeHandler = function(err, server) { - var closeServers = function() { - // Set the state to disconnected - parent._state = 'disconnected'; - // Shut down the replicaset for now and Fire off all the callbacks sitting with no reply - if(replSetSelf._serverState == 'connected') { - // Close the replicaset - replSetSelf.close(function() { - __executeAllCallbacksWithError(parent, err); - // Ensure single callback only - if(callback != null) { - // Single callback only - var internalCallback = callback; - callback = null; - // Return the error - internalCallback(err, null); - } else { - // If the parent has listeners trigger an event - if(parent.listeners("close").length > 0) { - parent.emit("close", err); - } - } - }); - } - } - - // Check if this is the primary server, then disconnect otherwise keep going - if(replSetSelf._state.master != null) { - var primaryAddress = format("%s:%s", replSetSelf._state.master.host, replSetSelf._state.master.port); - var errorServerAddress = format("%s:%s", server.host, server.port); - - // Only shut down the set if we have a primary server error - if(primaryAddress == errorServerAddress) { - closeServers(); - } else { - // Remove from the list of servers - delete replSetSelf._state.addresses[errorServerAddress]; - // Locate one of the lists and remove - if(replSetSelf._state.secondaries[errorServerAddress] != null) { - delete replSetSelf._state.secondaries[errorServerAddress]; - } else if(replSetSelf._state.arbiters[errorServerAddress] != null) { - delete replSetSelf._state.arbiters[errorServerAddress]; - } else if(replSetSelf._state.passives[errorServerAddress] != null) { - delete replSetSelf._state.passives[errorServerAddress]; - } - - // Check if we are reading from Secondary only - if(replSetSelf._readPreference == Server.READ_SECONDARY_ONLY && Object.keys(replSetSelf._state.secondaries).length == 0) { - closeServers(); - } - } - } else { - closeServers(); - } - } - - // Handle a connection timeout - var timeoutHandler = function(err, server) { - var closeServers = function() { - // Set the state to disconnected - parent._state = 'disconnected'; - // Shut down the replicaset for now and Fire off all the callbacks sitting with no reply - if(replSetSelf._serverState == 'connected') { - // Close the replicaset - replSetSelf.close(function() { - __executeAllCallbacksWithError(parent, err); - // Ensure single callback only - if(callback != null) { - // Single callback only - var internalCallback = callback; - callback = null; - // Return the error - internalCallback(new Error("connection timed out"), null); - } else { - // If the parent has listeners trigger an event - if(parent.listeners("error").length > 0) { - parent.emit("timeout", new Error("connection timed out")); - } - } - }); - } - } - - // Check if this is the primary server, then disconnect otherwise keep going - if(replSetSelf._state.master != null) { - var primaryAddress = format("%s:%s", replSetSelf._state.master.host, replSetSelf._state.master.port); - var errorServerAddress = format("%s:%s", server.host, server.port); - - // Only shut down the set if we have a primary server error - if(primaryAddress == errorServerAddress) { - closeServers(); - } else { - // Remove from the list of servers - delete replSetSelf._state.addresses[errorServerAddress]; - // Locate one of the lists and remove - if(replSetSelf._state.secondaries[errorServerAddress] != null) { - delete replSetSelf._state.secondaries[errorServerAddress]; - } else if(replSetSelf._state.arbiters[errorServerAddress] != null) { - delete replSetSelf._state.arbiters[errorServerAddress]; - } else if(replSetSelf._state.passives[errorServerAddress] != null) { - delete replSetSelf._state.passives[errorServerAddress]; - } - - // Check if we are reading from Secondary only - if(replSetSelf._readPreference == Server.READ_SECONDARY_ONLY && Object.keys(replSetSelf._state.secondaries).length == 0) { - closeServers(); - } - } - } else { - closeServers(); - } - } - - // Handle an error - var errorHandler = function(err, server) { - var closeServers = function() { - // Set the state to disconnected - parent._state = 'disconnected'; - // Shut down the replicaset for now and Fire off all the callbacks sitting with no reply - if(replSetSelf._serverState == 'connected') { - // Close the replicaset - replSetSelf.close(function() { - __executeAllCallbacksWithError(parent, err); - // Ensure single callback only - if(callback != null) { - // Single callback only - var internalCallback = callback; - callback = null; - // Return the error - internalCallback(err, null); - } else { - // If the parent has listeners trigger an event - if(parent.listeners("error").length > 0) { - parent.emit("error", err); - } - } - }); - } - } - - // Check if this is the primary server, then disconnect otherwise keep going - if(replSetSelf._state.master != null) { - var primaryAddress = format("%s:%s", replSetSelf._state.master.host, replSetSelf._state.master.port); - var errorServerAddress = format("%s:%s", server.host, server.port); - - // Only shut down the set if we have a primary server error - if(primaryAddress == errorServerAddress) { - closeServers(); - } else { - // Remove from the list of servers - delete replSetSelf._state.addresses[errorServerAddress]; - // Locate one of the lists and remove - if(replSetSelf._state.secondaries[errorServerAddress] != null) { - delete replSetSelf._state.secondaries[errorServerAddress]; - } else if(replSetSelf._state.arbiters[errorServerAddress] != null) { - delete replSetSelf._state.arbiters[errorServerAddress]; - } else if(replSetSelf._state.passives[errorServerAddress] != null) { - delete replSetSelf._state.passives[errorServerAddress]; - } - - // Check if we are reading from Secondary only - if(replSetSelf._readPreference == Server.READ_SECONDARY_ONLY && Object.keys(replSetSelf._state.secondaries).length == 0) { - closeServers(); - } - } - } else { - closeServers(); - } - } - - // Ensure we don't have duplicate handlers - instanceServer.removeAllListeners("close"); - instanceServer.removeAllListeners("error"); - instanceServer.removeAllListeners("timeout"); - - // Add error handler to the instance of the server - instanceServer.on("close", closeHandler); - // Add error handler to the instance of the server - instanceServer.on("error", errorHandler); - // instanceServer.on("timeout", errorHandler); - instanceServer.on("timeout", timeoutHandler); - // Add tag info - instanceServer.tags = tags; - - // For each tag in tags let's add the instance Server to the list for that tag - if(tags != null && typeof tags === 'object') { - var tagKeys = Object.keys(tags); - // For each tag file in the server add it to byTags - for(var i = 0; i < tagKeys.length; i++) { - var value = tags[tagKeys[i]]; - // Check if we have a top level tag object - if(replSetSelf._state.byTags[tagKeys[i]] == null) replSetSelf._state.byTags[tagKeys[i]] = {}; - // For the value check if we have an array of server instances - if(!Array.isArray(replSetSelf._state.byTags[tagKeys[i]][value])) replSetSelf._state.byTags[tagKeys[i]][value] = []; - // Check that the instance is not already registered there - var valueArray = replSetSelf._state.byTags[tagKeys[i]][value]; - var found = false; - - // Iterate over all values - for(var j = 0; j < valueArray.length; j++) { - if(valueArray[j].host == instanceServer.host && valueArray[j].port == instanceServer.port) { - found = true; - break; - } - } - - // If it was not found push the instance server to the list - if(!found) valueArray.push(instanceServer); - } - } - - // Remove from error list - delete replSetSelf._state.errors[me]; - - // Add our server to the list of finished servers - replSetSelf._state.addresses[me] = instanceServer; - - // Assign the set name - if(replSetSelf.replicaSet == null) { - replSetSelf._state.setName = setName; - } else if(replSetSelf.replicaSet != setName && replSetSelf._serverState != 'disconnected') { - replSetSelf._state.errorMessages.push(new Error("configured mongodb replicaset does not match provided replicaset [" + setName + "] != [" + replSetSelf.replicaSet + "]")); - // Set done - replSetSelf._serverState = 'disconnected'; - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Return error message ignoring rest of calls - return internalCallback(replSetSelf._state.errorMessages[0], parent); - } - - // Let's add the server to our list of server types - if(secondary == true && (passive == false || passive == null)) { - replSetSelf._state.secondaries[me] = instanceServer; - } else if(arbiterOnly == true) { - replSetSelf._state.arbiters[me] = instanceServer; - } else if(secondary == true && passive == true) { - replSetSelf._state.passives[me] = instanceServer; - } else if(isMaster == true) { - replSetSelf._state.master = instanceServer; - } else if(isMaster == false && primary != null && replSetSelf._state.addresses[primary]) { - replSetSelf._state.master = replSetSelf._state.addresses[primary]; - } - - // Let's go throught all the "possible" servers in the replicaset - var candidateServers = hosts.concat(arbiters).concat(passives); - - // If we have new servers let's add them - for(var i = 0; i < candidateServers.length; i++) { - // Fetch the server string - var candidateServerString = candidateServers[i]; - // Add the server if it's not defined - if(replSetSelf._state.addresses[candidateServerString] == null) { - // Split the server string - var parts = candidateServerString.split(/:/); - if(parts.length == 1) { - parts = [parts[0], Connection.DEFAULT_PORT]; - } - - // Default empty socket options object - var socketOptions = {}; - // If a socket option object exists clone it - if(replSetSelf.socketOptions != null) { - var keys = Object.keys(replSetSelf.socketOptions); - for(var i = 0; i < keys.length;i++) socketOptions[keys[i]] = replSetSelf.socketOptions[keys[i]]; - } - - // Add host information to socket options - socketOptions['host'] = parts[0]; - socketOptions['port'] = parseInt(parts[1]); - - // Create a new server instance - var newServer = new Server(parts[0], parseInt(parts[1]), {auto_reconnect:false, 'socketOptions':socketOptions - , logger:replSetSelf.logger, ssl:replSetSelf.ssl, poolSize:replSetSelf.poolSize}); - // Set the replicaset instance - newServer.replicasetInstance = replSetSelf; - - // Add handlers - newServer.on("close", closeHandler); - newServer.on("timeout", timeoutHandler); - newServer.on("error", errorHandler); - - // Add server to list, ensuring we don't get a cascade of request to the same server - replSetSelf._state.addresses[candidateServerString] = newServer; - - // Add a new server to the total number of servers that need to initialized before we are done - numberOfServersLeftToInitialize = numberOfServersLeftToInitialize + 1; - - // Let's set up a new server instance - newServer.connect(parent, {returnIsMasterResults: true, eventReceiver:newServer}, connectionHandler(newServer)); - } - } - } else { - // Remove the instance from out list of servers - delete replSetSelf._state.addresses[me]; - } - } - - // If done finish up - if((numberOfServersLeftToInitialize == 0) && replSetSelf._serverState === 'connecting' && replSetSelf._state.errorMessages.length == 0) { - // Set db as connected - replSetSelf._serverState = 'connected'; - // If we don't expect a master let's call back, otherwise we need a master before - // the connection is successful - if(replSetSelf.masterNotNeeded || replSetSelf._state.master != null) { - // If we have a read strategy boot it - if(replSetSelf.strategyInstance != null) { - // Ensure we have a proper replicaset defined - replSetSelf.strategyInstance.replicaset = replSetSelf; - // Start strategy - replSetSelf.strategyInstance.start(function(err) { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(null, parent); - }) - } else { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(null, parent); - } - } else if(replSetSelf.readSecondary == true && Object.keys(replSetSelf._state.secondaries).length > 0) { - // If we have a read strategy boot it - if(replSetSelf.strategyInstance != null) { - // Ensure we have a proper replicaset defined - replSetSelf.strategyInstance.replicaset = replSetSelf; - // Start strategy - replSetSelf.strategyInstance.start(function(err) { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(null, parent); - }) - } else { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(null, parent); - } - } else if(replSetSelf.readSecondary == true && Object.keys(replSetSelf._state.secondaries).length == 0) { - replSetSelf._serverState = 'disconnected'; - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Force close all server instances - replSetSelf.close(); - // Perform callback - internalCallback(new Error("no secondary server found"), null); - } else if(typeof callback === 'function'){ - replSetSelf._serverState = 'disconnected'; - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Force close all server instances - replSetSelf.close(); - // Perform callback - internalCallback(new Error("no primary server found"), null); - } - } else if((numberOfServersLeftToInitialize == 0) && replSetSelf._state.errorMessages.length > 0 && replSetSelf._serverState != 'disconnected') { - // Set done - replSetSelf._serverState = 'disconnected'; - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Force close all server instances - replSetSelf.close(); - // Callback to signal we are done - internalCallback(replSetSelf._state.errorMessages[0], null); - } - } - } - - // Ensure we have all registered servers in our set - for(var i = 0; i < serverConnections.length; i++) { - replSetSelf._state.addresses[serverConnections[i].host + ':' + serverConnections[i].port] = serverConnections[i]; - } - - // Initialize all the connections - for(var i = 0; i < serverConnections.length; i++) { - // Set up the logger for the server connection - serverConnections[i].logger = replSetSelf.logger; - // Default empty socket options object - var socketOptions = {}; - // If a socket option object exists clone it - if(this.socketOptions != null && typeof this.socketOptions === 'object') { - var keys = Object.keys(this.socketOptions); - for(var j = 0; j < keys.length;j++) socketOptions[keys[j]] = this.socketOptions[keys[j]]; - } - - // If ssl is specified - if(replSetSelf.ssl) serverConnections[i].ssl = true; - - // Add host information to socket options - socketOptions['host'] = serverConnections[i].host; - socketOptions['port'] = serverConnections[i].port; - - // Set the socket options - serverConnections[i].socketOptions = socketOptions; - // Set the replicaset instance - serverConnections[i].replicasetInstance = replSetSelf; - // Connect to server - serverConnections[i].connect(parent, {returnIsMasterResults: true, eventReceiver:serverConnections[i]}, connectionHandler(serverConnections[i])); - } - - // Check if we have an error in the inital set of servers and callback with error - if(replSetSelf._state.errorMessages.length > 0 && typeof callback === 'function') { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(replSetSelf._state.errorMessages[0], null); - } -} - -ReplSetServers.prototype.checkoutWriter = function() { - // Establish connection - var connection = this._state.master != null ? this._state.master.checkoutWriter() : null; - // Return the connection - return connection; -} - -ReplSetServers.prototype.checkoutReader = function() { - var connection = null; - // If we have specified to read from a secondary server grab a random one and read - // from it, otherwise just pass the primary connection - if((this.readSecondary == true || this._readPreference == Server.READ_SECONDARY || this._readPreference == Server.READ_SECONDARY_ONLY) && Object.keys(this._state.secondaries).length > 0) { - // Checkout a secondary server from the passed in set of servers - if(this.strategyInstance != null) { - connection = this.strategyInstance.checkoutSecondary(); - } else { - // Pick a random key - var keys = Object.keys(this._state.secondaries); - var key = keys[Math.floor(Math.random() * keys.length)]; - connection = this._state.secondaries[key].checkoutReader(); - } - } else if(this._readPreference == Server.READ_SECONDARY_ONLY && Object.keys(this._state.secondaries).length == 0) { - connection = null; - } else if(this._readPreference != null && typeof this._readPreference === 'object') { - // Get all tag keys (used to try to find a server that is valid) - var keys = Object.keys(this._readPreference); - // final instance server - var instanceServer = null; - // for each key look for an avilable instance - for(var i = 0; i < keys.length; i++) { - // Grab subkey value - var value = this._readPreference[keys[i]]; - - // Check if we have any servers for the tag, if we do pick a random one - if(this._state.byTags[keys[i]] != null - && this._state.byTags[keys[i]][value] != null - && Array.isArray(this._state.byTags[keys[i]][value]) - && this._state.byTags[keys[i]][value].length > 0) { - // Let's grab an available server from the list using a random pick - var serverInstances = this._state.byTags[keys[i]][value]; - // Set instance to return - instanceServer = serverInstances[Math.floor(Math.random() * serverInstances.length)]; - break; - } - } - - // Return the instance of the server - connection = instanceServer != null ? instanceServer.checkoutReader() : this.checkoutWriter(); - } else { - connection = this.checkoutWriter(); - } - // Return the connection - return connection; -} - -ReplSetServers.prototype.allRawConnections = function() { - // Neeed to build a complete list of all raw connections, start with master server - var allConnections = []; - // Get connection object - var allMasterConnections = this._state.master.connectionPool.getAllConnections(); - // Add all connections to list - allConnections = allConnections.concat(allMasterConnections); - - // If we have read secondary let's add all secondary servers - if(this.readSecondary && Object.keys(this._state.secondaries).length > 0) { - // Get all the keys - var keys = Object.keys(this._state.secondaries); - // For each of the secondaries grab the connections - for(var i = 0; i < keys.length; i++) { - // Get connection object - var secondaryPoolConnections = this._state.secondaries[keys[i]].connectionPool.getAllConnections(); - // Add all connections to list - allConnections = allConnections.concat(secondaryPoolConnections); - } - } - - // Return all the conections - return allConnections; -} - -ReplSetServers.prototype.enableRecordQueryStats = function(enable) { - // Set the global enable record query stats - this.recordQueryStats = enable; - // Ensure all existing servers already have the flag set, even if the - // connections are up already or we have not connected yet - if(this._state != null && this._state.addresses != null) { - var keys = Object.keys(this._state.addresses); - // Iterate over all server instances and set the enableRecordQueryStats flag - for(var i = 0; i < keys.length; i++) { - this._state.addresses[keys[i]].enableRecordQueryStats(enable); - } - } else if(Array.isArray(this.servers)) { - for(var i = 0; i < this.servers.length; i++) { - this.servers[i].enableRecordQueryStats(enable); - } - } -} - -ReplSetServers.prototype.disconnect = function(callback) { - this.close(callback); -} - -ReplSetServers.prototype.close = function(callback) { - var self = this; - // Set server status as disconnected - this._serverState = 'disconnected'; - // Get all the server instances and close them - var allServers = []; - // Make sure we have servers - if(this._state['addresses'] != null) { - var keys = Object.keys(this._state.addresses); - for(var i = 0; i < keys.length; i++) { - allServers.push(this._state.addresses[keys[i]]); - } - } - - // Let's process all the closing - var numberOfServersToClose = allServers.length; - - // Remove all the listeners - self.removeAllListeners(); - - // Special case where there are no servers - if(allServers.length == 0 && typeof callback === 'function') return callback(null, null); - - // Close the servers - for(var i = 0; i < allServers.length; i++) { - var server = allServers[i]; - if(server.isConnected()) { - // Close each server - server.close(function() { - numberOfServersToClose = numberOfServersToClose - 1; - // Clear out state if we are done - if(numberOfServersToClose == 0) { - // Clear out state - self._state = {'master':null, 'secondaries':{}, 'arbiters':{}, 'passives':{}, 'errors':{}, 'addresses':{}, 'byTags':{}, 'setName':null, 'errorMessages':[], 'members':[]}; - } - - // If we are finished perform the call back - if(numberOfServersToClose == 0 && typeof callback === 'function') { - callback(null); - } - }) - } else { - numberOfServersToClose = numberOfServersToClose - 1; - // If we have no more servers perform the callback - if(numberOfServersToClose == 0 && typeof callback === 'function') { - callback(null); - } - } - } -} \ No newline at end of file diff --git a/lib/mongodb/connection/server.js b/lib/mongodb/connection/server.js deleted file mode 100644 index fa4222b6d5f..00000000000 --- a/lib/mongodb/connection/server.js +++ /dev/null @@ -1,622 +0,0 @@ -var Connection = require('./connection').Connection, - DbCommand = require('../commands/db_command').DbCommand, - MongoReply = require('../responses/mongo_reply').MongoReply, - ConnectionPool = require('./connection_pool').ConnectionPool, - SimpleEmitter = require('./simple_emitter').SimpleEmitter, - MongoReply = require("../responses/mongo_reply").MongoReply, - inherits = require('util').inherits; - -var Server = exports.Server = function(host, port, options) { - var self = this; - this.host = host; - this.port = port; - this.options = options == null ? {} : options; - this.internalConnection; - this.internalMaster = false; - this.connected = false; - this.poolSize = this.options.poolSize == null ? 1 : this.options.poolSize; - this.ssl = this.options.ssl == null ? false : this.options.ssl; - this.slaveOk = this.options["slave_ok"]; - this._used = false; - - // Get the readPreference - var readPreference = this.options['readPreference']; - // Read preference setting - if(readPreference != null) { - if(readPreference != Server.READ_PRIMARY && readPreference != Server.READ_SECONDARY_ONLY - && readPreference != Server.READ_SECONDARY) { - throw new Error("Illegal readPreference mode specified, " + readPreference); - } - - // Set read Preference - this._readPreference = readPreference; - } else { - this._readPreference = null; - } - - // Contains the isMaster information returned from the server - this.isMasterDoc; - - // Set default connection pool options - this.socketOptions = this.options.socketOptions != null ? this.options.socketOptions : {}; - // Set ssl up if it's defined - if(this.ssl) { - this.socketOptions.ssl = true; - } - - // Set up logger if any set - this.logger = this.options.logger != null - && (typeof this.options.logger.debug == 'function') - && (typeof this.options.logger.error == 'function') - && (typeof this.options.logger.debug == 'function') - ? this.options.logger : {error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}}; - - // Just keeps list of events we allow - this.eventHandlers = {error:[], parseError:[], poolReady:[], message:[], close:[], timeout:[]}; - // Internal state of server connection - this._serverState = 'disconnected'; - // this._timeout = false; - // Contains state information about server connection - this._state = {'runtimeStats': {'queryStats':new RunningStats()}}; - // Do we record server stats or not - this.recordQueryStats = false; - - // Setters and getters - Object.defineProperty(this, "autoReconnect", { enumerable: true - , get: function () { - return this.options['auto_reconnect'] == null ? false : this.options['auto_reconnect']; - } - }); - - Object.defineProperty(this, "connection", { enumerable: true - , get: function () { - return this.internalConnection; - } - , set: function(connection) { - this.internalConnection = connection; - } - }); - - Object.defineProperty(this, "master", { enumerable: true - , get: function () { - return this.internalMaster; - } - , set: function(value) { - this.internalMaster = value; - } - }); - - Object.defineProperty(this, "primary", { enumerable: true - , get: function () { - return this; - } - }); - - // Getter for query Stats - Object.defineProperty(this, "queryStats", { enumerable: true - , get: function () { - return this._state.runtimeStats.queryStats; - } - }); - - Object.defineProperty(this, "runtimeStats", { enumerable: true - , get: function () { - return this._state.runtimeStats; - } - }); - - // Get Read Preference method - Object.defineProperty(this, "readPreference", { enumerable: true - , get: function () { - if(this._readPreference == null && this.readSecondary) { - return Server.READ_SECONDARY; - } else if(this._readPreference == null && !this.readSecondary) { - return Server.READ_PRIMARY; - } else { - return this._readPreference; - } - } - }); -}; - -// Inherit simple event emitter -inherits(Server, SimpleEmitter); -// Read Preferences -Server.READ_PRIMARY = 'primary'; -Server.READ_SECONDARY = 'secondary'; -Server.READ_SECONDARY_ONLY = 'secondaryOnly'; - -// Always ourselves -Server.prototype.setReadPreference = function() {} - -// Return the used state -Server.prototype._isUsed = function() { - return this._used; -} - -// Server close function -Server.prototype.close = function(callback) { - // Remove all local listeners - this.removeAllListeners(); - - if(this.connectionPool != null) { - // Remove all the listeners on the pool so it does not fire messages all over the place - this.connectionPool.removeAllEventListeners(); - // Close the connection if it's open - this.connectionPool.stop(); - } - - // Set server status as disconnected - this._serverState = 'disconnected'; - // Peform callback if present - if(typeof callback === 'function') callback(); -}; - -Server.prototype.isConnected = function() { - return this.connectionPool != null && this.connectionPool.isConnected(); -} - -Server.prototype.allServerInstances = function() { - return [this]; -} - -Server.prototype.isSetMember = function() { - return this['replicasetInstance'] != null; -} - -Server.prototype.connect = function(dbInstance, options, callback) { - if('function' === typeof options) callback = options, options = {}; - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - - // Currently needed to work around problems with multiple connections in a pool with ssl - // TODO fix if possible - if(this.ssl == true) { - // Set up socket options for ssl - this.socketOptions.ssl = true; - } - - // Let's connect - var server = this; - // Let's us override the main receiver of events - var eventReceiver = options.eventReceiver != null ? options.eventReceiver : this; - // Creating dbInstance - this.dbInstance = dbInstance; - // Save reference to dbInstance - this.dbInstances = [dbInstance]; - - // Set server state to connecting - this._serverState = 'connecting'; - // Ensure dbInstance can do a slave query if it's set - dbInstance.slaveOk = this.slaveOk ? this.slaveOk : dbInstance.slaveOk; - // Create connection Pool instance with the current BSON serializer - var connectionPool = new ConnectionPool(this.host, this.port, this.poolSize, dbInstance.bson, this.socketOptions); - // Set logger on pool - connectionPool.logger = this.logger; - - // Set up a new pool using default settings - server.connectionPool = connectionPool; - - // Set basic parameters passed in - var returnIsMasterResults = options.returnIsMasterResults == null ? false : options.returnIsMasterResults; - - // Create a default connect handler, overriden when using replicasets - var connectCallback = function(err, reply) { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Internal callback - if(err != null) return internalCallback(err, null); - server.master = reply.documents[0].ismaster == 1 ? true : false; - server.connectionPool.setMaxBsonSize(reply.documents[0].maxBsonObjectSize); - // Set server as connected - server.connected = true; - // Save document returned so we can query it - server.isMasterDoc = reply.documents[0]; - - // If we have it set to returnIsMasterResults - if(returnIsMasterResults) { - internalCallback(null, reply); - } else { - internalCallback(null, dbInstance); - } - }; - - // Let's us override the main connect callback - var connectHandler = options.connectHandler == null ? connectCallback : options.connectHandler; - - // Set up on connect method - connectionPool.on("poolReady", function() { - // Create db command and Add the callback to the list of callbacks by the request id (mapping outgoing messages to correct callbacks) - var db_command = DbCommand.NcreateIsMasterCommand(dbInstance, dbInstance.databaseName); - // Check out a reader from the pool - var connection = connectionPool.checkoutConnection(); - // Set server state to connected - server._serverState = 'connected'; - - // Register handler for messages - dbInstance._registerHandler(db_command, false, connection, connectHandler); - - // Write the command out - connection.write(db_command); - }) - - // Set up item connection - connectionPool.on("message", function(message) { - // Attempt to parse the message - try { - // Create a new mongo reply - var mongoReply = new MongoReply() - // Parse the header - mongoReply.parseHeader(message, connectionPool.bson) - // If message size is not the same as the buffer size - // something went terribly wrong somewhere - if(mongoReply.messageLength != message.length) { - // Emit the error - eventReceiver.emit("error", new Error("bson length is different from message length"), server); - // Remove all listeners - server.removeAllListeners(); - } else { - var startDate = new Date().getTime(); - - // Attempt to locate a callback instance - for(var i = 0; i < server.dbInstances.length; i++) { - var dbInstanceObject = server.dbInstances[i]; - // Locate the callback info - var callbackInfo = dbInstanceObject._findHandler(mongoReply.responseTo.toString()); - - // Only execute callback if we have a caller - if(callbackInfo.callback && Array.isArray(callbackInfo.info.chained)) { - // Check if callback has already been fired (missing chain command) - var chained = callbackInfo.info.chained; - var numberOfFoundCallbacks = 0; - for(var i = 0; i < chained.length; i++) { - if(dbInstanceObject._hasHandler(chained[i])) numberOfFoundCallbacks++; - } - - // If we have already fired then clean up rest of chain and move on - if(numberOfFoundCallbacks != chained.length) { - for(var i = 0; i < chained.length; i++) { - dbInstanceObject._removeHandler(chained[i]); - } - - // Just return from function - return; - } - - // Parse the body - mongoReply.parseBody(message, connectionPool.bson, callbackInfo.info.raw, function(err) { - var callbackInfo = dbInstanceObject._findHandler(mongoReply.responseTo.toString()); - // If we have an error let's execute the callback and clean up all other - // chained commands - var firstResult = mongoReply && mongoReply.documents; - // Check for an error, if we have one let's trigger the callback and clean up - // The chained callbacks - if(firstResult[0].err != null || firstResult[0].errmsg != null) { - // Trigger the callback for the error - dbInstanceObject._callHandler(mongoReply.responseTo, mongoReply, null); - } else { - var chainedIds = callbackInfo.info.chained; - - if(chainedIds.length > 0 && chainedIds[chainedIds.length - 1] == mongoReply.responseTo) { - // Cleanup all other chained calls - chainedIds.pop(); - // Remove listeners - for(var i = 0; i < chainedIds.length; i++) dbInstanceObject._removeHandler(chainedIds[i]); - // Call the handler - dbInstanceObject._callHandler(mongoReply.responseTo, callbackInfo.info.results.shift(), null); - } else{ - // Add the results to all the results - for(var i = 0; i < chainedIds.length; i++) { - var handler = dbInstanceObject._findHandler(chainedIds[i]); - // Check if we have an object, if it's the case take the current object commands and - // and add this one - if(handler.info != null) { - handler.info.results = Array.isArray(callbackInfo.info.results) ? callbackInfo.info.results : []; - handler.info.results.push(mongoReply); - } - } - } - } - }); - } else if(callbackInfo.callback) { - // Parse the body - mongoReply.parseBody(message, connectionPool.bson, callbackInfo.info.raw, function(err) { - // Let's record the stats info if it's enabled - if(server.recordQueryStats == true && server._state['runtimeStats'] != null - && server._state.runtimeStats['queryStats'] instanceof RunningStats) { - // Add data point to the running statistics object - server._state.runtimeStats.queryStats.push(new Date().getTime() - callbackInfo.info.start); - } - - // Trigger the callback - dbInstanceObject._callHandler(mongoReply.responseTo, mongoReply, null); - }); - } - } - } - } catch (err) { - // Throw error in next tick - process.nextTick(function() { - throw err; - }) - } - }); - - // Handle timeout - connectionPool.on("timeout", function(err) { - // If pool connection is already closed - if(server._serverState === 'disconnected') return; - // Set server state to disconnected - server._serverState = 'disconnected'; - // Close the pool - connectionPool.stop(); - // If we have a callback return the error - if(typeof callback === 'function') { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(err, null); - } else if(server.isSetMember()) { - server.emit("timeout", err, server); - } else { - eventReceiver.emit("timeout", err, server); - } - - // If we are a single server connection fire errors correctly - if(!server.isSetMember()) { - // Fire all callback errors - _fireCallbackErrors(server, err); - // Emit error - _emitAcrossAllDbInstances(server, eventReceiver, "timeout", err, server); - } - }); - - // Handle errors - connectionPool.on("error", function(message) { - // If pool connection is already closed - if(server._serverState === 'disconnected') return; - // Set server state to disconnected - server._serverState = 'disconnected'; - // Close the pool - connectionPool.stop(); - // If we have a callback return the error - if(typeof callback === 'function') {// && !server.isSetMember()) { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(new Error(message && message.err ? message.err : message), null); - } else if(server.isSetMember()) { - server.emit("error", new Error(message && message.err ? message.err : message), server); - } else { - eventReceiver.emit("error", new Error(message && message.err ? message.err : message), server); - } - - // If we are a single server connection fire errors correctly - if(!server.isSetMember()) { - // Fire all callback errors - _fireCallbackErrors(server, new Error(message && message.err ? message.err : message)); - // Emit error - _emitAcrossAllDbInstances(server, eventReceiver, "error", new Error(message && message.err ? message.err : message), server); - } - }); - - // Handle close events - connectionPool.on("close", function() { - // If pool connection is already closed - if(server._serverState === 'disconnected') return; - // Set server state to disconnected - server._serverState = 'disconnected'; - // Close the pool - connectionPool.stop(true); - // If we have a callback return the error - if(typeof callback === 'function') { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(new Error("connection closed"), null); - } else if(server.isSetMember()) { - server.emit("close", new Error("connection closed"), server); - } else { - eventReceiver.emit("close", new Error("connection closed"), server); - } - - // If we are a single server connection fire errors correctly - if(!server.isSetMember()) { - // Fire all callback errors - _fireCallbackErrors(server, new Error("connection closed")); - // Emit error - _emitAcrossAllDbInstances(server, eventReceiver, "close", server); - } - }); - - // If we have a parser error we are in an unknown state, close everything and emit - // error - connectionPool.on("parseError", function(message) { - // If pool connection is already closed - if(server._serverState === 'disconnected') return; - // Set server state to disconnected - server._serverState = 'disconnected'; - // Close the pool - connectionPool.stop(); - // If we have a callback return the error - if(typeof callback === 'function') { - // ensure no callbacks get called twice - var internalCallback = callback; - callback = null; - // Perform callback - internalCallback(new Error("connection closed due to parseError"), null); - } else if(server.isSetMember()) { - server.emit("parseError", new Error("connection closed due to parseError"), server); - } else { - eventReceiver.emit("parseError", new Error("connection closed due to parseError"), server); - } - - // If we are a single server connection fire errors correctly - if(!server.isSetMember()) { - // Fire all callback errors - _fireCallbackErrors(server, new Error("connection closed due to parseError")); - // Emit error - _emitAcrossAllDbInstances(server, eventReceiver, "parseError", server); - } - }); - - // Boot up connection poole, pass in a locator of callbacks - connectionPool.start(); -} - -// Fire all the errors -var _fireCallbackErrors = function(server, err) { - // Locate all the possible callbacks that need to return - for(var i = 0; i < server.dbInstances.length; i++) { - // Fetch the db Instance - var dbInstance = server.dbInstances[i]; - // Check all callbacks - var keys = Object.keys(dbInstance._callBackStore._notReplied); - // For each key check if it's a callback that needs to be returned - for(var j = 0; j < keys.length; j++) { - var info = dbInstance._callBackStore._notReplied[keys[j]]; - if(info.connection.socketOptions.host === server.host && info.connection.socketOptions.port === server.port) { - dbInstance._callBackStore.emit(keys[j], err, null); - } - } - } -} - -var _emitAcrossAllDbInstances = function(server, filterDb, event, message, object) { - // Emit close event across all db instances sharing the sockets - var allServerInstances = server.allServerInstances(); - // Fetch the first server instance - var serverInstance = allServerInstances[0]; - // For all db instances signal all db instances - if(Array.isArray(serverInstance.dbInstances) && serverInstance.dbInstances.length > 1) { - for(var i = 0; i < serverInstance.dbInstances.length; i++) { - var dbInstance = serverInstance.dbInstances[i]; - // Check if it's our current db instance and skip if it is - if(filterDb == null || filterDb.databaseName !== dbInstance.databaseName || filterDb.tag !== dbInstance.tag) { - dbInstance.emit(event, message, object); - } - } - } -} - -Server.prototype.allRawConnections = function() { - return this.connectionPool.getAllConnections(); -} - -// Check if a writer can be provided -var canCheckoutWriter = function(self, read) { - // We cannot write to an arbiter or secondary server - if(self.isMasterDoc['arbiterOnly'] == true) { - return new Error("Cannot write to an arbiter"); - } if(self.isMasterDoc['secondary'] == true) { - return new Error("Cannot write to a secondary"); - } else if(read == true && self._readPreference == Server.READ_SECONDARY_ONLY && self.isMasterDoc['ismaster'] == true) { - return new Error("Cannot read from primary when secondary only specified"); - } - - // Return no error - return null; -} - -Server.prototype.checkoutWriter = function(read) { - if(read == true) return this.connectionPool.checkoutConnection(); - // Check if are allowed to do a checkout (if we try to use an arbiter f.ex) - var result = canCheckoutWriter(this, read); - // If the result is null check out a writer - if(result == null) { - return this.connectionPool.checkoutConnection(); - } else { - return result; - } -} - -// Check if a reader can be provided -var canCheckoutReader = function(self) { - // We cannot write to an arbiter or secondary server - if(self.isMasterDoc['arbiterOnly'] == true) { - return new Error("Cannot write to an arbiter"); - } else if(self._readPreference != null) { - // If the read preference is Primary and the instance is not a master return an error - if(self._readPreference == Server.READ_PRIMARY && self.isMasterDoc['ismaster'] != true) { - return new Error("Read preference is " + Server.READ_PRIMARY + " and server is not master"); - } else if(self._readPreference == Server.READ_SECONDARY_ONLY && self.isMasterDoc['ismaster'] == true) { - return new Error("Cannot read from primary when secondary only specified"); - } - } - - // Return no error - return null; -} - -Server.prototype.checkoutReader = function() { - // Check if are allowed to do a checkout (if we try to use an arbiter f.ex) - var result = canCheckoutReader(this); - // If the result is null check out a writer - if(result == null) { - return this.connectionPool.checkoutConnection(); - } else { - return result; - } -} - -Server.prototype.enableRecordQueryStats = function(enable) { - this.recordQueryStats = enable; -} - -// -// Internal statistics object used for calculating average and standard devitation on -// running queries -var RunningStats = function() { - var self = this; - this.m_n = 0; - this.m_oldM = 0.0; - this.m_oldS = 0.0; - this.m_newM = 0.0; - this.m_newS = 0.0; - - // Define getters - Object.defineProperty(this, "numDataValues", { enumerable: true - , get: function () { return this.m_n; } - }); - - Object.defineProperty(this, "mean", { enumerable: true - , get: function () { return (this.m_n > 0) ? this.m_newM : 0.0; } - }); - - Object.defineProperty(this, "variance", { enumerable: true - , get: function () { return ((this.m_n > 1) ? this.m_newS/(this.m_n - 1) : 0.0); } - }); - - Object.defineProperty(this, "standardDeviation", { enumerable: true - , get: function () { return Math.sqrt(this.variance); } - }); - - Object.defineProperty(this, "sScore", { enumerable: true - , get: function () { - var bottom = this.mean + this.standardDeviation; - if(bottom == 0) return 0; - return ((2 * this.mean * this.standardDeviation)/(bottom)); - } - }); -} - -RunningStats.prototype.push = function(x) { - // Update the number of samples - this.m_n = this.m_n + 1; - // See Knuth TAOCP vol 2, 3rd edition, page 232 - if(this.m_n == 1) { - this.m_oldM = this.m_newM = x; - this.m_oldS = 0.0; - } else { - this.m_newM = this.m_oldM + (x - this.m_oldM) / this.m_n; - this.m_newS = this.m_oldS + (x - this.m_oldM) * (x - this.m_newM); - - // set up for next iteration - this.m_oldM = this.m_newM; - this.m_oldS = this.m_newS; - } -} diff --git a/lib/mongodb/connection/simple_emitter.js b/lib/mongodb/connection/simple_emitter.js deleted file mode 100644 index 6782cbc30bc..00000000000 --- a/lib/mongodb/connection/simple_emitter.js +++ /dev/null @@ -1,48 +0,0 @@ -var SimpleEmitter = exports.SimpleEmitter = function() {} -// -// My own simple synchronous emit support, We don't need the overhead of the built in flexible node.js -// event emitter as we are looking for as low latency as possible. -// -SimpleEmitter.prototype.on = function(event, callback) { - if(this.eventHandlers[event] == null) throw "Event handler only accepts values of " + Object.keys(this.eventHandlers); - // Just add callback to our event handler (avoiding the cost of the node.js event handler) - this.eventHandlers[event].push(callback); -} - -SimpleEmitter.prototype.emit = function(event, err, object) { - if(this.eventHandlers[event] == null) throw "Event handler only accepts values of " + Object.keys(this.eventHandlers); - // Fire off all the callbacks - var callbacks = this.eventHandlers[event]; - // Attemp to emit - try { - // Perform a callback on all the registered callback handlers - for(var i = 0; i < callbacks.length; i++) { - callbacks[i](err, object); - } - } catch (err) { - this.emit("error", err); - } -} - -SimpleEmitter.prototype.listeners = function(event) { - return this.eventHandlers[event]; -} - -SimpleEmitter.prototype.overrideListeners = function(event, listeners) { - this.eventHandlers[event] = listeners; -} - -SimpleEmitter.prototype.removeListeners = function(event) { - if(this.eventHandlers[event] == null) throw "Event handler only accepts values of " + Object.keys(this.eventHandlers); - // Throw away all handlers - this.eventHandlers[event] = []; -} - -SimpleEmitter.prototype.removeAllListeners = function() { - // Fetch all the keys of handlers - var keys = Object.keys(this.eventHandlers); - // Remove all handlers - for(var i = 0; i < keys.length; i++) { - this.eventHandlers[keys[i]] = []; - } -} diff --git a/lib/mongodb/connection/strategies/ping_strategy.js b/lib/mongodb/connection/strategies/ping_strategy.js deleted file mode 100644 index 6bb36cff276..00000000000 --- a/lib/mongodb/connection/strategies/ping_strategy.js +++ /dev/null @@ -1,125 +0,0 @@ -var Server = require("../server").Server; - -// The ping strategy uses pings each server and records the -// elapsed time for the server so it can pick a server based on lowest -// return time for the db command {ping:true} -var PingStrategy = exports.PingStrategy = function(replicaset) { - this.replicaset = replicaset; - this.state = 'disconnected'; - // Class instance - this.Db = require("../../db").Db; -} - -// Starts any needed code -PingStrategy.prototype.start = function(callback) { - this.state = 'connected'; - // Start ping server - this._pingServer(callback); -} - -// Stops and kills any processes running -PingStrategy.prototype.stop = function(callback) { - // Stop the ping process - this.state = 'disconnected'; - // Call the callback - callback(null, null); -} - -PingStrategy.prototype.checkoutSecondary = function() { - // Get all secondary server keys - var keys = Object.keys(this.replicaset._state.secondaries); - // Contains the picked instance - var minimumPingMs = null; - var selectedInstance = null; - // Pick server key by the lowest ping time - for(var i = 0; i < keys.length; i++) { - // Fetch a server - var server = this.replicaset._state.secondaries[keys[i]]; - // If we don't have a ping time use it - if(server.runtimeStats['pingMs'] == null) { - // Set to 0 ms for the start - server.runtimeStats['pingMs'] = 0; - // Pick server - selectedInstance = server; - break; - } else { - // If the next server's ping time is less than the current one choose than one - if(minimumPingMs == null || server.runtimeStats['pingMs'] < minimumPingMs) { - minimumPingMs = server.runtimeStats['pingMs']; - selectedInstance = server; - } - } - } - - // Return the selected instance - return selectedInstance != null ? selectedInstance.checkoutReader() : null; -} - -PingStrategy.prototype._pingServer = function(callback) { - var self = this; - - // Ping server function - var pingFunction = function() { - if(self.state == 'disconnected') return; - var addresses = self.replicaset._state != null && self.replicaset._state.addresses != null ? self.replicaset._state.addresses : null; - // Grab all servers - var serverKeys = Object.keys(addresses); - // Number of server entries - var numberOfEntries = serverKeys.length; - // We got keys - for(var i = 0; i < serverKeys.length; i++) { - // We got a server instance - var server = addresses[serverKeys[i]]; - // Create a new server object, avoid using internal connections as they might - // be in an illegal state - new function(serverInstance) { - var server = new Server(serverInstance.host, serverInstance.port, {poolSize:1, timeout:500}); - var db = new self.Db(self.replicaset.db.databaseName, server); - // Add error listener - db.on("error", function(err) { - // Adjust the number of checks - numberOfEntries = numberOfEntries - 1; - // Close connection - db.close(); - // If we are done with all results coming back trigger ping again - if(numberOfEntries == 0 && self.state == 'connected') { - setTimeout(pingFunction, 1000); - } - }) - - // Open the db instance - db.open(function(err, p_db) { - if(err != null) { - db.close(); - } else { - // Startup time of the command - var startTime = new Date().getTime(); - // Execute ping on this connection - p_db.executeDbCommand({ping:1}, function(err, result) { - // Adjust the number of checks - numberOfEntries = numberOfEntries - 1; - // Get end time of the command - var endTime = new Date().getTime(); - // Store the ping time in the server instance state variable, if there is one - if(serverInstance != null && serverInstance.runtimeStats != null && serverInstance.isConnected()) { - serverInstance.runtimeStats['pingMs'] = (endTime - startTime); - } - - // Close server - p_db.close(); - // If we are done with all results coming back trigger ping again - if(numberOfEntries == 0 && self.state == 'connected') { - setTimeout(pingFunction, 1000); - } - }) - } - }) - }(server); - } - } - - // Start pingFunction - setTimeout(pingFunction, 1000); - // Do the callback - callback(null); -} diff --git a/lib/mongodb/connection/strategies/statistics_strategy.js b/lib/mongodb/connection/strategies/statistics_strategy.js deleted file mode 100644 index 0c8b1c0832f..00000000000 --- a/lib/mongodb/connection/strategies/statistics_strategy.js +++ /dev/null @@ -1,40 +0,0 @@ -// The Statistics strategy uses the measure of each end-start time for each -// query executed against the db to calculate the mean, variance and standard deviation -// and pick the server which the lowest mean and deviation -var StatisticsStrategy = exports.StatisticsStrategy = function(replicaset) { - this.replicaset = replicaset; -} - -// Starts any needed code -StatisticsStrategy.prototype.start = function(callback) { - callback(null, null); -} - -StatisticsStrategy.prototype.stop = function(callback) { - // Remove reference to replicaset - this.replicaset = null; - // Perform callback - callback(null, null); -} - -StatisticsStrategy.prototype.checkoutSecondary = function() { - // Get all secondary server keys - var keys = Object.keys(this.replicaset._state.secondaries); - // Contains the picked instance - var minimumSscore = null; - var selectedInstance = null; - - // Pick server key by the lowest ping time - for(var i = 0; i < keys.length; i++) { - // Fetch a server - var server = this.replicaset._state.secondaries[keys[i]]; - // Pick server by lowest Sscore - if(minimumSscore == null || (server.queryStats.sScore < minimumSscore)) { - minimumSscore = server.queryStats.sScore; - selectedInstance = server; - } - } - - // Return the selected instance - return selectedInstance != null ? selectedInstance.checkoutReader() : null; -} diff --git a/lib/mongodb/cursor.js b/lib/mongodb/cursor.js deleted file mode 100644 index 1674fdb2e4e..00000000000 --- a/lib/mongodb/cursor.js +++ /dev/null @@ -1,704 +0,0 @@ -var QueryCommand = require('./commands/query_command').QueryCommand, - GetMoreCommand = require('./commands/get_more_command').GetMoreCommand, - KillCursorCommand = require('./commands/kill_cursor_command').KillCursorCommand, - Long = require('./bson/long').Long, - CursorStream = require('./cursorstream'), - debug = require('util').debug, - inspect = require('util').inspect, - utils = require('./utils'); - -/** - * Constructor for a cursor object that handles all the operations on query result - * using find. This cursor object is unidirectional and cannot traverse backwards. Clients should not be creating a cursor directly, - * but use find to acquire a cursor. - * - * @class Represents a Cursor. - * @param {Db} db the database object to work with. - * @param {Collection} collection the collection to query. - * @param {Object} selector the query selector. - * @param {Object} fields an object containing what fields to include or exclude from objects returned. - * @param {Number} skip number of documents to skip. - * @param {Number} limit the number of results to return. -1 has a special meaning and is used by Db.eval. A value of 1 will also be treated as if it were -1. - * @param {String|Array|Object} sort the required sorting for the query. - * @param {Object} hint force the query to use a specific index. - * @param {Boolean} explain return the explaination of the query. - * @param {Boolean} snapshot Snapshot mode assures no duplicates are returned. - * @param {Boolean} timeout allow the query to timeout. - * @param {Boolean} tailable allow the cursor to be tailable. - * @param {Number} batchSize the number of the subset of results to request the database to return for every request. This should initially be greater than 1 otherwise the database will automatically close the cursor. The batch size can be set to 1 with cursorInstance.batchSize after performing the initial query to the database. - * @param {Boolean} raw return all query documents as raw buffers (default false). - * @param {Boolean} read specify override of read from source (primary/secondary). - * @param {Boolean} returnKey only return the index key. - * @param {Number} maxScan limit the number of items to scan. - * @param {Number} min set index bounds. - * @param {Number} max set index bounds. - * @param {Boolean} showDiskLoc show disk location of results. - * @param {String} comment you can put a $comment field on a query to make looking in the profiler logs simpler. - */ -function Cursor(db, collection, selector, fields, skip, limit - , sort, hint, explain, snapshot, timeout, tailable, batchSize, slaveOk, raw, read - , returnKey, maxScan, min, max, showDiskLoc, comment) { - this.db = db; - this.collection = collection; - this.selector = selector; - this.fields = fields; - this.skipValue = skip == null ? 0 : skip; - this.limitValue = limit == null ? 0 : limit; - this.sortValue = sort; - this.hint = hint; - this.explainValue = explain; - this.snapshot = snapshot; - this.timeout = timeout == null ? true : timeout; - this.tailable = tailable; - this.batchSizeValue = batchSize == null ? 0 : batchSize; - this.slaveOk = slaveOk == null ? collection.slaveOk : slaveOk; - this.raw = raw == null ? false : raw; - this.read = read == null ? true : read; - this.returnKey = returnKey; - this.maxScan = maxScan; - this.min = min; - this.max = max; - this.showDiskLoc = showDiskLoc; - this.comment = comment; - - this.totalNumberOfRecords = 0; - this.items = []; - this.cursorId = Long.fromInt(0); - - // State variables for the cursor - this.state = Cursor.INIT; - // Keep track of the current query run - this.queryRun = false; - this.getMoreTimer = false; - this.collectionName = (this.db.databaseName ? this.db.databaseName + "." : '') + this.collection.collectionName; -}; - -/** - * Resets this cursor to its initial state. All settings like the query string, - * tailable, batchSizeValue, skipValue and limits are preserved. - * - * @return {Cursor} returns itself with rewind applied. - * @api public - */ -Cursor.prototype.rewind = function() { - var self = this; - - if (self.state != Cursor.INIT) { - if (self.state != Cursor.CLOSED) { - self.close(function() {}); - } - - self.numberOfReturned = 0; - self.totalNumberOfRecords = 0; - self.items = []; - self.cursorId = Long.fromInt(0); - self.state = Cursor.INIT; - self.queryRun = false; - } - - return self; -}; - - -/** - * Returns an array of documents. The caller is responsible for making sure that there - * is enough memory to store the results. Note that the array only contain partial - * results when this cursor had been previouly accessed. In that case, - * cursor.rewind() can be used to reset the cursor. - * - * @param {Function} callback This will be called after executing this method successfully. The first paramter will contain the Error object if an error occured, or null otherwise. The second paramter will contain an array of BSON deserialized objects as a result of the query. - * @return {null} - * @api public - */ -Cursor.prototype.toArray = function(callback) { - var self = this; - - if(!callback) { - throw new Error('callback is mandatory'); - } - - if(this.tailable) { - callback(new Error("Tailable cursor cannot be converted to array"), null); - } else if(this.state != Cursor.CLOSED) { - var items = []; - - this.each(function(err, item) { - if(err != null) return callback(err, null); - - if (item != null) { - items.push(item); - } else { - callback(err, items); - items = null; - self.items = []; - } - }); - } else { - callback(new Error("Cursor is closed"), null); - } -}; - -/** - * Iterates over all the documents for this cursor. As with **{cursor.toArray}**, - * not all of the elements will be iterated if this cursor had been previouly accessed. - * In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike - * **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements - * at any given time if batch size is specified. Otherwise, the caller is responsible - * for making sure that the entire result can fit the memory. - * - * @param {Function} callback this will be called for while iterating every document of the query result. The first paramter will contain the Error object if an error occured, or null otherwise. While the second paramter will contain the document. - * @return {null} - * @api public - */ -Cursor.prototype.each = function(callback) { - var self = this; - - if (!callback) { - throw new Error('callback is mandatory'); - } - - if(this.state != Cursor.CLOSED) { - //FIX: stack overflow (on deep callback) (cred: https://github.com/limp/node-mongodb-native/commit/27da7e4b2af02035847f262b29837a94bbbf6ce2) - process.nextTick(function(){ - // Fetch the next object until there is no more objects - self.nextObject(function(err, item) { - if(err != null) return callback(err, null); - - if(item != null) { - callback(null, item); - self.each(callback); - } else { - // Close the cursor if done - self.state = Cursor.CLOSED; - callback(err, null); - } - - item = null; - }); - }); - } else { - callback(new Error("Cursor is closed"), null); - } -}; - -/** - * Determines how many result the query for this cursor will return - * - * @param {Function} callback this will be after executing this method. The first paramter will contain the Error object if an error occured, or null otherwise. While the second paramter will contain the number of results or null if an error occured. - * @return {null} - * @api public - */ -Cursor.prototype.count = function(callback) { - this.collection.count(this.selector, callback); -}; - -/** - * Sets the sort parameter of this cursor to the given value. - * - * This method has the following method signatures: - * (keyOrList, callback) - * (keyOrList, direction, callback) - * - * @param {String|Array|Object} keyOrList This can be a string or an array. If passed as a string, the string will be the field to sort. If passed an array, each element will represent a field to be sorted and should be an array that contains the format [string, direction]. - * @param {String|Number} direction this determines how the results are sorted. "asc", "ascending" or 1 for asceding order while "desc", "desceding or -1 for descending order. Note that the strings are case insensitive. - * @param {Function} callback this will be called after executing this method. The first parameter will contain an error object when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution. - * @return {Cursor} an instance of this object. - * @api public - */ -Cursor.prototype.sort = function(keyOrList, direction, callback) { - callback = callback || function(){}; - if(typeof direction === "function") { callback = direction; direction = null; } - - if(this.tailable) { - callback(new Error("Tailable cursor doesn't support sorting"), null); - } else if(this.queryRun == true || this.state == Cursor.CLOSED) { - callback(new Error("Cursor is closed"), null); - } else { - var order = keyOrList; - - if(direction != null) { - order = [[keyOrList, direction]]; - } - - this.sortValue = order; - callback(null, this); - } - return this; -}; - -/** - * Sets the limit parameter of this cursor to the given value. - * - * @param {Number} limit the new limit. - * @param {Function} callback this will be called after executing this method. The first parameter will contain an error object when the limit given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution. - * @return {Cursor} an instance of this object. - * @api public - */ -Cursor.prototype.limit = function(limit, callback) { - callback = callback || function(){}; - - if(this.tailable) { - callback(new Error("Tailable cursor doesn't support limit"), null); - } else if(this.queryRun == true || this.state == Cursor.CLOSED) { - callback(new Error("Cursor is closed"), null); - } else { - if(limit != null && limit.constructor != Number) { - callback(new Error("limit requires an integer"), null); - } else { - this.limitValue = limit; - callback(null, this); - } - } - - return this; -}; - -/** - * Sets the skip parameter of this cursor to the given value. - * - * @param {Number} skip the new skip value. - * @param {Function} callback this will be called after executing this method. The first parameter will contain an error object when the skip value given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution. - * @return {Cursor} an instance of this object. - * @api public - */ -Cursor.prototype.skip = function(skip, callback) { - callback = callback || function(){}; - - if(this.tailable) { - callback(new Error("Tailable cursor doesn't support skip"), null); - } else if(this.queryRun == true || this.state == Cursor.CLOSED) { - callback(new Error("Cursor is closed"), null); - } else { - if(skip != null && skip.constructor != Number) { - callback(new Error("skip requires an integer"), null); - } else { - this.skipValue = skip; - callback(null, this); - } - } - - return this; -}; - -/** - * Sets the batch size parameter of this cursor to the given value. - * - * @param {Number} batchSize the new batch size. - * @param {Function} callback this will be called after executing this method. The first parameter will contain an error object when the batchSize given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution. - * @return {Cursor} an instance of this object. - * @api public - */ -Cursor.prototype.batchSize = function(batchSize, callback) { - if(this.state == Cursor.CLOSED) { - if(callback != null) { - return callback(new Error("Cursor is closed"), null); - } else { - throw new Error("Cursor is closed"); - } - } else if(batchSize != null && batchSize.constructor != Number) { - if(callback != null) { - return callback(new Error("batchSize requires an integer"), null); - } else { - throw new Error("batchSize requires an integer"); - } - } else { - this.batchSizeValue = batchSize; - if(callback != null) return callback(null, this); - } - - return this; -}; - -/** - * The limit used for the getMore command - * - * @return {Number} The number of records to request per batch. - * @ignore - * @api private - */ -var limitRequest = function(self) { - var requestedLimit = self.limitValue; - - if(self.limitValue > 0) { - if (self.batchSizeValue > 0) { - requestedLimit = self.limitValue < self.batchSizeValue ? - self.limitValue : self.batchSizeValue; - } - } else { - requestedLimit = self.batchSizeValue; - } - - return requestedLimit; -}; - - -/** - * Generates a QueryCommand object using the parameters of this cursor. - * - * @return {QueryCommand} The command object - * @ignore - * @api private - */ -var generateQueryCommand = function(self) { - // Unpack the options - var queryOptions = QueryCommand.OPTS_NONE; - if(!self.timeout) { - queryOptions |= QueryCommand.OPTS_NO_CURSOR_TIMEOUT; - } - - if(self.tailable != null) { - queryOptions |= QueryCommand.OPTS_TAILABLE_CURSOR; - self.skipValue = self.limitValue = 0; - } - - if(self.slaveOk) { - queryOptions |= QueryCommand.OPTS_SLAVE; - } - - // limitValue of -1 is a special case used by Db#eval - var numberToReturn = self.limitValue == -1 ? -1 : limitRequest(self); - - // Check if we need a special selector - if(self.sortValue != null || self.explainValue != null || self.hint != null || self.snapshot != null - || self.returnKey != null || self.maxScan != null || self.min != null || self.max != null - || self.showDiskLoc != null || self.comment != null) { - - // Build special selector - var specialSelector = {'query':self.selector}; - if(self.sortValue != null) specialSelector['orderby'] = utils.formattedOrderClause(self.sortValue); - if(self.hint != null && self.hint.constructor == Object) specialSelector['$hint'] = self.hint; - if(self.explainValue != null) specialSelector['$explain'] = true; - if(self.snapshot != null) specialSelector['$snapshot'] = true; - if(self.returnKey != null) specialSelector['$returnKey'] = self.returnKey; - if(self.maxScan != null) specialSelector['$maxScan'] = self.maxScan; - if(self.min != null) specialSelector['$min'] = self.min; - if(self.max != null) specialSelector['$max'] = self.max; - if(self.showDiskLoc != null) specialSelector['$showDiskLoc'] = self.showDiskLoc; - if(self.comment != null) specialSelector['$comment'] = self.comment; - - // Return the query - return new QueryCommand(self.db, self.collectionName, queryOptions, self.skipValue, numberToReturn, specialSelector, self.fields); - } else { - return new QueryCommand(self.db, self.collectionName, queryOptions, self.skipValue, numberToReturn, self.selector, self.fields); - } -}; - -/** - * @return {Object} Returns an object containing the sort value of this cursor with - * the proper formatting that can be used internally in this cursor. - * @ignore - * @api private - */ -Cursor.prototype.formattedOrderClause = function() { - return utils.formattedOrderClause(this.sortValue); -}; - -/** - * Converts the value of the sort direction into its equivalent numerical value. - * - * @param sortDirection {String|number} Range of acceptable values: - * 'ascending', 'descending', 'asc', 'desc', 1, -1 - * - * @return {number} The equivalent numerical value - * @throws Error if the given sortDirection is invalid - * @ignore - * @api private - */ -Cursor.prototype.formatSortValue = function(sortDirection) { - return utils.formatSortValue(sortDirection); -}; - -/** - * Gets the next document from the cursor. - * - * @param {Function} callback this will be called after executing this method. The first parameter will contain an error object on error while the second parameter will contain a document from the returned result or null if there are no more results. - * @api public - */ -Cursor.prototype.nextObject = function(callback) { - var self = this; - - if(self.state == Cursor.INIT) { - var cmd; - try { - cmd = generateQueryCommand(self); - } catch (err) { - return callback(err, null); - } - - var commandHandler = function(err, result) { - if(err != null && result == null) return callback(err, null); - - if(!err && result.documents[0] && result.documents[0]['$err']) { - return self.close(function() {callback(result.documents[0]['$err'], null);}); - } - - self.queryRun = true; - self.state = Cursor.OPEN; // Adjust the state of the cursor - self.cursorId = result.cursorId; - self.totalNumberOfRecords = result.numberReturned; - - // Add the new documents to the list of items - self.items = self.items.concat(result.documents); - self.nextObject(callback); - result = null; - }; - - self.db._executeQueryCommand(cmd, {read:self.read, raw:self.raw}, commandHandler); - commandHandler = null; - } else if(self.items.length) { - callback(null, self.items.shift()); - } else if(self.cursorId.greaterThan(Long.fromInt(0))) { - getMore(self, callback); - } else { - // Force cursor to stay open - return self.close(function() {callback(null, null);}); - } -} - -/** - * Gets more results from the database if any. - * - * @param {Function} callback this will be called after executing this method. The first parameter will contain an error object on error while the second parameter will contain a document from the returned result or null if there are no more results. - * @ignore - * @api private - */ -var getMore = function(self, callback) { - var limit = 0; - - if (!self.tailable && self.limitValue > 0) { - limit = self.limitValue - self.totalNumberOfRecords; - if (limit < 1) { - self.close(function() {callback(null, null);}); - return; - } - } - try { - var getMoreCommand = new GetMoreCommand(self.db, self.collectionName, limitRequest(self), self.cursorId); - // Execute the command - self.db._executeQueryCommand(getMoreCommand, {read:self.read, raw:self.raw}, function(err, result) { - try { - if(err != null) callback(err, null); - - self.cursorId = result.cursorId; - self.totalNumberOfRecords += result.numberReturned; - // Determine if there's more documents to fetch - if(result.numberReturned > 0) { - if (self.limitValue > 0) { - var excessResult = self.totalNumberOfRecords - self.limitValue; - - if (excessResult > 0) { - result.documents.splice(-1 * excessResult, excessResult); - } - } - - self.items = self.items.concat(result.documents); - callback(null, self.items.shift()); - } else if(self.tailable) { - self.getMoreTimer = setTimeout(function() {getMore(self, callback);}, 500); - } else { - self.close(function() {callback(null, null);}); - } - - result = null; - } catch(err) { - callback(err, null); - } - }); - - getMoreCommand = null; - } catch(err) { - var handleClose = function() { - callback(err, null); - }; - - self.close(handleClose); - handleClose = null; - } -} - -/** - * Gets a detailed information about how the query is performed on this cursor and how - * long it took the database to process it. - * - * @param {Function} callback this will be called after executing this method. The first parameter will always be null while the second parameter will be an object containing the details. - * @api public - */ -Cursor.prototype.explain = function(callback) { - var limit = (-1)*Math.abs(this.limitValue); - // Create a new cursor and fetch the plan - var cursor = new Cursor(this.db, this.collection, this.selector, this.fields, this.skipValue, limit, - this.sortValue, this.hint, true, this.snapshot, this.timeout, this.tailable, this.batchSizeValue); - // Fetch the explaination document - cursor.nextObject(function(err, item) { - if(err != null) return callback(err, null); - // close the cursor - cursor.close(function(err, result) { - if(err != null) return callback(err, null); - callback(null, item); - }); - }); -}; - -/** - * Returns a stream object that can be used to listen to and stream records - * (**Use the CursorStream object instead as this is deprected**) - * - * Options - * - **fetchSize** {Number} the number of records to fetch in each batch (steam specific batchSize). - * - * Events - * - **data** {function(item) {}} the data event triggers when a document is ready. - * - **error** {function(err) {}} the error event triggers if an error happens. - * - **end** {function() {}} the end event triggers when there is no more documents available. - * - * @param {Object} [options] additional options for streamRecords. - * @return {EventEmitter} returns a stream object. - * @api public - */ -Cursor.prototype.streamRecords = function(options) { - var args = Array.prototype.slice.call(arguments, 0); - options = args.length ? args.shift() : {}; - - var - self = this, - stream = new process.EventEmitter(), - recordLimitValue = this.limitValue || 0, - emittedRecordCount = 0, - queryCommand = generateQueryCommand(self); - - // see http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol - queryCommand.numberToReturn = options.fetchSize ? options.fetchSize : 500; - // Execute the query - execute(queryCommand); - - function execute(command) { - self.db._executeQueryCommand(command, {read:self.read, raw:self.raw}, function(err,result) { - if(err) { - stream.emit('error', err); - self.close(function(){}); - return; - } - - if (!self.queryRun && result) { - self.queryRun = true; - self.cursorId = result.cursorId; - self.state = Cursor.OPEN; - self.getMoreCommand = new GetMoreCommand(self.db, self.collectionName, queryCommand.numberToReturn, result.cursorId); - } - - var resflagsMap = { - CursorNotFound:1<<0, - QueryFailure:1<<1, - ShardConfigStale:1<<2, - AwaitCapable:1<<3 - }; - - if(result.documents && result.documents.length && !(result.responseFlag & resflagsMap.QueryFailure)) { - try { - result.documents.forEach(function(doc){ - if(recordLimitValue && emittedRecordCount>=recordLimitValue) { - throw("done"); - } - emittedRecordCount++; - stream.emit('data', doc); - }); - } catch(err) { - if (err != "done") { throw err; } - else { - self.close(function(){ - stream.emit('end', recordLimitValue); - }); - self.close(function(){}); - return; - } - } - // rinse & repeat - execute(self.getMoreCommand); - } else { - self.close(function(){ - stream.emit('end', recordLimitValue); - }); - } - }); - } - - return stream; -}; - -/** - * Returns a Node ReadStream interface for this cursor. - * - * @return {CursorStream} returns a stream object. - * @api public - */ -Cursor.prototype.stream = function stream () { - return new CursorStream(this); -} - -/** - * Close the cursor. - * - * @param {Function} callback this will be called after executing this method. The first parameter will always contain null while the second parameter will contain a reference to this cursor. - * @return {null} - * @api public - */ -Cursor.prototype.close = function(callback) { - var self = this - this.getMoreTimer && clearTimeout(this.getMoreTimer); - // Close the cursor if not needed - if(this.cursorId instanceof Long && this.cursorId.greaterThan(Long.fromInt(0))) { - try { - var command = new KillCursorCommand(this.db, [this.cursorId]); - this.db._executeQueryCommand(command, {read:self.read, raw:self.raw}, null); - } catch(err) {} - } - - // Reset cursor id - this.cursorId = Long.fromInt(0); - // Set to closed status - this.state = Cursor.CLOSED; - - if(callback) { - callback(null, self); - self.items = []; - } - - return this; -}; - -/** - * Check if the cursor is closed or open. - * - * @return {Boolean} returns the state of the cursor. - * @api public - */ -Cursor.prototype.isClosed = function() { - return this.state == Cursor.CLOSED ? true : false; -}; - -/** - * Init state - * - * @classconstant INIT - **/ -Cursor.INIT = 0; - -/** - * Cursor open - * - * @classconstant OPEN - **/ -Cursor.OPEN = 1; - -/** - * Cursor closed - * - * @classconstant CLOSED - **/ -Cursor.CLOSED = 2; - -/** - * @ignore - * @api private - */ -exports.Cursor = Cursor; diff --git a/lib/mongodb/cursorstream.js b/lib/mongodb/cursorstream.js deleted file mode 100644 index cb3d2ff60d7..00000000000 --- a/lib/mongodb/cursorstream.js +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Module dependecies. - */ -var Stream = require('stream').Stream; - -/** - * CursorStream - * - * Returns a stream interface for the **cursor**. - * - * Events - * - **data** {function(item) {}} the data event triggers when a document is ready. - * - **error** {function(err) {}} the error event triggers if an error happens. - * - **end** {function() {}} the end event triggers when there is no more documents available. - * - * @class Represents a CursorStream. - * @param {Cursor} cursor a cursor object that the stream wraps. - * @return {Stream} - */ -function CursorStream(cursor) { - Stream.call(this); - - this.readable = true; - this.paused = false; - this._cursor = cursor; - this._destroyed = null; - - // give time to hook up events - var self = this; - process.nextTick(function () { - self._init(); - }); -} - -/** - * Inherit from Stream - * @ignore - * @api private - */ -CursorStream.prototype.__proto__ = Stream.prototype; - -/** - * Flag stating whether or not this stream is readable. - */ -CursorStream.prototype.readable; - -/** - * Flag stating whether or not this stream is paused. - */ -CursorStream.prototype.paused; - -/** - * Initialize the cursor. - * @ignore - * @api private - */ -CursorStream.prototype._init = function () { - if (this._destroyed) return; - this._next(); -} - -/** - * Pull the next document from the cursor. - * @ignore - * @api private - */ -CursorStream.prototype._next = function () { - if (this.paused || this._destroyed) return; - - var self = this; - - // nextTick is necessary to avoid stack overflows when - // dealing with large result sets. - process.nextTick(function () { - self._cursor.nextObject(function (err, doc) { - self._onNextObject(err, doc); - }); - }); -} - -/** - * Handle each document as its returned from the cursor. - * @ignore - * @api private - */ -CursorStream.prototype._onNextObject = function (err, doc) { - if (err) return this.destroy(err); - - // when doc is null we hit the end of the cursor - if (!doc) return this.destroy(); - - this.emit('data', doc); - this._next(); -} - -/** - * Pauses the stream. - * - * @api public - */ -CursorStream.prototype.pause = function () { - this.paused = true; -} - -/** - * Resumes the stream. - * - * @api public - */ -CursorStream.prototype.resume = function () { - this.paused = false; - this._next(); -} - -/** - * Destroys the stream, closing the underlying - * cursor. No more events will be emitted. - * - * @api public - */ -CursorStream.prototype.destroy = function (err) { - if (this._destroyed) return; - this._destroyed = true; - this.readable = false; - - this._cursor.close(); - - if (err) { - this.emit('error', err); - } - - this.emit('close'); -} - -// TODO - maybe implement the raw option to pass binary? -//CursorStream.prototype.setEncoding = function () { -//} - -module.exports = exports = CursorStream; diff --git a/lib/mongodb/db.js b/lib/mongodb/db.js deleted file mode 100644 index ec6a5d82f22..00000000000 --- a/lib/mongodb/db.js +++ /dev/null @@ -1,1694 +0,0 @@ -/** - * Module dependencies. - * @ignore - */ -var QueryCommand = require('./commands/query_command').QueryCommand, - DbCommand = require('./commands/db_command').DbCommand, - BinaryParser = require('./bson/binary_parser').BinaryParser, - MongoReply = require('./responses/mongo_reply').MongoReply, - Admin = require('./admin').Admin, - Collection = require('./collection').Collection, - Server = require('./connection/server').Server, - ReplSetServers = require('./connection/repl_set_servers').ReplSetServers, - Cursor = require('./cursor').Cursor, - EventEmitter = require('events').EventEmitter, - inherits = require('util').inherits, - crypto = require('crypto'), - debug = require('util').debug, - inspect = require('util').inspect, - b = require('./bson/bson'); - -/** - * Internal class for callback storage - * @ignore - */ -var CallbackStore = function() { - // Make class an event emitter - EventEmitter.call(this); - // Add a info about call variable - this._notReplied = {}; -} - -/** - * @ignore - */ -inherits(CallbackStore, EventEmitter); - -/** - * Create a new Db instance. - * - * Options - * - **strict** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, execute insert with a getLastError command returning the result of the insert command. - * - **native_parser** {Boolean, default:false}, use c++ bson parser. - * - **forceServerObjectId** {Boolean, default:false}, force server to create _id fields instead of client. - * - **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. - * - **slaveOk** {Boolean, default:false}, allow reads from secondaries. - * - **serializeFunctions** {Boolean, default:false}, serialize functions. - * - **raw** {Boolean, default:false}, peform operations using raw bson buffers. - * - **recordQueryStats** {Boolean, default:false}, record query statistics during execution. - * - **reaper** {Boolean, default:false}, enables the reaper, timing out calls that never return. - * - **reaperInterval** {Number, default:10000}, number of miliseconds between reaper wakups. - * - **reaperTimeout** {Number, default:30000}, the amount of time before a callback times out. - * - **retryMiliSeconds** {Number, default:5000}, number of miliseconds between retries. - * - **numberOfRetries** {Number, default:5}, number of retries off connection. - * - * @class Represents a Collection - * @param {String} databaseName name of the database. - * @param {Object} serverConfig server config object. - * @param {Object} [options] additional options for the collection. - */ -function Db(databaseName, serverConfig, options) { - EventEmitter.call(this); - this.databaseName = databaseName; - this.serverConfig = serverConfig; - this.options = options == null ? {} : options; - // State to check against if the user force closed db - this._applicationClosed = false; - // Fetch the override flag if any - var overrideUsedFlag = this.options['override_used_flag'] == null ? false : this.options['override_used_flag']; - // Verify that nobody is using this config - if(!overrideUsedFlag && typeof this.serverConfig == 'object' && this.serverConfig._isUsed()) { - throw new Error("A Server or ReplSetServers instance cannot be shared across multiple Db instances"); - } else if(!overrideUsedFlag && typeof this.serverConfig == 'object'){ - // Set being used - this.serverConfig._used = true; - } - - // Ensure we have a valid db name - validateDatabaseName(databaseName); - - // Contains all the connections for the db - try { - this.native_parser = this.options.native_parser; - // The bson lib - var bsonLib = this.options.native_parser ? require('../../external-libs/bson') : new require('./bson/bson'); - // Fetch the serializer object - var BSON = bsonLib.BSON; - // Create a new instance - this.bson = new BSON([b.Long, b.ObjectID, b.Binary, b.Code, b.DBRef, b.Symbol, b.Double, b.Timestamp, b.MaxKey, b.MinKey]); - // Backward compatibility to access types - this.bson_deserializer = bsonLib; - this.bson_serializer = bsonLib; - } catch (err) { - // If we tried to instantiate the native driver - throw "Native bson parser not compiled, please compile or avoid using native_parser=true"; - } - - // Internal state of the server - this._state = 'disconnected'; - - this.pkFactory = this.options.pk == null ? b.ObjectID : this.options.pk; - this.forceServerObjectId = this.options.forceServerObjectId != null ? this.options.forceServerObjectId : false; - // Added strict - this.strict = this.options.strict == null ? false : this.options.strict; - this.notReplied ={}; - this.isInitializing = true; - this.auths = []; - - // Command queue, keeps a list of incoming commands that need to be executed once the connection is up - this.commands = []; - - // Contains all the callbacks - this._callBackStore = new CallbackStore(); - - // Set up logger - this.logger = this.options.logger != null - && (typeof this.options.logger.debug == 'function') - && (typeof this.options.logger.error == 'function') - && (typeof this.options.logger.log == 'function') - ? this.options.logger : {error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}}; - // Allow slaveOk - this.slaveOk = this.options["slave_ok"] == null ? false : this.options["slave_ok"]; - - var self = this; - // Associate the logger with the server config - this.serverConfig.logger = this.logger; - this.tag = new Date().getTime(); - // Just keeps list of events we allow - this.eventHandlers = {error:[], parseError:[], poolReady:[], message:[], close:[]}; - - // Controls serialization options - this.serializeFunctions = this.options.serializeFunctions != null ? this.options.serializeFunctions : false; - - // Raw mode - this.raw = this.options.raw != null ? this.options.raw : false; - - // Record query stats - this.recordQueryStats = this.options.recordQueryStats != null ? this.options.recordQueryStats : false; - - // If we have server stats let's make sure the driver objects have it enabled - if(this.recordQueryStats == true) { - this.serverConfig.enableRecordQueryStats(true); - } - - // Reaper enable setting - this.reaperEnabled = this.options.reaper != null ? this.options.reaper : false; - this._lastReaperTimestamp = new Date().getTime(); - - // Retry information - this.retryMiliSeconds = this.options.retryMiliSeconds != null ? this.options.retryMiliSeconds : 5000; - this.numberOfRetries = this.options.numberOfRetries != null ? this.options.numberOfRetries : 5; - - // Reaper information - this.reaperInterval = this.options.reaperInterval != null ? this.options.reaperInterval : 10000; - this.reaperTimeout = this.options.reaperTimeout != null ? this.options.reaperTimeout : 30000; - - // get self - var self = this; - // State of the db connection - Object.defineProperty(this, "state", { enumerable: true - , get: function () { - return this.serverConfig._serverState; - } - }); -}; - -/** - * The reaper cleans up any callbacks that have not returned inside the space set by - * the parameter reaperTimeout, it will only attempt to reap if the time since last reap - * is bigger or equal to the reaperInterval value - * @ignore - */ -var reaper = function(dbInstance, reaperInterval, reaperTimeout) { - // Get current time, compare to reaper interval - var currentTime = new Date().getTime(); - // Now calculate current time difference to check if it's time to reap - if((currentTime - dbInstance._lastReaperTimestamp) >= reaperInterval) { - // Save current timestamp for next reaper iteration - dbInstance._lastReaperTimestamp = currentTime; - // Get all non-replied to messages - var keys = Object.keys(dbInstance._callBackStore._notReplied); - // Iterate over all callbacks - for(var i = 0; i < keys.length; i++) { - // Fetch the current key - var key = keys[i]; - // Get info element - var info = dbInstance._callBackStore._notReplied[key]; - // If it's timed out let's remove the callback and return an error - if((currentTime - info.start) > reaperTimeout) { - // Cleanup - delete dbInstance._callBackStore._notReplied[key]; - // Perform callback in next Tick - process.nextTick(function() { - dbInstance._callBackStore.emit(key, new Error("operation timed out"), null); - }); - } - } - // Return reaping was done - return true; - } else { - // No reaping done - return false; - } -} - -/** - * @ignore - */ -function validateDatabaseName(databaseName) { - if(typeof databaseName !== 'string') throw new Error("database name must be a string"); - if(databaseName.length === 0) throw new Error("database name cannot be the empty string"); - - var invalidChars = [" ", ".", "$", "/", "\\"]; - for(var i = 0; i < invalidChars.length; i++) { - if(databaseName.indexOf(invalidChars[i]) != -1) throw new Error("database names cannot contain the character '" + invalidChars[i] + "'"); - } -} - -/** - * @ignore - */ -inherits(Db, EventEmitter); - -/** - * Initialize the database connection. - * - * @param {Function} callback returns index information. - * @return {null} - * @api public - */ -Db.prototype.open = function(callback) { - var self = this; - - // Set the status of the server - self._state = 'connecting'; - // Set up connections - if(self.serverConfig instanceof Server || self.serverConfig instanceof ReplSetServers) { - self.serverConfig.connect(self, {firstCall: true}, function(err, result) { - if(err != null) { - // Return error from connection - return callback(err, null); - } - // Set the status of the server - self._state = 'connected'; - // Callback - return callback(null, self); - }); - } else { - return callback(Error("Server parameter must be of type Server or ReplSetServers"), null); - } -}; - -/** - * Create a new Db instance sharing the current socket connections. - * - * @param {String} dbName the name of the database we want to use. - * @return {Db} a db instance using the new database. - * @api public - */ -Db.prototype.db = function(dbName) { - // Copy the options and add out internal override of the not shared flag - var options = {}; - for(var key in this.options) { - options[key] = this.options[key]; - } - // Add override flag - options['override_used_flag'] = true; - // Create a new db instance - var newDbInstance = new Db(dbName, this.serverConfig, options); - // Add the instance to the list of approved db instances - var allServerInstances = this.serverConfig.allServerInstances(); - // Add ourselves to all server callback instances - for(var i = 0; i < allServerInstances.length; i++) { - var server = allServerInstances[i]; - server.dbInstances.push(newDbInstance); - } - // Return new db object - return newDbInstance; -} - -/** - * Close the current db connection, including all the child db instances. Emits close event if no callback is provided. - * - * @param {Boolean} [forceClose] connection can never be reused. - * @param {Function} [callback] returns the results. - * @return {null} - * @api public - */ -Db.prototype.close = function(forceClose, callback) { - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - // Ensure we force close all connections - this._applicationClosed = args.length ? args.shift() : false; - // Remove all listeners and close the connection - this.serverConfig.close(callback); - // Emit the close event - if(typeof callback !== 'function') this.emit("close"); - - // Emit close event across all db instances sharing the sockets - var allServerInstances = this.serverConfig.allServerInstances(); - // Fetch the first server instance - if(Array.isArray(allServerInstances) && allServerInstances.length > 0) { - var server = allServerInstances[0]; - // For all db instances signal all db instances - if(Array.isArray(server.dbInstances) && server.dbInstances.length > 1) { - for(var i = 0; i < server.dbInstances.length; i++) { - var dbInstance = server.dbInstances[i]; - // Check if it's our current db instance and skip if it is - if(dbInstance.databaseName !== this.databaseName && dbInstance.tag !== this.tag) { - server.dbInstances[i].emit("close"); - } - } - } - } - - // Remove all listeners - this.removeAllEventListeners(); -}; - -/** - * Access the Admin database - * - * @param {Function} [callback] returns the results. - * @return {Admin} the admin db object. - * @api public - */ -Db.prototype.admin = function(callback) { - if(callback == null) return new Admin(this); - callback(null, new Admin(this)); -}; - -/** - * Returns a cursor to all the collection information. - * - * @param {String} [collectionName] the collection name we wish to retrieve the information from. - * @param {Function} callback returns option results. - * @return {null} - * @api public - */ -Db.prototype.collectionsInfo = function(collectionName, callback) { - if(callback == null && typeof collectionName == 'function') { callback = collectionName; collectionName = null; } - // Create selector - var selector = {}; - // If we are limiting the access to a specific collection name - if(collectionName != null) selector.name = this.databaseName + "." + collectionName; - - // Return Cursor - // callback for backward compatibility - if(callback) { - callback(null, new Cursor(this, new Collection(this, DbCommand.SYSTEM_NAMESPACE_COLLECTION), selector)); - } else { - return new Cursor(this, new Collection(this, DbCommand.SYSTEM_NAMESPACE_COLLECTION), selector); - } -}; - -/** - * Get the list of all collection names for the specified db - * - * @param {String} [collectionName] the collection name we wish to filter by. - * @param {Function} callback returns option results. - * @return {null} - * @api public - */ -Db.prototype.collectionNames = function(collectionName, callback) { - if(callback == null && typeof collectionName == 'function') { callback = collectionName; collectionName = null; } - var self = this; - // Let's make our own callback to reuse the existing collections info method - self.collectionsInfo(collectionName, function(err, cursor) { - if(err != null) return callback(err, null); - - cursor.toArray(function(err, documents) { - if(err != null) return callback(err, null); - - // List of result documents that have been filtered - var filtered_documents = []; - // Remove any collections that are not part of the db or a system db signed with $ - documents.forEach(function(document) { - if(!(document.name.indexOf(self.databaseName) == -1 || document.name.indexOf('$') != -1)) - filtered_documents.push(document); - }); - // Return filtered items - callback(null, filtered_documents); - }); - }); -}; - -/** - * Fetch a specific collection (containing the actual collection information) - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - **slaveOk** {Boolean, default:false}, Allow reads from secondaries. - * - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. - * - **raw** {Boolean, default:false}, perform all operations using raw bson objects. - * - **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. - * - * @param {String} collectionName the collection name we wish to access. - * @param {Object} [options] returns option results. - * @param {Function} [callback] returns the results. - * @return {null} - * @api public - */ -Db.prototype.collection = function(collectionName, options, callback) { - var self = this; - if(typeof options === "function") { callback = options; options = {}; } - // Execute safe - if(options && options.safe || this.strict) { - self.collectionNames(collectionName, function(err, collections) { - if(err != null) return callback(err, null); - - if(collections.length == 0) { - return callback(new Error("Collection " + collectionName + " does not exist. Currently in strict mode."), null); - } else { - try { - var collection = new Collection(self, collectionName, self.pkFactory, options); - } catch(err) { - return callback(err, null); - } - return callback(null, collection); - } - }); - } else { - try { - var collection = new Collection(self, collectionName, self.pkFactory, options); - } catch(err) { - if(callback == null) { - throw err; - } else { - return callback(err, null); - } - } - - // If we have no callback return collection object - return callback == null ? collection : callback(null, collection); - } -}; - -/** - * Fetch all collections for the current db. - * - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.collections = function(callback) { - var self = this; - // Let's get the collection names - self.collectionNames(function(err, documents) { - if(err != null) return callback(err, null); - var collections = []; - documents.forEach(function(document) { - collections.push(new Collection(self, document.name.replace(self.databaseName + ".", ''), self.pkFactory)); - }); - // Return the collection objects - callback(null, collections); - }); -}; - -/** - * Evaluate javascript on the server - * - * Options - * - **nolock** {Boolean, default:false}, Tell MongoDB not to block on the evaulation of the javascript. - * - * @param {Code} code javascript to execute on server. - * @param {Object|Array} [parameters] the parameters for the call. - * @param {Object} [options] the options - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.eval = function(code, parameters, options, callback) { - // Unpack calls - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - parameters = args.length ? args.shift() : parameters; - options = args.length ? args.shift() : {}; - - var finalCode = code; - var finalParameters = []; - // If not a code object translate to one - if(!(finalCode instanceof b.Code)) { - finalCode = new b.Code(finalCode); - } - - // Ensure the parameters are correct - if(parameters != null && parameters.constructor != Array && typeof parameters !== 'function') { - finalParameters = [parameters]; - } else if(parameters != null && parameters.constructor == Array && typeof parameters !== 'function') { - finalParameters = parameters; - } - // Create execution selector - var selector = {'$eval':finalCode, 'args':finalParameters}; - // Check if the nolock parameter is passed in - if(options['nolock']) { - selector['nolock'] = options['nolock']; - } - - // Iterate through all the fields of the index - new Cursor(this, new Collection(this, DbCommand.SYSTEM_COMMAND_COLLECTION), selector, options, 0, -1).nextObject(function(err, result) { - if(err != null) return callback(err, null); - - if(result.ok == 1) { - callback(null, result.retval); - } else { - callback(new Error("eval failed: " + result.errmsg), null); return; - } - }); -}; - -/** - * Dereference a dbref, against a db - * - * @param {DBRef} dbRef db reference object we wish to resolve. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.dereference = function(dbRef, callback) { - var db = this; - // If we have a db reference then let's get the db first - if(dbRef.db != null) db = this.db(dbRef.db); - // Fetch the collection and find the reference - db.collection(dbRef.namespace, function(err, collection) { - if(err != null) return callback(err, null); - - collection.findOne({'_id':dbRef.oid}, function(err, result) { - callback(err, result); - }); - }); -}; - -/** - * Logout user from server, fire off on all connections and remove all auth info - * - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.logout = function(callback) { - var self = this; - // Let's generate the logout command object - var logoutCommand = DbCommand.logoutCommand(self, {logout:1}); - self._executeQueryCommand(logoutCommand, {onAll:true}, function(err, result) { - // Reset auth - self.auths = []; - // Handle any errors - if(err == null && result.documents[0].ok == 1) { - callback(null, true); - } else { - err != null ? callback(err, false) : callback(new Error(result.documents[0].errmsg), false); - } - }); -} - -/** - * Authenticate a user against the server. - * - * @param {String} username username. - * @param {String} password password. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.authenticate = function(username, password, callback) { - var self = this; - - // Push the new auth if we have no previous record - self.auths = [{'username':username, 'password':password}]; - // Get the amount of connections in the pool to ensure we have authenticated all comments - var numberOfConnections = this.serverConfig.allRawConnections().length; - var errorObject = null; - - // Execute all four - this._executeQueryCommand(DbCommand.createGetNonceCommand(self), {onAll:true}, function(err, result, connection) { - // Execute on all the connections - if(err == null) { - // Nonce used to make authentication request with md5 hash - var nonce = result.documents[0].nonce; - // Execute command - self._executeQueryCommand(DbCommand.createAuthenticationCommand(self, username, password, nonce), {connection:connection}, function(err, result) { - // Ensure we save any error - if(err) { - errorObject = err; - } else if(result.documents[0].err != null || result.documents[0].errmsg != null){ - errorObject = self.wrap(result.documents[0]); - } - - // Count down - numberOfConnections = numberOfConnections - 1; - - // If we are done with the callbacks return - if(numberOfConnections <= 0) { - if(errorObject == null && result.documents[0].ok == 1) { - callback(errorObject, true); - } else { - callback(errorObject, false); - } - } - }); - } - }); -}; - -/** - * Add a user to the database. - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - * @param {String} username username. - * @param {String} password password. - * @param {Object} [options] additional options during update. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.addUser = function(username, password, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - // Figure out the safe mode settings - var safe = self.strict != null && self.strict == false ? true : self.strict; - // Override with options passed in if applicable - safe = options != null && options['safe'] != null ? options['safe'] : safe; - // Ensure it's at least set to safe - safe = safe == null ? true : safe; - - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - var userPassword = md5.digest('hex'); - // Fetch a user collection - this.collection(DbCommand.SYSTEM_USER_COLLECTION, function(err, collection) { - collection.find({user: username}).toArray(function(err, documents) { - // We got an error (f.ex not authorized) - if(err != null) return callback(err, null); - // We have a user, let's update the password - if(documents.length > 0) { - collection.update({user: username},{user: username, pwd: userPassword}, {safe:safe}, function(err, results) { - callback(err, documents); - }); - } else { - collection.insert({user: username, pwd: userPassword}, {safe:safe}, function(err, documents) { - callback(err, documents); - }); - } - }); - }); -}; - -/** - * Remove a user from a database - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - * @param {String} username username. - * @param {Object} [options] additional options during update. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.removeUser = function(username, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - // Figure out the safe mode settings - var safe = self.strict != null && self.strict == false ? true : self.strict; - // Override with options passed in if applicable - safe = options != null && options['safe'] != null ? options['safe'] : safe; - // Ensure it's at least set to safe - safe = safe == null ? true : safe; - - // Fetch a user collection - this.collection(DbCommand.SYSTEM_USER_COLLECTION, function(err, collection) { - collection.findOne({user: username}, function(err, user) { - if(user != null) { - collection.remove({user: username}, {safe:safe}, function(err, result) { - callback(err, true); - }); - } else { - callback(err, false); - } - }); - }); -}; - -/** - * Creates a collection on a server pre-allocating space, need to create f.ex capped collections. - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - **slaveOk** {Boolean, default:false}, Allow reads from secondaries. - * - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. - * - **raw** {Boolean, default:false}, perform all operations using raw bson objects. - * - **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. - * - **capped** {Boolean, default:false}, create a capped collection. - * - **size** {Number}, the size of the capped collection in bytes. - * - **max** {Number}, the maximum number of documents in the capped collection. - * - **autoIndexId** {Boolean, default:false}, create an index on the _id field of the document, not created automatically on capped collections. - * - * @param {String} collectionName the collection name we wish to access. - * @param {Object} [options] returns option results. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.createCollection = function(collectionName, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : null; - var self = this; - - // Figure out the safe mode settings - var safe = self.strict != null && self.strict == false ? true : self.strict; - // Override with options passed in if applicable - safe = options != null && options['safe'] != null ? options['safe'] : safe; - // Ensure it's at least set to safe - safe = safe == null ? true : safe; - - // Check if we have the name - this.collectionNames(collectionName, function(err, collections) { - if(err != null) return callback(err, null); - - var found = false; - collections.forEach(function(collection) { - if(collection.name == self.databaseName + "." + collectionName) found = true; - }); - - // If the collection exists either throw an exception (if db in strict mode) or return the existing collection - if(found && ((options && options.safe) || self.strict)) { - return callback(new Error("Collection " + collectionName + " already exists. Currently in strict mode."), null); - } else if(found){ - try { - var collection = new Collection(self, collectionName, self.pkFactory, options); - } catch(err) { - return callback(err, null); - } - return callback(null, collection); - } - - // Create a new collection and return it - self._executeQueryCommand(DbCommand.createCreateCollectionCommand(self, collectionName, options), {read:false, safe:safe}, function(err, result) { - var document = result.documents[0]; - // If we have no error let's return the collection - if(err == null && document.ok == 1) { - try { - var collection = new Collection(self, collectionName, self.pkFactory, options); - } catch(err) { - return callback(err, null); - } - return callback(null, collection); - } else { - err != null ? callback(err, null) : callback(self.wrap(document), null); - } - }); - }); -}; - -/** - * Execute a command hash against MongoDB. This lets you acess any commands not available through the api on the server. - * - * @param {Object} selector the command hash to send to the server, ex: {ping:1}. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.command = function(selector, callback) { - var cursor = new Cursor(this, new Collection(this, DbCommand.SYSTEM_COMMAND_COLLECTION), selector, {}, 0, -1, null, null, null, null, QueryCommand.OPTS_NO_CURSOR_TIMEOUT); - cursor.nextObject(callback); -}; - -/** - * Drop a collection from the database, removing it permanently. New accesses will create a new collection. - * - * @param {String} collectionName the name of the collection we wish to drop. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.dropCollection = function(collectionName, callback) { - var self = this; - - // Drop the collection - this._executeQueryCommand(DbCommand.createDropCollectionCommand(this, collectionName), function(err, result) { - if(err == null && result.documents[0].ok == 1) { - if(callback != null) return callback(null, true); - } else { - if(callback != null) err != null ? callback(err, null) : callback(self.wrap(result.documents[0]), null); - } - }); -}; - -/** - * Rename a collection. - * - * @param {String} fromCollection the name of the current collection we wish to rename. - * @param {String} toCollection the new name of the collection. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.renameCollection = function(fromCollection, toCollection, callback) { - var self = this; - - // Execute the command, return the new renamed collection if successful - this._executeQueryCommand(DbCommand.createRenameCollectionCommand(this, fromCollection, toCollection), function(err, result) { - if(err == null && result.documents[0].ok == 1) { - if(callback != null) return callback(null, new Collection(self, toCollection, self.pkFactory)); - } else { - if(callback != null) err != null ? callback(err, null) : callback(self.wrap(result.documents[0]), null); - } - }); -}; - -/** - * Return last error message for the given connection, note options can be combined. - * - * Options - * - **fsync** {Boolean, default:false}, option forces the database to fsync all files before returning. - * - **j** {Boolean, default:false}, awaits the journal commit before returning, > MongoDB 2.0. - * - **w** {Number}, until a write operation has been replicated to N servers. - * - **wtimeout** {Number}, number of miliseconds to wait before timing out. - * - * Connection Options - * - **connection** {Connection}, fire the getLastError down a specific connection. - * - * @param {Object} [options] returns option results. - * @param {Object} [connectionOptions] returns option results. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.lastError = function(options, connectionOptions, callback) { - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - options = args.length ? args.shift() : {}; - connectionOptions = args.length ? args.shift() : {}; - - this._executeQueryCommand(DbCommand.createGetLastErrorCommand(options, this), connectionOptions, function(err, error) { - callback(err, error && error.documents); - }); -}; - -/** - * Legacy method calls. - * - * @ignore - * @api private - */ -Db.prototype.error = Db.prototype.lastError; -Db.prototype.lastStatus = Db.prototype.lastError; - -/** - * Return all errors up to the last time db reset_error_history was called. - * - * Options - * - **connection** {Connection}, fire the getLastError down a specific connection. - * - * @param {Object} [options] returns option results. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.previousErrors = function(options, callback) { - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - this._executeQueryCommand(DbCommand.createGetPreviousErrorsCommand(this), options, function(err, error) { - callback(err, error.documents); - }); -}; - -/** - * Runs a command on the database. - * @ignore - * @api private - */ -Db.prototype.executeDbCommand = function(command_hash, options, callback) { - if(callback == null) { callback = options; options = {}; } - this._executeQueryCommand(DbCommand.createDbSlaveOkCommand(this, command_hash, options), options, callback); -}; - -/** - * Runs a command on the database as admin. - * @ignore - * @api private - */ -Db.prototype.executeDbAdminCommand = function(command_hash, options, callback) { - if(callback == null) { callback = options; options = {}; } - this._executeQueryCommand(DbCommand.createAdminDbCommand(this, command_hash, options), callback); -}; - -/** - * Resets the error history of the mongo instance. - * - * Options - * - **connection** {Connection}, fire the getLastError down a specific connection. - * - * @param {Object} [options] returns option results. - * @param {Function} callback returns the results. - * @return {null} - * @api public - */ -Db.prototype.resetErrorHistory = function(options, callback) { - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - this._executeQueryCommand(DbCommand.createResetErrorHistoryCommand(this), options, function(err, error) { - callback(err, error.documents); - }); -}; - -/** - * Creates an index on the collection. - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - * - **unique** {Boolean, default:false}, creates an unique index. - * - **sparse** {Boolean, default:false}, creates a sparse index. - * - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. - * - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. - * - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. - * - * @param {String} collectionName name of the collection to create the index on. - * @param {Object} fieldOrSpec fieldOrSpec that defines the index. - * @param {Object} [options] additional options during update. - * @param {Function} callback for results. - * @return {null} - * @api public - */ -Db.prototype.createIndex = function(collectionName, fieldOrSpec, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - // Figure out the safe mode settings - var safe = self.strict != null && self.strict == false ? true : self.strict; - // Override with options passed in if applicable - safe = options != null && options['safe'] != null ? options['safe'] : safe; - // Ensure it's at least set to safe - safe = safe == null ? true : safe; - - // Create command - var command = DbCommand.createCreateIndexCommand(this, collectionName, fieldOrSpec, options); - // Execute insert command - this._executeInsertCommand(command, {read:false, safe:safe}, function(err, result) { - if(err != null) return callback(err, null); - - result = result && result.documents; - if (result[0].err) { - callback(self.wrap(result[0])); - } else { - callback(null, command.documents[0].name); - } - }); -}; - -/** - * Ensures that an index exists, if it does not it creates it - * - * Options - * - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a - * - **unique** {Boolean, default:false}, creates an unique index. - * - **sparse** {Boolean, default:false}, creates a sparse index. - * - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. - * - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. - * - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. - * - **v** {Number}, specify the format version of the indexes. - * - * @param {String} collectionName name of the collection to create the index on. - * @param {Object} fieldOrSpec fieldOrSpec that defines the index. - * @param {Object} [options] additional options during update. - * @param {Function} callback for results. - * @return {null} - * @api public - */ -Db.prototype.ensureIndex = function(collectionName, fieldOrSpec, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - // Figure out the safe mode settings - var safe = self.strict != null && self.strict == false ? true : self.strict; - // Override with options passed in if applicable - safe = options != null && options['safe'] != null ? options['safe'] : safe; - // Ensure it's at least set to safe - safe = safe == null ? true : safe; - - // Create command - var command = DbCommand.createCreateIndexCommand(this, collectionName, fieldOrSpec, options); - var index_name = command.documents[0].name; - var self = this; - // Check if the index allready exists - this.indexInformation(collectionName, function(err, collectionInfo) { - if(err != null) return callback(err, null); - - if(!collectionInfo[index_name]) { - self._executeInsertCommand(command, {read:false, safe:safe}, function(err, result) { - // Only callback if we have one specified - if(typeof callback === 'function') { - if(err != null) return callback(err, null); - - result = result && result.documents; - if (result[0].err) { - callback(self.wrap(result[0])); - } else { - callback(null, command.documents[0].name); - } - } - }); - } else { - if(typeof callback === 'function') return callback(null, index_name); - } - }); -}; - -/** - * Returns the information available on allocated cursors. - * - * @param {Function} callback for results. - * @return {null} - * @api public - */ -Db.prototype.cursorInfo = function(callback) { - this._executeQueryCommand(DbCommand.createDbSlaveOkCommand(this, {'cursorInfo':1}), function(err, result) { - callback(err, result.documents[0]); - }); -}; - -/** - * Drop an index on a collection. - * - * @param {String} collectionName the name of the collection where the command will drop an index. - * @param {String} indexName name of the index to drop. - * @param {Function} callback for results. - * @return {null} - * @api public - */ -Db.prototype.dropIndex = function(collectionName, indexName, callback) { - this._executeQueryCommand(DbCommand.createDropIndexCommand(this, collectionName, indexName), callback); -}; - -/** - * Reindex all indexes on the collection - * Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections. - * - * @param {String} collectionName the name of the collection. - * @param {Function} callback returns the results. - * @api public -**/ -Db.prototype.reIndex = function(collectionName, callback) { - this._executeQueryCommand(DbCommand.createReIndexCommand(this, collectionName), function(err, result) { - if(err != null) { - callback(err, false); - } else if(result.documents[0].errmsg == null) { - callback(null, true); - } else { - callback(new Error(result.documents[0].errmsg), false); - } - }); -}; - -/** - * Retrieves this collections index info. - * - * Options - * - **full** {Boolean, default:false}, returns the full raw index information. - * - * @param {String} collectionName the name of the collection. - * @param {Object} [options] additional options during update. - * @param {Function} callback returns the index information. - * @return {null} - * @api public - */ -Db.prototype.indexInformation = function(collectionName, options, callback) { - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - collectionName = args.length ? args.shift() : null; - options = args.length ? args.shift() : {}; - - // If we specified full information - var full = options['full'] == null ? false : options['full']; - // Build selector for the indexes - var selector = collectionName != null ? {ns: (this.databaseName + "." + collectionName)} : {}; - // Iterate through all the fields of the index - new Cursor(this, new Collection(this, DbCommand.SYSTEM_INDEX_COLLECTION), selector).toArray(function(err, indexes) { - if(err != null) return callback(err, null); - // Contains all the information - var info = {}; - - // if full defined just return all the indexes directly - if(full) return callback(null, indexes); - - // Process all the indexes - for(var i = 0; i < indexes.length; i++) { - var index = indexes[i]; - // Let's unpack the object - info[index.name] = []; - for(var name in index.key) { - info[index.name].push([name, index.key[name]]); - } - } - - // Return all the indexes - callback(null, info); - }); -}; - -/** - * Drop a database. - * - * @param {Function} callback returns the index information. - * @return {null} - * @api public - */ -Db.prototype.dropDatabase = function(callback) { - this._executeQueryCommand(DbCommand.createDropDatabaseCommand(this), function(err, result) { - callback(err, result); - }); -}; - -/** - * Register a handler - * @ignore - * @api private - */ -Db.prototype._registerHandler = function(db_command, raw, connection, callback) { - // If we have an array of commands, chain them - var chained = Array.isArray(db_command); - - // If they are chained we need to add a special handler situation - if(chained) { - // List off chained id's - var chainedIds = []; - // Add all id's - for(var i = 0; i < db_command.length; i++) chainedIds.push(db_command[i].getRequestId().toString()); - - // Register all the commands together - for(var i = 0; i < db_command.length; i++) { - var command = db_command[i]; - // Add the callback to the store - this._callBackStore.once(command.getRequestId(), callback); - // Add the information about the reply - this._callBackStore._notReplied[command.getRequestId().toString()] = {start: new Date().getTime(), 'raw': raw, chained:chainedIds, connection:connection}; - } - } else { - // Add the callback to the list of handlers - this._callBackStore.once(db_command.getRequestId(), callback); - // Add the information about the reply - this._callBackStore._notReplied[db_command.getRequestId().toString()] = {start: new Date().getTime(), 'raw': raw, connection:connection}; - } -} - -/** - * - * @ignore - * @api private - */ -Db.prototype._callHandler = function(id, document, err) { - // If there is a callback peform it - if(this._callBackStore.listeners(id).length >= 1) { - // Get info object - var info = this._callBackStore._notReplied[id]; - // Delete the current object - delete this._callBackStore._notReplied[id]; - // Emit to the callback of the object - this._callBackStore.emit(id, err, document, info.connection); - } -} - -/** - * - * @ignore - * @api private - */ -Db.prototype._hasHandler = function(id) { - // If there is a callback peform it - return this._callBackStore.listeners(id).length >= 1; -} - -/** - * - * @ignore - * @api private - */ -Db.prototype._removeHandler = function(id) { - // Remove the information - if(this._callBackStore._notReplied[id] != null) delete this._callBackStore._notReplied[id]; - // Remove the callback if it's registered - this._callBackStore.removeAllListeners(id); - // Force cleanup _events, node.js seems to set it as a null value - if(this._callBackStore._events != null) delete this._callBackStore._events[id]; -} - -/** - * - * @ignore - * @api private - */ -Db.prototype._findHandler = function(id) { - var info = this._callBackStore._notReplied[id]; - // Return the callback - return {info:info, callback:(this._callBackStore.listeners(id).length >= 1)} -} - -/** - * @ignore - */ -var __executeQueryCommand = function(self, db_command, options, callback) { - // Options unpacking - var read = options['read'] != null ? options['read'] : false; - var raw = options['raw'] != null ? options['raw'] : self.raw; - var onAll = options['onAll'] != null ? options['onAll'] : false; - var specifiedConnection = options['connection'] != null ? options['connection'] : null; - - // If we got a callback object - if(callback instanceof Function && !onAll) { - // Fetch either a reader or writer dependent on the specified read option - var connection = read == true || read === 'secondary' ? self.serverConfig.checkoutReader() : self.serverConfig.checkoutWriter(true); - // Override connection if needed - connection = specifiedConnection != null ? specifiedConnection : connection; - // Ensure we have a valid connection - if(connection == null) { - return callback(new Error("no open connections")); - } else if(connection instanceof Error) { - return callback(connection); - } - - // Perform reaping of any dead connection - if(self.reaperEnabled) reaper(self, self.reaperInterval, self.reaperTimeout); - - // Register the handler in the data structure - self._registerHandler(db_command, raw, connection, callback); - - // Write the message out and handle any errors if there are any - connection.write(db_command, function(err) { - if(err != null) { - // Call the handler with an error - self._callHandler(db_command.getRequestId(), null, err); - } - }); - } else if(callback instanceof Function && onAll) { - var connections = self.serverConfig.allRawConnections(); - var numberOfEntries = connections.length; - // Go through all the connections - for(var i = 0; i < connections.length; i++) { - // Fetch a connection - var connection = connections[i]; - // Override connection if needed - connection = specifiedConnection != null ? specifiedConnection : connection; - // Ensure we have a valid connection - if(connection == null) { - return callback(new Error("no open connections")); - } else if(connection instanceof Error) { - return callback(connection); - } - - // Register the handler in the data structure - self._registerHandler(db_command, raw, connection, callback); - - // Write the message out - connection.write(db_command, function(err) { - // Adjust the number of entries we need to process - numberOfEntries = numberOfEntries - 1; - // Remove listener - if(err != null) { - // Clean up listener and return error - self._removeHandler(db_command.getRequestId()); - } - - // No more entries to process callback with the error - if(numberOfEntries <= 0) { - callback(err); - } - }); - - // Update the db_command request id - db_command.updateRequestId(); - } - } else { - // Fetch either a reader or writer dependent on the specified read option - var connection = read == true || read === 'secondary' ? self.serverConfig.checkoutReader() : self.serverConfig.checkoutWriter(); - // Override connection if needed - connection = specifiedConnection != null ? specifiedConnection : connection; - // Ensure we have a valid connection - if(connection == null || connection instanceof Error) return null; - // Write the message out - connection.write(db_command, function(err) { - if(err != null) { - // Emit the error - self.emit("error", err); - } - }); - } -} - -/** - * @ignore - */ -var __retryCommandOnFailure = function(self, retryInMilliseconds, numberOfTimes, command, db_command, options, callback) { - if(this._state == 'connected' || this._state == 'disconnected') this._state = 'connecting'; - // Number of retries done - var numberOfRetriesDone = numberOfTimes; - // Retry function, execute once - var retryFunction = function(_self, _numberOfRetriesDone, _retryInMilliseconds, _numberOfTimes, _command, _db_command, _options, _callback) { - _self.serverConfig.connect(_self, {}, function(err, result) { - // Adjust the number of retries left - _numberOfRetriesDone = _numberOfRetriesDone - 1; - // Definitively restart - if(err != null && _numberOfRetriesDone > 0) { - _self._state = 'connecting'; - // Force close the current connections - _self.serverConfig.close(function(err) { - // Retry the connect - setTimeout(function() { - retryFunction(_self, _numberOfRetriesDone, _retryInMilliseconds, _numberOfTimes, _command, _db_command, _options, _callback); - }, _retryInMilliseconds); - }); - } else if(err != null && _numberOfRetriesDone <= 0) { - _self._state = 'disconnected'; - // Force close the current connections - _self.serverConfig.close(function(_err) { - // Force close the current connections - _callback(err, null); - }); - } else if(err == null && _self.serverConfig.isConnected() == true && Array.isArray(_self.auths) && _self.auths.length > 0) { - _self._state = 'connected'; - // Get number of auths we need to execute - var numberOfAuths = _self.auths.length; - // Apply all auths - for(var i = 0; i < _self.auths.length; i++) { - _self.authenticate(_self.auths[i].username, _self.auths[i].password, function(err, authenticated) { - numberOfAuths = numberOfAuths - 1; - - // If we have no more authentications to replay - if(numberOfAuths == 0) { - if(err != null || !authenticated) { - return _callback(err, null); - } else { - // Execute command - command(_self, _db_command, _options, function(err, result) { - // Peform the command callback - _callback(err, result); - // Execute any backed up commands - while(_self.commands.length > 0) { - // Fetch the command - var command = _self.commands.shift(); - // Execute based on type - if(command['type'] == 'query') { - __executeQueryCommand(_self, command['db_command'], command['options'], command['callback']); - } else if(command['type'] == 'insert') { - __executeInsertCommand(_self, command['db_command'], command['options'], command['callback']); - } - } - }); - } - } - }); - } - } else if(err == null && _self.serverConfig.isConnected() == true) { - _self._state = 'connected'; - // Execute command - command(_self, _db_command, _options, function(err, result) { - // Peform the command callback - _callback(err, result); - // Execute any backed up commands - while(_self.commands.length > 0) { - // Fetch the command - var command = _self.commands.shift(); - // Execute based on type - if(command['type'] == 'query') { - __executeQueryCommand(_self, command['db_command'], command['options'], command['callback']); - } else if(command['type'] == 'insert') { - __executeInsertCommand(_self, command['db_command'], command['options'], command['callback']); - } - } - }); - } else { - _self._state = 'connecting'; - // Force close the current connections - _self.serverConfig.close(function(err) { - // Retry the connect - setTimeout(function() { - retryFunction(_self, _numberOfRetriesDone, _retryInMilliseconds, _numberOfTimes, _command, _db_command, _options, _callback); - }, _retryInMilliseconds); - }); - } - }); - }; - - // Execute function first time - retryFunction(self, numberOfRetriesDone, retryInMilliseconds, numberOfTimes, command, db_command, options, callback); -} - -/** - * Execute db query command (not safe) - * @ignore - * @api private - */ -Db.prototype._executeQueryCommand = function(db_command, options, callback) { - var self = this; - // Unpack the parameters - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - // Check if the user force closed the command - if(this._applicationClosed) { - if(typeof callback == 'function') { - return callback(new Error("db closed by application"), null); - } else { - throw new Error("db closed by application"); - } - } - - // If the pool is not connected, attemp to reconnect to send the message - if(this._state == 'connecting' && this.serverConfig.autoReconnect) { - process.nextTick(function() { - self.commands.push({type:'insert', 'db_command':db_command, 'options':options, 'callback':callback}); - }) - } else if(!this.serverConfig.isConnected() && this.serverConfig.autoReconnect) { - this._state = 'connecting'; - // Retry command - __retryCommandOnFailure(this, this.retryMiliSeconds, this.numberOfRetries, __executeQueryCommand, db_command, options, callback); - } else { - __executeQueryCommand(self, db_command, options, callback) - } -}; - -/** - * @ignore - */ -var __executeInsertCommand = function(self, db_command, options, callback) { - // Always checkout a writer for this kind of operations - var connection = self.serverConfig.checkoutWriter(); - // Get strict mode - var safe = options['safe'] != null ? options['safe'] : false; - var raw = options['raw'] != null ? options['raw'] : self.raw; - var specifiedConnection = options['connection'] != null ? options['connection'] : null; - // Override connection if needed - connection = specifiedConnection != null ? specifiedConnection : connection; - - // Ensure we have a valid connection - if(callback instanceof Function) { - // Ensure we have a valid connection - if(connection == null) { - return callback(new Error("no open connections")); - } else if(connection instanceof Error) { - return callback(connection); - } - - // We are expecting a check right after the actual operation - if(safe != null && safe != false) { - // db command is now an array of commands (original command + lastError) - db_command = [db_command, DbCommand.createGetLastErrorCommand(safe, self)]; - - // Register the handler in the data structure - self._registerHandler(db_command[1], raw, connection, callback); - } - } - - // If we have no callback and there is no connection - if(connection == null) return null; - if(connection instanceof Error && typeof callback == 'function') return callback(connection, null); - if(connection instanceof Error) return null; - if(connection == null && typeof callback == 'function') return callback(new Error("no primary server found"), null); - - // Write the message out - connection.write(db_command, function(err) { - // Return the callback if it's not a safe operation and the callback is defined - if(callback instanceof Function && (safe == null || safe == false)) { - // Perform reaping - if(self.reaperEnabled) reaper(self, self.reaperInterval, self.reaperTimeout); - // Perform the callback - callback(err, null); - } else if(callback instanceof Function){ - // Call the handler with an error - self._callHandler(db_command[1].getRequestId(), null, err); - } else { - self.emit("error", err); - } - }); -} - -/** - * Execute an insert Command - * @ignore - * @api private - */ -Db.prototype._executeInsertCommand = function(db_command, options, callback) { - var self = this; - // Unpack the parameters - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - - // Check if the user force closed the command - if(this._applicationClosed) { - if(typeof callback == 'function') { - return callback(new Error("db closed by application"), null); - } else { - throw new Error("db closed by application"); - } - } - - // If the pool is not connected, attemp to reconnect to send the message - if(self._state == 'connecting' && this.serverConfig.autoReconnect) { - process.nextTick(function() { - self.commands.push({type:'insert', 'db_command':db_command, 'options':options, 'callback':callback}); - }) - } else if(!this.serverConfig.isConnected() && this.serverConfig.autoReconnect) { - this._state = 'connecting'; - // Retry command - __retryCommandOnFailure(this, this.retryMiliSeconds, this.numberOfRetries, __executeInsertCommand, db_command, options, callback); - } else { - __executeInsertCommand(self, db_command, options, callback) - } -} - -/** - * Update command is the same - * @ignore - * @api private - */ -Db.prototype._executeUpdateCommand = Db.prototype._executeInsertCommand; -/** - * Remove command is the same - * @ignore - * @api private - */ -Db.prototype._executeRemoveCommand = Db.prototype._executeInsertCommand; - -/** - * Wrap a Mongo error document into an Error instance - * @ignore - * @api private - */ -Db.prototype.wrap = function(error) { - var e = new Error(error.err != null ? error.err : error.errmsg); - e.name = 'MongoError'; - - // Get all object keys - var keys = Object.keys(error); - // Populate error object with properties - for(var i = 0; i < keys.length; i++) { - e[keys[i]] = error[keys[i]]; - } - - return e; -} - -/** - * Default URL - * - * @classconstant DEFAULT_URL - **/ -Db.DEFAULT_URL = 'mongodb://localhost:27017/default'; - -/** - * Connect to MongoDB using a url as documented at - * - * www.mongodb.org/display/DOCS/Connections - * - * @param {String} url connection url for MongoDB. - * @param {Object} options additional options not covered by the url. - * @param {Function} callback callback returns the initialized db. - * @return {null} - * @api public - */ -Db.connect = function(url, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : null; - options = options || {}; - var serverOptions = options.server || {}; - var replSetServersOptions = options.replSetServers || {}; - var dbOptions = options.db || {}; - - var urlRE = new RegExp('^mongo(?:db)?://(?:|([^@/]*)@)([^@/]*)(?:|/([^?]*)(?:|\\?([^?]*)))$'); - var match = (url || Db.DEFAULT_URL).match(urlRE); - if (!match) - throw Error("URL must be in the format mongodb://user:pass@host:port/dbname"); - - var authPart = match[1] || ''; - var auth = authPart.split(':', 2); - var hostPart = match[2]; - var dbname = match[3] || 'default'; - var urlOptions = (match[4] || '').split(/[&;]/); - - // Ugh, we have to figure out which options go to which constructor manually. - urlOptions.forEach(function(opt) { - if (!opt) return; - var splitOpt = opt.split('='), name = splitOpt[0], value = splitOpt[1]; - - // Server options: - if (name == 'slaveOk' || name == 'slave_ok') - serverOptions.slave_ok = (value == 'true'); - if (name == 'poolSize') - serverOptions.poolSize = Number(value); - if (name == 'autoReconnect' || name == 'auto_reconnect') - serverOptions.auto_reconnect = (value == 'true'); - if (name == 'ssl' || name == 'ssl') - serverOptions.ssl = (value == 'true'); - - // ReplSetServers options: - if (name == 'replicaSet' || name == 'rs_name') - replSetServersOptions.rs_name = value; - if (name == 'reconnectWait') - replSetServersOptions.reconnectWait = Number(value); - if (name == 'retries') - replSetServersOptions.retries = Number(value); - if (name == 'readSecondary' || name == 'read_secondary') - replSetServersOptions.read_secondary = (value == 'true'); - - // DB options: - if (name == 'safe') - dbOptions.safe = (value == 'true'); - // Not supported by Db: safe, w, wtimeoutMS, fsync, journal, connectTimeoutMS, socketTimeoutMS - if (name == 'nativeParser' || name == 'native_parser') - dbOptions.native_parser = (value == 'true'); - if (name == 'strict') - dbOptions.strict = (value == 'true'); - }); - - var servers = hostPart.split(',').map(function(h) { - var hostPort = h.split(':', 2); - return new Server(hostPort[0] || 'localhost', hostPort[1] != null ? parseInt(hostPort[1]) : 27017, serverOptions); - }); - - var server; - if (servers.length == 1) { - server = servers[0]; - } else { - server = new ReplSetServers(servers, replSetServersOptions); - } - - var db = new Db(dbname, server, dbOptions); - if (options.noOpen) - return db; - - db.open(function(err, db){ - if(err == null && authPart){ - db.authenticate(auth[0], auth[1], function(err, success){ - if(success){ - callback(null, db); - } else { - callback(err ? err : new Error('Could not authenticate user ' + auth[0]), db); - } - }); - } else { - callback(err, db); - } - }); -} - -/** - * Legacy support - * - * @ignore - * @api private - */ -exports.connect = Db.connect; -exports.Db = Db; - -/** - * Remove all listeners to the db instance. - * @ignore - * @api private - */ -Db.prototype.removeAllEventListeners = function() { - this.removeAllListeners("close"); - this.removeAllListeners("error"); - this.removeAllListeners("timeout"); - this.removeAllListeners("parseError"); - this.removeAllListeners("poolReady"); - this.removeAllListeners("message"); -} diff --git a/lib/mongodb/gridfs/chunk.js b/lib/mongodb/gridfs/chunk.js deleted file mode 100644 index 92c50180015..00000000000 --- a/lib/mongodb/gridfs/chunk.js +++ /dev/null @@ -1,210 +0,0 @@ -var BinaryParser = require('../bson/binary_parser').BinaryParser, - Binary = require('../bson/binary').Binary, - ObjectID = require('../bson/objectid').ObjectID, - sys = require('util'), - debug = require('util').debug, - inspect = require('util').inspect; - -/** - * Class for representing a single chunk in GridFS. - * - * @class - * - * @param file {GridStore} The {@link GridStore} object holding this chunk. - * @param mongoObject {object} The mongo object representation of this chunk. - * - * @throws Error when the type of data field for {@link mongoObject} is not - * supported. Currently supported types for data field are instances of - * {@link String}, {@link Array}, {@link Binary} and {@link Binary} - * from the bson module - * - * @see Chunk#buildMongoObject - */ -var Chunk = exports.Chunk = function(file, mongoObject) { - this.file = file; - var self = this; - var mongoObjectFinal = mongoObject == null ? {} : mongoObject; - - this.objectId = mongoObjectFinal._id == null ? new ObjectID() : mongoObjectFinal._id; - this.chunkNumber = mongoObjectFinal.n == null ? 0 : mongoObjectFinal.n; - this.data = new Binary(); - - if(mongoObjectFinal.data == null) { - } else if(mongoObjectFinal.data.constructor == String) { - var buffer = new Buffer(mongoObjectFinal.data.length); - buffer.write(mongoObjectFinal.data, 'binary', 0); - this.data = new Binary(buffer); - } else if(mongoObjectFinal.data.constructor == Array) { - var buffer = new Buffer(mongoObjectFinal.data.length); - buffer.write(mongoObjectFinal.data.join(''), 'binary', 0); - this.data = new Binary(buffer); - } else if(mongoObjectFinal.data instanceof Binary || Object.prototype.toString.call(mongoObjectFinal.data) == "[object Binary]") { - this.data = mongoObjectFinal.data; - } else if(mongoObjectFinal.data instanceof Buffer) { - } else { - throw Error("Illegal chunk format"); - } - // Update position - this.internalPosition = 0; - - /** - * The position of the read/write head - * @name position - * @lends Chunk# - * @field - */ - Object.defineProperty(this, "position", { enumerable: true - , get: function () { - return this.internalPosition; - } - , set: function(value) { - this.internalPosition = value; - } - }); -}; - -/** - * Writes a data to this object and advance the read/write head. - * - * @param data {string} the data to write - * @param callback {function(*, GridStore)} This will be called after executing - * this method. The first parameter will contain null and the second one - * will contain a reference to this object. - */ -Chunk.prototype.write = function(data, callback) { - this.data.write(data, this.internalPosition); - this.internalPosition = this.data.length(); - callback(null, this); -}; - -/** - * Reads data and advances the read/write head. - * - * @param length {number} The length of data to read. - * - * @return {string} The data read if the given length will not exceed the end of - * the chunk. Returns an empty String otherwise. - */ -Chunk.prototype.read = function(length) { - // Default to full read if no index defined - length = length == null || length == 0 ? this.length() : length; - - if(this.length() - this.internalPosition + 1 >= length) { - var data = this.data.read(this.internalPosition, length); - this.internalPosition = this.internalPosition + length; - return data; - } else { - return ''; - } -}; - -Chunk.prototype.readSlice = function(length) { - if ((this.length() - this.internalPosition + 1) >= length) { - var data = null; - if (this.data.buffer != null) { //Pure BSON - data = this.data.buffer.slice(this.internalPosition, this.internalPosition + length); - } else { //Native BSON - data = new Buffer(length); - length = this.data.readInto(data, this.internalPosition); - } - this.internalPosition = this.internalPosition + length; - return data; - } else { - return null; - } -}; - -/** - * Checks if the read/write head is at the end. - * - * @return {boolean} Whether the read/write head has reached the end of this - * chunk. - */ -Chunk.prototype.eof = function() { - return this.internalPosition == this.length() ? true : false; -}; - -/** - * Reads one character from the data of this chunk and advances the read/write - * head. - * - * @return {string} a single character data read if the the read/write head is - * not at the end of the chunk. Returns an empty String otherwise. - */ -Chunk.prototype.getc = function() { - return this.read(1); -}; - -/** - * Clears the contents of the data in this chunk and resets the read/write head - * to the initial position. - */ -Chunk.prototype.rewind = function() { - this.internalPosition = 0; - this.data = new Binary(); -}; - -/** - * Saves this chunk to the database. Also overwrites existing entries having the - * same id as this chunk. - * - * @param callback {function(*, GridStore)} This will be called after executing - * this method. The first parameter will contain null and the second one - * will contain a reference to this object. - */ -Chunk.prototype.save = function(callback) { - var self = this; - - self.file.chunkCollection(function(err, collection) { - collection.remove({'_id':self.objectId}, {safe:true}, function(err, result) { - if(self.data.length() > 0) { - self.buildMongoObject(function(mongoObject) { - collection.insert(mongoObject, {safe:true}, function(err, collection) { - callback(null, self); - }); - }); - } else { - callback(null, self); - } - }); - }); -}; - -/** - * Creates a mongoDB object representation of this chunk. - * - * @param callback {function(Object)} This will be called after executing this - * method. The object will be passed to the first parameter and will have - * the structure: - * - *
        
        - *        {
        - *          '_id' : , // {number} id for this chunk
        - *          'files_id' : , // {number} foreign key to the file collection
        - *          'n' : , // {number} chunk number
        - *          'data' : , // {bson#Binary} the chunk data itself
        - *        }
        - *        
        - * - * @see MongoDB GridFS Chunk Object Structure - */ -Chunk.prototype.buildMongoObject = function(callback) { - var mongoObject = {'_id': this.objectId, - 'files_id': this.file.fileId, - 'n': this.chunkNumber, - 'data': this.data}; - callback(mongoObject); -}; - -/** - * @return {number} the length of the data - */ -Chunk.prototype.length = function() { - return this.data.length(); -}; - -/** - * The default chunk size - * @constant - */ -Chunk.DEFAULT_CHUNK_SIZE = 1024 * 256; diff --git a/lib/mongodb/gridfs/grid.js b/lib/mongodb/gridfs/grid.js deleted file mode 100644 index 114aa6e5c17..00000000000 --- a/lib/mongodb/gridfs/grid.js +++ /dev/null @@ -1,95 +0,0 @@ -var GridStore = require('./gridstore').GridStore, - ObjectID = require('../bson/objectid').ObjectID; - -/** - * A class representation of a simple Grid interface. - * - * @class Represents the Grid. - * @param {Db} db A database instance to interact with. - * @param {String} [fsName] optional different root collection for GridFS. - * @return {Grid} - */ -function Grid(db, fsName) { - this.db = db; - this.fsName = fsName == null ? GridStore.DEFAULT_ROOT_COLLECTION : fsName; -} - -/** - * Puts binary data to the grid - * - * @param {Buffer} data buffer with Binary Data. - * @param {Object} [options] the options for the files. - * @callback {Function} this will be called after this method is executed. The first parameter will contain an Error object if an error occured or null otherwise. The second parameter will contain a reference to this object. - * @return {null} - * @api public - */ -Grid.prototype.put = function(data, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - options = args.length ? args.shift() : {}; - // If root is not defined add our default one - options['root'] = options['root'] == null ? this.fsName : options['root']; - - // Return if we don't have a buffer object as data - if(!(data instanceof Buffer)) return callback(new Error("Data object must be a buffer object"), null); - // Get filename if we are using it - var filename = options['filename']; - // Create gridstore - var gridStore = new GridStore(this.db, filename, "w", options); - gridStore.open(function(err, gridStore) { - if(err) return callback(err, null); - - gridStore.write(data, function(err, result) { - if(err) return callback(err, null); - - gridStore.close(function(err, result) { - if(err) return callback(err, null); - callback(null, result); - }) - }) - }) -} - -/** - * Get binary data to the grid - * - * @param {ObjectID} id ObjectID for file. - * @callback {Function} this will be called after this method is executed. The first parameter will contain an Error object if an error occured or null otherwise. The second parameter will contain a reference to this object. - * @return {null} - * @api public - */ -Grid.prototype.get = function(id, callback) { - // Validate that we have a valid ObjectId - if(!(id instanceof ObjectID)) return callback(new Error("Not a valid ObjectID", null)); - // Create gridstore - var gridStore = new GridStore(this.db, id, "r", {root:this.fsName}); - gridStore.open(function(err, gridStore) { - if(err) return callback(err, null); - - // Return the data - gridStore.read(function(err, data) { - return callback(err, data) - }); - }) -} - -/** - * Delete file from grid - * - * @param {ObjectID} id ObjectID for file. - * @callback {Function} this will be called after this method is executed. The first parameter will contain an Error object if an error occured or null otherwise. The second parameter will contain a reference to this object. - * @return {null} - * @api public - */ -Grid.prototype.delete = function(id, callback) { - // Validate that we have a valid ObjectId - if(!(id instanceof ObjectID)) return callback(new Error("Not a valid ObjectID", null)); - // Create gridstore - GridStore.unlink(this.db, id, {root:this.fsName}, function(err, result) { - if(err) return callback(err, false); - return callback(null, true); - }); -} - -exports.Grid = Grid; diff --git a/lib/mongodb/gridfs/gridstore.js b/lib/mongodb/gridfs/gridstore.js deleted file mode 100644 index 6a83e79a072..00000000000 --- a/lib/mongodb/gridfs/gridstore.js +++ /dev/null @@ -1,1094 +0,0 @@ -/** - * @fileOverview GridFS is a tool for MongoDB to store files to the database. - * Because of the restrictions of the object size the database can hold, a - * facility to split a file into several chunks is needed. The {@link GridStore} - * class offers a simplified api to interact with files while managing the - * chunks of split files behind the scenes. More information about GridFS can be - * found here. - */ -var BinaryParser = require('../bson/binary_parser').BinaryParser, - Chunk = require('./chunk').Chunk, - DbCommand = require('../commands/db_command').DbCommand, - ObjectID = require('../bson/objectid').ObjectID, - Buffer = require('buffer').Buffer, - fs = require('fs'), - util = require('util'), - debug = require('util').debug, - inspect = require('util').inspect, - ReadStream = require('./readstream').ReadStream; - -var REFERENCE_BY_FILENAME = 0, - REFERENCE_BY_ID = 1; - -/** - * A class representation of a file stored in GridFS. - * - * Modes - * - **"r"** - read only. This is the default mode. - * - **"w"** - write in truncate mode. Existing data will be overwriten. - * - **w+"** - write in edit mode. - * - * Options - * - **root** {String}, root collection to use. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * - **chunk_type** {String}, mime type of the file. Defaults to **{GridStore.DEFAULT_CONTENT_TYPE}**. - * - **chunk_size** {Number}, size for the chunk. Defaults to **{Chunk.DEFAULT_CHUNK_SIZE}**. - * - **metadata** {Object}, arbitrary data the user wants to store. - * - * @class Represents the GridStore. - * @param {Db} db A database instance to interact with. - * @param {String|ObjectID} fileIdObject ObjectID or the name for the file. - * @param {String} mode set the mode for this file. - * @param {Object} options optional properties to specify. Recognized keys: - * @return {GridStore} - */ -function GridStore(db, fileIdObject, mode, options) { - var self = this; - this.db = db; - - // set grid referencetype - this.referenceBy = typeof fileIdObject == 'string' ? 0 : 1; - this.filename = fileIdObject; - this.fileId = fileIdObject; - - // Set up the rest - this.mode = mode == null ? "r" : mode; - this.options = options == null ? {} : options; - this.root = this.options['root'] == null ? exports.GridStore.DEFAULT_ROOT_COLLECTION : this.options['root']; - this.position = 0; - // Set default chunk size - this.internalChunkSize = this.options['chunkSize'] == null ? Chunk.DEFAULT_CHUNK_SIZE : this.options['chunkSize']; - - /** - * Returns the current chunksize of the file. - * - * @field chunkSize - * @type {Number} - * @getter - * @setter - * @property return number of bytes in the current chunkSize. - */ - Object.defineProperty(this, "chunkSize", { enumerable: true - , get: function () { - return this.internalChunkSize; - } - , set: function(value) { - if(!(this.mode[0] == "w" && this.position == 0 && this.uploadDate == null)) { - this.internalChunkSize = this.internalChunkSize; - } else { - this.internalChunkSize = value; - } - } - }); - - /** - * The md5 checksum for this file. - * - * @field md5 - * @type {Number} - * @getter - * @setter - * @property return this files md5 checksum. - */ - Object.defineProperty(this, "md5", { enumerable: true - , get: function () { - return this.internalMd5; - } - }); -}; - -/** - * Opens the file from the database and initialize this object. Also creates a - * new one if file does not exist. - * - * @param {Function} callback this will be called after executing this method. The first parameter will contain an **{Error}** object and the second parameter will be null if an error occured. Otherwise, the first parameter will be null and the second will contain the reference to this object. - * @return {null} - * @api public - */ -GridStore.prototype.open = function(callback) { - if( this.mode != "w" && this.mode != "w+" && this.mode != "r"){ - callback(new Error("Illegal mode " + this.mode), null); - return; - } - - var self = this; - - if((self.mode == "w" || self.mode == "w+") && self.db.serverConfig.primary != null) { - // Get files collection - self.collection(function(err, collection) { - // Ensure index on files Collection - collection.ensureIndex([['filename', 1], ['uploadDate', -1]], function(err, index) { - - // Get chunk collection - self.chunkCollection(function(err, chunkCollection) { - // Ensure index on chunk collection - chunkCollection.ensureIndex([['files_id', 1], ['n', 1]], function(err, index) { - _open(self, callback); - }); - }); - }); - }); - } else { - _open(self, callback); - } -} - -/** - * Hidding the _open function - * @ignore - * @api private - */ -var _open = function(self, callback) { - self.collection(function(err, collection) { - if(err!==null) { - callback(new Error("at collection: "+err), null); - return; - } - - // Create the query - var query = self.referenceBy == REFERENCE_BY_ID ? {_id:self.fileId} : {filename:self.filename}; - query = self.fileId == null && this.filename == null ? null : query; - - // Fetch the chunks - if(query != null) { - collection.find(query, function(err, cursor) { - // Fetch the file - cursor.nextObject(function(err, doc) { - // Chek if the collection for the files exists otherwise prepare the new one - if(doc != null) { - self.fileId = doc._id; - self.contentType = doc.contentType; - self.internalChunkSize = doc.chunkSize; - self.uploadDate = doc.uploadDate; - self.aliases = doc.aliases; - self.length = doc.length; - self.metadata = doc.metadata; - self.internalMd5 = doc.md5; - } else { - self.fileId = self.fileId instanceof ObjectID ? self.fileId : new ObjectID(); - self.contentType = exports.GridStore.DEFAULT_CONTENT_TYPE; - self.internalChunkSize = self.internalChunkSize == null ? Chunk.DEFAULT_CHUNK_SIZE : self.internalChunkSize; - self.length = 0; - } - - // Process the mode of the object - if(self.mode == "r") { - nthChunk(self, 0, function(err, chunk) { - self.currentChunk = chunk; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w") { - // Delete any existing chunks - deleteChunks(self, function(err, result) { - self.currentChunk = new Chunk(self, {'n':0}); - self.contentType = self.options['content_type'] == null ? self.contentType : self.options['content_type']; - self.internalChunkSize = self.options['chunk_size'] == null ? self.internalChunkSize : self.options['chunk_size']; - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w+") { - nthChunk(self, lastChunkNumber(self), function(err, chunk) { - // Set the current chunk - self.currentChunk = chunk == null ? new Chunk(self, {'n':0}) : chunk; - self.currentChunk.position = self.currentChunk.data.length(); - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.position = self.length; - callback(null, self); - }); - } - }); - }); - } else { - // Write only mode - self.fileId = new ObjectID(); - self.contentType = exports.GridStore.DEFAULT_CONTENT_TYPE; - self.internalChunkSize = self.internalChunkSize == null ? Chunk.DEFAULT_CHUNK_SIZE : self.internalChunkSize; - self.length = 0; - - self.chunkCollection(function(err, collection2) { - // No file exists set up write mode - if(self.mode == "w") { - // Delete any existing chunks - deleteChunks(self, function(err, result) { - self.currentChunk = new Chunk(self, {'n':0}); - self.contentType = self.options['content_type'] == null ? self.contentType : self.options['content_type']; - self.internalChunkSize = self.options['chunk_size'] == null ? self.internalChunkSize : self.options['chunk_size']; - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w+") { - nthChunk(self, lastChunkNumber(self), function(err, chunk) { - // Set the current chunk - self.currentChunk = chunk == null ? new Chunk(self, {'n':0}) : chunk; - self.currentChunk.position = self.currentChunk.data.length(); - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.position = self.length; - callback(null, self); - }); - } - }); - }; - }); -}; - -/** - * Stores a file from the file system to the GridFS database. - * - * @param {String|Buffer|FileHandle} file the file to store. - * @param {Function} callback this will be called after this method is executed. The first parameter will be null and the the second will contain the reference to this object. - * @return {null} - * @api public - */ -GridStore.prototype.writeFile = function (file, callback) { - var self = this; - if (typeof file === 'string') { - fs.open(file, 'r', 0666, function (err, fd) { - // TODO Handle err - self.writeFile(fd, callback); - }); - return; - } - - self.open(function (err, self) { - fs.fstat(file, function (err, stats) { - var offset = 0; - var index = 0; - var numberOfChunksLeft = Math.min(stats.size / self.chunkSize); - - // Write a chunk - var writeChunk = function() { - fs.read(file, self.chunkSize, offset, 'binary', function(err, data, bytesRead) { - offset = offset + bytesRead; - // Create a new chunk for the data - var chunk = new Chunk(self, {n:index++}); - chunk.write(data, function(err, chunk) { - chunk.save(function(err, result) { - // Point to current chunk - self.currentChunk = chunk; - - if(offset >= stats.size) { - fs.close(file); - self.close(function(err, result) { - return callback(null, result); - }) - } else { - return process.nextTick(writeChunk); - } - }); - }); - }); - } - - // Process the first write - process.nextTick(writeChunk); - }); - }); -}; - -/** - * Writes some data. This method will work properly only if initialized with mode "w" or "w+". - * - * @param {String|Buffer} data the data to write. - * @param {Boolean} [close] closes this file after writing if set to true. - * @param {Function} callback this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {null} - * @api public - */ -GridStore.prototype.write = function(data, close, callback) { - // If we have a buffer write it using the writeBuffer method - if(Buffer.isBuffer(data)) return writeBuffer(this, data, close, callback); - // Otherwise check for the callback - if(typeof close === "function") { callback = close; close = null; } - var self = this; - var finalClose = close == null ? false : close; - // Otherwise let's write the data - if(self.mode[0] != "w") { - callback(new Error((self.referenceBy == REFERENCE_BY_ID ? self.toHexString() : self.filename) + " not opened for writing"), null); - } else { - if((self.currentChunk.position + data.length) > self.chunkSize) { - var previousChunkNumber = self.currentChunk.chunkNumber; - var leftOverDataSize = self.chunkSize - self.currentChunk.position; - var previousChunkData = data.substr(0, leftOverDataSize); - var leftOverData = data.substr(leftOverDataSize, (data.length - leftOverDataSize)); - // Save out current Chunk as another variable and assign a new Chunk for overflow data - var saveChunk = self.currentChunk; - // Create a new chunk at once (avoid wrong writing of chunks) - self.currentChunk = new Chunk(self, {'n': (previousChunkNumber + 1)}); - - // Let's finish the current chunk and then call write again for the remaining data - saveChunk.write(previousChunkData, function(err, chunk) { - chunk.save(function(err, result) { - self.position = self.position + leftOverDataSize; - // Write the remaining data - self.write(leftOverData, function(err, gridStore) { - if(finalClose) { - self.close(function(err, result) { - callback(null, gridStore); - }); - } else { - callback(null, gridStore); - } - }); - }); - }); - } else { - self.currentChunk.write(data, function(err, chunk) { - self.position = self.position + data.length; - if(finalClose) { - self.close(function(err, result) { - callback(null, self); - }); - } else { - callback(null, self); - } - }); - } - } -}; - -/** - * Writes some data. This method will work properly only if initialized with mode - * "w" or "w+". - * - * @param string {string} The data to write. - * @param close {boolean=false} opt_argument Closes this file after writing if - * true. - * @param callback {function(*, GridStore)} This will be called after executing - * this method. The first parameter will contain null and the second one - * will contain a reference to this object. - * - * @ignore - * @api private - */ -var writeBuffer = function(self, buffer, close, callback) { - if(typeof close === "function") { callback = close; close = null; } - var finalClose = (close == null) ? false : close; - - if(self.mode[0] != "w") { - callback(new Error((self.referenceBy == REFERENCE_BY_ID ? self.toHexString() : self.filename) + " not opened for writing"), null); - } else { - if((self.currentChunk.position + buffer.length) > self.chunkSize) { - // Data exceeds current chunk remaining free size; fill up current chunk and write the rest - // to a new chunk (recursively) - var previousChunkNumber = self.currentChunk.chunkNumber; - var leftOverDataSize = self.chunkSize - self.currentChunk.position; - var firstChunkData = buffer.slice(0, leftOverDataSize); - var leftOverData = buffer.slice(leftOverDataSize); - // Save out current Chunk as another variable and assign a new Chunk for overflow data - var saveChunk = self.currentChunk; - // Create a new chunk at once (avoid wrong writing of chunks) - self.currentChunk = new Chunk(self, {'n': (previousChunkNumber + 1)}); - - // Let's finish the current chunk and then call write again for the remaining data - saveChunk.write(firstChunkData, function(err, chunk) { - chunk.save(function(err, result) { - self.position = self.position + leftOverDataSize; - - // Write the remaining data - writeBuffer(self, leftOverData, function(err, gridStore) { - if(finalClose) { - self.close(function(err, result) { - callback(null, gridStore); - }); - } - else { - callback(null, gridStore); - } - }); - }); - }); - } - else { - // Write buffer to chunk all at once - self.currentChunk.write(buffer, function(err, chunk) { - self.position = self.position + buffer.length; - if(finalClose) { - self.close(function(err, result) { - callback(null, self); - }); - } - else { - callback(null, self); - } - }); - } - } -}; - -/** - * Creates a mongoDB object representation of this object. - * - * @param callback {function(object)} This will be called after executing this - * method. The object will be passed to the first parameter and will have - * the structure: - * - *
        
        - *        {
        - *          '_id' : , // {number} id for this file
        - *          'filename' : , // {string} name for this file
        - *          'contentType' : , // {string} mime type for this file
        - *          'length' : , // {number} size of this file?
        - *          'chunksize' : , // {number} chunk size used by this file
        - *          'uploadDate' : , // {Date}
        - *          'aliases' : , // {array of string}
        - *          'metadata' : , // {string}
        - *        }
        - *        
        - * - * @ignore - * @api private - */ -var buildMongoObject = function(self, callback) { - var length = self.currentChunk != null ? (self.currentChunk.chunkNumber * self.chunkSize + self.currentChunk.position) : 0; - var mongoObject = { - '_id': self.fileId, - 'filename': self.filename, - 'contentType': self.contentType, - 'length': length < 0 ? 0 : length, - 'chunkSize': self.chunkSize, - 'uploadDate': self.uploadDate, - 'aliases': self.aliases, - 'metadata': self.metadata - }; - - var md5Command = {filemd5:self.fileId, root:self.root}; - self.db.command(md5Command, function(err, results) { - mongoObject.md5 = results.md5; - callback(mongoObject); - }); -}; - -/** - * Saves this file to the database. This will overwrite the old entry if it - * already exists. This will work properly only if mode was initialized to - * "w" or "w+". - * - * @param {Function} callback this will be called after executing this method. Passes an **{Error}** object to the first parameter and null to the second if an error occured. Otherwise, passes null to the first and a reference to this object to the second. - * @return {null} - * @api public - */ -GridStore.prototype.close = function(callback) { - var self = this; - - if(self.mode[0] == "w") { - if(self.currentChunk != null && self.currentChunk.position > 0) { - self.currentChunk.save(function(err, chuck) { - self.collection(function(err, files) { - // Build the mongo object - if(self.uploadDate != null) { - files.remove({'_id':self.fileId}, {safe:true}, function(err, collection) { - buildMongoObject(self, function(mongoObject) { - files.save(mongoObject, {safe:true}, function(err, doc) { - callback(err, mongoObject); - }); - }); - }); - } else { - self.uploadDate = new Date(); - buildMongoObject(self, function(mongoObject) { - files.save(mongoObject, {safe:true}, function(err, doc) { - callback(err, mongoObject); - }); - }); - } - }); - }); - } else { - self.collection(function(err, files) { - self.uploadDate = new Date(); - buildMongoObject(self, function(mongoObject) { - files.save(mongoObject, {safe:true}, function(err, doc) { - callback(err, mongoObject); - }); - }); - }); - } - } else if(self.mode[0] == "r") { - callback(null, null); - } else { - callback(new Error("Illegal mode " + self.mode), null); - } -}; - -/** - * Gets the nth chunk of this file. - * - * @param chunkNumber {number} The nth chunk to retrieve. - * @param callback {function(*, Chunk|object)} This will be called after - * executing this method. null will be passed to the first parameter while - * a new {@link Chunk} instance will be passed to the second parameter if - * the chunk was found or an empty object {} if not. - * - * @ignore - * @api private - */ -var nthChunk = function(self, chunkNumber, callback) { - self.chunkCollection(function(err, collection) { - collection.find({'files_id':self.fileId, 'n':chunkNumber}, function(err, cursor) { - cursor.nextObject(function(err, chunk) { - var finalChunk = chunk == null ? {} : chunk; - callback(null, new Chunk(self, finalChunk)); - }); - }); - }); -}; - -/** - * - * @ignore - * @api private - */ -GridStore.prototype._nthChunk = function(chunkNumber, callback) { - nthChunk(this, chunkNumber, callback); -} - -/** - * @return {Number} The last chunk number of this file. - * - * @ignore - * @api private - */ -var lastChunkNumber = function(self) { - return Math.floor(self.length/self.chunkSize); -}; - -/** - * Retrieve this file's chunks collection. - * - * @param {Function} callback this will be called after executing this method. An exception object will be passed to the first parameter when an error occured or null otherwise. A new **{Collection}** object will be passed to the second parameter if no error occured. - * @return {null} - * @api public - */ -GridStore.prototype.chunkCollection = function(callback) { - this.db.collection((this.root + ".chunks"), callback); -}; - -/** - * Deletes all the chunks of this file in the database. - * - * @param callback {function(*, boolean)} This will be called after this method - * executes. Passes null to the first and true to the second argument. - * - * @ignore - * @api private - */ -var deleteChunks = function(self, callback) { - if(self.fileId != null) { - self.chunkCollection(function(err, collection) { - if(err!==null) { - callback(err, false); - } - collection.remove({'files_id':self.fileId}, {safe:true}, function(err, result) { - callback(null, true); - }); - }); - } else { - callback(null, true); - } -}; - -/** - * Deletes all the chunks of this file in the database. - * - * @param {Function} callback this will be called after this method executes. Passes null to the first and true to the second argument. - * @return {null} - * @api public - */ -GridStore.prototype.unlink = function(callback) { - var self = this; - deleteChunks(this, function(err) { - if(err!==null) { - callback("at deleteChunks: "+err); - return; - } - - self.collection(function(err, collection) { - if(err!==null) { - callback("at collection: "+err); - return; - } - - collection.remove({'_id':self.fileId}, {safe:true}, function(err, collection) { - callback(err, self); - }); - }); - }); -}; - -/** - * Retrieves the file collection associated with this object. - * - * @param {Function} callback this will be called after executing this method. An exception object will be passed to the first parameter when an error occured or null otherwise. A new **{Collection}** object will be passed to the second parameter if no error occured. - * @return {null} - * @api public - */ -GridStore.prototype.collection = function(callback) { - this.db.collection(this.root + ".files", function(err, collection) { - callback(err, collection); - }); -}; - -/** - * Reads the data of this file. - * - * @param {String} [separator] the character to be recognized as the newline separator. - * @param {Function} callback This will be called after this method is executed. The first parameter will be null and the second parameter will contain an array of strings representing the entire data, each element representing a line including the separator character. - * @return {null} - * @api public - */ -GridStore.prototype.readlines = function(separator, callback) { - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - separator = args.length ? args.shift() : "\n"; - - this.read(function(err, data) { - var items = data.toString().split(separator); - items = items.length > 0 ? items.splice(0, items.length - 1) : []; - for(var i = 0; i < items.length; i++) { - items[i] = items[i] + separator; - } - - callback(null, items); - }); -}; - -/** - * Deletes all the chunks of this file in the database if mode was set to "w" or - * "w+" and resets the read/write head to the initial position. - * - * @param {Function} callback this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {null} - * @api public - */ -GridStore.prototype.rewind = function(callback) { - var self = this; - - if(this.currentChunk.chunkNumber != 0) { - if(this.mode[0] == "w") { - deleteChunks(self, function(err, gridStore) { - self.currentChunk = new Chunk(self, {'n': 0}); - self.position = 0; - callback(null, self); - }); - } else { - self.currentChunk(0, function(err, chunk) { - self.currentChunk = chunk; - self.currentChunk.rewind(); - self.position = 0; - callback(null, self); - }); - } - } else { - self.currentChunk.rewind(); - self.position = 0; - callback(null, self); - } -}; - -/** - * Retrieves the contents of this file and advances the read/write head. Works with Buffers only. - * - * There are 3 signatures for this method: - * - * (callback) - * (length, callback) - * (length, buffer, callback) - * - * @param {Number} [length] the number of characters to read. Reads all the characters from the read/write head to the EOF if not specified. - * @param {String|Buffer} [buffer] a string to hold temporary data. This is used for storing the string data read so far when recursively calling this method. - * @param {Function} callback this will be called after this method is executed. null will be passed to the first parameter and a string containing the contents of the buffer concatenated with the contents read from this file will be passed to the second. - * @return {null} - * @api public - */ -GridStore.prototype.read = function(length, buffer, callback) { - var self = this; - - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - length = args.length ? args.shift() : null; - buffer = args.length ? args.shift() : null; - - // The data is a c-terminated string and thus the length - 1 - var finalLength = length == null ? self.length - self.position : length; - var finalBuffer = buffer == null ? new Buffer(finalLength) : buffer; - // Add a index to buffer to keep track of writing position or apply current index - finalBuffer._index = buffer != null && buffer._index != null ? buffer._index : 0; - - if((self.currentChunk.length() - self.currentChunk.position + 1 + finalBuffer._index) >= finalLength) { - var slice = self.currentChunk.readSlice(finalLength - finalBuffer._index); - // Copy content to final buffer - slice.copy(finalBuffer, finalBuffer._index); - // Update internal position - self.position = finalBuffer.length; - // Check if we don't have a file at all - if(finalLength == 0 && finalBuffer.length == 0) return callback(new Error("File does not exist"), null); - // Else return data - callback(null, finalBuffer); - } else { - var slice = self.currentChunk.readSlice(self.currentChunk.length()); - // Copy content to final buffer - slice.copy(finalBuffer, finalBuffer._index); - // Update index position - finalBuffer._index += slice.length; - - // Load next chunk and read more - nthChunk(self, self.currentChunk.chunkNumber + 1, function(err, chunk) { - if(chunk.length() > 0) { - self.currentChunk = chunk; - self.read(length, finalBuffer, callback); - } else { - finalBuffer._index > 0 ? callback(null, finalBuffer) : callback(new Error("no chunks found for file, possibly corrupt"), null); - } - }); - } -} - -/** - * Retrieves the position of the read/write head of this file. - * - * @param {Function} callback This gets called after this method terminates. null is passed to the first parameter and the position is passed to the second. - * @return {null} - * @api public - */ -GridStore.prototype.tell = function(callback) { - callback(null, this.position); -}; - -/** - * Moves the read/write head to a new location. - * - * There are 3 signatures for this method - * - * Seek Location Modes - * - **GridStore.IO_SEEK_SET**, **(default)** set the position from the start of the file. - * - **GridStore.IO_SEEK_CUR**, set the position from the current position in the file. - * - **GridStore.IO_SEEK_END**, set the position from the end of the file. - * - * @param {Number} [position] the position to seek to - * @param {Number} [seekLocation] seek mode. Use one of the Seek Location modes. - * @param {Function} callback this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {null} - * @api public - */ -GridStore.prototype.seek = function(position, seekLocation, callback) { - var self = this; - - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - seekLocation = args.length ? args.shift() : null; - - var seekLocationFinal = seekLocation == null ? exports.GridStore.IO_SEEK_SET : seekLocation; - var finalPosition = position; - var targetPosition = 0; - if(seekLocationFinal == exports.GridStore.IO_SEEK_CUR) { - targetPosition = self.position + finalPosition; - } else if(seekLocationFinal == exports.GridStore.IO_SEEK_END) { - targetPosition = self.length + finalPosition; - } else { - targetPosition = finalPosition; - } - - var newChunkNumber = Math.floor(targetPosition/self.chunkSize); - if(newChunkNumber != self.currentChunk.chunkNumber) { - if(self.mode[0] == 'w') { - self.currentChunk.save(function(err, chunk) { - nthChunk(self, newChunkNumber, function(err, chunk) { - self.currentChunk = chunk; - self.position = targetPosition; - self.currentChunk.position = (self.position % self.chunkSize); - callback(null, self); - }); - }); - } - } else { - self.position = targetPosition; - self.currentChunk.position = (self.position % self.chunkSize); - callback(null, self); - } -}; - -/** - * Verify if the file is at EOF. - * - * @return {Boolean} true if the read/write head is at the end of this file. - * @api public - */ -GridStore.prototype.eof = function() { - return this.position == this.length ? true : false; -}; - -/** - * Retrieves a single character from this file. - * - * @param {Function} callback this gets called after this method is executed. Passes null to the first parameter and the character read to the second or null to the second if the read/write head is at the end of the file. - * @return {null} - * @api public - */ -GridStore.prototype.getc = function(callback) { - var self = this; - - if(self.eof()) { - callback(null, null); - } else if(self.currentChunk.eof()) { - nthChunk(self, self.currentChunk.chunkNumber + 1, function(err, chunk) { - self.currentChunk = chunk; - self.position = self.position + 1; - callback(null, self.currentChunk.getc()); - }); - } else { - self.position = self.position + 1; - callback(null, self.currentChunk.getc()); - } -}; - -/** - * Writes a string to the file with a newline character appended at the end if - * the given string does not have one. - * - * @param {String} string the string to write. - * @param {Function} callback this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {null} - * @api public - */ -GridStore.prototype.puts = function(string, callback) { - var finalString = string.match(/\n$/) == null ? string + "\n" : string; - this.write(finalString, callback); -}; - -/** - * Returns read stream based on this GridStore file - * - * Events - * - **data** {function(item) {}} the data event triggers when a document is ready. - * - **end** {function() {}} the end event triggers when there is no more documents available. - * - **close** {function() {}} the close event triggers when the stream is closed. - * - **error** {function(err) {}} the error event triggers if an error happens. - * - * @param {Boolean} autoclose if true current GridStore will be closed when EOF and 'close' event will be fired - * @return {null} - * @api public - */ -GridStore.prototype.stream = function(autoclose) { - return new ReadStream(autoclose, this); -}; - -/** -* The collection to be used for holding the files and chunks collection. -* -* @classconstant DEFAULT_ROOT_COLLECTION -**/ -GridStore.DEFAULT_ROOT_COLLECTION = 'fs'; - -/** -* Default file mime type -* -* @classconstant DEFAULT_CONTENT_TYPE -**/ -GridStore.DEFAULT_CONTENT_TYPE = 'binary/octet-stream'; - -/** -* Seek mode where the given length is absolute. -* -* @classconstant IO_SEEK_SET -**/ -GridStore.IO_SEEK_SET = 0; - -/** -* Seek mode where the given length is an offset to the current read/write head. -* -* @classconstant IO_SEEK_CUR -**/ -GridStore.IO_SEEK_CUR = 1; - -/** -* Seek mode where the given length is an offset to the end of the file. -* -* @classconstant IO_SEEK_END -**/ -GridStore.IO_SEEK_END = 2; - -/** - * Checks if a file exists in the database. - * - * @param {Db} db the database to query. - * @param {String} name the name of the file to look for. - * @param {String} [rootCollection] the root collection that holds the files and chunks collection. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * @param {Function} callback this will be called after this method executes. Passes null to the first and passes true to the second if the file exists and false otherwise. - * @return {null} - * @api public - */ -GridStore.exist = function(db, fileIdObject, rootCollection, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - rootCollection = args.length ? args.shift() : null; - - // Fetch collection - var rootCollectionFinal = rootCollection != null ? rootCollection : GridStore.DEFAULT_ROOT_COLLECTION; - db.collection(rootCollectionFinal + ".files", function(err, collection) { - // Build query - var query = (typeof fileIdObject == 'string' || Object.prototype.toString.call(fileIdObject) == '[object RegExp]' ) - ? {'filename':fileIdObject} : {'_id':fileIdObject}; // Attempt to locate file - collection.find(query, function(err, cursor) { - cursor.nextObject(function(err, item) { - callback(null, item == null ? false : true); - }); - }); - }); -}; - -/** - * Gets the list of files stored in the GridFS. - * - * @param {Db} db the database to query. - * @param {String} [rootCollection] the root collection that holds the files and chunks collection. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * @param {Function} callback this will be called after this method executes. Passes null to the first and passes an array of strings containing the names of the files. - * @return {null} - * @api public - */ -GridStore.list = function(db, rootCollection, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - rootCollection = args.length ? args.shift() : null; - options = args.length ? args.shift() : {}; - - // Ensure we have correct values - if(rootCollection != null && typeof rootCollection == 'object') { - options = rootCollection; - rootCollection = null; - } - - // Check if we are returning by id not filename - var byId = options['id'] != null ? options['id'] : false; - // Fetch item - var rootCollectionFinal = rootCollection != null ? rootCollection : GridStore.DEFAULT_ROOT_COLLECTION; - var items = []; - db.collection((rootCollectionFinal + ".files"), function(err, collection) { - collection.find(function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) { - items.push(byId ? item._id : item.filename); - } else { - callback(null, items); - } - }); - }); - }); -}; - -/** - * Reads the contents of a file. - * - * This method has the following signatures - * - * (db, name, callback) - * (db, name, length, callback) - * (db, name, length, offset, callback) - * (db, name, length, offset, options, callback) - * - * @param {Db} db the database to query. - * @param {String} name the name of the file. - * @param {Number} [length] the size of data to read. - * @param {Number} [offset] the offset from the head of the file of which to start reading from. - * @param {Object} [options] the options for the file. - * @param {Function} callback this will be called after this method executes. A string with an error message will be passed to the first parameter when the length and offset combination exceeds the length of the file while an Error object will be passed if other forms of error occured, otherwise, a string is passed. The second parameter will contain the data read if successful or null if an error occured. - * @return {null} - * @api public - */ -GridStore.read = function(db, name, length, offset, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - length = args.length ? args.shift() : null; - offset = args.length ? args.shift() : null; - options = args.length ? args.shift() : null; - - new GridStore(db, name, "r", options).open(function(err, gridStore) { - // Make sure we are not reading out of bounds - if(offset && offset >= gridStore.length) return callback("offset larger than size of file", null); - if(length && length > gridStore.length) return callback("length is larger than the size of the file", null); - if(offset && length && (offset + length) > gridStore.length) return callback("offset and length is larger than the size of the file", null); - - if(offset != null) { - gridStore.seek(offset, function(err, gridStore) { - gridStore.read(length, function(err, data) { - callback(err, data); - }); - }); - } else { - gridStore.read(length, function(err, data) { - callback(err, data); - }); - } - }); -}; - -/** - * Reads the data of this file. - * - * @param {Db} db the database to query. - * @param {String} name the name of the file. - * @param {String} [separator] the character to be recognized as the newline separator. - * @param {Object} [options] file options. - * @param {Function} callback this will be called after this method is executed. The first parameter will be null and the second parameter will contain an array of strings representing the entire data, each element representing a line including the separator character. - * @return {null} - * @api public - */ -GridStore.readlines = function(db, name, separator, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - separator = args.length ? args.shift() : null; - options = args.length ? args.shift() : null; - - var finalSeperator = separator == null ? "\n" : separator; - new GridStore(db, name, "r", options).open(function(err, gridStore) { - gridStore.readlines(finalSeperator, function(err, lines) { - callback(err, lines); - }); - }); -}; - -/** - * Deletes the chunks and metadata information of a file from GridFS. - * - * @param {Db} db the database to interact with. - * @param {String|Array} names the name/names of the files to delete. - * @param {Object} [options] the options for the files. - * @callback {Function} this will be called after this method is executed. The first parameter will contain an Error object if an error occured or null otherwise. The second parameter will contain a reference to this object. - * @return {null} - * @api public - */ -GridStore.unlink = function(db, names, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - options = args.length ? args.shift() : null; - - if(names.constructor == Array) { - var tc = 0; - for(var i = 0; i < names.length; i++) { - ++tc; - self.unlink(db, names[i], function(result) { - if(--tc == 0) { - callback(null, self); - } - }); - } - } else { - new GridStore(db, names, "w", options).open(function(err, gridStore) { - deleteChunks(gridStore, function(err, result) { - gridStore.collection(function(err, collection) { - collection.remove({'_id':gridStore.fileId}, {safe:true}, function(err, collection) { - callback(err, self); - }); - }); - }); - }); - } -}; - -/** - * @ignore - * @api private - */ -exports.GridStore = GridStore; diff --git a/lib/mongodb/gridfs/readstream.js b/lib/mongodb/gridfs/readstream.js deleted file mode 100644 index 427cb4df407..00000000000 --- a/lib/mongodb/gridfs/readstream.js +++ /dev/null @@ -1,167 +0,0 @@ -var Stream = require('stream').Stream, - util = require('util'); - -/** - * ReadStream - * - * Returns a stream interface for the **file**. - * - * Events - * - **data** {function(item) {}} the data event triggers when a document is ready. - * - **end** {function() {}} the end event triggers when there is no more documents available. - * - **close** {function() {}} the close event triggers when the stream is closed. - * - **error** {function(err) {}} the error event triggers if an error happens. - * - * @class Represents a GridFS File Stream. - * @param {Boolean} autoclose automatically close file when the stream reaches the end. - * @param {GridStore} cursor a cursor object that the stream wraps. - * @return {ReadStream} - */ -function ReadStream(autoclose, gstore) { - if (!(this instanceof ReadStream)) return new ReadStream(autoclose, gstore); - Stream.call(this); - - this.autoclose = !!autoclose; - this.gstore = gstore; - - this.finalLength = gstore.length - gstore.position; - this.completedLength = 0; - - this.paused = false; - this.readable = true; - this.pendingChunk = null; - - var self = this; - process.nextTick(function() { - self._execute(); - }); -}; - -/** - * Inherit from Stream - * @ignore - * @api private - */ -ReadStream.prototype.__proto__ = Stream.prototype; - -/** - * Flag stating whether or not this stream is readable. - */ -ReadStream.prototype.readable; - -/** - * Flag stating whether or not this stream is paused. - */ -ReadStream.prototype.paused; - -/** - * @ignore - * @api private - */ -ReadStream.prototype._execute = function() { - if(this.paused === true || this.readable === false) { - return; - } - - var gstore = this.gstore; - var self = this; - - var last = false; - var toRead = 0; - - if ((gstore.currentChunk.length() - gstore.currentChunk.position + 1 + self.completedLength) >= self.finalLength) { - toRead = self.finalLength - self.completedLength; - last = true; - } else { - toRead = gstore.currentChunk.length(); - } - - var data = gstore.currentChunk.readSlice(toRead); - - if (data != null) { - self.completedLength += data.length; - self.pendingChunk = null; - self.emit("data", data); - } - - if (last === true) { - self.readable = false; - self.emit("end"); - if (self.autoclose === true) { - if (gstore.mode[0] == "w") { - gstore.close(function(err, doc) { - if (err) { - self.emit("error", err); - return; - } - self.readable = false; - self.emit("close", doc); - }); - } else { - self.readable = false; - self.emit("close"); - } - } - } else { - gstore._nthChunk(gstore.currentChunk.chunkNumber + 1, function(err, chunk) { - if (err) { - self.readable = false; - self.emit("error", err); - return; - } - self.pendingChunk = chunk; - if (self.paused === true) { - return; - } - gstore.currentChunk = self.pendingChunk; - self._execute(); - }); - } -}; - -/** - * Pauses this stream, then no farther events will be fired. - * - * @ignore - * @api public - */ -ReadStream.prototype.pause = function() { - this.paused = true; -}; - -/** - * Destroys the stream, then no farther events will be fired. - * - * @ignore - * @api public - */ -ReadStream.prototype.destroy = function() { - this.readable = false; - // Emit close event - this.emit("close"); -}; - -/** - * Resumes this stream. - * - * @ignore - * @api public - */ -ReadStream.prototype.resume = function() { - if (this.paused === false) { - return; - } - this.paused = false; - var self = this; - if(self.pendingChunk != null) { - self.currentChunk = self.pendingChunk; - process.nextTick(function() { - self._execute(); - }); - } else { - self.readable = false; - self.emit("close"); - } -}; - -exports.ReadStream = ReadStream; diff --git a/lib/mongodb/index.js b/lib/mongodb/index.js deleted file mode 100644 index 2ebf7c1401d..00000000000 --- a/lib/mongodb/index.js +++ /dev/null @@ -1,131 +0,0 @@ - -try { - exports.BSONPure = require('./bson/bson'); - exports.BSONNative = require('../../external-libs/bson'); -} catch(err) { - // do nothing -} - -[ 'bson/binary_parser' - , 'bson/binary' - , 'bson/code' - , 'bson/db_ref' - , 'bson/double' - , 'bson/max_key' - , 'bson/min_key' - , 'bson/objectid' - , 'bson/symbol' - , 'bson/timestamp' - , 'bson/long' - , 'commands/base_command' - , 'commands/db_command' - , 'commands/delete_command' - , 'commands/get_more_command' - , 'commands/insert_command' - , 'commands/kill_cursor_command' - , 'commands/query_command' - , 'commands/update_command' - , 'responses/mongo_reply' - , 'admin' - , 'collection' - , 'connection/connection' - , 'connection/server' - , 'connection/repl_set_servers' - , 'cursor' - , 'db' - , 'gridfs/grid' - , 'gridfs/chunk' - , 'gridfs/gridstore'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - exports[i] = module[i]; - } -}); - -// Exports all the classes for the NATIVE JS BSON Parser -exports.native = function() { - var classes = {}; - // Map all the classes - [ 'bson/binary_parser' - , 'bson/binary' - , 'bson/code' - , 'bson/db_ref' - , 'bson/double' - , 'bson/max_key' - , 'bson/min_key' - , 'bson/objectid' - , 'bson/symbol' - , 'bson/timestamp' - , 'bson/long' - , '../../external-libs/bson/bson' - , 'commands/base_command' - , 'commands/db_command' - , 'commands/delete_command' - , 'commands/get_more_command' - , 'commands/insert_command' - , 'commands/kill_cursor_command' - , 'commands/query_command' - , 'commands/update_command' - , 'responses/mongo_reply' - , 'admin' - , 'collection' - , 'connection/connection' - , 'connection/server' - , 'connection/repl_set_servers' - , 'cursor' - , 'db' - , 'gridfs/grid' - , 'gridfs/chunk' - , 'gridfs/gridstore'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - // Return classes list - return classes; -} - -// Exports all the classes for the PURE JS BSON Parser -exports.pure = function() { - var classes = {}; - // Map all the classes - [ 'bson/binary_parser' - , 'bson/binary' - , 'bson/code' - , 'bson/db_ref' - , 'bson/double' - , 'bson/max_key' - , 'bson/min_key' - , 'bson/objectid' - , 'bson/symbol' - , 'bson/timestamp' - , 'bson/long' - , './bson/bson' - , 'commands/base_command' - , 'commands/db_command' - , 'commands/delete_command' - , 'commands/get_more_command' - , 'commands/insert_command' - , 'commands/kill_cursor_command' - , 'commands/query_command' - , 'commands/update_command' - , 'responses/mongo_reply' - , 'admin' - , 'collection' - , 'connection/connection' - , 'connection/server' - , 'connection/repl_set_servers' - , 'cursor' - , 'db' - , 'gridfs/grid' - , 'gridfs/chunk' - , 'gridfs/gridstore'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - // Return classes list - return classes; -} diff --git a/lib/mongodb/responses/mongo_reply.js b/lib/mongodb/responses/mongo_reply.js deleted file mode 100644 index b25bbbb6d3a..00000000000 --- a/lib/mongodb/responses/mongo_reply.js +++ /dev/null @@ -1,133 +0,0 @@ -var Long = require('../bson/long').Long, - debug = require('util').debug, - inspect = require('util').inspect; - -/** - Reply message from mongo db -**/ -var MongoReply = exports.MongoReply = function() { - this.documents = []; - this.index = 0; -}; - -MongoReply.prototype.parseHeader = function(binary_reply, bson) { - // Unpack the standard header first - this.messageLength = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - this.index = this.index + 4; - // Fetch the request id for this reply - this.requestId = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - this.index = this.index + 4; - // Fetch the id of the request that triggered the response - this.responseTo = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - // Skip op-code field - this.index = this.index + 4 + 4; - // Unpack the reply message - this.responseFlag = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - this.index = this.index + 4; - // Unpack the cursor id (a 64 bit long integer) - var low_bits = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - this.index = this.index + 4; - var high_bits = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - this.index = this.index + 4; - this.cursorId = new Long(low_bits, high_bits); - // Unpack the starting from - this.startingFrom = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - this.index = this.index + 4; - // Unpack the number of objects returned - this.numberReturned = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - this.index = this.index + 4; -} - -MongoReply.prototype.parseBody = function(binary_reply, bson, raw, callback) { - raw = raw == null ? false : raw; - // Just set a doc limit for deserializing - var docLimitSize = 1024*20; - - // If our message length is very long, let's switch to process.nextTick for messages - if(this.messageLength > docLimitSize) { - var batchSize = this.numberReturned; - this.documents = new Array(this.numberReturned); - - // Just walk down until we get a positive number >= 1 - for(var i = 50; i > 0; i--) { - if((this.numberReturned/i) >= 1) { - batchSize = i; - break; - } - } - - // Actual main creator of the processFunction setting internal state to control the flow - var parseFunction = function(_self, _binary_reply, _batchSize, _numberReturned) { - var object_index = 0; - // Internal loop process that will use nextTick to ensure we yield some time - var processFunction = function() { - // Adjust batchSize if we have less results left than batchsize - if((_numberReturned - object_index) < _batchSize) { - _batchSize = _numberReturned - object_index; - } - - // If raw just process the entries - if(raw) { - // Iterate over the batch - for(var i = 0; i < _batchSize; i++) { - // Are we done ? - if(object_index <= _numberReturned) { - // Read the size of the bson object - var bsonObjectSize = _binary_reply[_self.index] | _binary_reply[_self.index + 1] << 8 | _binary_reply[_self.index + 2] << 16 | _binary_reply[_self.index + 3] << 24; - // If we are storing the raw responses to pipe straight through - _self.documents[object_index] = binary_reply.slice(_self.index, _self.index + bsonObjectSize); - // Adjust binary index to point to next block of binary bson data - _self.index = _self.index + bsonObjectSize; - // Update number of docs parsed - object_index = object_index + 1; - } - } - } else { - // Parse documents - _self.index = bson.deserializeStream(binary_reply, _self.index, _batchSize, _self.documents, object_index); - // Adjust index - object_index = object_index + _batchSize; - } - - // If we hav more documents process NextTick - if(object_index < _numberReturned) { - process.nextTick(processFunction); - } else { - callback(null); - } - } - - // Return the process function - return processFunction; - }(this, binary_reply, batchSize, this.numberReturned)(); - } else { - // Let's unpack all the bson documents, deserialize them and store them - for(var object_index = 0; object_index < this.numberReturned; object_index++) { - // Read the size of the bson object - var bsonObjectSize = binary_reply[this.index] | binary_reply[this.index + 1] << 8 | binary_reply[this.index + 2] << 16 | binary_reply[this.index + 3] << 24; - // If we are storing the raw responses to pipe straight through - if(raw) { - // Deserialize the object and add to the documents array - this.documents.push(binary_reply.slice(this.index, this.index + bsonObjectSize)); - } else { - // Deserialize the object and add to the documents array - this.documents.push(bson.deserialize(binary_reply.slice(this.index, this.index + bsonObjectSize))); - } - // Adjust binary index to point to next block of binary bson data - this.index = this.index + bsonObjectSize; - } - - callback(null); - } -} - -MongoReply.prototype.is_error = function(){ - if(this.documents.length == 1) { - return this.documents[0].ok == 1 ? false : true; - } - return false; -}; - -MongoReply.prototype.error_message = function() { - return this.documents.length == 1 && this.documents[0].ok == 1 ? '' : this.documents[0].errmsg; -}; \ No newline at end of file diff --git a/lib/mongodb/utils.js b/lib/mongodb/utils.js deleted file mode 100644 index 302a944252a..00000000000 --- a/lib/mongodb/utils.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Sort functions, Normalize and prepare sort parameters - */ -var formatSortValue = exports.formatSortValue = function(sortDirection) { - var value = ("" + sortDirection).toLowerCase(); - - switch (value) { - case 'ascending': - case 'asc': - case '1': - return 1; - case 'descending': - case 'desc': - case '-1': - return -1; - default: - throw new Error("Illegal sort clause, must be of the form " - + "[['field1', '(ascending|descending)'], " - + "['field2', '(ascending|descending)']]"); - } -}; - -var formattedOrderClause = exports.formattedOrderClause = function(sortValue) { - var orderBy = {}; - - if (Array.isArray(sortValue)) { - for(var i = 0; i < sortValue.length; i++) { - if(sortValue[i].constructor == String) { - orderBy[sortValue[i]] = 1; - } else { - orderBy[sortValue[i][0]] = formatSortValue(sortValue[i][1]); - } - } - } else if(Object.prototype.toString.call(sortValue) === '[object Object]') { - orderBy = sortValue; - } else if (sortValue.constructor == String) { - orderBy[sortValue] = 1; - } else { - throw new Error("Illegal sort clause, must be of the form " + - "[['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]"); - } - - return orderBy; -}; \ No newline at end of file diff --git a/nodejsvideo.html b/nodejsvideo.html deleted file mode 100644 index fcfb78cf070..00000000000 --- a/nodejsvideo.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - Node.JS Specific Presentations — MongoDB Node.JS Driver 0.9.9.1 documentation - - - - - - - - - - -
        -
        -
        -
        - -
        -

        Node.JS Specific Presentations

        -
        -

        NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js

        -

        Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach

        -

        SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include:

        -
          -
        • Dynamic collection creation
        • -
        • Updating (Increments over sets)
        • -
        • Schema
        • -
        • Next gen schemas for dynamic filters
        • -
        -
        -
        -

        NYC MongoDB User Group - What’s in the Trello

        -

        What’s in the Trello - Brett Kiefer, Fog Creek

        -

        Trello is a collaboration tool that organizes your projects into boards. Brett Kiefer will discuss how Trello uses Node.js, Socket.io, MongoDB, Redis, and Backbone to create a responsive single-page app.

        -
        -
        - - -
        -
        -
        -
        - -
        -
        -
        - - - - - - - \ No newline at end of file diff --git a/objects.inv b/objects.inv index 95313f0aa5ffb6bb3a4ad1703340a80ef4e77503..618933a6002042927c36283f17f3d49109316ba1 100644 GIT binary patch delta 1094 zcmV-M1iAad3Bd`Fihpj~I1s((D+Fw>_M(Sgdb8uCNjJ3%yG4O6_CSdvnGHp1Ny@bs z`|%x7ie;&?MbbG17C9tm=FOW&CYO{63j0VK`ks>*crBrQ2a zkJYD}48(xZ%h$%Do~nVUWZRuse`}^~>It7o1~-fO8q(;8et(~EqIL8(A_beoT8as- z4T>0`eu93Z09cGX(ENd6`av@Je!5^ zvQAJ)fNb4WkW@LbhG8do6k+)(6zrHR^_@~uY3I#vEq_)wMghssN4Z9{wzFE>6kVPP zinPSi!{v&QoP!-Yt$aapxIK!ZG7QqoTmt11t+*7==PCPC~_+r3Uy@U+0yn~?ga?twAmWZ%w(zm22fO-d+Dp|}p zx1A6CbAN>KF}8%9!<*B0uf^+KCI|*f)sRP$-EG2E%xu7%oo-5hZM(O3kZU>_ZQrLG zW+0cSQoOe^(zVuy5R7HMAcn+5k3gxXG?-pd8dl_lCnd+xx@ym8jov!d&u%tfPVJ6j zQmlcNiGMQd4l>p|PQ(k@JBSyu?}(S9#&m7aU4MWd&7HbyU!iKKDdB-t^?C?sRHZ<@ z`t0ATW=fHRm)2C^SIBKfwO2iMsp^UvJEq2Ujc#@_lqATtRi9a@yMIf)X znO2N&thrVY`BdJV38KcJ9otDmD1m)|o_Xo+)5J#N9wT{`z}XRA!YUm%)rUNmykp2H zj(<2Rx*lU5Bma$=?YvA=P}pD2VfkVfI=77ri5P&v#`-j3*LQp%1Jw~if?rX0fFkai zoT1^t=6KD0M}G$;gG^BfKj1|)Sm4-deT7bGuf$J~hTXX8bO)sCgtJ1!*W4q%3e7SB z^i?>|H+m?^9>@U~O`e+vByX|Z+z_r|?thj(F{%{X?1)kupim)=-CtjKfXj~*y*(=d zy%PRv3xqCxd%R6_aGLGwl_Sar9PMs?J-Z9oo4Vq?bWt;cQ!O{UU)V-D+sKdTVi0r| z@p;S)zIZ;t4!BoawK`@EiBwd31#FGgH1;f1Rb2m32*vW};N#A!pXc}M&0fed=07mf zt*Mh&~kWa#tZ)!Mhq!@ew0_fkJvi%Z6- M@BaXP0iWCeq$pV->i_@% delta 1095 zcmV-N1i1Ub3Bn1GihqvVHW0n=z$VPGP4w^l9Xc? z{rC3??_Ct4?O6H>8Bs->9V z+MtL5`fDaBG^THo$=$OQ#WYv4oHL`XWnPQSFe!$Oxt)G8R#3_veAS=^EL$U*wkDO5 zIpa(ePa>CBtq3idXblT6%i4K4OFbMltORXHS+y&q#AMqI`xmZmo7GB7)mmlSTD&+b zQI{#6^sf(K41cKqHtx^gb}?d%VrgyQht&$js5VlaMf?*Jzr$f9NqF=ZIJ8E3%W|`3 z#nwa}{kviY-ZOsv=mXAT)W5tgH@>q>zX1-@*51eshDH=oUN6#VCWXKyz2S9o)?s?t zWGrTHSBMs)swB=Z&Vwfrm#|8~j>%d-C?%El-u&Ky7k@(zr0gTC4{_~gwYE7Pc_t|G z6w43SOGI)GZs?o}1S#SEG~(^@2L#>5fsQk6Lh)(jBkX-4_9Hx9mLK-Gu?{{lmd3OE z?nj#g8E(SAhD<7|gBWS$j`6e@p^$;o>LnD2<{dN#B#I0va4~3GSF>?X)KJ>Bp*RG)l2f0D$Xh%Qa zumHJ4;S#)+rHjkVW^-_sd#vjPF(f5=1UWse!SssKs8nTyXEn#srbsWSjov!;XE%AT zUVDeL)dydNW`%$__nZDP);Z3!4B2~V8M5zanSYby^li^waG%V*dTU>>YG~--k=a^3 zM6{_|pnQD^Z&Wj-$RUX6=bP1X`V$b<){zdX(Jp=6AmmOd^IfBxwE{aO@~`bZEA{YC zO?Z?SE}Rq*pcvs8##SbU1ar;=QDcx#-J~J(z&=9dymtI)<|6SPBYBhT*%4mDDjzr1 zhkr7aykp2Hj(F<49<81t{|7VMd7bB=u;*NAR9Camxs+TQ*4-y zw}_h>cc0rr>j~x9BRSxr*~{@gDOhM9Z+{23Fmy|k7*&dGc0{%fP^FN@?XPch;JU=@ z?PiobsX$}S@U?V`iMu2 ze5|^RnZXCpXV?J`X`d~GmZSv#N1-*=(%6%bt+)Pz5K86G(az57&&&JuW-nx&azGgA z$<$3cyQq_D4Yba}3y" -, "contributors" : [ "Aaron Heckmann", - "Christoph Pojer", - "Pau Ramon Revilla", - "Nathan White", - "Emmerman", - "Seth LaForge", - "Boris Filipov", - "Stefan Schärmeli", - "Tedde Lundgren", - "renctan", - "Sergey Ukustov", - "Ciaran Jessup", - "kuno", - "srimonti", - "Erik Abele", - "Pratik Daga", - "Slobodan Utvic", - "Kristina Chodorow", - "Yonathan Randolph", - "Brian Noguchi", - "Sam Epstein", - "James Harrison Fisher", - "Vladimir Dronnikov", - "Ben Hockey", - "Henrik Johansson", - "Simon Weare", - "Alex Gorbatchev", - "Shimon Doodkin", - "Kyle Mueller", - "Eran Hammer-Lahav", - "Marcin Ciszak", - "François de Metz", - "Vinay Pulim", - "nstielau", - "Adam Wiggins", - "entrinzikyl", - "Jeremy Selier", - "Ian Millington", - "Public Keating", - "andrewjstone", - "Christopher Stott", - "Corey Jewett", - "brettkiefer", - "Rob Holland", - "Senmiao Liu", - "heroic", - "gitfy", - "Andrew Stone", - "John Le Drew"] - -, "repository" : { "type" : "git" - , "url" : "http://github.com/christkv/node-mongodb-native.git" } -, "bugs" : { "mail" : "node-mongodb-native@googlegroups.com" - , "url" : "http://github.com/christkv/node-mongodb-native/issues" } -, "os" : [ "linux" - , "darwin" - , "freebsd" ] -, "devDependencies": { - "dox": "0.1.3" - , "uglify-js": "1.2.5" - , "ejs": "0.6.1" - , "nodeunit": "0.7.3" - , "github3": ">=0.3.0" - , "markdown": "0.3.1" - , "gleak": "0.2.3" - , "step": "0.0.5" - } -, "config": { "native" : false } -, "main": "./lib/mongodb/index" -, "directories" : { "lib" : "./lib/mongodb" } -, "engines" : { "node" : ">=0.4.0" } -, "scripts": { "install" : "node install.js" } -, "licenses" : [ { "type" : "Apache License, Version 2.0" - , "url" : "http://www.apache.org/licenses/LICENSE-2.0" } ] -} diff --git a/searchindex.js b/searchindex.js index 1508f2d877c..76be5853a60 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{notEquals:[31,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[31,1,1,""],DBRef:[3,0,1,""],ensureIndex:[19,1,1,""],reIndex:[19,1,1,""],Binary:[28,0,1,""],deserializeStream:[1,1,1,""],findOne:[20,1,1,""],valueOf:[30,1,1,""],chunkCollection:[4,1,1,""],collectionNames:[19,1,1,""],Long:[15,0,1,""],nextObject:[10,1,1,""],validateCollection:[22,1,1,""],removeUser:[19,1,1,""],profilingInfo:[22,1,1,""],dropIndex:[19,1,1,""],findAndRemove:[20,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[31,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[22,1,1,""],getNumBitsAbs:[31,1,1,""],cursorInfo:[19,1,1,""],"generationTime number [Getter|Setter]":[8,2,1,""],Timestamp:[31,0,1,""],batchSize:[10,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[19,0,1,""],dropCollection:[19,1,1,""],Collection:[20,0,1,""],MinKey:[5,0,1,""],shiftRight:[31,1,1,""],writeFile:[4,1,1,""],toString:[31,1,1,""],Double:[16,0,1,""],getTimestamp:[8,1,1,""],Grid:[29,0,1,""],profilingLevel:[22,1,1,""],streamRecords:[10,1,1,""],indexInformation:[19,1,1,""],isOdd:[31,1,1,""],getHighBits:[31,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[22,0,1,""],dropDatabase:[19,1,1,""],Symbol:[30,0,1,""],previousErrors:[19,1,1,""],shiftRightUnsigned:[31,1,1,""],shiftLeft:[31,1,1,""],mapReduce:[20,1,1,""],Cursor:[10,0,1,""],MaxKey:[11,0,1,""],CursorStream:[33,0,1,""],findAndModify:[20,1,1,""],greaterThan:[31,1,1,""],renameCollection:[19,1,1,""],buildInfo:[22,1,1,""],resetErrorHistory:[19,1,1,""],isClosed:[10,1,1,""],getLowBitsUnsigned:[31,1,1,""],toHexString:[8,1,1,""],indexExists:[20,1,1,""],getLowBits:[31,1,1,""],toArray:[10,1,1,""],toNumber:[31,1,1,""],listDatabases:[22,1,1,""],ObjectID:[8,0,1,""],isNegative:[31,1,1,""],geoHaystackSearch:[20,1,1,""],addUser:[19,1,1,""],lessThanOrEqual:[31,1,1,""],isZero:[31,1,1,""],collectionsInfo:[19,1,1,""],lessThan:[31,1,1,""],isCapped:[20,1,1,""],ReadStream:[7,0,1,""],createCollection:[19,1,1,""],createIndex:[19,1,1,""],dropAllIndexes:[20,1,1,""],lastError:[19,1,1,""],geoNear:[20,1,1,""],greaterThanOrEqual:[31,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[8,1,1,""],createFromHexString:[8,1,1,""]},Timestamp:{fromBits:[31,1,1,""],fromNumber:[31,1,1,""],fromInt:[31,1,1,""],fromString:[31,1,1,""]},Db:{connect:[19,1,1,""]},Long:{fromBits:[15,1,1,""],fromNumber:[15,1,1,""],fromInt:[15,1,1,""],fromString:[15,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:14,returnkei:[34,10,20],maxscan:[34,10,20],readfilesync:4,prefix:[18,34],crete:20,attemp:[19,20],world_safe2:20,world_safe1:20,test_map_reduce_functions_inlin:20,deviat:34,under:34,everi:[0,10,27,21],test_gs_seek_with_buff:4,simple_next_object_collect:10,upload:21,correct:[1,19,8,34,4,35],gotik:17,servic:[],"10k":34,cceac:14,seper:4,direct:[6,10,35],second:[19,13,2,18,20,4,36,34,8,27,10],street:14,aggreg:20,even:[0,20],createindex:[19,20,34,6,24,9],d27cdb6e:[],neg:[31,15],"256k":36,allowscriptaccess:[],"new":[0,1,2,18,4,6,7,8,10,13,15,22,34,19,20,21,27,28,29,31,33,35,36],net:14,metadata:[21,36,4],manipul:20,rootcollect:4,never:[34,19],here:[35,36,4],epce4qkoh5:32,path:[21,34,4],integration_tests_to_drop:19,anymor:34,loos:[14,35],getlowbit:[23,15,31,9],findandmodifi:[34,20,24,9,13],vincentcr:34,pvorb:14,schemaless:35,sessionstorag:14,middlewar:14,sarah:20,would:[0,19,20,31,15,6,36,34],init:10,concret:14,overhead:35,recommend:[35,32,20],type:[11,12,1,20,21,3,22,4,5,32,16,36,35,28,30,34,37],tell:[19,20,4,24,35,36,9],relat:6,notic:[35,36],warn:[20,19,13],exce:4,forceclos:19,must:[0,31,15,20],err:[0,22,7,19,13,2,21,18,20,4,33,34,29,35,36,27,10],aheckmann:34,setup:[2,36,19],work:[0,10,34,4,35,25,36,19],test_gs_tel:4,rework:34,root:[36,4,29],overrid:[34,19,10,20],simple_geo_haystack_command:20,indic:[0,13,12,18,6,21,35,27],want:[0,19,20,18,4,6,16,35,36,27],david:13,unsign:[31,15],end:[7,10,20,21,18,4,33,35,36],replicaset:[12,19,2,34,35,26],quot:10,playerid:32,swflash:[],how:[12,32,10,20,22,4,37,35,25,36,19],"_id_":[19,20],recoveri:2,rewind:[0,10,34,4,24,9],milisecond:[34,19,8],config:[2,34,19],updat:[28,12,32,19,20,13,34,22,24,35,36,26,9],maxdist:20,recogn:4,after:[7,10,13,14,21,34,33,4,1,36],listdatabas:[24,34,22,19,9],befor:[0,19,20,2,34,6,35,36,27],wrong:34,gs2:4,descriptior:21,parallel:35,attempt:[35,22,27],third:4,zzdhidden:14,exclud:[10,20],receiv:36,errorobject:34,order:[0,10,13,20,6,27],origin:[20,13],cursorinfo:[24,19,9],over:[19,20,14,34,32,27,10],becaus:[14,31,15],readbuff:[34,36],flexibl:14,vari:34,digest:[34,36],uuid:[28,1],fit:[35,10],fix:[34,36],mongolia:14,better:[35,34,27],complex:[35,19,20],loggerinst:34,persist:[35,17,20],split:[31,15,4],them:35,thei:[35,31,15,36,34],safe:[13,19,20,18,22,33,35,34,10],update_a_simple_docu:20,bread:14,"instanceof":[10,20,34,22,4,19],choic:34,guileen:14,changelog:[12,34],bonu:35,timeout:[2,34,10,27,20],each:[0,7,19,20,2,31,15,4,34,33,24,36,27,9,10],debug:34,went:20,a_simple_collect:19,mean:[10,2,34,35,36,27],resum:[33,7,24,9],nin:0,eventstor:14,extract:34,newli:[6,18,22],monitor:14,content:[28,0,7,29,13,14,21,32,4,35,36,9],daniel:[0,27,21],reader:34,got:[35,19,20],more_index_information_test:[19,20],navig:36,worthwhil:36,rail:14,default_port:27,situat:34,standard:14,md5:[28,34,1,4],filter:[32,19,20],mvc:14,pagin:20,regress:34,onto:34,rang:[0,34,20],unlik:10,alreadi:[10,13,21,18,4,6,35,27],wrapper:14,unlin:4,getnumbitsab:[23,15,31,9],primari:[0,19,20,2,34,35,27,10],hexstr:8,rewritten:34,top:[14,31,15,20],travers:10,startindex:1,tonumb:[23,15,31,9],ton:[35,36],similarli:35,kamikazepanda:17,listen:[34,10],consol:[0,1,13,21,18,35,36,27],namespac:3,eventlisten:34,took:10,incur:35,removeus:[24,34,22,19,9],silli:35,target:[36,20],provid:[19,20,14,31,15,4,35,36],cursorstream:[24,12,33,10,9],project:[14,12,25,32],matter:35,iron:35,myexperience620186085001:32,thu:13,websocket:[14,35],abov:[35,36,13],mind:35,raw:[0,19,20,18,13,34,36,27,10],manner:[34,36],increment:[35,32],seek:[24,21,36,4,9],dbref:[12,19,3,23,35,34,9],ensureindex:[19,20,34,6,24,9],simple_limit_collect:10,data2:4,simplifi:[14,34,36],insur:34,plenti:36,usernam:[6,22,19],object:[0,1,2,18,4,6,7,8,10,12,13,14,22,34,19,20,21,27,28,29,37,32,33,35,36],deleg:27,regular:[0,21],sub:[28,20],tradit:35,simplic:36,don:[34,27,20],doc:[0,22,1,19,13,14,34,20,4,33,35,10],flow:34,doe:[19,13,18,15,4,34,20,35,36,31],masylum:14,bson_data_d:1,radix:[31,15],random:4,speedup:34,syntax:34,test_stream_funct:10,identifi:[35,18,36],absolut:[31,15,36,4],bind:14,acquir:10,field2:0,explain:[0,10,20,24,9,19],field1:0,theme:35,busi:35,rich:35,ppf_qxbkwm4g:32,io_seek_cur:4,cachefunct:1,nasti:34,test_cursorstream_destroi:33,stop:34,collectionsinfo:[24,19,9],bson_data_numb:1,report:35,youtub:[25,32,17],databank:14,bar:4,npmj:14,patch:34,previouli:10,fileidobject:4,steam:10,fieldnam:0,fair:36,indexnam:[19,20],num:20,result:[0,22,7,19,13,21,31,15,4,34,36,20,29,35,8,27,10],previouserror:[24,19,9],respons:[0,32,10],fail:[29,20,34,22,35,19],said:36,databas:[0,29,22,19,13,14,12,18,20,4,37,34,21,35,36,26,27,10],test_gs_empty_file_eof:4,discoveri:32,gridstor:[28,12,22,7,19,20,21,34,8,4,33,37,1,24,29,36,26,9,10],simplest:[14,0,36],awai:36,lotsofdoc:35,side:14,accord:2,newnam:20,getlasterror:[22,19,20],howev:10,against:[0,22,10,20,31,15,4,8,34,19],logic:[0,34],seri:14,com:[14,34,32,17,35,25],assur:10,can:[0,19,13,2,21,18,15,34,31,6,36,20,35,8,27,10],simple_explain_collect:10,ae6d:[],height:[25,32,17],foobar2:4,io_seek_set:4,dropdatabas:[24,22,19,9,27],duplic:[6,34,19,10,20],three:[35,36,4],been:[34,36,19,10],trigger:[7,10,20,34,4,33],basic:[12,19,37,20,35,36],life:36,regul:10,nodeeventstor:14,search:[14,12,35,20],argument:[28,22,7,19,20,33,3,15,4,30,1,16,36,34,29,8,31,10],child:19,"catch":20,laurie71:34,another_root:4,subsequ:[19,20],peform:[33,7,19,10,20],dissect:36,properti:[0,8,21,34,4,23,24,9],weren:0,"typeof":[34,1,4],succes:20,toolkit:14,my_f:4,sever:[13,2,18,6,35,27],grown:35,usessl:19,test_is_close_function_on_cursor:10,perform:[0,15,19,20,31,22,34,10],make:[0,10,13,34,20,6,35,36,27],transpar:32,meetup:[12,32],drawback:36,descend:[6,10],isneg:[23,15,31,9],complet:20,reset_error_histori:19,hang:34,hand:27,fairli:34,tune:36,speakerdeck:[],scenario:27,geohaystack:20,test_close_function_on_cursor:10,client:[22,10,13,14,20,4,29,35,19],thi:[28,0,22,7,19,13,14,21,31,15,4,27,6,34,36,20,35,8,25,10],everyth:13,settimeout:[33,34,7,20],left:[31,15,19,27,20],protocol:[35,34],just:[0,36,35,20],laptop:34,ordin:[19,20],farther:7,yet:27,languag:[14,35,32],previous:34,wmode:32,easi:14,collectionn:27,had:10,board:32,els:[20,22,27,13],ffffff:32,save:[19,20,21,13,4,24,27,9],dynamicstream:32,applic:[12,19,14,17,35,36],which:[0,2,21,18,15,4,31,34,36,27],preserv:10,background:[19,20],test_ev:19,apart:[35,36],measur:34,specif:[0,32,19,20,12,18,8,4,35,34,10],arbitrari:4,negat:[23,15,31,9],collection2:[19,20],collection1:20,underli:33,www:[14,25,32,17,19],right:[35,31,15,36],old:4,creek:32,deal:35,manual:[12,9],interv:34,deserializestream:[23,1,9],dead:34,intern:[0,31,15,21,20],successfulli:10,m_tddbw6qnuu4iuxlyo:32,nwtj:14,timestampd:8,multipli:[23,15,31,9,20],fog:32,christkv:[35,34],condit:[0,34,20],localhost:[14,35,18,36,19],a_simple_create_drop_collect:19,collection_stats_test:20,promot:35,repositori:[14,35],post:[0,18,15,31],ryanke:14,plug:35,obj:20,slightli:35,simul:[31,15,36],commit:19,book:0,simple_previous_error_col:19,bson_data_symbol:1,"float":[35,31,15],encod:[2,35,34,27],bound:[19,10,20],down:[34,19],wrap:[0,7,30,34,33,16],storag:[14,35,36],git:14,wai:[0,13,20,14,31,15,35,36,34],support:[0,34,36,35,21],serverinfo:20,avail:[7,10,20,2,34,22,4,33,35,36,19],width:[25,32,17],test_rename_collection3:20,test_rename_collection2:20,constantli:35,bulqmxg0vdc:32,lowest:34,head:[36,4],medium:22,form:[34,4],forc:[34,22,19,10,20],"true":[0,22,1,19,13,2,21,18,20,4,32,33,6,7,34,29,35,36,27,10],reset:[0,4,10,19],new_nam:18,geospati:[19,20],maximum:[35,34,19,10],until:[35,22,19],deprect:10,fundament:35,sampl:35,emit:[35,34,33,19,20],classid:[],shouldcorrectlyfailonretryduetoappcloseofdb:19,featur:36,"abstract":14,fromstr:[23,15,31,9,34],exist:[0,22,19,13,21,18,20,4,6,34,24,35,36,27,9],videoplay:32,check:[0,22,7,19,20,21,31,15,4,33,6,1,35,34,10],test_collection_opt:20,bson_binary_subtype_md5:[28,1],test_to_a_after_each:10,floor:8,when:[0,1,10,13,2,21,18,20,4,33,7,34,35,36,27],refactor:34,simple_limit_skip_find_one_queri:20,test:[22,19,13,14,21,18,20,4,17,35,36,34,10],miliscecond:[33,7],node:[12,10,2,34,32,14,17,35,25,9],insensit:10,consid:20,sql:35,cachefunctionscrc32:1,errormessag:34,"_id":[0,19,13,34,20,4,6,36,27,29],longer:[34,4],ignor:[35,1,20],time:[12,32,19,20,2,34,8,14,37,35,27,10],push:[19,14,34,33,35,10],seamlesstab:[],backward:[34,10],concept:[35,34],skip:[24,0,10,9,20],global:34,primer:[12,36,37],row:20,millisecond:27,middl:20,depend:34,flash:[],originalhex:8,dropindex:[24,6,19,9,20],sourc:[17,10],string:[28,0,22,1,19,20,21,3,15,4,30,31,6,36,34,29,35,8,18,10],feasibl:36,test_cursorstream_resum:33,logmeup:14,contenttyp:21,level:[19,20,14,34,22,4],did:[34,19],dig:35,eventemitt:10,iter:[10,20],item:[7,10,20,34,22,4,33,35,19],quick:[35,36],div:[32,23,15,31,9],round:35,databasenam:[19,27],wtimeout:[34,22,19,20],addtoset:35,sign:[18,15,31],slow_onli:22,cost:34,port:[34,19,27],comparis:4,checkoutwrit:19,repli:[35,22,20],muq2w2u5x9m:25,current:[22,19,21,3,15,4,35,36,31],subtype_uuid:28,boost:14,deriv:[31,15],gener:[19,8,14,34,20,36,27],wait:[19,20],box:35,bson_data_regexp:1,shift:[31,15,34],queue:[14,35],behav:34,examp:14,more_complex_ensure_index_test:[19,20],extrem:34,weird:34,werehamst:14,flashobj:[],extra:0,modul:[14,34],prefer:[0,34,35],toarrai:[0,10,20,14,34,22,24,35,9,19],bxhflrwemeg:17,instal:[35,34],includeloc:20,perf:34,memori:[0,10,12,34,37,35,36],regep:35,connector:[12,32],live:[35,34,36],handler:36,value2:0,value1:0,criteria:13,scope:[35,34,1,19,20],prev:20,maxkei:[11,12,1,34,23,9],multiplecoll1:19,qard:14,finit:[31,15],visual:14,examin:35,content_typ:[21,36],fly:14,cap:[35,34,19,20],uniqu:[0,20,19,27,6],descriptor:36,whatev:27,cab:[],bson_binary_subtype_funct:[28,1],mongo:[12,19,13,14,34,37,35,36],stream:[7,10,21,34,33,4,1,24,35,36,9],predict:34,bson_data_long:1,createcollect:[10,20,18,33,24,35,34,9,19],topic:32,nocr:14,cube:14,kaflr8pi5nk:25,occur:[0,10,13,21,18,4,6,34,27],alwai:[35,31,15,10,20],multipl:[20,2,31,15,34,27],ping:[24,34,22,19,9],fieldvalu:0,write:[28,1,19,2,21,34,4,23,7,24,35,36,9,29],foreach:[4,20],pure:[28,22,7,10,20,33,34,8,4,1,29,19],nyc:[12,32],map:[35,20],product:[31,15],max:[34,19,10,20],dive:[35,36],date:[1,10,8,34,22,6,20,35],docstartindex:1,data:[28,12,7,19,20,21,34,32,4,33,37,1,17,29,35,36,10],grow:35,sbrekken:34,inform:[19,20,2,21,22,4,6,14,35,27,10],"switch":34,reaper:[34,19,27],combin:[4,19],keepgoingexampl:20,filedata:4,increas:34,still:[0,34,13],pointer:[0,18,4,27,21],dynam:32,test_map_reduce_funct:20,group:[12,20,34,32,24,25,36,9],gte:0,indexexist:[34,24,9,20],jim:20,nodelai:[2,34,27],platform:35,mbostock:34,requir:[28,22,7,19,13,33,18,20,4,1,36,34,29,35,8,27,10],main:[35,36],non:[14,34,20],"6pjmp23z0lw":25,simple_skip_collect:10,col2:19,col3:19,initi:[10,20,34,4,35,36,19],col1:19,verifi:[8,20,22,4,19],now:[35,34,36,19],discuss:32,nor:18,introduct:[2,12,37,32,35],mapreduc:[34,24,9,20],name:[28,0,22,1,19,13,2,21,3,20,4,27,6,32,34,36,18,10],drop:[19,20,18,22,6,24,34,9],revert:0,crypto:34,separ:[0,34,4],jprichardson:14,failov:[2,34],domain:[],replai:34,dialect:14,replac:[0,20,34,13,4,35],individu:[0,34],firej:14,a_1_b_1:[19,20],poolreadi:34,serverclust:34,happen:[33,7,4,10],shown:[35,36],accomplish:36,space:[1,19],streetsaheadllc:14,profil:[22,10,20],stuff:[2,12,36,37,35],factori:[0,27,20],brett:32,"_event":34,orm:14,mime:4,sethml:34,replacethiscollect:20,org:[14,19],"byte":[28,0,1,19,8,21,34,35,36,27],care:[2,0,35],question:[31,15],bradberri:32,synchron:35,thing:[35,36,27],place:[31,15],year2013:34,frequent:[31,15],first:[0,22,19,13,21,18,20,4,36,35,8,27,10],oper:[0,22,19,13,18,15,34,31,6,20,35,36,27,10],bson_binary_:34,directli:[0,10,35],onc:[6,35],arrai:[28,0,22,1,19,13,2,21,18,20,4,35,34,10],"0x7f":1,reopen:[4,27],fast:14,happi:14,open:[22,7,19,13,2,21,18,20,4,34,33,24,29,35,36,27,9,10],predefin:1,size:[0,1,19,20,21,31,15,4,36,34,10],given:[28,10,20,31,15,4,36,19],breviti:[35,36],workaround:34,paramt:10,collectionnam:[19,20,18,22,6,24,36,9],conveni:[0,31,15],subtype_md5:28,especi:35,copi:2,specifi:[28,0,10,20,21,34,4,35,36,27,19],test_arrai:10,keepgo:[34,20],than:[0,10,13,20,2,21,31,15,34,36,27],png:[21,4],firebas:14,tedeh:34,were:[10,13],posit:[28,21,31,15,4,36],browser:14,pre:[22,1,19,20],fork:14,sai:36,ani:[0,19,13,14,35,36,10],simple_rename_collection_2:19,p1_prod_vers:[],bitwis:[35,31,15],squar:14,alias:0,destroi:[33,7,24,9],note:[31,15,19,10],take:[0,1,2,34,35,36],createfromhexstr:[0,23,34,9,8],begin:[0,4],sure:[36,10],normal:10,buffer:[28,0,1,19,13,21,18,20,4,34,29,36,27,10],clearer:34,getyear:20,homepag:14,renam:[19,20,18,24,35,9],byte_valu:28,later:[36,19,20],indexbound:[19,20],test_gs_read_stream:4,runtim:34,parseint:20,axi:20,show:[28,7,10,20,33,8,4,1,29,35,19],atom:[35,34,20],objectid3:8,objectid2:8,concurr:34,corner:34,onli:[0,22,19,13,2,34,20,4,6,35,36,27,10],slow:[34,22,19,20],dice:35,setprofilinginfo:22,activ:[14,34],written:[28,20,14,31,15,4,36],analyt:[14,12,32,35],overwritten:36,min_valu:[31,15],variou:[14,22,20],get:[7,18,4,6,8,9,10,12,13,14,22,34,19,20,21,24,27,29,37,33,35,36],secondari:[2,34,19,10,20],ssl:[34,19],cannot:[19,20,31,15,35,10],shiftrightunsign:[23,15,31,9],geo:20,gen:32,nolock:[34,19],doabl:0,seldom:34,yield:[18,20,19,34,13],isarrai:1,caboos:14,nettl:14,where:[28,0,1,19,13,2,21,18,20,4,6,35,36,34],highbit:[31,15],desced:10,wiki:35,khwang:14,testcas:34,infinit:[31,15,34],detect:2,heckmann:34,fs_chunk:36,integration_tests_2:19,wayt:20,enough:10,between:[35,34,19,27],"import":[35,36],across:[34,27,20],spars:[6,19,20],august:[12,32],test_group:20,come:[21,31,15,20],simple_find_and_modify_operations_:20,region:20,gwt:[31,15],tutori:[12,25,36],mani:[35,10],fromnumb:[23,15,31,9],reindex:[24,34,19,9,20],iscap:[34,24,9,20],db_option:27,period:[0,18],pop:35,createcreateindexcommand:34,fs_file:36,lessthan:[23,15,31,9],reaperinterv:[34,19,27],cursor_information_collect:19,cursorinst:10,coupl:[28,35,20],aciev:0,rebuilt:[19,20],derefer:[24,34,19,9],lowbit:[31,15],geonear:[34,24,9,20],"1mb":36,those:[31,15],"case":[10,20,31,15,6,35,36,34],myself:35,bson_seri:34,tostr:[28,29,8,31,15,4,23,20,36,9],trick:36,invok:36,idhex:0,firstext:22,simple_sort_collect:10,trello:[12,32],advantag:35,createexperi:32,eras:[21,18],dynamicgui:14,ascii:[2,28,34,27],acess:19,develop:[14,35],author:[0,21,13],media:14,same:[0,19,20,31,15,4,6,8,34,10],binari:[28,0,22,7,19,12,21,18,13,4,33,23,1,20,29,35,8,34,9,10],document:[0,22,1,19,12,2,21,18,13,4,33,6,34,7,20,14,35,36,27,10],createpk:27,exhaust:10,ifram:[25,32,17],finish:[36,20],closest:[31,15,20],utf8:[2,35,34,4,27],nest:[0,6],oid:3,driver:[0,13,2,12,18,32,34,14,24,35,36,27,9,37],gotend:4,newobjectid:8,improv:34,defo:0,bson_data_boolean:1,crud:[12,37,35],framework:14,brightcov:32,without:[1,19,31,15,27,34,18],model:[14,20],dereferenc:19,upsert:[20,13],ourexamplefiletowrit:4,execut:[10,13,34,22,4,20,35,19],rest:[14,34,8,20],hint:[10,20],db_connector:[18,27],except:[35,34,4,13],littl:35,blog:[14,0,18],framebord:[25,32,17],default_chunk_s:4,haystack:20,found2:4,around:[14,35,34],read:[28,7,19,20,2,21,34,4,23,24,35,36,9,10],grid:[28,12,29,14,34,24,36,9],spank:34,world:[7,19,13,20,4,1,36,29],lasterror:[24,34,19,9],reap:34,subtype_user_defin:28,saniti:34,poolsiz:[7,10,20,34,22,4,33,29,35,27,19],integ:[0,1,8,31,15,35,34],server:[28,22,1,19,13,2,33,18,20,4,14,7,36,34,29,35,8,27,10],firebaseco:14,either:[21,34,36,35],output:[0,20],greaterthanorequ:[23,15,31,9],manag:[14,21,34,35],bson_binary_subtype_byte_arrai:[28,1],eventloop:36,ascend:[0,10,6],intact:13,generationtim:8,setnodelai:34,slice:35,writedata:36,node_ev:34,confirm:35,heeeeeeeeeeeeeeeeeeeeeeeeeeee:[],legal:20,evolv:35,profilinginfo:[22,24,9],refer:[10,3,4,35,34,19],power:[14,32],broken:34,aquir:19,bson_binary_subtype_default:[28,34,1],regexp:[35,34,1],"throw":[35,34,36,13],comparison:8,pointer_to_collect:0,firstnam:[0,6],nocooki:[25,32,17],numbit:[31,15],bson_data_code_w_scop:1,gump:20,act:36,luck:36,readstream:[24,12,7,10,9],addus:[24,34,22,19,9],test_collections_info:19,your:[20,2,32,4,14,35,36],loc:20,log:[0,1,10,20,14,21,18,13,22,34,35,36,27],hex:[0,29,4,8],overwrit:[22,4],dropdup:[34,19,20],strict:[18,34,19,27,20],interfac:[7,10,14,34,33,35,29],low:[35,31,15,36],lot:[10,20,34,6,33,35,36],isvid:32,tupl:6,shamelessli:35,replsetsrv:2,faster:[6,34],pull:[35,34,22],dirti:35,possibl:[0,19,13,14,34,20,6,35],"default":[28,0,22,1,19,13,2,21,18,20,4,6,36,34,35,8,27,10],remove_subset_of_documents_saf:20,bson_data_min_kei:1,expect:[0,27],gone:[29,20,4,19],creat:[28,0,22,1,19,20,2,21,18,8,4,32,33,6,7,34,29,35,36,27,10],certain:[6,35],watcher:14,intro:35,file:[7,29,14,21,34,4,36,19],russel:32,incorrect:34,again:[4,10],kaba:14,field:[0,10,13,34,20,6,35,19],valid:[28,1,19,8,18,22,10],longlib:15,you:[0,1,19,13,2,21,18,20,6,34,35,36,27,10],scttnlsn:14,pefrom:20,sequenc:34,symbol:[12,1,30,34,23,35,9],opt_radix:[31,15],pool:[34,19,27],reduc:[31,15,34,20],lessthanorequ:[23,15,31,9],coreh:14,directori:34,descript:[28,1,4,10,19],tricki:35,potenti:34,alright:35,cpu:[34,36],unset:35,represent:[11,28,29,8,3,15,4,5,16,30,31],all:[0,22,1,19,13,2,21,18,20,4,6,34,35,36,27,10],forget:35,numberupd:20,dollar:18,simple_rename_collect:19,erhangundogan:14,follow:[0,10,13,2,4,6,35,36],fetchsiz:10,disk:[36,7,4,10,20],nodej:[14,17],subtype_default:28,nextobject:[24,0,19,9,10],aaron:34,setprofilinglevel:[22,24,9],evaul:19,util:[14,34],test_rename_collect:20,failur:[35,34],veri:[35,34,36],base698:14,list:[19,20,18,22,4,24,35,36,34,9],resav:20,adjust:[34,36],findandremov:[34,24,9,20],small:[25,36,34],retun:1,eas:14,zero:[31,15,34,8],pass:[1,19,20,2,18,8,4,34,36,27,10],what:[12,10,18,32,35,36],abc:[0,4,13],xor:[23,15,31,9],barrier:34,sum:[31,15],brief:25,delet:[19,20,21,34,4,24,35,36,27,9,29],version:[34,36,19,27,20],cruso:0,method:[28,0,10,20,12,18,8,4,37,34,35,36,27,29],full:[34,19,20],hash:[0,34,36,19,27],variat:35,behaviour:14,getmorecommand:[10,20],foobar3:4,strong:25,modifi:[35,20,13],valu:[0,1,18,4,6,8,9,10,13,15,22,16,34,19,20,21,23,27,28,30,31,32,35,36],bartt:14,isodd:[23,15,31,9],ahead:[14,35,36,20],showdiskloc:[34,10,20],amount:[35,31,15,19],pick:[35,34,36,19],codebas:[],mongoos:[14,12,25,32],narrow:20,evalfunct:1,via:35,shorthand:13,lazybum:14,c_1:20,deprec:19,default_root_collect:4,establish:[7,10,20,34,22,4,33,29,19],select:[18,20,27,34,13],test_collection_is_cap:20,distinct:[34,24,9,20],regist:4,two:[0,19,13,2,21,18,15,4,6,36,14,35,8,31],coverag:34,bson_binary_subtype_user_defin:[28,1],taken:35,minor:34,more:[0,7,19,13,2,31,15,4,33,20,35,36,34,10],flag:20,stick:35,particular:35,cach:1,none:[2,32],outlin:[35,36],dev:14,histori:19,remain:[36,4],learn:14,scan:[10,20],share:[14,34,19,27],shard:21,accept:[34,20],simple_document_insert_collection_no_saf:20,default_url:19,robinson:0,cours:35,newlin:4,divid:[31,15,20],rather:20,anoth:[0,4,35,8],simpl:[28,0,7,19,12,14,33,18,20,4,6,37,1,29,35,36,34,10],perman:19,resourc:[14,27],resultset:35,reflect:34,unlink:[24,21,36,4,9],associ:[36,4],keyorlist:10,github:[14,12,34,17,35],defineproperti:34,save_a_simple_document_modify_it_and_resave_it:20,caus:[35,34],callback:[0,22,19,13,21,18,20,4,6,34,35,36,27,10],spheric:20,doc_id:0,bson_data_oid:1,trade:36,through:[35,34,19,20],reconnect:[34,27],paramet:[0,19,13,2,21,18,22,4,6,34,35,36,27,10],style:[14,35,32],mongorepli:34,call:[0,10,14,34,4,36,27,19],asbuff:1,dbname:[34,19],stylu:17,rapidli:35,bypass:35,simple_limit_skip_queri:20,might:[6,36,19,35],alter:[0,18],good:[35,36],"return":[0,7,3,4,5,1,8,10,11,13,15,22,16,18,19,20,21,27,28,29,30,31,33,34,35,36],timestamp:[12,1,8,31,20,23,34,9],more_complex_index_test:[19,20],distancemultipli:20,compound:[19,20],karaco:14,readlen:4,emerleit:14,uploadd:21,instruct:2,authent:[24,34,22,19,9],easili:[31,15,34],achiev:0,skipvalu:10,found:[0,13,4,20,19],truncat:[18,36,4],hard:35,realli:35,connect:[12,7,19,20,2,34,22,4,14,37,33,36,24,29,35,25,27,9,10],slave:2,event:[7,10,21,34,4,33,35,36,27,19],mojo:14,b4ajeu13u6u:25,read_primari:34,shockwav:[],pullal:35,foreground:[19,20],core2duo:34,advanc:[12,37,18,4,35,36],pub:[],asc:[0,10,13],reason:4,base:[8,14,21,20,4,35,36],connectionopt:19,put:[28,10,20,34,4,23,24,36,9,29],seconddb:19,gethighbit:[23,15,31,9],tailabl:[34,10,20],omit:[35,3,36,34],dir:13,assign:[2,34],notifi:[35,36,20],articl:[12,36,37],lastnam:[0,6],number:[28,0,22,1,19,20,31,15,4,6,16,36,34,35,8,27,10],done:[0,7,19,20,21,34,13,22,33,35,36,27],construct:[31,15],autoclos:[21,36,7,4],create_and_drop_an_index:[19,20],miss:34,differ:[19,8,31,15,4,6,20,35,36,34,29],chunk_typ:4,script:[21,32],interact:[35,36,4,29],least:[0,20],custompkfactori:27,settim:8,statement:[35,36,19],illeg:[29,22,19,34,20],master:2,store:[1,10,14,21,4,35,36,19],schema:[12,32],otherid:8,option:[28,0,22,1,19,13,2,21,3,20,4,27,6,34,24,29,35,36,18,9,10],reseterrorhistori:[24,19,9],selector:[34,19,10,20],getter:[4,8],pars:[34,1,20],literarili:35,std:34,kind:36,bson_data_nul:1,whenev:[19,20],remov:[22,19,13,18,20,4,6,24,35,34,9],reus:[34,1,19],str:[31,15],consumpt:36,cleaner:14,luckili:[35,36],"null":[0,1,19,20,2,18,22,4,14,33,34,29,27,10],built:[14,35],equival:[35,20],valueof:[23,16,9,30],fromcollect:19,also:[0,10,13,18,4,6,35,36,34],build:[22,19,34,32,35,36],tool:[14,32],lubow:32,blackboard:[12,17],choos:[35,20],reach:[36,7],most:[0,36,35],plan:36,native_pars:[7,10,20,22,4,33,29,27,19],"16mb":21,filesystem:21,cover:19,part:[35,25,34,8],clean:[14,34,19],frombit:[23,15,31,9],ridicul:14,brightcoveexperi:32,session:14,find:[0,7,19,13,14,21,34,20,22,6,33,24,35,9,10],firewal:34,nosql:14,pretti:35,test_gs_weird_bug:4,numberofdocu:1,queu:14,batch_document_insert_collection_saf:20,hit:[19,20],unus:34,express:[0,20,14,21,17,35],fieldtoupd:35,test_map_reduce_functions_scop:20,nativ:[14,35,34,27],ferret:14,restart:[33,7],statist:[34,22,19,20],wrote:35,set:[0,22,1,19,13,2,21,18,20,4,6,32,36,34,35,8,27,10],jade:17,see:[0,13,21,18,15,31,6,35,36,27],easymongo:14,close:[7,19,20,14,21,34,22,4,33,24,29,35,36,27,9,10],andrewjston:34,misalign:34,someth:[4,27],hold:[35,1,4,10],shockwaveflash:[],altern:[14,20],signatur:[4,10],complement:[31,15],javascript:[1,19,20,14,31,15,32,35],salzman:34,succeed:6,batchsizevalu:10,last:[14,21,19,35],create_and_drop_all_index:[19,20],context:27,logout:[24,22,19,9],whole:[35,20,4,19],createdat:10,load:[0,34],simpli:0,jsmode:20,point:[10,20,31,15,35,36],instanti:[35,34],param:32,shutdown:34,linux:34,backend:35,faithfulli:[31,15],user_id:20,due:[35,34,29],empti:[28,0,4,10,20],bgcolor:32,txt:4,strategi:[35,34],test_streamingrecords_funct:10,fire:[7,19,13,14,21,4,35,36,27],admindb:[22,19],imag:[21,36],understand:35,func:[1,20],look:[10,20,21,34,4,6,35,36],mdoq:14,straight:[35,36],batch:[35,34,10,20],"while":[0,34,4,21,10],getownpropertynam:34,behavior:[0,13,31,15,35,34],simple_key_based_distinct_sub_query_filt:20,fun:36,fixtur:14,robin:35,loop:34,real:[14,12,32],test_gs_unlink:4,readi:[33,7,4,35,10],key2:0,key1:0,jpg:4,itself:10,test_deref_exampl:19,rid:34,chase:34,decor:34,simple_document_insert_with_function_saf:20,geohaystacksearch:[34,24,9,20],coffeescript:[14,12,25],p_db:[2,19],higher:[2,34,36,27,20],optim:[34,20],operaion:21,numberofretri:[34,19,27],iya_logo_final_bw:4,temporari:[4,20],user:[28,0,1,19,12,14,34,13,4,6,32,22],hello2:20,keyf:20,recreat:27,lower:[19,20],entri:[36,20,4,19],explan:[19,20],getlowbitsunsign:[23,15,31,9],a_1:20,collabor:32,shape:34,tempcollect:20,sidebar:[],update_a_simple_document_multi:20,checkkei:1,bson_data_timestamp:1,cur:36,colladow:14,tdegrunt:14,keeptemp:20,appli:[0,34,10,35],input:[31,15,20],mod:[0,31,15],format:[0,19,20,13,22,10],big:[35,34,36],checksum:4,shiftright:[23,15,31,9],rs_name:[2,34],replsetserv:[28,22,1,19,20,2,33,34,8,4,7,29,10],like:[0,19,20,14,31,15,6,36,10],success:[21,4,10],resolv:19,collect:[0,2,3,4,6,9,10,12,13,14,22,34,19,20,21,24,26,27,29,37,32,33,18,35,36],bson_data_cod:1,popular:35,bamboo:34,variant:35,serverpair:34,often:[31,15],federated_f9:[],creation:[22,19,20,34,32,35],some:[28,0,7,19,20,21,34,4,6,29,35,36,10],back:[0,22,8,14,31,15,4,20,35],understood:35,dropallindex:[24,9,20],scale:[35,36,20],slaveok:[34,19,20],chunksiz:[21,36,4],retri:[35,34,19,27],larg:[0,19,20,21,35,36],cgi:[],intial:20,previou:[36,27],run:[12,19,20,2,34,13,35,36,37],lublow:32,simple_reset_error_history_col:19,step:36,simple_explain_queri:20,zir:14,subtract:[23,15,31,9],"96b8":[],k1mnspb8wvq:25,allowfullscreen:[25,32,17],recordquerystat:19,block:[36,19,20],cygwin:34,flashvar:[],within:[31,15],simple_index_test:20,ensur:[19,20,34,6,35,36],test_collection_index_exist:20,bson_deseri:34,textual:[31,15],custom:[0,34,36,27,20],includ:[0,19,20,18,32,4,6,34,35,27,10],forward:4,files:4,properli:[34,4],uniquedoc:20,"_bsontyp":34,link:[12,36,37,35],translat:14,simple_count_exampl:20,line:[14,36,4],info:[34,22,36,19,20],concaten:[31,15,4],consist:34,caller:10,forceserverobjectid:[34,19,27],contin:14,readlin:[24,4,9],similar:21,constant:[28,1,10,4,23,24,9,19],multiplecoll2:19,parser:[34,1,19,27],doesn:[0,27,13],repres:[10,8,31,15,4,30,16,35],isconnect:34,titl:[0,20,26,13],unidirect:10,wakup:19,nice:35,deseri:[1,10,34,23,35,9],bcoe:14,jannehietamaki:34,mongodb:[0,1,2,18,4,6,7,8,9,10,12,13,14,22,17,34,19,20,21,25,27,28,29,32,33,35,36],eval:[1,10,20,34,24,9,19],profilinglevel:[22,24,9],algorithm:[2,31,15,27,34],cursorinform:19,"11cf":[],tradeoff:36,awesom:[12,25,17],far:4,hello:[28,7,19,13,20,4,1,35,36,29],code:[28,22,7,10,20,33,34,8,4,1,29,35,36,19],partial:[10,20],worldbuff:4,queri:[0,22,19,13,12,18,20,4,6,37,34,35,26,27,10],idvalu:0,mongoskin:14,octet:4,replicasetcheckinterv:34,base64:[2,34,27,29],update_a_simple_document_upsert:20,send:[2,35,34,19,27],swliveconnect:[],io_seek_end:4,sens:13,reapertimeout:[34,19,27],passiv:34,result2:29,degrunt:14,writebuff:34,untouch:27,relev:35,magic:14,gettim:[10,8],fieldorspec:[19,20],fewer:20,"try":[35,34,20,36,13],race:34,bson_data_binari:1,smaller:21,fortun:35,natur:35,jump:[35,36],video:36,odm:[14,12,25],download:35,odd:[31,15],append:[21,4,35],compat:34,index:[12,1,19,20,18,6,24,26,34,9,10],compar:[8,31,15,4,6,23,9],test_correctly_access_collect:19,access:[10,20,21,22,4,30,16,19],experiment:34,asced:10,lee:34,bson_data_int:1,simplereach:32,cursor_count_collect:10,calipso:14,let:[7,10,20,34,4,35,36,19],filedescriptor:36,becom:35,sinc:[35,31,15,36,13],subtype_byte_arrai:28,nexttick:34,convert:[0,35,8],convers:[35,20],larger:[21,34,36],technolog:32,chang:[20,31,15,35,36,34],configur:[2,35,18,19,34],read_secondari:[2,34],app:[2,34,32],mattinsl:14,api:[12,19,14,23,24,36],redi:32,chrisgibson:14,from:[28,0,22,1,19,13,2,21,18,15,4,34,36,20,29,35,8,31,10],batchsiz:[24,10,19,9,20],doubl:[12,34,23,16,35,9],next:[0,1,10,32,36,27],websit:[14,32],chr:4,sort:[0,10,13,34,20,6,24,8,9],src:[25,32,17],benchmark:34,name2:0,socketopt:[2,34,27],sollect:18,account:20,retriev:[0,22,10,13,21,34,20,4,35,36,19],scalabl:21,multiple_db_inst:19,annot:36,tag:[34,20],thin:14,assum:[31,15],fetch:[0,29,10,20,6,35,19],queryfailur:34,control:[35,34,36,27],objectid:[28,0,22,7,19,12,33,3,20,4,23,1,36,34,29,35,8,27,9,10],process:[14,31,15,10,34],lock:[34,36,19],calcul:1,username_:6,high:[19,20,31,15,35,34],unopen:34,serial:[1,19,20,34,23,9],pingresult:22,integration_test_:[2,19],instead:[0,19,20,2,34,6,36,27,10],npm:[35,34],await:19,formattedorderclaus:34,originaldata:29,alloc:[34,1,19],aaaaipotmrk:32,remove_all_documents_no_saf:20,correspond:[6,18,15,31],element:[0,4,35,10],issu:[35,34,20],writ:4,allow:[19,20,18,22,34,35,36,27,10],subtyp:28,deoptim:34,movi:[],doc2:35,doc3:35,move:[21,34,4,35],alexeypetrushin:14,doc4:35,autoindexid:19,server_opt:27,effici:[35,36,20],bunch:[34,19,20],perfect:35,total:[0,20],crash:34,greater:[0,31,15,10],handl:[10,20,31,15,4,35,36,34],databs:[21,18,27],auth:[34,19],renamecollect:[24,19,9],precess:35,numberofremoveddoc:20,writefil:[24,21,36,4,9],convin:0,anyth:34,edit:[36,4],emb:[25,32,17],slide:32,deserializeddoc:1,exampledb:[35,36],subset:[10,20],opensync:4,chunk:[21,34,36,4],bson_binary_subtype_uuid:[28,1],default_content_typ:4,pushal:[35,34],our:[35,36,4,10],special:[35,31,15,36,10],out:[12,19,8,2,34,20,35,36,27,37],variabl:[35,34,20],trickier:[0,35],categori:36,suitabl:36,clsid:[],leverag:35,ref:34,clone:14,math:8,jessica:[0,13],insid:[0,36,21,6],dropcollect:[24,18,19,9],unpars:34,releas:34,princess:20,unwant:0,could:[35,34],shiftleft:[23,15,31,9],keep:[21,34,19,35,20],length:[28,22,1,10,20,21,8,4,23,36,9,19],lte:0,primarki:0,minkei:[12,23,1,34,5],evanp:14,debugmessag:34,iszero:[23,15,31,9],should_correctly_rewind_and_restart_cursor:10,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:19,prioriti:34,"long":[12,1,10,8,34,15,23,35,9],start:[28,0,1,10,20,2,18,4,35,36],system:[14,18,36,4],messag:[19,13,34,22,4,20],createfromtim:[23,34,9,8],bson_data_max_kei:1,termin:4,"final":[35,34,20],idottv:14,deconstruct:36,test_gs_getc_fil:4,exactli:18,gridstorew:4,bson_data_object:1,replset:[2,19],mongoserv:[18,27],tocollect:19,charact:[28,34,8,4,20],test_gs_puts_and_readlin:4,seriou:34,"function":[0,1,2,18,4,7,8,10,13,14,15,22,34,19,20,21,27,28,29,31,33,35,36],counter:[27,20],terribl:34,viewer:[],corrupt:22,have:[0,19,20,2,18,4,6,35,36],tabl:[35,18,25],need:[0,1,19,13,21,18,15,31,6,35,36,27],turn:[0,22,19],border:25,buildinfo:[22,24,9],min:[34,19,10,20],rout:14,mix:[0,6],milli:22,test_other_drop:20,orgiin:4,singl:[28,0,32,19,13,21,34,20,4],fileid:[36,7,4],statsync:4,whi:0,serverconfig:[34,19,27],why:[14,35],overwriten:4,url:[14,19],timestamplib:31,request:[34,10],face:35,test_collect:13,snapshot:[10,20],error:[0,22,7,19,13,14,21,18,20,4,6,33,34,35,27,10],determin:[35,10],streamrecord:[24,35,34,10,9],fact:[35,13],text:[32,31,15,36,4],serializefunct:[34,1,19,20],verbos:20,"static":14,nagl:[2,34,27],anywai:[19,20],setter:[4,8],locat:[35,20,4,10,19],playerkei:32,should:[0,22,19,20,18,15,36,29,8,31,10],noid:14,test_cursorstream_paus:33,local:[3,19],devnul:14,doc1:35,ritch:[14,34],kiefer:32,gettimestamp:[23,34,9,8],donewithwrit:36,enabl:[34,19,27],organ:32,simple_batch_size_collect:10,tohexstr:[0,23,34,9,8],integr:[14,35,36],contain:[28,1,19,20,2,18,4,35,36,10],grab:[22,19,10],mon4mongo:14,"4e9491be94469d0054000072":[],view:14,modulo:[0,23,15,31,9],packet:34,meritt:14,statu:[14,35,34],wire:[35,34],correctli:[35,34,20],state:[35,10,27],crude:35,world2:20,kei:[0,1,19,20,34,4,6,35,36,27,10],buckets:20,simple_queri:20,isol:34,job:[14,20],entir:[36,4,10],auto_reconnect:[7,10,20,2,22,4,33,29,35,36,27,19],crc32:1,addit:[0,1,19,20,31,15,22,36,10],mongod:14,admin:[12,32,19,20,34,22,24,9],mongoj:14,equal:[28,0,22,7,19,20,33,31,15,4,23,1,29,35,8,9,10],etc:[0,27,20],instanc:[22,1,10,20,2,34,8,4,29,35,36,27,19],greaterthan:[23,15,31,9],mongoq:14,subtype_funct:28,comment:[34,10,20],toint:[23,15,31,9],structur:[0,36,35],removealllisten:34,save_a_simple_docu:20,addition:18,compon:34,json:[12,23,15,31,35],treat:[0,34,10],pkfactori:[19,20],immedi:13,bit:[0,1,21,31,15,35,36,34],both:[34,20],assert:[28,22,7,10,20,33,8,4,1,29,19],ador:14,present:[6,18,32,12],replic:[2,19],multi:[20,13],plain:34,cursor:[0,7,19,20,12,34,22,33,24,35,9,10],defin:[28,0,1,19,13,31,15,4,34,20,35,27],setreadprefer:34,bson_data_arrai:1,observ:14,layer:[14,35],helper:[14,34],site:2,lightweight:14,tojson:[23,15,31,9,34],getc:[24,4,9],cross:34,member:[2,34],world_no_saf:20,probabl:0,gett:14,difficult:36,calculateobjects:[23,1,9],http:[14,34,32,17,35,25],hostnam:27,keepal:[2,34,27],upon:10,pluginspag:[],retriv:22,student:25,serializewithbufferandindex:[23,1,9],chunk_siz:[21,4],off:[10,2,18,22,4,34,35,27,19],center:20,nevertheless:27,well:[0,34,36,35],exampl:[28,0,22,7,19,12,21,18,13,4,33,6,37,1,36,20,29,35,8,27,10],command:[10,20,14,34,22,4,24,35,27,9,19],simple_geo_near_command:20,validatecollect:[34,22,24,9],latest:35,distanc:20,paus:[33,7,24,9],less:[35,31,15],"boolean":[7,19,20,21,31,15,4,6,1,36,10],additon:6,tcp:35,arrj:14,indexinform:[10,20,34,6,24,9,19],web:[14,35],seekloc:[36,4],add:[22,19,8,31,15,6,23,20,35,9],cleanup:[34,36],tjanczuk:14,logger:34,match:[0,22,20,13,18,15,35,31],karait:14,simple_key_based_distinct:20,piec:[35,31,15,36],know:18,password:[34,22,19],recurs:[15,31,1,4],isclos:[24,10,9],desc:[0,10],bson_data_str:1,insert:[0,22,1,19,12,18,13,4,24,34,33,20,35,26,27,9,10],resid:35,backbon:32,fsync:[22,19,20],isui:32,chunkcollect:[24,4,9],necessari:0,"0xff":1,async:[14,35],page:[0,32,35,12],dispatch:35,milewis:14,suppli:[34,36],macromedia:[],gridf:[12,29,37,21,34,4,36],flush:[36,7,4],proper:34,fileinfo:36,newhex:8,librari:[14,12,34,36],leaf:14,lead:[31,15,34],leak:34,avoid:[6,34,22,35],fromint:[23,15,31,9],thank:34,leav:[34,13],kcbanner:14,mode:[10,20,21,18,4,34,36,27,19],slight:35,journal:19,usag:[28,12,1,29,8,2,21,18,4,34,35,36,27],collection_nam:18,host:27,although:36,offset:[28,36,4],java:[31,15],cliftonc:14,simpler:[14,35,34,10,20],continu:14,about:[19,13,6,35,36,27,10],actual:[0,36,19,35,27],socket:[12,19,2,34,32,17,35,27],dbinstanc:36,notequ:[23,15,31,9],constructor:[1,2,3,4,5,7,8,9,10,11,15,22,16,34,19,20,23,24,27,28,29,30,31,33],fals:[0,22,7,19,13,21,18,20,4,33,1,34,29,36,27,10],disabl:[2,34,27],own:[34,4],automat:[7,19,2,21,34,35,36,27,10],dataset:[0,35],bson:[0,7,3,4,5,1,8,9,10,11,12,13,22,16,18,19,20,23,27,28,29,30,33,34],merg:[34,20],val:20,pictur:36,transfer:19,mykei:35,much:[35,36,13],concat:0,"var":[28,0,22,1,19,13,2,21,18,20,4,33,7,36,29,35,8,27,10],fsname:29,deliveri:32,brand:34,learnboost:14,waitforconnect:34,overflow:[31,15],inlin:20,bug:[34,36],count:[0,19,13,18,20,4,24,34,9,10],made:36,wise:0,whether:[31,15],wish:[28,1,19,20,22,4,36],displai:[32,19],asynchron:[2,35],record:[0,19,13,21,18,20,4,6,35,27,10],below:[35,31,15,19,13],limit:[0,10,20,21,24,35,9],otherwis:[1,10,31,15,4,35,36],problem:[34,22],myexperience1123429378001:32,evalu:[1,19],"int":[31,15],dure:[35,34,22,19,20],year:0,filenam:[21,34,36,4],replica:[2,34,19],implement:[14,35,31,15,34],eric:32,retrymilisecond:[34,19,27],inc:[35,34],tick:34,detail:[6,10,21],deepequ:[29,20,4,10,19],other:[0,32,12,2,31,15,4,35,36,34,37],bool:8,futur:[14,35,34,19],branch:34,stat:[34,24,9,20],findon:[0,19,20,34,24,35,9],"class":[7,3,4,5,1,8,10,11,15,22,16,34,19,20,28,29,30,31,32,33,35,36],geck:14,stai:20,eof:[24,21,36,4,9],integration_test:[7,10,20,22,4,33,29,19],kaij:34,"0_gnhwzhc":25},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","ObjectID()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Double()","Awesome Node.js + MongoDB Applications","Collections","Db()","Collection()","GridStore","Admin()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Binary()","Grid()","Symbol()","Timestamp()","Node.JS Specific Presentations","CursorStream()","Changelog","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver","Articles"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/double","content/awesomeappsvideo","markdown-docs/collections","api-generated/db","api-generated/collection","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-bson-generated/symbol","api-bson-generated/timestamp","content/nodejsvideo","api-generated/cursorstream","changelog/changelog","api-articles/nodekoarticle1","api-articles/nodekoarticle2","api-articles/index"]}) \ No newline at end of file +Search.setIndex({objects:{"":{notEquals:[32,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[32,1,1,""],DBRef:[3,0,1,""],ensureIndex:[10,1,1,""],Binary:[29,0,1,""],streamRecords:[20,1,1,""],deserializeStream:[1,1,1,""],findOne:[21,1,1,""],valueOf:[16,1,1,""],chunkCollection:[4,1,1,""],Long:[15,0,1,""],nextObject:[20,1,1,""],validateCollection:[23,1,1,""],removeUser:[10,1,1,""],profilingInfo:[23,1,1,""],dropIndex:[10,1,1,""],findAndRemove:[21,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[32,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[23,1,1,""],getNumBitsAbs:[32,1,1,""],cursorInfo:[10,1,1,""],"generationTime number [Getter|Setter]":[8,2,1,""],Timestamp:[32,0,1,""],batchSize:[20,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[10,0,1,""],dropCollection:[10,1,1,""],Collection:[21,0,1,""],MinKey:[5,0,1,""],shiftRight:[32,1,1,""],writeFile:[4,1,1,""],Grid:[30,0,1,""],Double:[17,0,1,""],getTimestamp:[8,1,1,""],toString:[32,1,1,""],profilingLevel:[23,1,1,""],collectionNames:[10,1,1,""],toNumber:[32,1,1,""],indexInformation:[10,1,1,""],isOdd:[32,1,1,""],getHighBits:[32,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[23,0,1,""],dropDatabase:[10,1,1,""],Symbol:[16,0,1,""],previousErrors:[10,1,1,""],mapReduce:[21,1,1,""],shiftLeft:[32,1,1,""],shiftRightUnsigned:[32,1,1,""],Cursor:[20,0,1,""],MaxKey:[11,0,1,""],CursorStream:[34,0,1,""],findAndModify:[21,1,1,""],greaterThan:[32,1,1,""],renameCollection:[10,1,1,""],buildInfo:[23,1,1,""],resetErrorHistory:[10,1,1,""],isClosed:[20,1,1,""],getLowBitsUnsigned:[32,1,1,""],toHexString:[8,1,1,""],indexExists:[21,1,1,""],getLowBits:[32,1,1,""],toArray:[20,1,1,""],reIndex:[10,1,1,""],listDatabases:[23,1,1,""],ObjectID:[8,0,1,""],isNegative:[32,1,1,""],geoHaystackSearch:[21,1,1,""],addUser:[10,1,1,""],lessThanOrEqual:[32,1,1,""],isZero:[32,1,1,""],collectionsInfo:[10,1,1,""],lessThan:[32,1,1,""],isCapped:[21,1,1,""],ReadStream:[7,0,1,""],createCollection:[10,1,1,""],createIndex:[10,1,1,""],dropAllIndexes:[21,1,1,""],lastError:[10,1,1,""],geoNear:[21,1,1,""],greaterThanOrEqual:[32,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[8,1,1,""],createFromHexString:[8,1,1,""]},Timestamp:{fromBits:[32,1,1,""],fromNumber:[32,1,1,""],fromInt:[32,1,1,""],fromString:[32,1,1,""]},Db:{connect:[10,1,1,""]},Long:{fromBits:[15,1,1,""],fromNumber:[15,1,1,""],fromInt:[15,1,1,""],fromString:[15,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:14,returnkei:[19,20,21],maxscan:[19,20,21],readfilesync:4,prefix:[19,35],crete:21,createindex:[10,21,19,6,25,9],world_safe2:21,world_safe1:21,pedro:12,test_map_reduce_functions_inlin:21,deviat:19,under:19,everi:[0,20,28,22],test_gs_seek_with_buff:4,simple_next_object_collect:20,upload:22,correct:[1,10,8,19,4,36],gotik:18,"10k":19,erhangundogan:14,seper:4,direct:[6,20,36],second:[20,13,2,19,21,4,37,35,8,28,10],street:14,aggreg:21,even:[0,33,21],attemp:[10,21],neg:[32,15],"256k":37,"new":[0,1,2,19,4,6,7,8,10,13,15,23,35,20,21,22,28,29,30,32,34,36,37],net:14,metadata:[22,37,4],"_event":19,rootcollect:4,never:[19,10],here:[36,37,4],epce4qkoh5:33,io_seek_set:4,integration_tests_to_drop:10,anymor:19,robin:36,getlowbit:[24,15,32,9],findandmodifi:[19,21,25,9,13],vincentcr:19,pvorb:14,schemaless:36,sessionstorag:14,middlewar:[14,33],sarah:21,describ:33,would:[0,10,21,19,15,6,37,32],init:20,concret:14,overhead:36,recommend:[36,33,21],type:[11,12,1,21,22,3,33,4,5,31,17,37,36,29,16,19,23],tell:[10,21,4,25,36,37,9],relat:6,notic:[36,37],warn:[21,10,13],exce:4,hold:[36,1,4,20],must:[0,32,15,21],join:33,err:[0,23,7,20,13,2,22,19,21,4,34,35,30,36,37,28,10],aheckmann:19,setup:[2,37,10],work:[0,10,19,33,4,36,26,37,20],test_gs_tel:4,rework:19,root:[37,4,30],overrid:[10,19,20,21],give:33,simple_geo_haystack_command:21,indic:[0,13,12,35,6,22,36,28],want:[0,10,21,35,4,6,17,36,37,28],keep:[22,19,10,36,21],unsign:[32,15],end:[7,20,21,22,35,33,4,34,36,37],replicaset:[12,10,2,19,36,27],quot:20,playerid:33,how:[12,23,10,21,33,4,31,36,26,37,20],"_id_":[10,21],recoveri:2,rewind:[0,20,19,4,25,9],milisecond:[19,10,8],config:[2,19,10],updat:[29,12,23,10,21,13,19,33,25,36,37,27,9],maxdist:21,recogn:4,after:[7,20,13,14,22,19,33,4,34,1,37],listdatabas:[25,19,23,10,9],befor:[0,10,21,2,19,6,36,37,28],wrong:19,simple_document_insert_with_function_saf:21,beauti:[12,33],descriptior:22,parallel:36,demonstr:33,attempt:[36,23,28],third:4,zzdhidden:14,exclud:[20,21],receiv:37,maintain:33,errorobject:19,order:[0,20,13,21,6,28],oper:[0,23,20,13,19,15,35,32,6,21,36,37,28,10],cursorinfo:[25,10,9],over:[20,21,14,19,33,28,10],becaus:[14,32,15],readbuff:[19,37],flexibl:14,vari:19,digest:[19,37],uuid:[29,1],fit:[36,20],fix:[19,37],mongolia:14,better:[36,19,28],complex:[36,10,21],loggerinst:19,persist:[36,18,21],split:[32,15,4],them:36,thei:[36,19,15,37,32],safe:[13,10,21,19,23,34,36,35,20],update_a_simple_docu:21,yourself:33,bread:14,"instanceof":[10,21,19,23,4,20],choic:19,guileen:14,changelog:[12,19],bonu:36,timeout:[2,19,20,28,21],each:[0,7,20,21,2,19,15,4,32,34,25,37,28,9,10],debug:19,went:21,a_simple_collect:10,mean:[20,2,19,33,36,37,28],resum:[34,7,25,9],overflow:[32,15],reset_error_histori:10,eventstor:14,extract:19,newli:[6,35,23],content:[29,0,7,30,13,14,22,33,4,36,37,9],daniel:[0,28,22],reader:19,got:[36,10,21],more_index_information_test:[10,21],validatecollect:[19,23,25,9],navig:37,worthwhil:37,hang:19,findandremov:[19,25,9,21],situat:19,standard:14,md5:[29,19,1,4],filter:[33,10,21],mvc:14,pagin:21,regress:19,onto:19,rang:[0,19,21],instruct:2,alreadi:[20,13,22,35,4,6,36,28],messag:[13,10,21,19,23,4],unlin:4,getnumbitsab:[24,15,32,9],mojo:14,hexstr:8,rewritten:19,top:[14,32,15,21],startindex:1,tonumb:[24,15,32,9],ton:[36,37],tom:33,kamikazepanda:18,listen:[19,20],consol:[0,1,13,22,35,36,37,28],namespac:3,eventlisten:19,took:20,incur:36,removeus:[25,19,23,10,9],silli:36,target:[37,21],provid:[10,21,14,32,15,4,36,37],zero:[19,15,32,8],project:[14,12,26,33],matter:36,iron:36,myexperience620186085001:33,beginn:12,websocket:[14,36],abov:[36,37,13],mind:36,raw:[0,10,21,19,13,35,37,28,20],manner:[19,37],increment:[36,33],seek:[25,22,37,4,9],dbref:[12,10,3,24,36,19,9],ensureindex:[10,21,19,6,25,9],simple_limit_collect:20,data2:4,simplifi:[14,19,37],evangelist:33,insur:19,plenti:37,usernam:[6,23,10],object:[0,1,2,19,4,6,7,8,10,12,13,14,23,35,20,21,22,28,29,30,31,33,34,36,37],what:[12,20,35,33,36,37],regular:[0,22],tradit:36,simplic:37,don:[19,28,21],doc:[0,23,1,20,13,14,19,21,4,34,36,10],flow:19,doe:[13,15,10,21,19,33,4,35,36,37,32],masylum:14,bson_data_d:1,radix:[32,15],random:4,speedup:19,syntax:19,test_stream_funct:20,identifi:[36,35,37],absolut:[32,15,37,4],acquir:20,field2:0,explain:[0,10,21,25,9,20],field1:0,theme:36,busi:36,rich:36,ppf_qxbkwm4g:33,io_seek_cur:4,cachefunct:1,nasti:19,test_cursorstream_destroi:34,stop:19,collectionsinfo:[25,10,9],bson_data_numb:1,report:36,youtub:[26,33,18],databank:14,bar:4,emb:[26,33,18],patch:19,previouli:20,fileidobject:4,steam:20,fieldnam:0,fair:37,indexnam:[10,21],num:21,tocollect:10,previouserror:[25,10,9],respons:[0,33,20],fail:[30,21,19,23,36,10],hash:[0,19,37,10,28],said:37,databas:[0,30,23,20,13,14,12,19,21,4,31,35,22,36,37,27,28,10],test_gs_empty_file_eof:4,discoveri:33,gridstor:[29,12,23,7,20,21,22,19,8,4,34,31,1,25,30,37,27,9,10],simplest:[14,0,37],awai:37,lotsofdoc:36,side:14,accord:2,newnam:21,simple_key_based_distinct:21,getlasterror:[23,10,21],howev:20,against:[0,23,20,21,19,15,4,8,32,10],logic:[0,19],browser:14,com:[12,14,19,33,18,36,26],con:33,assur:20,asced:20,simple_explain_collect:20,height:[26,33,18],getmorecommand:[20,21],path:[22,19,4],guid:12,assum:[32,15],duplic:[10,6,19,20,21],three:[36,37,4],been:[19,37,20,10],much:[36,37,33,13],basic:[12,10,31,21,36,37],quickli:33,life:37,regul:20,nodeeventstor:14,isodd:[24,15,32,9],ani:[0,10,13,14,36,37,20],child:10,"catch":21,laurie71:19,another_root:4,dissect:37,properti:[0,8,22,19,4,24,25,9],calcul:1,marriag:[12,33],"typeof":[19,1,4],succes:21,toolkit:14,sever:[13,2,35,6,36,28],grown:36,usessl:10,test_is_close_function_on_cursor:20,perform:[0,23,10,21,19,15,32,20],make:[0,20,13,19,21,6,36,37,28],transpar:33,meetup:[12,33],drawback:37,descend:[6,20],isneg:[24,15,32,9],complet:21,nin:0,rail:14,hand:28,fairli:19,tune:37,scenario:28,geohaystack:21,test_close_function_on_cursor:20,client:[23,10,13,14,21,4,30,36,20],thi:[29,0,23,7,20,13,14,22,19,15,4,28,32,6,33,37,21,36,8,26,10],everyth:13,settimeout:[34,19,7,21],left:[32,15,10,28,21],protocol:[36,19],just:[0,37,36,21],laptop:19,ordin:[10,21],farther:7,yet:28,languag:[14,36,33],previous:19,doc1:36,wmode:33,easi:14,collectionn:28,had:20,board:33,els:[21,23,28,13],ffffff:33,save:[10,21,22,13,4,25,28,9],dynamicstream:33,applic:[12,10,14,33,18,36,37],milli:23,preserv:20,background:[10,21],test_ev:10,apart:[36,37],measur:19,specif:[0,20,12,19,33,4,21,36,8,35,10],arbitrari:4,negat:[24,15,32,9],collection2:[10,21],collection1:21,underli:34,www:[12,10,14,33,18,26],right:[33,32,15,37,36],old:4,creek:33,deal:36,manual:[12,9],interv:19,deserializestream:[24,1,9],dead:19,intern:[0,32,15,22,21],successfulli:20,thu:13,m_tddbw6qnuu4iuxlyo:33,nwtj:14,timestampd:8,multipli:[24,15,32,9,21],fog:33,christkv:[36,19],condit:[0,19,21],localhost:[14,36,35,37,10],a_simple_create_drop_collect:10,collection_stats_test:21,promot:36,repositori:[14,36],post:[0,32,15,35],ryanke:14,plug:36,obj:21,slightli:36,simul:[32,15,37],commit:10,simple_previous_error_col:10,bson_data_symbol:1,"float":[36,32,15],simple_skip_collect:20,bound:[10,20,21],down:[19,10],wrap:[0,7,16,19,34,17],storag:[14,36,37],git:14,wai:[0,13,21,14,19,15,36,37,32],support:[0,19,37,36,22],happi:[14,12,33],avail:[23,7,20,21,2,19,33,4,34,36,37,10],width:[26,33,18],test_rename_collection3:21,call:[0,10,14,19,4,37,28,20],constantli:36,bulqmxg0vdc:33,fork:14,head:[37,4],medium:23,form:[19,33,4],forc:[10,19,23,20,21],"true":[0,23,1,20,13,2,22,19,33,4,34,6,35,7,21,30,36,37,28,10],reset:[0,10,4,20],new_nam:35,highbit:[32,15],maximum:[36,19,20,10],until:[36,23,10],deprect:20,fundament:36,sampl:36,emit:[36,19,34,10,21],shouldcorrectlyfailonretryduetoappcloseofdb:10,featur:37,"abstract":14,fromstr:[32,19,15,24,9],exist:[0,23,10,13,22,19,21,4,6,35,25,36,37,28,9],videoplay:33,check:[0,23,7,20,21,22,19,15,4,34,6,1,36,32,10],test_collection_opt:21,bson_binary_subtype_md5:[29,1],test_to_a_after_each:20,floor:8,tip:12,refactor:19,simple_limit_skip_find_one_queri:21,test:[23,20,13,14,22,19,21,4,18,36,37,35,10],forceclos:10,miliscecond:[34,7],node:[12,20,2,19,33,14,18,36,26,9],insensit:20,consid:21,sql:36,cachefunctionscrc32:1,errormessag:19,teixeira:12,faster:[6,19],ignor:[36,1,21],time:[12,20,21,2,19,33,14,31,36,8,28,10],push:[20,14,19,34,36,10],backward:[19,20],daili:33,concept:[36,19],skip:[25,0,20,9,21],global:19,primer:[12,37,33,31],row:21,millisecond:28,middl:21,depend:19,originalhex:8,dropindex:[25,6,10,9,21],sourc:[33,18,20],string:[29,0,23,1,20,21,22,3,15,4,16,32,6,37,35,30,36,8,19,10],feasibl:37,test_cursorstream_resum:34,logmeup:14,contenttyp:22,level:[10,21,14,19,23,4],did:[19,10],dig:36,eventemitt:20,iter:[20,21],item:[7,10,21,19,23,4,34,36,20],team:33,quick:[36,37,33],div:[33,24,15,32,9],round:36,databasenam:[10,28],wtimeout:[19,23,10,21],addtoset:36,sign:[32,15,35],slow_onli:23,cost:19,port:[19,10,28],comparis:4,checkoutwrit:10,repli:[36,23,21],muq2w2u5x9m:26,current:[15,10,22,3,33,4,36,37,32,23],subtype_uuid:29,boost:14,deriv:[32,15],gener:[12,10,8,14,19,21,37,28],wait:[10,21],box:36,bson_data_regexp:1,shift:[19,15,32],queue:[14,36],behav:19,examp:14,more_complex_ensure_index_test:[10,21],extrem:19,weird:19,werehamst:14,checkkei:1,extra:0,modul:[14,19],prefer:[0,19,36],toarrai:[0,20,21,14,19,23,25,36,9,10],bxhflrwemeg:18,instal:[36,19],includeloc:21,aaaaipotmrk:33,perf:19,memori:[0,20,31,12,19,36,37],regep:36,connector:[12,33],live:[36,19,37],handler:37,value2:0,value1:0,criteria:13,scope:[36,19,1,10,21],prev:21,maxkei:[11,12,1,19,24,9],multiplecoll1:10,share:[14,19,33,10,28],finit:[32,15],visual:14,examin:36,content_typ:[22,37],fly:14,cap:[36,19,10,21],uniqu:[0,21,10,28,6],test_correctly_access_collect:10,whatev:28,bson_binary_subtype_funct:[29,1],mongo:[12,10,13,14,19,33,36,37,31],stream:[7,20,22,19,34,4,1,25,36,37,9],predict:19,bson_data_long:1,createcollect:[10,21,19,34,25,36,35,9,20],topic:[12,33],nocr:14,kaflr8pi5nk:26,occur:[0,20,13,22,19,4,6,35,28],alwai:[36,32,15,20,21],multipl:[21,2,32,15,28,19],ping:[25,19,23,10,9],fieldvalu:0,write:[29,1,10,2,22,19,4,24,7,25,36,37,9,30],foreach:[4,21],pure:[29,23,7,20,21,34,19,8,4,1,30,10],nyc:[12,33],map:[36,21],product:[33,32,15],max:[10,19,20,21],dive:[36,37],date:[1,20,8,19,21,23,6,36],docstartindex:1,data:[29,12,7,20,21,22,19,33,4,34,31,1,18,30,36,37,10],grow:36,sbrekken:19,inform:[20,21,2,22,23,4,6,14,36,28,10],"switch":19,reaper:[19,10,28],combin:[33,4,10],anoth:[0,4,36,8],filedata:4,talk:33,gettimestamp:[19,24,9,8],still:[0,19,13],pointer:[0,35,4,28,22],dynam:33,test_map_reduce_funct:21,group:[12,21,19,33,25,26,37,9],gte:0,indexexist:[19,25,9,21],jim:21,nodelai:[2,19,28],platform:36,mbostock:19,requir:[29,23,7,20,13,34,19,21,4,1,37,35,30,36,8,28,10],main:[12,37,33,36],non:[14,19,21],"6pjmp23z0lw":26,encod:[2,36,19,28],col2:10,col3:10,initi:[10,21,19,4,36,37,20],col1:10,verifi:[10,8,23,4,21],now:[36,19,37,10],discuss:[12,33],nor:35,introduct:[2,12,33,36,31],mapreduc:[19,25,9,21],name:[29,0,23,1,20,13,2,22,3,33,4,28,6,35,21,37,19,10],drop:[10,21,19,23,6,25,35,9],revert:0,crypto:19,separ:[0,19,4],recreat:28,jprichardson:14,failov:[2,19],replai:19,dialect:14,replac:[0,21,19,13,4,36],individu:[0,19],firej:14,a_1_b_1:[10,21],ensur:[10,21,19,6,36,37],poolreadi:19,serverclust:19,happen:[34,7,4,20],shown:[36,37],accomplish:37,space:[1,10],streetsaheadllc:14,profil:[23,20,21],tohexstr:[0,19,24,9,8],factori:[0,28,21],resultset:36,million:33,orm:[14,33],mime:4,sethml:19,replacethiscollect:21,org:[14,12,10],"byte":[29,0,1,10,8,22,19,36,37,28],care:[2,0,36],question:[33,32,15],bradberri:33,synchron:36,thing:[36,37,28],place:[12,32,15],year2013:19,frequent:[32,15],first:[0,23,20,13,22,35,33,4,37,21,36,8,28,10],origin:[21,13],bson_binary_:19,directli:[0,20,36],onc:[6,36],arrai:[29,0,23,1,20,13,2,22,19,21,4,36,35,10],"0x7f":1,reopen:[4,28],"long":[12,1,20,8,19,15,24,36,9],serverinfo:21,open:[23,7,20,13,2,22,19,33,4,25,35,34,21,30,36,37,28,9,10],predefin:1,size:[0,1,20,21,22,19,15,4,37,32,10],given:[29,10,21,32,15,4,37,20],breviti:[36,37],workaround:19,paramt:20,collectionnam:[10,21,35,23,6,25,37,9],conveni:[0,32,15],subtype_md5:29,especi:36,copi:2,specifi:[29,0,10,21,22,19,4,36,37,28,20],test_rename_collection2:21,test_arrai:20,keepgo:[19,21],than:[0,20,13,21,2,22,19,15,32,37,28],png:[22,4],serv:33,firebas:14,tedeh:19,were:[20,13],posit:[29,22,32,15,4,37],seri:14,pre:[23,1,10,21],lowest:19,sai:37,pro:33,argument:[29,32,23,7,20,21,34,3,15,4,16,1,17,37,30,8,19,10],simple_rename_collection_2:10,deliv:33,bitwis:[36,32,15],squar:14,alias:0,destroi:[34,7,25,9],note:[32,15,20,10],take:[0,1,2,19,33,36,37],createfromhexstr:[0,19,24,9,8],begin:[0,4],sure:[37,20],normal:20,buffer:[29,0,1,20,13,22,19,21,4,35,30,37,28,10],clearer:19,getyear:21,homepag:14,deepequ:[30,10,21,4,20],renam:[10,21,35,25,36,9],byte_valu:29,later:[37,10,21],indexbound:[10,21],test_gs_read_stream:4,runtim:19,parseint:21,axi:21,show:[29,7,10,21,34,8,4,1,30,36,20],simple_count_exampl:21,objectid3:8,objectid2:8,concurr:19,corner:19,onli:[0,23,20,13,2,19,21,4,6,36,37,28,10],slow:[19,23,10,21],dice:36,setprofilinginfo:23,activ:[14,19],state:[36,20,28],analyt:[14,12,33,36],overwritten:37,min_valu:[32,15],variou:[14,23,21],get:[7,19,4,6,8,9,10,12,13,14,23,35,20,21,22,25,28,30,31,33,34,36,37],secondari:[2,19,10,20,21],ssl:[19,10],cannot:[10,21,32,15,36,20],shiftrightunsign:[24,15,32,9],geo:21,gen:33,nolock:[19,10],doabl:0,seldom:19,yield:[19,21,10,35,13],isarrai:1,caboos:14,nettl:14,where:[29,0,1,10,13,2,22,19,21,4,6,36,37,35],geospati:[10,21],desced:20,wiki:36,khwang:14,testcas:19,infinit:[19,15,32],detect:2,heckmann:19,fs_chunk:37,integration_tests_2:10,wayt:21,enough:20,between:[36,19,33,10,28],"import":[36,37],across:[19,28,21],spars:[6,10,21],august:[12,33],subtype_user_defin:29,tut:12,test_group:21,come:[22,32,15,21],simple_find_and_modify_operations_:21,region:21,gwt:[32,15],tutori:[12,26,37],mani:[36,20],fromnumb:[24,15,32,9],reindex:[25,19,10,9,21],iscap:[19,25,9,21],dir:13,dispatch:36,createcreateindexcommand:19,fs_file:37,lessthan:[24,15,32,9],reaperinterv:[19,10,28],cursor_information_collect:10,cursorinst:20,coupl:[29,36,21],aciev:0,rebuilt:[10,21],addit:[0,1,10,21,32,15,23,37,20],derefer:[25,19,10,9],lowbit:[32,15],geonear:[19,25,9,21],"1mb":37,those:[32,15],"case":[20,21,32,15,6,36,37,19],myself:36,bson_seri:19,tostr:[29,30,8,32,15,4,24,21,37,9],trick:[12,37],invok:37,isconnect:19,firstext:23,simple_sort_collect:20,trello:[12,33],advantag:36,createexperi:33,eras:[22,35],dynamicgui:14,ascii:[2,29,19,28],acess:10,develop:[14,12,33,36],author:[0,22,13],media:14,same:[0,20,21,19,15,4,6,8,32,10],binari:[29,0,23,7,20,12,22,19,13,4,34,24,1,21,30,36,8,35,9,10],html:12,document:[0,23,1,20,12,2,22,19,13,4,33,34,6,35,7,21,14,36,37,28,10],howtonod:12,createpk:28,exhaust:20,ifram:[26,33,18],finish:[37,21],closest:[32,15,21],utf8:[2,36,19,4,28],nest:[0,6],oid:3,driver:[0,13,2,12,19,33,35,14,25,36,37,28,9,31],gotend:4,capabl:33,newobjectid:8,improv:19,extern:12,defo:0,bson_data_boolean:1,appropri:33,moder:33,distancemultipli:21,brightcov:33,without:[1,10,32,15,28,35,19],model:[14,33,21],dereferenc:10,upsert:[21,13],ourexamplefiletowrit:4,execut:[23,10,13,19,21,4,36,20],when:[0,1,20,13,2,22,19,33,4,34,35,7,21,36,37,28],rest:[14,19,8,21],hint:[20,21],db_connector:[35,28],except:[36,19,4,13],littl:36,desktop:12,blog:[14,0,35,12],framebord:[26,33,18],default_chunk_s:4,haystack:21,real:[14,12,33],around:[14,12,19,36],read:[29,7,20,21,2,22,19,4,24,25,36,37,9,10],period:[0,35],grid:[29,12,30,14,19,25,37,9],pop:36,world:[7,10,21,13,4,1,37,30],lasterror:[25,19,10,9],reap:19,mod:[0,32,15],saniti:19,poolsiz:[7,10,21,19,23,4,34,30,36,28,20],realtim:[12,33],integ:[0,1,8,32,15,36,19],server:[29,23,1,20,13,2,34,19,33,4,14,35,7,37,21,30,36,8,28,10],firebaseco:14,either:[22,19,37,36],output:[0,21],greaterthanorequ:[24,15,32,9],manag:[14,22,19,36],kvalheim:33,bson_binary_subtype_byte_arrai:[29,1],eventloop:37,"_bsontyp":19,intact:13,generationtim:8,setnodelai:19,slice:36,writedata:37,node_ev:19,confirm:36,definit:12,legal:21,evolv:36,profilinginfo:[23,25,9],bson_data_binari:1,power:[14,33],broken:19,aquir:10,bson_binary_subtype_default:[29,19,1],regexp:[36,19,1],"throw":[36,19,37,13],comparison:8,pointer_to_collect:0,firstnam:[0,6],nocooki:[26,33,18],numbit:[32,15],bson_data_code_w_scop:1,gump:21,act:37,luck:37,other:[0,15,12,2,19,33,4,36,37,32,31],readstream:[25,12,7,20,9],addus:[25,19,23,10,9],test_collections_info:10,your:[21,2,33,4,14,36,37],loc:21,log:[0,1,20,21,14,22,19,13,23,35,36,37,28],hex:[0,30,4,8],overwrit:[23,4],dropdup:[19,10,21],strict:[19,35,10,28,21],interfac:[7,20,14,19,34,36,30],low:[36,32,15,37],lot:[12,20,21,19,6,34,36,37],isvid:33,tupl:6,shamelessli:36,replsetsrv:2,longer:[19,4],pull:[36,19,23],dirti:36,possibl:[0,10,13,14,19,21,6,36],"default":[29,0,23,1,20,13,2,22,19,21,4,6,37,35,36,8,28,10],remove_subset_of_documents_saf:21,auto_reconnect:[7,10,21,2,23,4,34,30,36,37,28,20],connect:[12,7,20,21,2,19,23,4,14,31,34,37,25,30,36,26,28,9,10],gone:[30,10,4,21],creat:[29,0,23,1,20,21,2,22,19,33,4,34,6,7,37,35,30,36,8,28,10],certain:[6,36],watcher:14,intro:36,file:[7,10,14,22,19,4,37,30],russel:33,calculateobjects:[24,1,9],again:[4,20],kaba:14,compel:33,event:[7,10,22,19,4,34,36,37,28,20],field:[0,20,13,19,33,6,21,36,10],valid:[29,1,20,8,35,23,10],longlib:15,you:[0,1,20,13,2,22,19,33,35,6,21,36,37,28,10],scttnlsn:14,pefrom:21,sequenc:19,symbol:[12,1,16,19,24,36,9],briefli:33,opt_radix:[32,15],pool:[19,10,28],reduc:[19,15,32,21],lessthanorequ:[24,15,32,9],coreh:14,directori:19,descript:[29,10,1,4,20],tricki:36,potenti:19,alright:36,cpu:[19,37],unset:36,represent:[11,29,15,30,8,3,33,4,5,17,16,32],all:[0,23,1,20,12,2,22,19,13,4,6,35,21,36,37,28,10],forget:36,numberupd:21,dollar:35,month:33,simple_rename_collect:10,cceac:14,follow:[0,20,13,2,4,6,36,37],fetchsiz:20,disk:[37,7,4,21,20],nodej:[14,33,18],subtype_default:29,nextobject:[25,0,20,9,10],aaron:19,introduc:33,setprofilinglevel:[23,25,9],evaul:10,util:[14,19],test_rename_collect:21,failur:[36,19],veri:[12,19,37,36],base698:14,list:[10,21,19,23,4,25,36,37,35,9],resav:21,adjust:[19,37],default_port:28,small:[19,37,26],retun:1,cursorstream:[25,12,34,20,9],design:[12,33],pass:[1,20,21,2,19,8,4,35,37,28,10],excit:33,deleg:28,abc:[0,4,13],xor:[24,15,32,9],sub:[29,33,21],sum:[32,15],brief:26,delet:[10,21,22,19,4,25,36,37,28,9,30],version:[19,37,10,28,21],cruso:0,method:[29,0,20,21,12,19,8,4,31,35,36,37,28,30],full:[19,10,21],christian:33,variat:36,behaviour:14,foobar2:4,foobar3:4,strong:26,modifi:[36,21,13],valu:[0,1,19,4,6,8,9,10,13,15,23,17,35,20,21,22,24,28,29,16,32,33,36,37],search:[14,12,36,21],ahead:[14,36,37,21],showdiskloc:[19,20,21],amount:[36,32,15,10],base:[8,14,22,21,4,36,37],pick:[36,19,37,10],action:12,mongoos:[14,12,26,33],narrow:21,evalfunct:1,via:36,shorthand:13,lazybum:14,c_1:21,deprec:10,default_root_collect:4,establish:[7,10,21,19,23,4,34,30,20],select:[19,21,28,35,13],test_collection_is_cap:21,distinct:[19,25,9,21],regist:4,two:[0,33,10,13,2,12,32,15,4,22,6,37,14,36,8,35],coverag:19,bson_binary_subtype_user_defin:[29,1],taken:36,minor:19,more:[0,7,20,13,2,34,19,15,4,33,21,36,37,32,10],flag:21,stick:36,particular:36,cach:1,none:[2,33],outlin:[36,37],dev:14,histori:10,remain:[37,4],learn:[14,12,33],scan:[20,21],qard:14,shard:22,accept:[19,21],simple_document_insert_collection_no_saf:21,default_url:10,learnboost:[14,33],robinson:0,cours:36,newlin:4,divid:[32,15,21],rather:21,keepgoingexampl:21,hugh:33,simpl:[29,0,7,20,12,14,34,19,21,4,6,31,1,30,36,37,35,10],resourc:[14,28],brett:33,reflect:19,unlink:[25,22,37,4,9],associ:[37,4],keyorlist:20,github:[14,12,19,18,36],defineproperti:19,save_a_simple_document_modify_it_and_resave_it:21,caus:[36,19],callback:[0,23,20,13,22,19,21,4,6,35,36,37,28,10],spheric:21,doc_id:0,bson_data_oid:1,trade:37,through:[36,19,33,10,21],reconnect:[19,28],paramet:[0,20,13,2,22,19,23,4,6,35,36,37,28,10],style:[14,36,33],mongorepli:19,world_no_saf:21,batchsizevalu:20,asbuff:1,relev:36,stylu:18,rapidli:36,bypass:36,simple_limit_skip_queri:21,might:[6,37,10,36],alter:[0,35],good:[12,37,36],"return":[0,7,3,4,5,1,8,10,11,13,15,23,17,19,20,21,22,28,29,30,16,32,34,35,36,37],timestamp:[12,1,8,19,21,24,32,9],more_complex_index_test:[10,21],framework:14,compound:[10,21],karaco:14,readlen:4,emerleit:14,uploadd:22,unlik:20,authent:[25,19,23,10,9],easili:[19,15,32],achiev:0,skipvalu:20,found:[0,10,21,4,13],truncat:[35,37,4],hard:36,weren:0,realli:36,expect:[0,28],barrier:19,orient:12,primari:[0,10,21,2,19,36,28,20],b4ajeu13u6u:26,read_primari:19,pullal:36,foreground:[10,21],core2duo:19,advanc:[12,31,35,4,36,37],asc:[0,20,13],reason:4,croucher:33,connectionopt:10,put:[29,20,21,19,4,24,25,37,9,30],seconddb:10,gethighbit:[24,15,32,9],tailabl:[19,20,21],omit:[36,3,37,19],perman:10,assign:[2,19],notifi:[36,37,21],articl:[12,37,31],lastnam:[0,6],number:[29,0,23,1,20,21,19,15,4,32,6,17,37,36,8,28,10],done:[0,7,10,21,22,19,13,23,34,36,37,28],construct:[32,15],autoclos:[22,37,7,4],create_and_drop_an_index:[10,21],miss:19,differ:[12,10,21,19,15,4,6,37,36,8,32,30],chunk_typ:4,script:[22,33],interact:[36,37,4,30],least:[0,21],custompkfactori:28,settim:8,statement:[36,37,10],illeg:[30,19,23,10,21],master:2,store:[1,10,14,22,4,36,37,20],schema:[12,33],otherid:8,option:[29,0,23,1,20,13,2,22,3,21,4,28,6,35,25,30,36,37,19,9,10],reseterrorhistori:[25,10,9],similarli:36,native_pars:[7,10,21,23,4,34,30,28,20],getter:[4,8],pars:[19,1,21],literarili:36,std:19,kind:37,bson_data_nul:1,whenev:[10,21],remov:[23,10,21,19,13,4,6,25,36,35,9],reus:[19,1,10],str:[32,15],consumpt:37,toward:33,cleaner:14,comput:12,luckili:[36,37],"null":[0,1,20,21,2,19,23,4,14,34,35,30,28,10],built:[14,36],equival:[36,21],valueof:[24,17,9,16],fromcollect:10,also:[0,20,13,12,19,4,6,36,37,35],build:[23,10,19,33,36,37],tool:[14,33],lubow:33,blackboard:[12,18],choos:[36,21],reach:[37,7],most:[0,37,33,36],plai:33,plan:37,selector:[10,19,20,21],"16mb":22,cover:10,part:[36,19,26,8],clean:[14,19,10],frombit:[24,15,32,9],ridicul:14,brightcoveexperi:33,session:[14,33],find:[0,7,20,13,14,22,19,21,23,6,34,25,36,9,10],firewal:19,nosql:[14,12],pretti:36,manipul:21,test_gs_weird_bug:4,numberofdocu:1,queu:14,batch_document_insert_collection_saf:21,hit:[10,21],unus:19,express:[0,12,21,14,22,18,36],fieldtoupd:36,test_map_reduce_functions_scop:21,nativ:[14,36,19,28],ferret:14,restart:[34,7],statist:[19,23,10,21],wrote:36,set:[0,23,1,20,13,2,22,19,33,4,6,35,37,21,36,8,28,10],jade:18,see:[0,13,22,32,15,6,35,36,37,28],easymongo:14,close:[7,20,21,14,22,19,23,4,34,25,30,36,37,28,9,10],my_f:4,lee:19,misalign:19,someth:[4,28],altern:[14,21],signatur:[4,20],complement:[32,15],javascript:[1,10,21,14,32,15,33,36],salzman:19,succeed:6,both:[19,21],last:[14,22,10,36],create_and_drop_all_index:[10,21],context:[33,28],let:[7,10,21,19,4,36,37,20],corrupt:23,whole:[36,10,4,21],createdat:20,load:[0,19],episod:12,jsmode:21,point:[20,21,32,15,36,37],instanti:[36,19],param:33,shutdown:19,suppli:[19,37],backend:36,faithfulli:[32,15],user_id:21,due:[36,19,30],empti:[29,0,21,4,20],otherwis:[1,20,32,15,4,36,37],bgcolor:33,txt:4,strategi:[36,19],test_streamingrecords_funct:20,wish:[29,1,10,21,23,4,37],fire:[7,10,13,14,22,4,36,37,28],admindb:[23,10],imag:[22,37],understand:36,func:[1,21],look:[20,21,22,19,33,4,6,36,37],mdoq:14,straight:[36,37],batch:[36,19,20,21],"while":[0,19,4,22,20],getownpropertynam:19,behavior:[0,13,19,15,36,32],error:[0,23,7,20,13,14,22,19,21,4,6,34,35,36,28,10],fun:37,fixtur:14,loos:[14,36],loop:19,found2:4,test_gs_unlink:4,readi:[34,7,4,36,20],key2:0,key1:0,jpg:4,itself:[12,20],test_deref_exampl:10,rid:19,simple_key_based_distinct_sub_query_filt:21,chase:19,decor:19,gs2:4,geohaystacksearch:[19,25,9,21],coffeescript:[14,12,26],p_db:[2,10],higher:[2,19,37,28,21],"10gen":12,optim:[19,21],operaion:22,numberofretri:[19,10,28],piec:[36,32,15,37],temporari:[4,21],user:[29,0,1,10,13,14,12,19,33,4,6,23],hello2:21,keyf:21,recent:33,travers:20,entri:[10,37,4,21],joyent:33,explan:[10,21],getlowbitsunsign:[24,15,32,9],a_1:21,collabor:33,shape:19,tempcollect:21,update_a_simple_document_multi:21,password:[19,23,10],cur:37,colladow:14,tdegrunt:14,keeptemp:21,appli:[0,19,20,36],input:[32,15,21],subsequ:[10,21],format:[0,10,21,13,23,20],big:[36,19,37],checksum:4,shiftright:[24,15,32,9],rs_name:[2,19],replsetserv:[29,23,1,20,21,2,34,19,8,4,7,30,10],like:[0,15,20,21,14,32,33,6,37,10],fsync:[23,10,21],resolv:10,collect:[0,2,3,4,6,9,10,12,13,14,23,19,20,21,22,25,27,28,30,31,33,34,35,36,37],bson_data_cod:1,popular:[12,33,36],bamboo:19,variant:36,serverpair:19,often:[32,15],creation:[23,10,21,19,33,36],some:[29,0,7,20,12,22,19,33,4,6,21,30,36,37,10],back:[0,23,8,14,32,15,4,21,36],understood:36,dropallindex:[25,9,21],scale:[12,37,33,36,21],slaveok:[19,10,21],chunksiz:[22,37,4],bson_data_min_kei:1,retri:[36,19,10,28],larg:[0,10,21,22,36,37],intial:21,previou:[37,28],run:[12,10,21,2,19,13,36,37,31],lublow:33,simple_reset_error_history_col:10,step:37,simple_explain_queri:21,from:[29,0,23,1,20,12,2,15,19,13,4,32,35,33,37,21,22,36,8,30,10],subtract:[24,15,32,9],k1mnspb8wvq:26,allowfullscreen:[26,33,18],recordquerystat:10,block:[37,10,21],cygwin:19,within:[32,15],simple_index_test:21,contributor:33,test_collection_index_exist:21,bson_deseri:19,fast:14,custom:[0,19,37,28,21],plain:19,includ:[0,20,12,19,33,4,6,35,21,36,28,10],forward:4,files:4,properli:[19,4],uniquedoc:21,ascend:[0,20,6],link:[12,37,36,31],translat:14,atom:[36,19,21],line:[14,37,4],info:[19,23,37,10,21],concaten:[32,15,4],consist:19,caller:20,forceserverobjectid:[19,10,28],gridf:[12,30,31,22,19,4,37],readlin:[25,4,9],similar:22,constant:[29,1,10,4,24,25,9,20],multiplecoll2:10,parser:[19,1,10,28],doesn:[0,28,13],repres:[20,8,32,15,4,16,17,36],idhex:0,titl:[0,21,27,13],unidirect:20,wakup:10,nice:[36,33],deseri:[1,20,19,24,36,9],bcoe:14,jannehietamaki:19,mongodb:[0,1,2,19,4,6,7,8,9,10,12,13,14,23,18,35,20,21,22,26,28,29,30,33,34,36,37],eval:[1,10,21,19,25,9,20],profilinglevel:[23,25,9],algorithm:[2,32,19,15,28],cursorinform:10,tradeoff:37,awesom:[12,26,18],leak:19,far:4,hello:[29,7,10,21,13,4,1,36,37,30],code:[29,23,7,20,21,34,19,8,4,1,30,36,37,10],partial:[20,21],worldbuff:4,queri:[0,23,20,13,12,19,33,4,35,6,31,21,36,27,28,10],idvalu:0,mongoskin:14,octet:4,replicasetcheckinterv:19,base64:[2,19,28,30],update_a_simple_document_upsert:21,send:[2,36,19,10,28],lower:[10,21],io_seek_end:4,sens:13,reapertimeout:[19,10,28],passiv:19,result2:30,account:21,writebuff:19,untouch:28,dbname:[19,10],magic:14,gettim:[20,8],roll:12,fieldorspec:[10,21],fewer:21,"try":[36,19,21,37,13],race:19,marri:33,refer:[10,3,4,36,19,20],smaller:22,fortun:36,natur:[36,33],jump:[36,37,33],video:[12,37],odm:[14,12,26],download:36,odd:[32,15],append:[22,4,36],compat:19,index:[12,1,20,21,19,6,25,27,35,9,10],compar:[8,32,15,4,6,24,9],descriptor:37,access:[10,21,22,23,4,16,17,20],experiment:19,can:[0,20,13,2,22,19,15,35,32,6,37,21,36,8,28,10],chose:33,bson_data_int:1,simplereach:33,cursor_count_collect:20,calipso:14,logout:[25,23,10,9],filedescriptor:37,becom:36,sinc:[36,32,15,37,13],subtype_byte_arrai:29,nexttick:19,convert:[0,36,8],convers:[36,21],larger:[22,19,37],technolog:33,chang:[21,19,15,36,37,32],configur:[2,36,19,10,35],read_secondari:[2,19],app:[2,12,19,33],mattinsl:14,api:[12,10,14,33,24,25,37],redi:33,cloud:12,chrisgibson:14,zir:14,batchsiz:[25,10,20,9,21],doubl:[12,19,24,17,36,9],next:[0,1,20,33,37,28],websit:[14,33],chr:4,simpler:[14,36,19,20,21],sort:[0,20,13,19,21,6,25,8,9],src:[26,33,18],benchmark:19,name2:0,socketopt:[2,19,28],sollect:35,degrunt:14,retriev:[0,23,20,13,22,19,21,4,36,37,10],scalabl:22,multiple_db_inst:10,annot:37,tag:[19,21],thin:14,fetch:[0,10,20,21,6,36,30],queryfailur:19,control:[36,19,37,28],objectid:[29,0,23,7,20,12,34,3,21,4,28,24,1,37,30,36,8,19,9,10],process:[12,20,14,19,15,32],lock:[19,37,10],username_:6,high:[10,21,32,15,36,19],unopen:19,serial:[1,10,21,19,24,9],pingresult:23,integration_test_:[2,10],instead:[0,20,21,2,19,6,37,28,10],npm:[36,19],pois:33,await:10,formattedorderclaus:19,originaldata:30,alloc:[19,1,10],bind:14,remove_all_documents_no_saf:21,correspond:[6,32,15,35],element:[0,4,36,20],issu:[36,19,21],chief:33,writ:4,allow:[10,21,19,23,35,36,37,28,20],subtyp:29,deoptim:19,doc2:36,doc3:36,move:[22,19,4,36],alexeypetrushin:14,doc4:36,spank:19,own:[19,4],server_opt:28,effici:[36,37,21],bunch:[19,10,21],perfect:36,total:[0,21],crash:19,greater:[0,32,15,20],python:12,databs:[22,35,28],dai:[12,33],auth:[19,10],renamecollect:[25,10,9],precess:36,numberofremoveddoc:21,writefil:[25,22,37,4,9],convin:0,anyth:19,edit:[37,4],npmj:14,slide:[12,33],deserializeddoc:1,exampledb:[36,37],subset:[20,21],opensync:4,chunk:[22,19,37,4],bson_binary_subtype_uuid:[29,1],"static":14,pushal:[36,19],our:[36,37,33,4,20],special:[36,32,15,37,20],out:[12,10,8,2,19,21,36,37,28,31],variabl:[36,19,21],trickier:[0,36],categori:37,suitabl:37,merg:[19,21],ref:19,clone:14,math:8,jessica:[0,13],insid:[0,37,22,6],dropcollect:[25,35,10,9],unpars:19,releas:19,princess:21,unwant:0,could:[36,19],shiftleft:[24,15,32,9],david:13,length:[29,23,1,10,21,22,8,4,24,37,9,20],lte:0,transfer:10,minkei:[12,19,1,24,5],evanp:14,debugmessag:19,iszero:[24,15,32,9],should_correctly_rewind_and_restart_cursor:20,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:10,prioriti:19,start:[29,0,1,20,12,2,35,21,4,36,37],system:[14,35,37,4],wrapper:14,createfromtim:[19,24,9,8],bson_data_max_kei:1,termin:4,"final":[36,19,33,21],idottv:14,deconstruct:37,test_gs_getc_fil:4,exactli:35,gridstorew:4,bson_data_object:1,replset:[2,10],bother:33,mongoserv:[35,28],structur:[0,37,36],charact:[29,19,8,4,21],test_gs_puts_and_readlin:4,seriou:19,result:[0,23,7,20,13,22,19,15,4,32,37,21,30,36,8,28,10],"function":[0,1,2,19,4,7,8,10,13,14,15,23,35,20,21,22,28,29,30,32,34,36,37],counter:[28,21],terribl:19,peform:[34,10,7,20,21],have:[0,10,21,2,35,33,4,6,36,37],tabl:[36,26,35],need:[0,1,10,13,22,32,15,6,35,36,37,28],turn:[0,23,10],border:26,buildinfo:[23,25,9],min:[10,19,20,21],rout:14,mix:[0,6],andrewjston:19,which:[0,33,2,22,19,15,4,32,35,37,28],test_other_drop:21,orgiin:4,singl:[29,0,10,21,13,22,19,33,4],fileid:[37,7,4],statsync:4,whi:0,serverconfig:[19,10,28],why:[14,36,33],overwriten:4,url:[14,10],timestamplib:32,request:[19,33,20],face:36,test_collect:13,snapshot:[20,21],"400m":33,determin:[36,20],"_id":[0,10,13,19,21,4,6,37,28,30],fact:[36,13],text:[33,32,15,37,4],serializefunct:[19,1,10,21],verbos:21,nagl:[2,19,28],anywai:[10,21],setter:[4,8],textual:[32,15],locat:[36,10,21,4,20],playerkei:33,should:[0,23,10,8,32,15,21,30,37,35,20],noid:14,test_cursorstream_paus:34,local:[3,10],devnul:14,cube:14,ritch:[14,19],kiefer:33,increas:19,donewithwrit:37,enabl:[19,10,28],organ:33,simple_batch_size_collect:20,stuff:[2,12,37,36,31],integr:[14,36,37],contain:[29,1,10,21,2,35,4,36,37,20],grab:[23,20,10],mon4mongo:14,view:14,modulo:[0,24,15,32,9],packet:19,meritt:14,statu:[14,36,19],wire:[36,19],correctli:[36,19,21],pattern:12,written:[29,21,14,32,15,4,37],crude:36,world2:21,streamrecord:[25,36,19,20,9],kei:[0,1,20,21,19,4,6,36,37,28,10],buckets:21,simple_queri:21,isol:19,job:[14,21],entir:[37,4,20],db_option:28,crc32:1,monitor:14,mongod:14,plugin:33,admin:[12,23,10,21,19,33,25,9],mongoj:[14,12],equal:[29,0,23,7,20,21,34,32,15,4,24,1,30,36,8,9,10],etc:[0,28,21],instanc:[23,1,20,21,2,19,8,4,30,36,37,28,10],greaterthan:[24,15,32,9],mongoq:14,subtype_funct:29,comment:[19,20,21],toint:[24,15,32,9],walk:33,removealllisten:19,save_a_simple_docu:21,attende:33,addition:35,compon:19,json:[12,33,32,15,24,36],treat:[0,19,20],pkfactori:[10,21],immedi:13,bit:[0,1,22,32,15,36,37,19],assert:[29,23,7,10,21,34,8,4,1,30,20],ador:14,present:[6,35,33,12],replic:[2,10],multi:[21,13],vimeo:12,cursor:[0,7,20,21,12,19,23,34,25,36,9,10],defin:[29,0,1,10,21,13,19,15,4,32,36,28],setreadprefer:19,bson_data_arrai:1,observ:14,layer:[14,36,33],helper:[14,19],site:2,lightweight:14,tojson:[32,19,15,24,9],nodetut:12,getc:[25,4,9],cross:19,member:[2,19],handl:[15,20,21,19,33,4,36,37,32],speaker:33,inc:[36,19],gett:14,difficult:37,incorrect:19,slave:2,hostnam:28,keepal:[2,19,28],upon:20,proxlet:33,retriv:23,student:26,serializewithbufferandindex:[24,1,9],php:12,chunk_siz:[22,4],off:[10,2,19,23,4,35,36,28,20],center:21,nevertheless:28,builder:33,well:[0,19,37,36],exampl:[29,0,23,7,20,12,22,35,13,4,34,6,31,1,37,21,30,36,8,28,10],command:[20,21,14,19,23,4,25,36,28,9,10],simple_geo_near_command:21,filesystem:22,latest:36,distanc:21,paus:[34,7,25,9],less:[36,32,15],"boolean":[7,20,21,22,32,15,4,6,1,37,10],additon:6,tcp:36,detail:[6,20,22],indexinform:[10,21,19,6,25,9,20],simpli:0,web:[14,12,36],rapid:[12,33],seekloc:[37,4],add:[23,10,8,32,15,6,24,21,36,9],cleanup:[19,37],tjanczuk:14,logger:19,match:[0,23,21,13,32,15,36,35],branch:19,crud:[12,36,31],iya_logo_final_bw:4,know:35,bson_data_timestamp:1,recurs:[15,32,1,4],isclos:[25,20,9],desc:[0,20],bson_data_str:1,insert:[0,23,1,20,12,19,13,4,25,35,34,21,36,27,28,9,10],resid:36,backbon:33,success:[22,4,20],isui:33,chunkcollect:[25,4,9],necessari:0,"0xff":1,async:[14,36],page:[0,33,36,12],milewis:14,linux:19,contin:14,flush:[37,7,4],proper:19,fileinfo:37,newhex:8,librari:[14,12,19,33,37],leaf:14,lead:[19,15,32],dropdatabas:[25,23,10,9,28],avoid:[6,19,23,36],fromint:[24,15,32,9],thank:19,leav:[19,13],kcbanner:14,speak:33,mode:[10,21,22,19,4,35,37,28,20],slight:36,journal:10,usag:[29,12,1,30,8,2,22,19,4,35,36,37,28],collection_nam:35,host:28,although:37,offset:[29,37,4],java:[32,15],cliftonc:14,panel:[12,33],about:[12,10,13,33,6,36,37,28,20],actual:[0,37,10,36,28],socket:[12,10,2,19,33,18,36,28],http:[12,14,19,33,18,36,26],dbinstanc:37,notequ:[24,15,32,9],constructor:[1,2,3,4,5,7,8,9,10,11,15,23,17,19,20,21,24,25,28,29,30,16,32,34],fals:[0,23,7,20,13,22,19,21,4,34,1,35,30,37,28,10],disabl:[2,19,28],autoindexid:10,automat:[7,20,2,22,19,36,37,28,10],dataset:[0,36],bson:[0,7,3,4,5,1,8,9,10,11,12,13,23,17,19,20,21,24,28,29,30,16,34,35],leverag:[36,33],val:21,pictur:37,primarki:0,mykei:36,trigger:[7,20,21,19,4,34],concat:0,"var":[29,0,23,1,20,13,2,22,35,21,4,34,7,37,30,36,8,28,10],fsname:30,deliveri:33,brand:19,continu:14,waitforconnect:19,eas:14,inlin:21,bug:[19,37],count:[0,20,13,19,21,4,25,35,9,10],made:[37,33],wise:0,whether:[32,15],ecosystem:33,displai:[33,10],asynchron:[2,36],record:[0,20,13,22,35,21,4,6,36,28,10],below:[12,10,13,32,15,36],limit:[0,20,21,22,25,36,9],default_content_typ:4,problem:[19,23],myexperience1123429378001:33,evalu:[1,10],"int":[32,15],dure:[36,19,23,10,21],year:0,filenam:[22,19,37,4],replica:[2,19,10],implement:[14,36,19,15,32],ing:[12,33],eric:33,retrymilisecond:[19,10,28],probabl:0,tick:19,arrj:14,bartt:14,book:[0,12],bool:8,futur:[14,36,19,10],karait:14,stat:[19,25,9,21],findon:[0,10,21,19,25,36,9],"class":[7,3,4,5,1,8,10,11,15,23,17,19,20,21,29,30,16,32,33,34,36,37],geck:14,stai:21,experienc:33,eof:[25,22,37,4,9],integration_test:[7,10,21,23,4,34,30,20],kaij:19,"0_gnhwzhc":26},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","ObjectID()","Node.JS MongoDB Driver Manual Contents","Db()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Symbol()","Double()","Awesome Node.js + MongoDB Applications","Changelog","Cursor()","Collection()","GridStore","Admin()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Node.JS Specific Presentations","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/db","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/symbol","api-bson-generated/double","content/awesomeappsvideo","changelog/changelog","api-generated/cursor","api-generated/collection","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","content/nodejsvideo","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file diff --git a/test/admin_test.js b/test/admin_test.js deleted file mode 100644 index b02387f26a7..00000000000 --- a/test/admin_test.js +++ /dev/null @@ -1,698 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; -var native_parser = (process.env['TEST_NATIVE'] != null); - -/*! - * Module dependencies. - */ -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.shouldCorrectlyCallValidateCollection = function(test) { - var fs_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - fs_client.open(function(err, fs_client) { - fs_client.dropDatabase(function(err, done) { - fs_client.collection('test', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, doc) { - fs_client.admin(function(err, adminDb) { - adminDb.addUser('admin', 'admin', function(err, result) { - adminDb.authenticate('admin', 'admin', function(err, replies) { - adminDb.validateCollection('test', function(err, doc) { - // Pre 1.9.1 servers - if(doc.result != null) { - test.ok(doc.result != null); - test.ok(doc.result.match(/firstExtent/) != null); - } else { - test.ok(doc.firstExtent != null); - } - - fs_client.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * Authenticate against MongoDB Admin user - * - * @_class admin - * @_function authenticate - * @ignore - */ -exports.shouldCorrectlyAuthenticate = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Grab a collection object - db.collection('test', function(err, collection) { - - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - test.ok(result); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * Example showing how to access the Admin database for admin level operations. - * - * @_class db - * @_function admin - * @ignore - */ -exports.shouldCorrectlyAuthenticate = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - test.equal(null, err); - - db.close(); - test.done(); - }); - }); -} - -/** - * Retrieve the buildInfo for the current MongoDB instance - * - * @_class admin - * @_function buildInfo - * @ignore - */ -exports.shouldCorrectlyAuthenticate = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - test.ok(result); - - // Retrive the build information for the MongoDB instance - adminDb.buildInfo(function(err, info) { - test.ok(err == null); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the buildInfo using the command function - * - * @_class admin - * @_function command - * @ignore - */ -exports.shouldCorrectlyAuthenticate = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - test.ok(result); - - // Retrive the build information using the admin command - adminDb.command({buildInfo:1}, function(err, info) { - test.ok(err == null); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the current profiling level set for the MongoDB instance - * - * @_class admin - * @_function profilingLevel - * @ignore - */ -exports.shouldCorrectlySetDefaultProfilingLevel = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Grab a collection object - db.collection('test', function(err, collection) { - - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, replies) { - - // Retrive the profiling level - adminDb.profilingLevel(function(err, level) { - test.equal("off", level); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * An example of how to use the setProfilingInfo - * Use this command to set the Profiling level on the MongoDB server - * - * @_class admin - * @_function setProfilingLevel - */ -exports.shouldCorrectlyChangeProfilingLevel = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Grab a collection object - db.collection('test', function(err, collection) { - - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, replies) { - - // Set the profiling level to only profile slow queries - adminDb.setProfilingLevel('slow_only', function(err, level) { - - // Retrive the profiling level and verify that it's set to slow_only - adminDb.profilingLevel(function(err, level) { - test.equal('slow_only', level); - - // Turn profiling off - adminDb.setProfilingLevel('off', function(err, level) { - - // Retrive the profiling level and verify that it's set to off - adminDb.profilingLevel(function(err, level) { - test.equal('off', level); - - // Set the profiling level to log all queries - adminDb.setProfilingLevel('all', function(err, level) { - - // Retrive the profiling level and verify that it's set to all - adminDb.profilingLevel(function(err, level) { - test.equal('all', level); - - // Attempt to set an illegal profiling level - adminDb.setProfilingLevel('medium', function(err, level) { - test.ok(err instanceof Error); - test.equal("Error: illegal profiling level value medium", err.message); - - db.close(); - test.done(); - }); - }) - }); - }) - }); - }) - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * An example of how to use the profilingInfo - * Use this command to pull back the profiling information currently set for Mongodb - * - * @_class admin - * @_function profilingInfo - */ -exports.shouldCorrectlySetAndExtractProfilingInfo = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Grab a collection object - db.collection('test', function(err, collection) { - - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(doc) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, replies) { - - // Set the profiling level to all - adminDb.setProfilingLevel('all', function(err, level) { - - // Execute a query command - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { - - // Turn off profiling - adminDb.setProfilingLevel('off', function(err, level) { - - // Retrive the profiling information - adminDb.profilingInfo(function(err, infos) { - test.ok(infos.constructor == Array); - test.ok(infos.length >= 1); - test.ok(infos[0].ts.constructor == Date); - test.ok(infos[0].millis.constructor == Number); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * An example of how to use the validateCollection command - * Use this command to check that a collection is valid (not corrupt) and to get various statistics. - * - * @_class admin - * @_function validateCollection - */ -exports.shouldCorrectlyCallValidateCollection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Grab a collection object - db.collection('test', function(err, collection) { - - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, replies) { - - // Validate the 'test' collection - adminDb.validateCollection('test', function(err, doc) { - - // Pre 1.9.1 servers - if(doc.result != null) { - test.ok(doc.result != null); - test.ok(doc.result.match(/firstExtent/) != null); - } else { - test.ok(doc.firstExtent != null); - } - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * An example of how to add a user to the admin database - * - * @_class admin - * @_function ping - */ -exports.shouldCorrectlyPingTheMongoDbInstance = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - test.ok(result); - - // Ping the server - adminDb.ping(function(err, pingResult) { - test.equal(null, err); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * An example of how add a user, authenticate and logout - * - * @_class admin - * @_function logout - */ -exports.shouldCorrectlyUseLogoutFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - test.ok(result); - - // Logout the user - adminDb.logout(function(err, result) { - test.equal(true, result); - - db.close(); - test.done(); - }) - }); - }); - }); - }); - }); -} - - -/** - * An example of how to add a user to the admin database - * - * @_class admin - * @_function addUser - */ -exports.shouldCorrectlyAddAUserToAdminDb = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - test.ok(result); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * An example of how to remove a user from the admin database - * - * @_class admin - * @_function removeUser - */ -exports.shouldCorrectlyAddAUserAndRemoveItFromAdminDb = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - test.ok(result); - - // Remove the user - adminDb.removeUser('admin', function(err, result) { - - // Authenticate using the removed user should fail - adminDb.authenticate('admin', 'admin', function(err, result) { - test.ok(err != null); - test.ok(!result); - - db.close(); - test.done(); - }); - }) - }); - }); - }); - }); - }); -} - -/** - * An example of listing all available databases. - * - * @_class admin - * @_function listDatabases - */ -exports.shouldCorrectlyListAllAvailableDatabases = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // List all the available databases - adminDb.listDatabases(function(err, dbs) { - test.equal(null, err); - test.ok(dbs.databases.length > 0); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/authentication_test.js b/test/authentication_test.js deleted file mode 100644 index 9605dcd257c..00000000000 --- a/test/authentication_test.js +++ /dev/null @@ -1,171 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * Test the authentication method for the user - * - * @ignore - */ -exports.shouldCorrectlyAuthenticate = function(test) { - var user_name = 'spongebob'; - var password = 'squarepants'; - - client.authenticate('admin', 'admin', function(err, replies) { - test.ok(err instanceof Error); - test.ok(!replies); - - // Add a user - client.addUser(user_name, password, function(err, result) { - client.authenticate(user_name, password, function(err, replies) { - test.ok(!(err instanceof Error)); - test.ok(replies); - test.done(); - }); - }); - }); -} - -/** - * Test the authentication method for the user - * - * @ignore - */ -exports.shouldCorrectlyReAuthorizeReconnectedConnections = function(test) { - var user_name = 'spongebob2'; - var password = 'password'; - - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize:3, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - p_client.open(function(err, automatic_connect_client) { - p_client.authenticate('admin', 'admin', function(err, replies) { - test.ok(err instanceof Error); - // Add a user - p_client.addUser(user_name, password, function(err, result) { - // Execute authentication - p_client.authenticate(user_name, password, function(err, replies) { - test.ok(err == null); - - // Kill a connection to force a reconnect - p_client.serverConfig.close(); - - p_client.createCollection('shouldCorrectlyReAuthorizeReconnectedConnections', function(err, collection) { - collection.insert({a:1}, {safe:true}, function(err, r) { - collection.insert({a:2}, {safe:true}, function(err, r) { - collection.insert({a:3}, {safe:true}, function(err, r) { - collection.count(function(err, count) { - test.equal(3, count); - p_client.close(); - test.done(); - }) - }) - }) - }) - }); - }); - }); - }); - }); -} - -exports.shouldCorrectlyAddAndRemoveUser = function(test) { - var user_name = 'spongebob2'; - var password = 'password'; - - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - p_client.open(function(err, automatic_connect_client) { - p_client.authenticate('admin', 'admin', function(err, replies) { - test.ok(err instanceof Error); - - // Add a user - p_client.addUser(user_name, password, function(err, result) { - p_client.authenticate(user_name, password, function(err, replies) { - test.ok(replies); - - // Remove the user and try to authenticate again - p_client.removeUser(user_name, function(err, result) { - p_client.authenticate(user_name, password, function(err, replies) { - test.ok(err instanceof Error); - - test.done(); - p_client.close(); - }); - }); - }); - }); - }); - }); -} - -// run this last -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/auxilliary/authentication_test.js b/test/auxilliary/authentication_test.js deleted file mode 100644 index 3d0c6a978d7..00000000000 --- a/test/auxilliary/authentication_test.js +++ /dev/null @@ -1,216 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server, - ServerManager = require('../../test/tools/server_manager').ServerManager, - Step = require("step"); - -var MONGODB = 'integration_tests'; -var client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 1}), {native_parser: (process.env['TEST_NATIVE'] != null)}); -var serverManager = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - serverManager.killAll(function(err, result) { - callback(); - }); -} - -exports.shouldCorrectlyAuthenticate = function(test) { - var db1 = new Db('mongo-ruby-test-auth1', new Server("127.0.0.1", 27017, {auto_reconnect: true}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - var db2 = new Db('mongo-ruby-test-auth2', new Server("127.0.0.1", 27017, {auto_reconnect: true}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - var admin = new Db('admin', new Server("127.0.0.1", 27017, {auto_reconnect: true}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - - Step( - function bootTheServerWithNoAuth() { - serverManager = new ServerManager({auth:false, purgedirectories:true}) - serverManager.start(true, this); - }, - - function openDbs() { - db1.open(this.parallel()); - db2.open(this.parallel()); - admin.open(this.parallel()); - }, - - function addAdminUserToDatabase(err, db1, db2, admin) { - test.equal(null, err); - admin.addUser('admin', 'admin', this); - }, - - function restartServerInAuthMode(err, result) { - test.equal(null, err); - test.equal('7c67ef13bbd4cae106d959320af3f704', result.shift().pwd); - - db1.close(); - db2.close(); - admin.close(); - - serverManager = new ServerManager({auth:true, purgedirectories:false}) - serverManager.start(true, this); - }, - - function openDbs() { - db1.open(this.parallel()); - db2.open(this.parallel()); - admin.open(this.parallel()); - }, - - function authenticateAdminUser(err) { - test.equal(null, err); - - admin.authenticate('admin', 'admin', this.parallel()); - db1.admin().authenticate('admin', 'admin', this.parallel()); - db2.admin().authenticate('admin', 'admin', this.parallel()); - }, - - function addDbUsersForAuthentication(err, result1, result2, result3) { - test.equal(null, err); - test.ok(result1); - test.ok(result2); - test.ok(result3); - - db1.addUser('user1', 'secret', this.parallel()); - db2.addUser('user2', 'secret', this.parallel()); - }, - - function closeAdminConnection(err, result1, result2) { - test.ok(err == null); - test.ok(result1 != null); - test.ok(result2 != null); - admin.logout(this.parallel()); - db1.admin().logout(this.parallel()); - db2.admin().logout(this.parallel()); - }, - - function failAuthenticationWithDbs(err, result) { - var self = this; - - db1.collection('stuff', function(err, collection) { - collection.insert({a:2}, {safe:true}, self.parallel()); - }); - - db2.collection('stuff', function(err, collection) { - collection.insert({a:2}, {safe:true}, self.parallel()); - }); - }, - - function authenticateAgainstDbs(err, result) { - test.ok(err != null); - - db1.authenticate('user1', 'secret', this.parallel()); - db2.authenticate('user2', 'secret', this.parallel()); - }, - - function correctlyInsertRowToDbs(err, result1, result2) { - var self = this; - test.ok(err == null); - test.ok(result1); - test.ok(result2); - - db1.collection('stuff', function(err, collection) { - collection.insert({a:2}, {safe:true}, self.parallel()); - }); - - db2.collection('stuff', function(err, collection) { - collection.insert({a:2}, {safe:true}, self.parallel()); - }); - }, - - function validateCorrectInsertsAndBounceServer(err, result1, result2) { - test.ok(err == null); - test.ok(result1 != null); - test.ok(result2 != null); - - serverManager = new ServerManager({auth:true, purgedirectories:false}) - serverManager.start(true, this); - }, - - function reconnectAndVerifyThatAuthIsAutomaticallyApplied() { - var self = this; - db1.collection('stuff', function(err, collection) { - - collection.find({}).toArray(function(err, items) { - test.ok(err == null); - test.equal(1, items.length); - - db1.collection('stuff', function(err, collection) { - collection.insert({a:2}, {safe:true}, self.parallel()); - }); - - db2.collection('stuff', function(err, collection) { - collection.insert({a:2}, {safe:true}, self.parallel()); - }); - }) - }); - }, - - function logoutDb1(err, result1, result2) { - test.ok(err == null); - test.ok(result1 != null); - test.ok(result2 != null); - - db1.logout(this); - }, - - function insertShouldFail(err, result) { - var self = this; - db1.collection('stuff', function(err, collection) { - collection.insert({a:2}, {safe:true}, self.parallel()); - }); - }, - - function logoutDb2(err, result) { - test.ok(err != null); - db2.logout(this); - }, - - function insertShouldFail(err, result) { - var self = this; - db2.collection('stuff', function(err, collection) { - collection.insert({a:2}, {safe:true}, function(err, result) { - test.ok(err != null); - test.done(); - // Close all connections - db1.close(); - db2.close(); - admin.close(); - }); - }); - } - ) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/auxilliary/repl_set_ssl_test.js b/test/auxilliary/repl_set_ssl_test.js deleted file mode 100644 index f8bae8d824c..00000000000 --- a/test/auxilliary/repl_set_ssl_test.js +++ /dev/null @@ -1,80 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server, - ReplSetServers = mongodb.ReplSetServers, - ReplicaSetManager = require('../../test/tools/replica_set_manager').ReplicaSetManager, - Step = require("step"); - -var MONGODB = 'integration_tests'; -var serverManager = null; -var RS = RS == null ? null : RS; -var ssl = true; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - RS = new ReplicaSetManager({retries:120, - ssl:ssl, - arbiter_count:1, - secondary_count:1, - passive_count:1}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - RS.restartKilledNodes(function(err, result) { - callback(); - }); -} - -exports.shouldCorrectlyConncetToSSLBasedReplicaset = function(test) { - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - ], - {rs_name:RS.name, ssl:ssl} - ); - - // Connect to the replicaset - var slaveDb = null; - var db = new Db('foo', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - test.equal(null, err); - test.done(); - p_db.close(); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/auxilliary/replicaset_auth_test.js b/test/auxilliary/replicaset_auth_test.js deleted file mode 100644 index e15f5d14b7d..00000000000 --- a/test/auxilliary/replicaset_auth_test.js +++ /dev/null @@ -1,242 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server, - ReplSetServers = mongodb.ReplSetServers, - ReplicaSetManager = require('../../test/tools/replica_set_manager').ReplicaSetManager, - Step = require("step"); - -var MONGODB = 'integration_tests'; -var serverManager = null; -var RS = RS == null ? null : RS; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - RS = new ReplicaSetManager({retries:120, - auth:true, - arbiter_count:0, - secondary_count:1, - passive_count:0}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - callback(); -} - -exports.shouldCorrectlyAuthenticateWithMultipleLoginsAndLogouts = function(test) { - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - ], - {rs_name:RS.name} - ); - - // Connect to the replicaset - var slaveDb = null; - var db = new Db('foo', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - Step( - function addUser() { - db.admin().addUser("me", "secret", this); - }, - - function ensureFailingInsert(err, result) { - // return - var self = this; - test.equal(null, err); - test.ok(result != null); - - db.collection("stuff", function(err, collection) { - collection.insert({a:2}, {safe: {w: 3}}, self); - }); - }, - - function authenticate(err, result) { - test.ok(err != null); - - db.admin().authenticate("me", "secret", this); - }, - - function changePassword(err, result) { - var self = this; - test.equal(null, err); - test.ok(result); - - db.admin().addUser("me", "secret2", this); - }, - - function authenticate(err, result) { - db.admin().authenticate("me", "secret2", this); - }, - - function insertShouldSuccedNow(err, result) { - var self = this; - test.equal(null, err); - test.ok(result); - - db.collection("stuff", function(err, collection) { - collection.insert({a:3}, {safe: true}, self); - }); - }, - - function queryShouldExecuteCorrectly(err, result) { - var self = this; - test.equal(null, err); - - db.collection("stuff", function(err, collection) { - collection.findOne(self); - }); - }, - - function logout(err, item) { - test.ok(err == null); - test.equal(3, item.a); - - db.admin().logout(this); - }, - - function findShouldFailDueToLoggedOut(err, result) { - var self = this; - test.equal(null, err); - - db.collection("stuff", function(err, collection) { - collection.findOne(self); - }); - }, - - function sameShouldApplyToRandomSecondaryServer(err, result) { - var self = this; - test.ok(err != null); - - slaveDb = new Db('foo', new Server(db.serverConfig.secondaries[0].host - , db.serverConfig.secondaries[0].port, {auto_reconnect: true, poolSize: 1}), {native_parser: (process.env['TEST_NATIVE'] != null), slave_ok:true}); - slaveDb.open(function(err, slaveDb) { - slaveDb.collection('stuff', function(err, collection) { - collection.findOne(self) - }) - }); - }, - - function shouldCorrectlyAuthenticateAgainstSecondary(err, result) { - test.ok(err != null) - slaveDb.admin().authenticate('me', 'secret2', this); - }, - - function shouldCorrectlyInsertItem(err, result) { - var self = this; - test.equal(null, err); - test.ok(result); - - slaveDb.collection('stuff', function(err, collection) { - collection.findOne(self) - }) - }, - - function finishUp(err, item) { - test.ok(err == null); - test.equal(3, item.a); - - test.done(); - p_db.close(); - slaveDb.close(); - } - ) - }); -} - -exports.shouldCorrectlyAuthenticate = function(test) { - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:true} - ); - - // Connect to the replicaset - var slaveDb = null; - var db = new Db('foo', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - Step( - function addUser() { - db.admin().addUser("me", "secret", this); - }, - - function ensureFailingInsert(err, result) { - var self = this; - test.equal(null, err); - test.ok(result != null); - - db.collection("stuff", function(err, collection) { - collection.insert({a:2}, {safe: {w: 2, wtimeout: 10000}}, self); - }); - }, - - function authenticate(err, result) { - test.ok(err != null); - - db.admin().authenticate("me", "secret", this); - }, - - function insertShouldSuccedNow(err, result) { - var self = this; - test.equal(null, err); - test.ok(result); - - db.collection("stuff", function(err, collection) { - collection.insert({a:2}, {safe: {w: 2, wtimeout: 10000}}, self); - }); - }, - - function queryShouldExecuteCorrectly(err, result) { - var self = this; - test.equal(null, err); - - db.collection("stuff", function(err, collection) { - collection.findOne(self); - }); - }, - - function finishUp(err, item) { - test.ok(err == null); - test.equal(2, item.a); - test.done(); - p_db.close(); - } - ) - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/auxilliary/single_server_kill_reconnect.js b/test/auxilliary/single_server_kill_reconnect.js deleted file mode 100644 index 85e7fab241d..00000000000 --- a/test/auxilliary/single_server_kill_reconnect.js +++ /dev/null @@ -1,159 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server, - ServerManager = require('../../test/tools/server_manager').ServerManager, - Step = require("step"); - -var MONGODB = 'integration_tests'; -var client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 1}), {native_parser: (process.env['TEST_NATIVE'] != null)}); -var serverManager = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - callback(); -} - -exports.shouldCorrectlyKeepInsertingDocumentsWhenServerDiesAndComesUp = function(test) { - var db1 = new Db('mongo-ruby-test-single-server', new Server("127.0.0.1", 27017, {auto_reconnect: true}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - // All inserted docs - var docs = []; - var errs = []; - var insertDocs = []; - // Start server - serverManager = new ServerManager({auth:false, purgedirectories:true, journal:true}) - serverManager.start(true, function() { - db1.open(function(err, db) { - // Startup the insert of documents - var intervalId = setInterval(function() { - db.collection('inserts', function(err, collection) { - var doc = {timestamp:new Date().getTime()}; - insertDocs.push(doc); - // Insert document - collection.insert(doc, {safe:{fsync:true}}, function(err, result) { - // Save errors - if(err != null) errs.push(err); - if(err == null) { - docs.push(result[0]); - } - }) - }); - }, 500); - - // Wait for a second and then kill the server - setTimeout(function() { - // Kill server instance - serverManager.stop(9, function(err, result) { - // Server down for 1 second - setTimeout(function() { - // Restart server - serverManager = new ServerManager({auth:false, purgedirectories:false, journal:true}); - serverManager.start(true, function() { - // Wait for it - setTimeout(function() { - // Drop db - db.dropDatabase(function(err, result) { - clearInterval(intervalId); - // Close db - db.close(); - // Check that we got at least one error - test.ok(docs.length > 0); - test.ok(insertDocs.length > 0); - // Finish up - test.done(); - }); - }, 5000) - }) - }, 1000); - }); - }, 3000); - }) - }); -} - -exports.shouldCorrectlyInsertKillServerFailThenRestartServerAndSucceed = function(test) { - var db = new Db('test-single-server-recovery', new Server("127.0.0.1", 27017, {auto_reconnect: true}), {numberOfRetries:3, retryMiliSeconds:500, native_parser: (process.env['TEST_NATIVE'] != null)}); - // All inserted docs - var docs = []; - var errs = []; - var insertDocs = []; - - // Start server - serverManager = new ServerManager({auth:false, purgedirectories:true, journal:true}) - serverManager.start(true, function() { - db.open(function(err, db) { - // Add an error handler - db.on("error", function(err) { - console.log("----------------------------------------------- received error") - console.dir(err) - errs.push(err); - }); - - db.collection('inserts', function(err, collection) { - var doc = {timestamp:new Date().getTime(), a:1}; - collection.insert(doc, {safe:true}, function(err, result) { - test.equal(null, err); - - // Kill server instance - serverManager.stop(9, function(err, result) { - // Attemp insert (should timeout) - var doc = {timestamp:new Date().getTime(), b:1}; - collection.insert(doc, {safe:true}, function(err, result) { - test.ok(err != null); - test.equal(null, result); - - // Restart server - serverManager = new ServerManager({auth:false, purgedirectories:false, journal:true}); - serverManager.start(true, function() { - // Attemp insert again - collection.insert(doc, {safe:true}, function(err, result) { - // Fetch the documents - collection.find({b:1}).toArray(function(err, items) { - test.equal(null, err); - test.equal(1, items[0].b); - db.close(); - test.done(); - }); - }); - }); - }); - }); - }) - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/auxilliary/ssl_test.js b/test/auxilliary/ssl_test.js deleted file mode 100644 index 9511fd2c9c1..00000000000 --- a/test/auxilliary/ssl_test.js +++ /dev/null @@ -1,78 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server, - ServerManager = require('../../test/tools/server_manager').ServerManager, - Step = require("step"); - -var MONGODB = 'integration_tests'; -var serverManager = null; -var ssl = true; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - callback(); -} - -exports.shouldCorrectlyCommunicateUsingSSLSocket = function(test) { - var db1 = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize:4, ssl:ssl}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - // All inserted docs - var docs = []; - var errs = []; - var insertDocs = []; - - // Start server - serverManager = new ServerManager({auth:false, purgedirectories:true, journal:true, ssl:ssl}) - serverManager.start(true, function() { - db1.open(function(err, db) { - // Create a collection - db.createCollection('shouldCorrectlyCommunicateUsingSSLSocket', function(err, collection) { - collection.insert([{a:1}, {b:2}, {c:'hello world'}]); - collection.insert([{a:1}, {b:2}, {c:'hello world'}]); - collection.insert([{a:1}, {b:2}, {c:'hello world'}]); - collection.insert([{a:1}, {b:2}, {c:'hello world'}]); - collection.insert([{a:1}, {b:2}, {c:'hello world'}], {safe:true}, function(err, result) { - collection.find({}).toArray(function(err, items) { - // test.equal(3, items.length); - db.close(); - test.done(); - }) - }); - }); - }) - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/bson/bson_test.js b/test/bson/bson_test.js deleted file mode 100644 index c3461019c59..00000000000 --- a/test/bson/bson_test.js +++ /dev/null @@ -1,1606 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - mongoO = require('../../lib/mongodb').pure(), - debug = require('util').debug, - inspect = require('util').inspect, - Buffer = require('buffer').Buffer, - gleak = require('../../dev/tools/gleak'), - fs = require('fs'), - BSON = mongoO.BSON, - Code = mongoO.Code, - Binary = mongoO.Binary, - Timestamp = mongoO.Timestamp, - Long = mongoO.Long, - MongoReply = mongoO.MongoReply, - ObjectID = mongoO.ObjectID, - Symbol = mongoO.Symbol, - DBRef = mongoO.DBRef, - Double = mongoO.Double, - MinKey = mongoO.MinKey, - MaxKey = mongoO.MaxKey, - BinaryParser = mongoO.BinaryParser; - -var BSONSE = mongodb, - BSONDE = mongodb; - -// for tests -BSONDE.BSON_BINARY_SUBTYPE_DEFAULT = 0; -BSONDE.BSON_BINARY_SUBTYPE_FUNCTION = 1; -BSONDE.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -BSONDE.BSON_BINARY_SUBTYPE_UUID = 3; -BSONDE.BSON_BINARY_SUBTYPE_MD5 = 4; -BSONDE.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -BSONSE.BSON_BINARY_SUBTYPE_DEFAULT = 0; -BSONSE.BSON_BINARY_SUBTYPE_FUNCTION = 1; -BSONSE.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -BSONSE.BSON_BINARY_SUBTYPE_UUID = 3; -BSONSE.BSON_BINARY_SUBTYPE_MD5 = 4; -BSONSE.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -var hexStringToBinary = function(string) { - var numberofValues = string.length / 2; - var array = ""; - - for(var i = 0; i < numberofValues; i++) { - array += String.fromCharCode(parseInt(string[i*2] + string[i*2 + 1], 16)); - } - return array; -} - -var assertBuffersEqual = function(test, buffer1, buffer2) { - if(buffer1.length != buffer2.length) test.fail("Buffers do not have the same length", buffer1, buffer2); - - for(var i = 0; i < buffer1.length; i++) { - test.equal(buffer1[i], buffer2[i]); - } -} - -/** - * Module for parsing an ISO 8601 formatted string into a Date object. - */ -var ISODate = function (string) { - var match; - - if (typeof string.getTime === "function") - return string; - else if (match = string.match(/^(\d{4})(-(\d{2})(-(\d{2})(T(\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|((\+|-)(\d{2}):(\d{2}))))?)?)?$/)) { - var date = new Date(); - date.setUTCFullYear(Number(match[1])); - date.setUTCMonth(Number(match[3]) - 1 || 0); - date.setUTCDate(Number(match[5]) || 0); - date.setUTCHours(Number(match[7]) || 0); - date.setUTCMinutes(Number(match[8]) || 0); - date.setUTCSeconds(Number(match[10]) || 0); - date.setUTCMilliseconds(Number("." + match[12]) * 1000 || 0); - - if (match[13] && match[13] !== "Z") { - var h = Number(match[16]) || 0, - m = Number(match[17]) || 0; - - h *= 3600000; - m *= 60000; - - var offset = h + m; - if (match[15] == "+") - offset = -offset; - - date = new Date(date.valueOf() + offset); - } - - return date; - } else - throw new Error("Invalid ISO 8601 date given.", __filename); -}; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - callback(); -} - -/** - * @ignore - */ -exports['Should Correctly get BSON types from require'] = function(test) { - var _mongodb = require('../../lib/mongodb'); - test.ok(_mongodb.ObjectID === ObjectID); - test.ok(_mongodb.Binary === Binary); - test.ok(_mongodb.Long === Long); - test.ok(_mongodb.Timestamp === Timestamp); - test.ok(_mongodb.Code === Code); - test.ok(_mongodb.DBRef === DBRef); - test.ok(_mongodb.Symbol === Symbol); - test.ok(_mongodb.MinKey === MinKey); - test.ok(_mongodb.MaxKey === MaxKey); - test.ok(_mongodb.Double === Double); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Deserialize object'] = function(test) { - var bytes = [95,0,0,0,2,110,115,0,42,0,0,0,105,110,116,101,103,114,97,116,105,111,110,95,116,101,115,116,115,95,46,116,101,115,116,95,105,110,100,101,120,95,105,110,102,111,114,109,97,116,105,111,110,0,8,117,110,105,113,117,101,0,0,3,107,101,121,0,12,0,0,0,16,97,0,1,0,0,0,0,2,110,97,109,101,0,4,0,0,0,97,95,49,0,0]; - var serialized_data = ''; - // Convert to chars - for(var i = 0; i < bytes.length; i++) { - serialized_data = serialized_data + BinaryParser.fromByte(bytes[i]); - } - - var object = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(new Buffer(serialized_data, 'binary')); - test.equal("a_1", object.name); - test.equal(false, object.unique); - test.equal(1, object.key.a); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Deserialize object with all types'] = function(test) { - var bytes = [26,1,0,0,7,95,105,100,0,161,190,98,75,118,169,3,0,0,3,0,0,4,97,114,114,97,121,0,26,0,0,0,16,48,0,1,0,0,0,16,49,0,2,0,0,0,16,50,0,3,0,0,0,0,2,115,116,114,105,110,103,0,6,0,0,0,104,101,108,108,111,0,3,104,97,115,104,0,19,0,0,0,16,97,0,1,0,0,0,16,98,0,2,0,0,0,0,9,100,97,116,101,0,161,190,98,75,0,0,0,0,7,111,105,100,0,161,190,98,75,90,217,18,0,0,1,0,0,5,98,105,110,97,114,121,0,7,0,0,0,2,3,0,0,0,49,50,51,16,105,110,116,0,42,0,0,0,1,102,108,111,97,116,0,223,224,11,147,169,170,64,64,11,114,101,103,101,120,112,0,102,111,111,98,97,114,0,105,0,8,98,111,111,108,101,97,110,0,1,15,119,104,101,114,101,0,25,0,0,0,12,0,0,0,116,104,105,115,46,120,32,61,61,32,51,0,5,0,0,0,0,3,100,98,114,101,102,0,37,0,0,0,2,36,114,101,102,0,5,0,0,0,116,101,115,116,0,7,36,105,100,0,161,190,98,75,2,180,1,0,0,2,0,0,0,10,110,117,108,108,0,0]; - var serialized_data = ''; - // Convert to chars - for(var i = 0; i < bytes.length; i++) { - serialized_data = serialized_data + BinaryParser.fromByte(bytes[i]); - } - - var object = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(new Buffer(serialized_data, 'binary'));//, false, true); - // Perform tests - test.equal("hello", object.string); - test.deepEqual([1,2,3], object.array); - test.equal(1, object.hash.a); - test.equal(2, object.hash.b); - test.ok(object.date != null); - test.ok(object.oid != null); - test.ok(object.binary != null); - test.equal(42, object.int); - test.equal(33.3333, object.float); - test.ok(object.regexp != null); - test.equal(true, object.boolean); - test.ok(object.where != null); - test.ok(object.dbref != null); - test.ok(object[null] == null); - test.done(); -} - -/** - * @ignore - */ -exports['Should Serialize and Deserialize String'] = function(test) { - var test_string = {hello: 'world'}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_string, false, true); - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_string)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_string, false, serialized_data2, 0); - - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - test.deepEqual(test_string, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data)); - test.done(); -} - -/** - * @ignore - */ -exports['Should Serialize and Deserialize Empty String'] = function(test) { - var test_string = {hello: ''}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_string, false, true); - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_string)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_string, false, serialized_data2, 0); - - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - test.deepEqual(test_string, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data)); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Integer'] = function(test) { - var test_number = {doc: 5}; - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_number, false, true); - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_number)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_number, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - test.deepEqual(test_number, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data)); - test.deepEqual(test_number, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data2)); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize null value'] = function(test) { - var test_null = {doc:null}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_null, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_null)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_null, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var object = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.equal(null, object.doc); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Number'] = function(test) { - var test_number = {doc: 5.5}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_number, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_number)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_number, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - test.deepEqual(test_number, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data)); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Integer'] = function(test) { - var test_int = {doc: 42}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_int, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_int)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_int, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - test.deepEqual(test_int.doc, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc); - - test_int = {doc: -5600}; - serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_int, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_int)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_int, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - test.deepEqual(test_int.doc, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc); - - test_int = {doc: 2147483647}; - serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_int, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_int)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_int, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - test.deepEqual(test_int.doc, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc); - - test_int = {doc: -2147483648}; - serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_int, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_int)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_int, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - test.deepEqual(test_int.doc, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Object'] = function(test) { - var doc = {doc: {age: 42, name: 'Spongebob', shoe_size: 9.5}}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - test.deepEqual(doc.doc.age, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc.age); - test.deepEqual(doc.doc.name, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc.name); - test.deepEqual(doc.doc.shoe_size, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc.shoe_size); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Array'] = function(test) { - var doc = {doc: [1, 2, 'a', 'b']}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.equal(doc.doc[0], deserialized.doc[0]) - test.equal(doc.doc[1], deserialized.doc[1]) - test.equal(doc.doc[2], deserialized.doc[2]) - test.equal(doc.doc[3], deserialized.doc[3]) - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Array with added on functions'] = function(test) { - Array.prototype.toXml = function() {}; - var doc = {doc: [1, 2, 'a', 'b']}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.equal(doc.doc[0], deserialized.doc[0]) - test.equal(doc.doc[1], deserialized.doc[1]) - test.equal(doc.doc[2], deserialized.doc[2]) - test.equal(doc.doc[3], deserialized.doc[3]) - test.done(); -} - -/** - * @ignore - */ -exports['Should correctly deserialize a nested object'] = function(test) { - var doc = {doc: {doc:1}}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - test.deepEqual(doc.doc.doc, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc.doc); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize A Boolean'] = function(test) { - var doc = {doc: true}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - test.equal(doc.doc, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize a Date'] = function(test) { - var date = new Date(); - //(2009, 11, 12, 12, 00, 30) - date.setUTCDate(12); - date.setUTCFullYear(2009); - date.setUTCMonth(11 - 1); - date.setUTCHours(12); - date.setUTCMinutes(0); - date.setUTCSeconds(30); - var doc = {doc: date}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - test.equal(doc.date, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc.date); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize nested doc'] = function(test) { - var doc = { - string: "Strings are great", - decimal: 3.14159265, - bool: true, - integer: 5, - - subObject: { - moreText: "Bacon ipsum dolor.", - longKeylongKeylongKeylongKeylongKeylongKey: "Pork belly." - }, - - subArray: [1,2,3,4,5,6,7,8,9,10], - anotherString: "another string" - } - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Oid'] = function(test) { - var doc = {doc: new ObjectID()}; - var doc2 = {doc: ObjectID.createFromHexString(doc.doc.toHexString())}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - delete doc.doc.__id; - test.deepEqual(doc, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data)); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly encode Empty Hash'] = function(test) { - var doc = {}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - test.deepEqual(doc, new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data)); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Ordered Hash'] = function(test) { - var doc = {doc: {b:1, a:2, c:3, d:4}}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var decoded_hash = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data).doc; - var keys = []; - - for(var name in decoded_hash) keys.push(name); - test.deepEqual(['b', 'a', 'c', 'd'], keys); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Regular Expression'] = function(test) { - // Serialize the regular expression - var doc = {doc: /foobar/mi}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - - test.deepEqual(doc.doc.toString(), doc2.doc.toString()); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize a Binary object'] = function(test) { - var bin = new Binary(); - var string = 'binstring'; - for(var index = 0; index < string.length; index++) { - bin.put(string.charAt(index)); - } - - var doc = {doc: bin}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - - test.deepEqual(doc.doc.value(), deserialized_data.doc.value()); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize a big Binary object'] = function(test) { - var data = fs.readFileSync("test/gridstore/test_gs_weird_bug.png", 'binary'); - var bin = new Binary(); - bin.write(data); - var doc = {doc: bin}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.doc.value(), deserialized_data.doc.value()); - test.done(); -} - -/** - * @ignore - */ -exports["Should Correctly Serialize and Deserialize DBRef"] = function(test) { - var oid = new ObjectID(); - var doc = {dbref: new DBRef('namespace', oid, null)}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.equal("namespace", doc2.dbref.namespace); - test.deepEqual(doc2.dbref.oid.toHexString(), oid.toHexString()); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize partial DBRef'] = function(test) { - var id = new ObjectID(); - var doc = {'name':'something', 'user':{'$ref':'username', '$id': id}}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.equal('something', doc2.name); - test.equal('username', doc2.user.namespace); - test.equal(id.toString(), doc2.user.oid.toString()); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize simple Int'] = function(test) { - var doc = {doc:2147483648}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.doc, doc2.doc) - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Long Integer'] = function(test) { - var doc = {doc: Long.fromNumber(9223372036854775807)}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.doc, deserialized_data.doc); - - doc = {doc: Long.fromNumber(-9223372036854775)}; - serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.doc, deserialized_data.doc); - - doc = {doc: Long.fromNumber(-9223372036854775809)}; - serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.doc, deserialized_data.doc); - test.done(); -} - -/** - * @ignore - */ -exports['Should Deserialize Large Integers as Number not Long'] = function(test) { - function roundTrip(val) { - var doc = {doc: val}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.doc, deserialized_data.doc); - }; - - roundTrip(Math.pow(2,52)); - roundTrip(Math.pow(2,53) - 1); - roundTrip(Math.pow(2,53)); - roundTrip(-Math.pow(2,52)); - roundTrip(-Math.pow(2,53) + 1); - roundTrip(-Math.pow(2,53)); - roundTrip(Math.pow(2,65)); // Too big for Long. - roundTrip(-Math.pow(2,65)); - roundTrip(9223372036854775807); - roundTrip(1234567890123456800); // Bigger than 2^53, stays a double. - roundTrip(-1234567890123456800); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Long Integer and Timestamp as different types'] = function(test) { - var long = Long.fromNumber(9223372036854775807); - var timestamp = Timestamp.fromNumber(9223372036854775807); - test.ok(long instanceof Long); - test.ok(!(long instanceof Timestamp)); - test.ok(timestamp instanceof Timestamp); - test.ok(!(timestamp instanceof Long)); - - var test_int = {doc: long, doc2: timestamp}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(test_int, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(test_int)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(test_int, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(test_int.doc, deserialized_data.doc); - test.done(); -} - -/** - * @ignore - */ -exports['Should Always put the id as the first item in a hash'] = function(test) { - var hash = {doc: {not_id:1, '_id':2}}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(hash, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(hash)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(hash, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - var keys = []; - - for(var name in deserialized_data.doc) { - keys.push(name); - } - - test.deepEqual(['not_id', '_id'], keys); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize a User defined Binary object'] = function(test) { - var bin = new Binary(); - bin.sub_type = BSON.BSON_BINARY_SUBTYPE_USER_DEFINED; - var string = 'binstring'; - for(var index = 0; index < string.length; index++) { - bin.put(string.charAt(index)); - } - - var doc = {doc: bin}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - - test.deepEqual(deserialized_data.doc.sub_type, BSON.BSON_BINARY_SUBTYPE_USER_DEFINED); - test.deepEqual(doc.doc.value(), deserialized_data.doc.value()); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correclty Serialize and Deserialize a Code object'] = function(test) { - var doc = {'doc': {'doc2': new Code('this.a > i', {i:1})}}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.doc.doc2.code, deserialized_data.doc.doc2.code); - test.deepEqual(doc.doc.doc2.scope.i, deserialized_data.doc.doc2.scope.i); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly serialize and deserialize and embedded array'] = function(test) { - var doc = {'a':0, - 'b':['tmp1', 'tmp2', 'tmp3', 'tmp4', 'tmp5', 'tmp6', 'tmp7', 'tmp8', 'tmp9', 'tmp10', 'tmp11', 'tmp12', 'tmp13', 'tmp14', 'tmp15', 'tmp16'] - }; - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.a, deserialized_data.a); - test.deepEqual(doc.b, deserialized_data.b); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize UTF8'] = function(test) { - // Serialize utf8 - var doc = { "name" : "本荘由利地域に洪水警報", "name1" : "öüóőúéáűíÖÜÓŐÚÉÁŰÍ", "name2" : "abcdedede"}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc, deserialized_data); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize query object'] = function(test) { - var doc = { count: 'remove_with_no_callback_bug_test', query: {}, fields: null}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc, deserialized_data); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize empty query object'] = function(test) { - var doc = {}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc, deserialized_data); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize array based doc'] = function(test) { - var doc = { b: [ 1, 2, 3 ], _id: new ObjectID() }; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.b, deserialized_data.b) - test.deepEqual(doc, deserialized_data); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize and Deserialize Symbol'] = function(test) { - if(Symbol != null) { - var doc = { b: [ new Symbol('test') ]}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc.b, deserialized_data.b) - test.deepEqual(doc, deserialized_data); - test.ok(deserialized_data.b[0] instanceof Symbol); - } - - test.done(); -} - -/** - * @ignore - */ -exports['Should handle Deeply nested document'] = function(test) { - var doc = {a:{b:{c:{d:2}}}}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var deserialized_data = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc, deserialized_data); - test.done(); -} - -/** - * @ignore - */ -exports['Should handle complicated all typed object'] = function(test) { - // First doc - var date = new Date(); - var oid = new ObjectID(); - var string = 'binstring' - var bin = new Binary() - for(var index = 0; index < string.length; index++) { - bin.put(string.charAt(index)) - } - - var doc = { - 'string': 'hello', - 'array': [1,2,3], - 'hash': {'a':1, 'b':2}, - 'date': date, - 'oid': oid, - 'binary': bin, - 'int': 42, - 'float': 33.3333, - 'regexp': /regexp/, - 'boolean': true, - 'long': date.getTime(), - 'where': new Code('this.a > i', {i:1}), - 'dbref': new DBRef('namespace', oid, 'integration_tests_') - } - - // Second doc - var oid = new ObjectID.createFromHexString(oid.toHexString()); - var string = 'binstring' - var bin = new Binary() - for(var index = 0; index < string.length; index++) { - bin.put(string.charAt(index)) - } - - var doc2 = { - 'string': 'hello', - 'array': [1,2,3], - 'hash': {'a':1, 'b':2}, - 'date': date, - 'oid': oid, - 'binary': bin, - 'int': 42, - 'float': 33.3333, - 'regexp': /regexp/, - 'boolean': true, - 'long': date.getTime(), - 'where': new Code('this.a > i', {i:1}), - 'dbref': new DBRef('namespace', oid, 'integration_tests_') - } - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var serialized_data2 = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc2, false, true); - - for(var i = 0; i < serialized_data2.length; i++) { - require('assert').equal(serialized_data2[i], serialized_data[i]) - } - - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize Complex Nested Object'] = function(test) { - var doc = { email: 'email@email.com', - encrypted_password: 'password', - friends: [ '4db96b973d01205364000006', - '4dc77b24c5ba38be14000002' ], - location: [ 72.4930088, 23.0431957 ], - name: 'Amit Kumar', - password_salt: 'salty', - profile_fields: [], - username: 'amit', - _id: new ObjectID() } - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = doc; - doc2._id = ObjectID.createFromHexString(doc2._id.toHexString()); - var serialized_data2 = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc2, false, true); - - for(var i = 0; i < serialized_data2.length; i++) { - require('assert').equal(serialized_data2[i], serialized_data[i]) - } - - test.done(); -} - -/** - * @ignore - */ -exports['Should correctly massive doc'] = function(test) { - var oid1 = new ObjectID(); - var oid2 = new ObjectID(); - - // JS doc - var doc = { dbref2: new DBRef('namespace', oid1, 'integration_tests_'), - _id: oid2 }; - - var doc2 = { dbref2: new DBRef('namespace', ObjectID.createFromHexString(oid1.toHexString()), 'integration_tests_'), - _id: new ObjectID.createFromHexString(oid2.toHexString()) }; - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var serialized_data2 = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc2, false, true); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize/Deserialize regexp object'] = function(test) { - var doc = {'b':/foobaré/}; - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var serialized_data2 = new BSONDE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - for(var i = 0; i < serialized_data2.length; i++) { - require('assert').equal(serialized_data2[i], serialized_data[i]) - } - - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize/Deserialize complicated object'] = function(test) { - var doc = {a:{b:{c:[new ObjectID(), new ObjectID()]}}, d:{f:1332.3323}}; - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - - test.deepEqual(doc, doc2) - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize/Deserialize nested object'] = function(test) { - var doc = { "_id" : { "date" : new Date(), "gid" : "6f35f74d2bea814e21000000" }, - "value" : { - "b" : { "countries" : { "--" : 386 }, "total" : 1599 }, - "bc" : { "countries" : { "--" : 3 }, "total" : 10 }, - "gp" : { "countries" : { "--" : 2 }, "total" : 13 }, - "mgc" : { "countries" : { "--" : 2 }, "total" : 14 } - } - } - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - - test.deepEqual(doc, doc2) - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize/Deserialize nested object with even more nesting'] = function(test) { - var doc = { "_id" : { "date" : {a:1, b:2, c:new Date()}, "gid" : "6f35f74d2bea814e21000000" }, - "value" : { - "b" : { "countries" : { "--" : 386 }, "total" : 1599 }, - "bc" : { "countries" : { "--" : 3 }, "total" : 10 }, - "gp" : { "countries" : { "--" : 2 }, "total" : 13 }, - "mgc" : { "countries" : { "--" : 2 }, "total" : 14 } - } - } - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual(doc, doc2) - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly Serialize empty name object'] = function(test) { - var doc = {'':'test', - 'bbbb':1}; - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.equal(doc2[''], 'test'); - test.equal(doc2['bbbb'], 1); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly handle Forced Doubles to ensure we allocate enough space for cap collections'] = function(test) { - if(Double != null) { - var doubleValue = new Double(100); - var doc = {value:doubleValue}; - - // Serialize - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - - var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - test.deepEqual({value:100}, doc2); - } - - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly deserialize a message'] = function(test) { - var data = "24000000be00de4428000000010000000800000000000000000000000000000000000000"; - var parent = {bson_deserializer:{"Long":Long, "BSON":BSONSE.BSON}} - var binaryData = new Buffer(hexStringToBinary(data)); - - var doc2 = new MongoReply(parent, binaryData); - test.deepEqual([], doc2.documents); - test.done(); -} - -/** - * @ignore - */ -exports['Should deserialize correctly'] = function(test) { - var doc = { - "_id" : new ObjectID("4e886e687ff7ef5e00000162"), - "str" : "foreign", - "type" : 2, - "timestamp" : ISODate("2011-10-02T14:00:08.383Z"), - "links" : [ - "http://www.reddit.com/r/worldnews/comments/kybm0/uk_home_secretary_calls_for_the_scrapping_of_the/" - ] - } - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - - test.deepEqual(doc, doc2) - test.done(); -} - -/** - * @ignore - */ -exports['Should correctly serialize and deserialize MinKey and MaxKey values'] = function(test) { - var doc = { - _id : new ObjectID("4e886e687ff7ef5e00000162"), - minKey : new MinKey(), - maxKey : new MaxKey() - } - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - - test.deepEqual(doc, doc2) - test.ok(doc2.minKey instanceof MinKey); - test.ok(doc2.maxKey instanceof MaxKey); - test.done(); -} - -/** - * @ignore - */ -exports['Should correctly serialize Double value'] = function(test) { - var doc = { - value : new Double(34343.2222) - } - - var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); - var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); - new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); - assertBuffersEqual(test, serialized_data, serialized_data2, 0); - var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data); - - test.ok(doc.value.valueOf(), doc2.value); - test.ok(doc.value.value, doc2.value); - test.done(); -} - -/** - * @ignore - */ -exports['ObjectID should correctly create objects'] = function(test) { - try { - var object1 = ObjectID.createFromHexString('000000000000000000000001') - var object2 = ObjectID.createFromHexString('00000000000000000000001') - test.ok(false); - } catch(err) { - test.ok(err != null); - } - - test.done(); -} - -/** - * @ignore - */ -exports['ObjectID should correctly retrieve timestamp'] = function(test) { - var testDate = new Date(); - var object1 = new ObjectID(); - test.equal(Math.floor(testDate.getTime()/1000), Math.floor(object1.getTimestamp().getTime()/1000)); - test.done(); -} - -/** - * @ignore - */ -exports['Should Correctly throw error on bsonparser errors'] = function(test) { - var data = new Buffer(3); - var parser = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]); - - // Catch to small buffer error - try { - parser.deserialize(data); - test.ok(false); - } catch(err) {} - - data = new Buffer(5); - data[0] = 0xff; - data[1] = 0xff; - // Catch illegal size - try { - parser.deserialize(data); - test.ok(false); - } catch(err) {} - - // Finish up - test.done(); -} - -/** - * A simple example showing the usage of BSON.calculateObjectSize function returning the number of BSON bytes a javascript object needs. - * - * @_class bson - * @_function BSON.calculateObjectSize - * @ignore - */ -exports['Should correctly calculate the size of a given javascript object'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){}} - // Calculate the size of the object without serializing the function - var size = BSON.calculateObjectSize(doc, false); - test.equal(12, size); - // Calculate the size of the object serializing the function - size = BSON.calculateObjectSize(doc, true); - // Validate the correctness - test.equal(36, size); - test.done(); -} - -/** - * A simple example showing the usage of BSON.calculateObjectSize function returning the number of BSON bytes a javascript object needs. - * - * @_class bson - * @_function calculateObjectSize - * @ignore - */ -exports['Should correctly calculate the size of a given javascript object using instance method'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){}} - // Create a BSON parser instance - var bson = new BSON(); - // Calculate the size of the object without serializing the function - var size = bson.calculateObjectSize(doc, false); - test.equal(12, size); - // Calculate the size of the object serializing the function - size = bson.calculateObjectSize(doc, true); - // Validate the correctness - test.equal(36, size); - test.done(); -} - -/** - * A simple example showing the usage of BSON.serializeWithBufferAndIndex function. - * - * @_class bson - * @_function BSON.serializeWithBufferAndIndex - * @ignore - */ -exports['Should correctly serializeWithBufferAndIndex a given javascript object'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){}} - // Calculate the size of the document, no function serialization - var size = BSON.calculateObjectSize(doc, false); - // Allocate a buffer - var buffer = new Buffer(size); - // Serialize the object to the buffer, checking keys and not serializing functions - var index = BSON.serializeWithBufferAndIndex(doc, true, buffer, 0, false); - // Validate the correctness - test.equal(12, size); - test.equal(11, index); - - // Serialize with functions - // Calculate the size of the document, no function serialization - var size = BSON.calculateObjectSize(doc, true); - // Allocate a buffer - var buffer = new Buffer(size); - // Serialize the object to the buffer, checking keys and not serializing functions - var index = BSON.serializeWithBufferAndIndex(doc, true, buffer, 0, true); - // Validate the correctness - test.equal(36, size); - test.equal(35, index); - test.done(); -} - -/** - * A simple example showing the usage of BSON.serializeWithBufferAndIndex function. - * - * @_class bson - * @_function serializeWithBufferAndIndex - * @ignore - */ -exports['Should correctly serializeWithBufferAndIndex a given javascript object using a BSON instance'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){}} - // Create a BSON parser instance - var bson = new BSON(); - // Calculate the size of the document, no function serialization - var size = bson.calculateObjectSize(doc, false); - // Allocate a buffer - var buffer = new Buffer(size); - // Serialize the object to the buffer, checking keys and not serializing functions - var index = bson.serializeWithBufferAndIndex(doc, true, buffer, 0, false); - // Validate the correctness - test.equal(12, size); - test.equal(11, index); - - // Serialize with functions - // Calculate the size of the document, no function serialization - var size = bson.calculateObjectSize(doc, true); - // Allocate a buffer - var buffer = new Buffer(size); - // Serialize the object to the buffer, checking keys and not serializing functions - var index = bson.serializeWithBufferAndIndex(doc, true, buffer, 0, true); - // Validate the correctness - test.equal(36, size); - test.equal(35, index); - test.done(); -} - -/** - * A simple example showing the usage of BSON.serialize function returning serialized BSON Buffer object. - * - * @_class bson - * @_function BSON.serialize - * @ignore - */ -exports['Should correctly serialize a given javascript object'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){}} - // Serialize the object to a buffer, checking keys and not serializing functions - var buffer = BSON.serialize(doc, true, true, false); - // Validate the correctness - test.equal(12, buffer.length); - - // Serialize the object to a buffer, checking keys and serializing functions - var buffer = BSON.serialize(doc, true, true, true); - // Validate the correctness - test.equal(36, buffer.length); - test.done(); -} - -/** - * A simple example showing the usage of BSON.serialize function returning serialized BSON Buffer object. - * - * @_class bson - * @_function serialize - * @ignore - */ -exports['Should correctly serialize a given javascript object using a bson instance'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){}} - // Create a BSON parser instance - var bson = new BSON(); - // Serialize the object to a buffer, checking keys and not serializing functions - var buffer = bson.serialize(doc, true, true, false); - // Validate the correctness - test.equal(12, buffer.length); - - // Serialize the object to a buffer, checking keys and serializing functions - var buffer = bson.serialize(doc, true, true, true); - // Validate the correctness - test.equal(36, buffer.length); - test.done(); -} - -/** - * A simple example showing the usage of BSON.deserialize function returning a deserialized Javascript function. - * - * @_class bson - * @_function BSON.deserialize - * @ignore - */ - exports['Should correctly deserialize a buffer using the BSON class level parser'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){ console.log('hello world'); }} - // Serialize the object to a buffer, checking keys and serializing functions - var buffer = BSON.serialize(doc, true, true, true); - // Validate the correctness - test.equal(65, buffer.length); - - // Deserialize the object with no eval for the functions - var deserializedDoc = BSON.deserialize(buffer); - // Validate the correctness - test.equal('object', typeof deserializedDoc.func); - test.equal(1, deserializedDoc.a); - - // Deserialize the object with eval for the functions caching the functions - deserializedDoc = BSON.deserialize(buffer, {evalFunctions:true, cacheFunctions:true}); - // Validate the correctness - test.equal('function', typeof deserializedDoc.func); - test.equal(1, deserializedDoc.a); - test.done(); -} - -/** - * A simple example showing the usage of BSON instance deserialize function returning a deserialized Javascript function. - * - * @_class bson - * @_function deserialize - * @ignore - */ -exports['Should correctly deserialize a buffer using the BSON instance parser'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){ console.log('hello world'); }} - // Create a BSON parser instance - var bson = new BSON(); - // Serialize the object to a buffer, checking keys and serializing functions - var buffer = bson.serialize(doc, true, true, true); - // Validate the correctness - test.equal(65, buffer.length); - - // Deserialize the object with no eval for the functions - var deserializedDoc = bson.deserialize(buffer); - // Validate the correctness - test.equal('object', typeof deserializedDoc.func); - test.equal(1, deserializedDoc.a); - - // Deserialize the object with eval for the functions caching the functions - deserializedDoc = bson.deserialize(buffer, {evalFunctions:true, cacheFunctions:true}); - // Validate the correctness - test.equal('function', typeof deserializedDoc.func); - test.equal(1, deserializedDoc.a); - test.done(); -} - -/** - * A simple example showing the usage of BSON.deserializeStream function returning deserialized Javascript objects. - * - * @_class bson - * @_function BSON.deserializeStream - * @ignore - */ -exports['Should correctly deserializeStream a buffer object'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){ console.log('hello world'); }} - // Serialize the object to a buffer, checking keys and serializing functions - var buffer = BSON.serialize(doc, true, true, true); - // Validate the correctness - test.equal(65, buffer.length); - - // The array holding the number of retuned documents - var documents = new Array(1); - // Deserialize the object with no eval for the functions - var index = BSON.deserializeStream(buffer, 0, 1, documents, 0); - // Validate the correctness - test.equal(65, index); - test.equal(1, documents.length); - test.equal(1, documents[0].a); - test.equal('object', typeof documents[0].func); - - // Deserialize the object with eval for the functions caching the functions - // The array holding the number of retuned documents - var documents = new Array(1); - // Deserialize the object with no eval for the functions - var index = BSON.deserializeStream(buffer, 0, 1, documents, 0, {evalFunctions:true, cacheFunctions:true}); - // Validate the correctness - test.equal(65, index); - test.equal(1, documents.length); - test.equal(1, documents[0].a); - test.equal('function', typeof documents[0].func); - test.done(); -} - -/** - * A simple example showing the usage of BSON instance deserializeStream function returning deserialized Javascript objects. - * - * @_class bson - * @_function deserializeStream - * @ignore - */ -exports['Should correctly deserializeStream a buffer object'] = function(test) { - // Create a simple object - var doc = {a: 1, func:function(){ console.log('hello world'); }} - // Create a BSON parser instance - var bson = new BSON(); - // Serialize the object to a buffer, checking keys and serializing functions - var buffer = bson.serialize(doc, true, true, true); - // Validate the correctness - test.equal(65, buffer.length); - - // The array holding the number of retuned documents - var documents = new Array(1); - // Deserialize the object with no eval for the functions - var index = bson.deserializeStream(buffer, 0, 1, documents, 0); - // Validate the correctness - test.equal(65, index); - test.equal(1, documents.length); - test.equal(1, documents[0].a); - test.equal('object', typeof documents[0].func); - - // Deserialize the object with eval for the functions caching the functions - // The array holding the number of retuned documents - var documents = new Array(1); - // Deserialize the object with no eval for the functions - var index = bson.deserializeStream(buffer, 0, 1, documents, 0, {evalFunctions:true, cacheFunctions:true}); - // Validate the correctness - test.equal(65, index); - test.equal(1, documents.length); - test.equal(1, documents[0].a); - test.equal('function', typeof documents[0].func); - test.done(); -} - -/** - * @ignore - */ -// 'Should Correctly Function' = function(test) { -// var doc = {b:1, func:function() { -// this.b = 2; -// }}; -// -// var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc, false, true); -// -// debug("----------------------------------------------------------------------") -// debug(inspect(serialized_data)) -// -// // var serialized_data2 = new Buffer(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).calculateObjectSize(doc)); -// // new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serializeWithBufferAndIndex(doc, false, serialized_data2, 0); -// // assertBuffersEqual(test, serialized_data, serialized_data2, 0); -// var COUNT = 100000; -// -// // var b = null; -// // eval("b = function(x) { return x+x; }"); -// // var b = new Function("x", "return x+x;"); -// -// console.log(COUNT + "x (objectBSON = BSON.serialize(object))") -// start = new Date -// -// for (i=COUNT; --i>=0; ) { -// var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data, {evalFunctions: true, cacheFunctions:true}); -// } -// -// end = new Date -// console.log("time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec") -// -// // debug(inspect(new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).functionCache)) -// // -// // var doc2 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data, {evalFunctions: true, cacheFunctions:true}); -// // // test.deepEqual(doc, doc2) -// // // -// // debug(inspect(doc2)) -// // doc2.func() -// // debug(inspect(doc2)) -// // -// // var serialized_data = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).serialize(doc2, false, true); -// // var doc3 = new BSONSE.BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey]).deserialize(serialized_data, {evalFunctions: true, cacheFunctions:true}); -// // -// // debug("-----------------------------------------------") -// // debug(inspect(doc3)) -// -// // var key = "0" -// // for(var i = 1; i < 10000; i++) { -// // key = key + " " + i -// // } -// -// test.done(); -// -// -// // var car = { -// // model : "Volvo", -// // country : "Sweden", -// // -// // isSwedish : function() { -// // return this.country == "Sweden"; -// // } -// // } -// -// }, - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/bson/commands_test.js b/test/bson/commands_test.js deleted file mode 100644 index e0d80cc6388..00000000000 --- a/test/bson/commands_test.js +++ /dev/null @@ -1,129 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - mongoO = require('../../lib/mongodb').pure(), - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - fs = require('fs'), - BSON = mongodb.BSON, - Code = mongoO.Code, - Binary = mongoO.Binary, - Symbol = mongoO.Symbol, - DBRef = mongoO.DBRef, - Double = mongoO.Double, - MinKey = mongoO.MinKey, - MaxKey = mongoO.MaxKey, - Timestamp = mongoO.Timestamp, - Long = mongoO.Long, - ObjectID = mongoO.ObjectID, - DBRef = mongoO.DBRef, - BaseCommand = mongoO.BaseCommand, - InsertCommand = mongoO.InsertCommand, - UpdateCommand = mongoO.UpdateCommand, - DeleteCommand = mongoO.DeleteCommand, - GetMoreCommand = mongoO.GetMoreCommand, - KillCursorCommand = mongoO.KillCursorCommand, - QueryCommand = mongoO.QueryCommand, - MongoReply = mongoO.MongoReply, - BinaryParser = mongoO.BinaryParser; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - callback(); -} - -exports['Should Correctly Generate an Insert Command'] = function(test) { - var full_collection_name = "db.users"; - var insert_command = new InsertCommand({bson: new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey])}, full_collection_name); - insert_command.add({name: 'peter pan'}); - insert_command.add({name: 'monkey king'}); - // assert the length of the binary - test.equal(81, insert_command.toBinary().length); - test.done(); -} - -exports['Should Correctly Generate an Update Command'] = function(test) { - var full_collection_name = "db.users"; - var flags = UpdateCommand.DB_UPSERT; - var selector = {name: 'peter pan'}; - var document = {name: 'peter pan junior'}; - // Create the command - var update_command = new UpdateCommand({bson: new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey])}, full_collection_name, selector, document, flags); - // assert the length of the binary - test.equal(90, update_command.toBinary().length); - test.done(); -} - -exports['Should Correctly Generate a Delete Command'] = function(test) { - var full_collection_name = "db.users"; - var selector = {name: 'peter pan'}; - // Create the command - var delete_command = new DeleteCommand({bson: new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey])}, full_collection_name, selector); - // assert the length of the binary - test.equal(58, delete_command.toBinary().length); - test.done(); -} - -exports['Should Correctly Generate a Get More Command'] = function(test) { - var full_collection_name = "db.users"; - var numberToReturn = 100; - var cursorId = Long.fromNumber(10000222); - // Create the command - var get_more_command = new GetMoreCommand({bson: new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey])}, full_collection_name, numberToReturn, cursorId); - // assert the length of the binary - test.equal(41, get_more_command.toBinary().length); - test.done(); -} - -exports['Should Correctly Generate a Kill Cursors Command'] = function(test) { - Array.prototype.toXml = function() {} - var cursorIds = [Long.fromNumber(1), Long.fromNumber(10000222)]; - // Create the command - var kill_cursor_command = new KillCursorCommand({bson: new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey])}, cursorIds); - // assert the length of the binary - test.equal(40, kill_cursor_command.toBinary().length); - test.done(); -} - -exports['Should Correctly Generate a Query Command'] = function(test) { - var full_collection_name = "db.users"; - var options = QueryCommand.OPTS_SLAVE; - var numberToSkip = 100; - var numberToReturn = 200; - var query = {name:'peter pan'}; - var query_command = new QueryCommand({bson: new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey])}, full_collection_name, options, numberToSkip, numberToReturn, query, null); - // assert the length of the binary - test.equal(62, query_command.toBinary().length); - // Generate command with return field filter - query_command = new QueryCommand({bson: new BSON([Long, ObjectID, Binary, Code, DBRef, Symbol, Double, Timestamp, MaxKey, MinKey])}, full_collection_name, options, numberToSkip, numberToReturn, query, { a : 1, b : 1, c : 1}); - test.equal(88, query_command.toBinary().length); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/bson_types_test.js b/test/bson_types_test.js deleted file mode 100644 index 5b8574065e1..00000000000 --- a/test/bson_types_test.js +++ /dev/null @@ -1,215 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - Buffer = require('buffer').Buffer, - gleak = require('../dev/tools/gleak'), - fs = require('fs'), - BSON = mongodb.BSON, - Code = mongodb.Code, - Binary = mongodb.Binary, - Timestamp = mongodb.Timestamp, - Long = mongodb.Long, - MongoReply = mongodb.MongoReply, - ObjectID = mongodb.ObjectID, - Symbol = mongodb.Symbol, - DBRef = mongodb.DBRef, - Double = mongodb.Double, - MinKey = mongodb.MinKey, - MaxKey = mongodb.MaxKey, - BinaryParser = mongodb.BinaryParser; - -var BSONSE = mongodb, - BSONDE = mongodb; - -// for tests -BSONDE.BSON_BINARY_SUBTYPE_DEFAULT = 0; -BSONDE.BSON_BINARY_SUBTYPE_FUNCTION = 1; -BSONDE.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -BSONDE.BSON_BINARY_SUBTYPE_UUID = 3; -BSONDE.BSON_BINARY_SUBTYPE_MD5 = 4; -BSONDE.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -BSONSE.BSON_BINARY_SUBTYPE_DEFAULT = 0; -BSONSE.BSON_BINARY_SUBTYPE_FUNCTION = 1; -BSONSE.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -BSONSE.BSON_BINARY_SUBTYPE_UUID = 3; -BSONSE.BSON_BINARY_SUBTYPE_MD5 = 4; -BSONSE.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -var hexStringToBinary = function(string) { - var numberofValues = string.length / 2; - var array = ""; - - for(var i = 0; i < numberofValues; i++) { - array += String.fromCharCode(parseInt(string[i*2] + string[i*2 + 1], 16)); - } - return array; -} - -var assertBuffersEqual = function(test, buffer1, buffer2) { - if(buffer1.length != buffer2.length) test.fail("Buffers do not have the same length", buffer1, buffer2); - - for(var i = 0; i < buffer1.length; i++) { - test.equal(buffer1[i], buffer2[i]); - } -} - -/** - * Module for parsing an ISO 8601 formatted string into a Date object. - */ -var ISODate = function (string) { - var match; - - if (typeof string.getTime === "function") - return string; - else if (match = string.match(/^(\d{4})(-(\d{2})(-(\d{2})(T(\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|((\+|-)(\d{2}):(\d{2}))))?)?)?$/)) { - var date = new Date(); - date.setUTCFullYear(Number(match[1])); - date.setUTCMonth(Number(match[3]) - 1 || 0); - date.setUTCDate(Number(match[5]) || 0); - date.setUTCHours(Number(match[7]) || 0); - date.setUTCMinutes(Number(match[8]) || 0); - date.setUTCSeconds(Number(match[10]) || 0); - date.setUTCMilliseconds(Number("." + match[12]) * 1000 || 0); - - if (match[13] && match[13] !== "Z") { - var h = Number(match[16]) || 0, - m = Number(match[17]) || 0; - - h *= 3600000; - m *= 60000; - - var offset = h + m; - if (match[15] == "+") - offset = -offset; - - date = new Date(date.valueOf() + offset); - } - - return date; - } else - throw new Error("Invalid ISO 8601 date given.", __filename); -}; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - callback(); -} - -/** - * A simple example showing the usage of the binary put method. - * - * @_class binary - * @_function put - * @ignore - */ -exports.shouldCorrectUsePutForBinaryType = function(test) { - // Create an empty Binary object - var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); - // Write some character to the Binary value - binary.put('h'); - binary.put('e'); - binary.put('l'); - binary.put('l'); - binary.put('o'); - // Validate the content of the binary - test.equal('hello', binary.toString('ascii')); - test.done(); -} - -/** - * A simple example showing the usage of the binary write method. - * - * @_class binary - * @_function write - * @ignore - */ -exports.shouldCorrectUseWriteForBinaryType = function(test) { - // Create an empty Binary object - var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); - // Write some data to the binary - binary.write('hello', 0); - // Validate the content of the binary - test.equal('hello', binary.toString('ascii')); - test.done(); -} - -/** - * A simple example showing the usage of the binary read method. - * - * @_class binary - * @_function read - * @ignore - */ -exports.shouldCorrectUseReadForBinaryType = function(test) { - // Create an empty Binary object - var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); - // Write some data to the binary - binary.write('hello', 0); - // Read a couple of characters from the binary - var data = binary.read(1, 2); - // Validate the content of the binary - test.equal('el', data.toString('ascii')); - test.done(); -} - -/** - * A simple example showing the usage of the binary value method. - * - * @_class binary - * @_function value - * @ignore - */ -exports.shouldCorrectUseValueForBinaryType = function(test) { - // Create an empty Binary object - var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); - // Write some data to the binary - binary.write('hello', 0); - // Validate the content of the binary - test.equal('hello', binary.value()); - test.done(); -} - -/** - * A simple example showing the usage of the binary length method. - * - * @_class binary - * @_function length - * @ignore - */ -exports.shouldCorrectUseLengthForBinaryType = function(test) { - // Create an empty Binary object - var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT); - // Write some data to the binary - binary.write('hello'); - // Validate the content of the binary - test.equal(5, binary.length()); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/certificates/mycert.pem b/test/certificates/mycert.pem deleted file mode 100644 index 954627cccd8..00000000000 --- a/test/certificates/mycert.pem +++ /dev/null @@ -1,36 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,5BC1D8935109F6C8 - -cbr7PTUV8ySzjBsvtCLng+0m7aez0D/Q76JnsW265oLxwqqID9mgS3rIZUgbu2SQ -+rfTTG+xcrONJs41Pbao1D1BNcUrmLF+8pl6055xFOPWrE1cxHQRShlhgG/pLVE3 -JqLFLV4Pd8Tf+o3FwbZ3zqgqwMPVZN/TLfzw94qcrXiidNvWuWf3oyU4w+CzD4Vt -f9HYNOeZWCUtaGGM5koUU/qu/RYQdKXZTRPz9wCHTjSsrznE4BpAJgtBbaOpr850 -c3WP48aveK9NZ9aoR1c+BW6MN+HPN2HhwA9rQUBSwfwlVVxxY1Ir2ArbP7fStlvK -TRtuE7Ro0ZEOUiHB5c9X7p6clKgshP7K19ZG6O0ns1P9d9z7l35f1WG/XQxA66tg -h8haN8nOtPJfrAyn5NcmOS2kTA0kL6Lk2TWwqoVErvpCRgdyhQ94GxjMiHLvkfxx -z5fVQqoXuYV8O6ozfdx+58qJnRTLC1cHf8iwWc9sDE/IP9OTpxwMUBKX4EYOL8MQ -4pjv0qnD/PQN4B5CbQ0RViBLykl22SScxqS3Zq14/sItEjM44ctjgAfmoPZSElTz -n9zhc8VQzgyjuNRt02xAi+tx2RD5I44ylm7QTYnXdWVgftnSgY+Ir4npTK5bnxIB -b9CLPljXbj8k5utoTyFkZa+bRES3a3+MEq5dNFRb0neQ3nJXqB83hMEDE35XWbU0 -gJwG7KsVS6Vr3SfBi47fsoIH1Ii92hZxWrtbTlzjy884zSps+mTWGA6TuU8jb6jn -b2JyNJDhVqDk19DPP+TtMv+GgXuoj7EXenQbwRXO/NVyaWpyBU7dHA== ------END RSA PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIC4TCCAkqgAwIBAgIJAM0r5teNISyyMA0GCSqGSIb3DQEBBQUAMFUxCzAJBgNV -BAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEO -MAwGA1UEChMFMTBnZW4xDjAMBgNVBAMTBTEwZ2VuMB4XDTExMTIwMjEwMTcwM1oX -DTEyMTIwMTEwMTcwM1owVTELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUJhcmNlbG9u -YTESMBAGA1UEBxMJQmFyY2Vsb25hMQ4wDAYDVQQKEwUxMGdlbjEOMAwGA1UEAxMF -MTBnZW4wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAPBY5u20gJQAXw/m3hiY -kC1zqDt4lahjUauPUDeshceAuBIgQLePZwckR3caPqS1a1uPsKMQIKN1E/z781MY -iAdgRPwpQfKt1MRZRZdUVzOsGQdDtF1XEnIbQgdiahbXVqVeULLLuypWnw1ceAys -ESu8kWqPAm1eu+utqJOENXWpAgMBAAGjgbgwgbUwHQYDVR0OBBYEFN1iayQf9puR -3OZxEy/FtFv6YSRoMIGFBgNVHSMEfjB8gBTdYmskH/abkdzmcRMvxbRb+mEkaKFZ -pFcwVTELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUJhcmNlbG9uYTESMBAGA1UEBxMJ -QmFyY2Vsb25hMQ4wDAYDVQQKEwUxMGdlbjEOMAwGA1UEAxMFMTBnZW6CCQDNK+bX -jSEssjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAOvATDKZ95epzVjV -qGnaHgu4u6NJuvZlGmBl2Mq/EA2ymw2LL+Pt38BqyQWvO/5TlxF1EFhH3kl6RENw -9U7C+w8tqhQL3hQsTASdX9gTczaYgHwHsKLc2JFcC7J2ffXM0aW5wUCKUwvvtf/h -7rUWJPi+evtVGTxRhCQGJcoI9lEK ------END CERTIFICATE----- diff --git a/test/collection_test.js b/test/collection_test.js deleted file mode 100644 index 15aa32fcccb..00000000000 --- a/test/collection_test.js +++ /dev/null @@ -1,1189 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - Long = require('../lib/mongodb/bson/long').Long, - Step = require("step"), - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * Example of a simple document save with safe set to false - * - * @_class collection - * @_function save - * @ignore - */ -exports.shouldCorrectlySaveASimpleDocument = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch the collection - db.collection("save_a_simple_document", function(err, collection) { - - // Save a document with no safe option - collection.save({hello:'world'}); - - // Wait for a second - setTimeout(function() { - - // Find the saved document - collection.findOne({hello:'world'}, function(err, item) { - test.equal(null, err); - test.equal('world', item.hello); - db.close(); - test.done(); - }); - }, 1000); - }); - }); -} - -/** - * Example of a simple document save and then resave with safe set to true - * - * @_class collection - * @_function save - * @ignore - */ -exports.shouldCorrectlySaveASimpleDocumentModifyItAndResaveIt = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch the collection - db.collection("save_a_simple_document_modify_it_and_resave_it", function(err, collection) { - - // Save a document with no safe option - collection.save({hello:'world'}, {safe:true}, function(err, result) { - - // Find the saved document - collection.findOne({hello:'world'}, function(err, item) { - test.equal(null, err); - test.equal('world', item.hello); - - // Update the document - item['hello2'] = 'world2'; - - // Save the item with the additional field - collection.save(item, {safe:true}, function(err, result) { - - // Find the changed document - collection.findOne({hello:'world'}, function(err, item) { - test.equal(null, err); - test.equal('world', item.hello); - test.equal('world2', item.hello2); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectExecuteBasicCollectionMethods = function(test) { - client.createCollection('test_collection_methods', function(err, collection) { - // Verify that all the result are correct coming back (should contain the value ok) - test.equal('test_collection_methods', collection.collectionName); - // Let's check that the collection was created correctly - client.collectionNames(function(err, documents) { - var found = false; - documents.forEach(function(document) { - if(document.name == "integration_tests_.test_collection_methods") found = true; - }); - test.ok(true, found); - // Rename the collection and check that it's gone - client.renameCollection("test_collection_methods", "test_collection_methods2", function(err, reply) { - test.equal(null, err); - // Drop the collection and check that it's gone - client.dropCollection("test_collection_methods2", function(err, result) { - test.equal(true, result); - test.done(); - }) - }); - }); - }) -} - -/** - * @ignore - */ -exports.shouldAccessToCollections = function(test) { - // Create two collections - client.createCollection('test.spiderman', function(r) { - client.createCollection('test.mario', function(r) { - // Insert test documents (creates collections) - client.collection('test.spiderman', function(err, spiderman_collection) { - spiderman_collection.insert({foo:5}, {safe:true}, function(err, r) { - - client.collection('test.mario', function(err, mario_collection) { - mario_collection.insert({bar:0}, {safe:true}, function(err, r) { - // Assert collections - client.collections(function(err, collections) { - var found_spiderman = false; - var found_mario = false; - var found_does_not_exist = false; - - collections.forEach(function(collection) { - if(collection.collectionName == "test.spiderman") found_spiderman = true; - if(collection.collectionName == "test.mario") found_mario = true; - if(collection.collectionName == "does_not_exist") found_does_not_exist = true; - }); - - test.ok(found_spiderman); - test.ok(found_mario); - test.ok(!found_does_not_exist); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyDropCollection = function(test) { - client.createCollection('test_drop_collection2', function(err, r) { - client.dropCollection('test_drop_collection', function(err, r) { - test.ok(err instanceof Error); - test.equal("ns not found", err.message); - var found = false; - // Ensure we don't have the collection in the set of names - client.collectionNames(function(err, replies) { - replies.forEach(function(err, document) { - if(document.name == "test_drop_collection") { - found = true; - return; - } - }); - // If we have an instance of the index throw and error - if(found) throw new Error("should not fail"); - // Let's close the db - test.done(); - }); - }); - }); -} - -/** - * Example of a simple document save and then resave with safe set to true - * - * @_class collection - * @_function drop - * @ignore - */ -exports.shouldCorrectlyDropCollectionWithDropFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('test_other_drop', function(err, collection) { - test.equal(null, err); - - // Drop the collection - collection.drop(function(err, reply) { - - // Ensure we don't have the collection in the set of names - db.collectionNames(function(err, replies) { - - var found = false; - // For each collection in the list of collection names in this db look for the - // dropped collection - replies.forEach(function(document) { - if(document.name == "test_other_drop") { - found = true; - return; - } - }); - - // Ensure the collection is not found - test.equal(false, found); - - // Let's close the db - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyRetriveCollectionNames = function(test) { - client.createCollection('test_collection_names', function(err, r) { - client.collectionNames(function(err, documents) { - var found = false; - var found2 = false; - documents.forEach(function(document) { - if(document.name == MONGODB + '.test_collection_names') found = true; - }); - test.ok(found); - // Insert a document in an non-existing collection should create the collection - client.collection('test_collection_names2', function(err, collection) { - collection.insert({a:1}, {safe:true}, function(err, r) { - client.collectionNames(function(err, documents) { - documents.forEach(function(document) { - if(document.name == MONGODB + '.test_collection_names2') found = true; - if(document.name == MONGODB + '.test_collection_names') found2 = true; - }); - - test.ok(found); - test.ok(found2); - // Let's close the db - test.done(); - }); - }) - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyRetrieveCollectionInfo = function(test) { - client.createCollection('test_collections_info', function(err, r) { - client.collectionsInfo(function(err, cursor) { - test.ok((cursor instanceof Cursor)); - // Fetch all the collection info - cursor.toArray(function(err, documents) { - test.ok(documents.length > 1); - - var found = false; - documents.forEach(function(document) { - if(document.name == MONGODB + '.test_collections_info') found = true; - }); - test.ok(found); - // Let's close the db - test.done(); - }); - }); - }); -} - -/** - * An example returning the options for a collection. - * - * @_class collection - * @_function options - */ -exports.shouldCorrectlyRetriveCollectionOptions = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a test collection that we are getting the options back from - db.createCollection('test_collection_options', {'capped':true, 'size':1024}, function(err, collection) { - test.ok(collection instanceof Collection); - test.equal('test_collection_options', collection.collectionName); - - // Let's fetch the collection options - collection.options(function(err, options) { - test.equal(true, options.capped); - test.equal(1024, options.size); - test.equal("test_collection_options", options.create); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * An example showing how to establish if it's a capped collection - * - * @_class collection - * @_function isCapped - */ -exports.shouldCorrectlyExecuteIsCapped = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a test collection that we are getting the options back from - db.createCollection('test_collection_is_capped', {'capped':true, 'size':1024}, function(err, collection) { - test.ok(collection instanceof Collection); - test.equal('test_collection_is_capped', collection.collectionName); - - // Let's fetch the collection options - collection.isCapped(function(err, capped) { - test.equal(true, capped); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * An example showing the use of the indexExists function for a single index name and a list of index names. - * - * @_class collection - * @_function indexExists - */ -exports.shouldCorrectlyExecuteIndexExists = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a test collection that we are getting the options back from - db.createCollection('test_collection_index_exists', function(err, collection) { - test.equal(null, err); - - // Create an index on the collection - collection.createIndex('a', function(err, indexName) { - - // Let's test to check if a single index exists - collection.indexExists("a_1", function(err, result) { - test.equal(true, result); - - // Let's test to check if multiple indexes are available - collection.indexExists(["a_1", "_id_"], function(err, result) { - test.equal(true, result); - - // Check if a non existing index exists - collection.indexExists("c_1", function(err, result) { - test.equal(false, result); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldEnsureStrictAccessCollection = function(test) { - var error_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, ssl:useSSL}), {strict:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - test.equal(true, error_client.strict); - - error_client.open(function(err, error_client) { - error_client.collection('does-not-exist', function(err, collection) { - test.ok(err instanceof Error); - test.equal("Collection does-not-exist does not exist. Currently in strict mode.", err.message); - }); - - error_client.createCollection('test_strict_access_collection', function(err, collection) { - error_client.collection('test_strict_access_collection', function(err, collection) { - test.ok(collection instanceof Collection); - // Let's close the db - error_client.close(); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldPerformStrictCreateCollection = function(test) { - var error_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, ssl:useSSL}), {strict:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - test.equal(true, error_client.strict); - - error_client.open(function(err, error_client) { - error_client.createCollection('test_strict_create_collection', function(err, collection) { - test.ok(collection instanceof Collection); - - // Creating an existing collection should fail - error_client.createCollection('test_strict_create_collection', function(err, collection) { - test.ok(err instanceof Error); - test.equal("Collection test_strict_create_collection already exists. Currently in strict mode.", err.message); - - // Switch out of strict mode and try to re-create collection - error_client.strict = false; - error_client.createCollection('test_strict_create_collection', function(err, collection) { - test.ok(collection instanceof Collection); - - // Let's close the db - error_client.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldFailToInsertDueToIllegalKeys = function(test) { - client.createCollection('test_invalid_key_names', function(err, collection) { - // Legal inserts - collection.insert([{'hello':'world'}, {'hello':{'hello':'world'}}], {safe:true}, function(err, r) { - // Illegal insert for key - collection.insert({'$hello':'world'}, {safe:true}, function(err, doc) { - test.ok(err instanceof Error); - test.equal("key $hello must not start with '$'", err.message); - - collection.insert({'hello':{'$hello':'world'}}, {safe:true}, function(err, doc) { - test.ok(err instanceof Error); - test.equal("key $hello must not start with '$'", err.message); - - collection.insert({'he$llo':'world'}, {safe:true}, function(err, docs) { - test.ok(docs[0].constructor == Object); - - collection.insert({'hello':{'hell$o':'world'}}, {safe:true}, function(err, docs) { - test.ok(err == null); - - collection.insert({'.hello':'world'}, {safe:true}, function(err, doc) { - test.ok(err instanceof Error); - test.equal("key .hello must not contain '.'", err.message); - - collection.insert({'hello':{'.hello':'world'}}, {safe:true}, function(err, doc) { - test.ok(err instanceof Error); - test.equal("key .hello must not contain '.'", err.message); - - collection.insert({'hello.':'world'}, {safe:true}, function(err, doc) { - test.ok(err instanceof Error); - test.equal("key hello. must not contain '.'", err.message); - - collection.insert({'hello':{'hello.':'world'}}, {safe:true}, function(err, doc) { - test.ok(err instanceof Error); - test.equal("key hello. must not contain '.'", err.message); - // Let's close the db - test.done(); - }); - }); - }); - }); - }) - }) - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldFailDueToIllegalCollectionNames = function(test) { - client.collection(5, function(err, collection) { - test.equal("collection name must be a String", err.message); - }); - - client.collection("", function(err, collection) { - test.equal("collection names cannot be empty", err.message); - }); - - client.collection("te$t", function(err, collection) { - test.equal("collection names must not contain '$'", err.message); - }); - - client.collection(".test", function(err, collection) { - test.equal("collection names must not start or end with '.'", err.message); - }); - - client.collection("test.", function(err, collection) { - test.equal("collection names must not start or end with '.'", err.message); - }); - - client.collection("test..t", function(err, collection) { - test.equal("collection names cannot be empty", err.message); - test.done(); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyCountOnNonExistingCollection = function(test) { - client.collection('test_multiple_insert_2', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - // Let's close the db - test.done(); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteSave = function(test) { - client.createCollection('test_save', function(err, collection) { - var doc = {'hello':'world'}; - collection.save(doc, {safe:true}, function(err, docs) { - test.ok(docs._id instanceof ObjectID || Object.prototype.toString.call(docs._id) === '[object ObjectID]'); - - collection.count(function(err, count) { - test.equal(1, count); - doc = docs; - - collection.save(doc, {safe:true}, function(err, doc2) { - - collection.count(function(err, count) { - test.equal(1, count); - - collection.findOne(function(err, doc3) { - test.equal('world', doc3.hello); - - doc3.hello = 'mike'; - - collection.save(doc3, {safe:true}, function(err, doc4) { - collection.count(function(err, count) { - test.equal(1, count); - - collection.findOne(function(err, doc5) { - test.equal('mike', doc5.hello); - - // Save another document - collection.save({hello:'world'}, {safe:true}, function(err, doc) { - collection.count(function(err, count) { - test.equal(2, count); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySaveDocumentWithLongValue = function(test) { - client.createCollection('test_save_long', function(err, collection) { - collection.insert({'x':Long.fromNumber(9223372036854775807)}, {safe:true}, function(err, r) { - collection.findOne(function(err, doc) { - test.ok(Long.fromNumber(9223372036854775807).equals(doc.x)); - // Let's close the db - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldSaveObjectThatHasIdButDoesNotExistInCollection = function(test) { - client.createCollection('test_save_with_object_that_has_id_but_does_not_actually_exist_in_collection', function(err, collection) { - var a = {'_id':'1', 'hello':'world'}; - collection.save(a, {safe:true}, function(err, docs) { - collection.count(function(err, count) { - test.equal(1, count); - - collection.findOne(function(err, doc) { - test.equal('world', doc.hello); - - doc.hello = 'mike'; - collection.save(doc, {safe:true}, function(err, doc) { - collection.count(function(err, count) { - test.equal(1, count); - }); - - collection.findOne(function(err, doc) { - test.equal('mike', doc.hello); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformUpsert = function(test) { - client.createCollection('test_should_correctly_do_upsert', function(err, collection) { - var id = new ObjectID(null) - var doc = {_id:id, a:1}; - - Step( - function test1() { - var self = this; - - collection.update({"_id":id}, doc, {upsert:true, safe:true}, function(err, result) { - test.equal(null, err); - test.equal(1, result); - - collection.findOne({"_id":id}, self); - }); - }, - - function test2(err, doc) { - var self = this; - test.equal(1, doc.a); - - id = new ObjectID(null) - doc = {_id:id, a:2}; - - collection.update({"_id":id}, doc, {safe:true, upsert:true}, function(err, result) { - test.equal(null, err); - test.equal(1, result); - - collection.findOne({"_id":id}, self); - }); - }, - - function test3(err, doc2) { - var self = this; - test.equal(2, doc2.a); - - collection.update({"_id":id}, doc2, {safe:true, upsert:true}, function(err, result) { - test.equal(null, err); - test.equal(1, result); - - collection.findOne({"_id":id}, function(err, doc) { - test.equal(2, doc.a); - test.done(); - }); - }); - } - ); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyUpdateWithNoDocs = function(test) { - client.createCollection('test_should_correctly_do_update_with_no_docs', function(err, collection) { - var id = new ObjectID(null) - var doc = {_id:id, a:1}; - collection.update({"_id":id}, doc, {safe:true}, function(err, numberofupdateddocs) { - test.equal(null, err); - test.equal(0, numberofupdateddocs); - - test.done(); - }); - }); -} - -/** - * Example of a simple document update with safe set to false on an existing document - * - * @_class collection - * @_function update - */ -exports.shouldCorrectlyUpdateASimpleDocument = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Get a collection - db.collection('update_a_simple_document', function(err, collection) { - - // Insert a document, then update it - collection.insert({a:1}, {safe:true}, function(err, doc) { - - // Update the document with an atomic operator - collection.update({a:1}, {$set:{b:2}}); - - // Wait for a second then fetch the document - setTimeout(function() { - - // Fetch the document that we modified - collection.findOne({a:1}, function(err, item) { - test.equal(null, err); - test.equal(1, item.a); - test.equal(2, item.b); - db.close(); - test.done(); - }); - }, 1000); - }) - }); - }); -} - -/** - * Example of a simple document update using upsert (the document will be inserted if it does not exist) - * - * @_class collection - * @_function update - * @ignore - */ -exports.shouldCorrectlyUpsertASimpleDocument = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Get a collection - db.collection('update_a_simple_document_upsert', function(err, collection) { - - // Update the document using an upsert operation, ensuring creation if it does not exist - collection.update({a:1}, {b:2, a:1}, {upsert:true, safe:true}, function(err, result) { - test.equal(null, err); - test.equal(1, result); - - // Fetch the document that we modified and check if it got inserted correctly - collection.findOne({a:1}, function(err, item) { - test.equal(null, err); - test.equal(1, item.a); - test.equal(2, item.b); - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * Example of an update across multiple documents using the multi option. - * - * @_class collection - * @_function update - * @ignore - */ -exports.shouldCorrectlyUpdateMultipleDocuments = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Get a collection - db.collection('update_a_simple_document_multi', function(err, collection) { - - // Insert a couple of documentations - collection.insert([{a:1, b:1}, {a:1, b:2}], {safe:true}, function(err, result) { - - // Update multiple documents using the multi option - collection.update({a:1}, {$set:{b:0}}, {safe:true, multi:true}, function(err, numberUpdated) { - test.equal(null, err); - test.equal(2, numberUpdated); - - // Fetch all the documents and verify that we have changed the b value - collection.find().toArray(function(err, items) { - test.equal(null, err); - test.equal(1, items[0].a); - test.equal(0, items[0].b); - test.equal(1, items[1].a); - test.equal(0, items[1].b); - - db.close(); - test.done(); - }); - }) - }); - }); - }); -} - -/** - * Example of running the distinct command against a collection - * - * @_class collection - * @_function distinct - * @ignore - */ -exports.shouldCorrectlyHandleDistinctIndexes = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Crete the collection for the distinct example - db.createCollection('simple_key_based_distinct', function(err, collection) { - - // Insert documents to perform distinct against - collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}}, - {a:2, b:{c:'a'}}, {a:3}, {a:3}], {safe:true}, function(err, ids) { - - // Peform a distinct query against the a field - collection.distinct('a', function(err, docs) { - test.deepEqual([0, 1, 2, 3], docs.sort()); - - // Perform a distinct query against the sub-field b.c - collection.distinct('b.c', function(err, docs) { - test.deepEqual(['a', 'b', 'c'], docs.sort()); - - db.close(); - test.done(); - }); - }); - }) - }); - }); -} - -/** - * Example of running the distinct command against a collection with a filter query - * - * @_class collection - * @_function distinct - * @ignore - */ -exports.shouldCorrectlyHandleDistinctIndexesWithSubQueryFilter = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Crete the collection for the distinct example - db.createCollection('simple_key_based_distinct_sub_query_filter', function(err, collection) { - - // Insert documents to perform distinct against - collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}}, - {a:2, b:{c:'a'}}, {a:3}, {a:3}, {a:5, c:1}], {safe:true}, function(err, ids) { - - // Peform a distinct query with a filter against the documents - collection.distinct('a', {c:1}, function(err, docs) { - test.deepEqual([5], docs.sort()); - - db.close(); - test.done(); - }); - }) - }); - }); -} - -/** - * Example of running simple count commands against a collection. - * - * @_class collection - * @_function count - * @ignore - */ -exports.shouldCorrectlyDoSimpleCountExamples = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Crete the collection for the distinct example - db.createCollection('simple_count_example', function(err, collection) { - - // Insert documents to perform distinct against - collection.insert([{a:1}, {a:2}, {a:3}, {a:4, b:1}], {safe:true}, function(err, ids) { - - // Perform a total count command - collection.count(function(err, count) { - test.equal(null, err); - test.equal(4, count); - - // Peform a partial account where b=1 - collection.count({b:1}, function(err, count) { - test.equal(null, err); - test.equal(1, count); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteInsertUpdateDeleteSafeMode = function(test) { - client.createCollection('test_should_execute_insert_update_delete_safe_mode', function(err, collection) { - test.ok(collection instanceof Collection); - test.equal('test_should_execute_insert_update_delete_safe_mode', collection.collectionName); - - collection.insert({i:1}, {safe:true}, function(err, ids) { - test.equal(1, ids.length); - test.ok(ids[0]._id.toHexString().length == 24); - - // Update the record - collection.update({i:1}, {"$set":{i:2}}, {safe:true}, function(err, result) { - test.equal(null, err); - test.equal(1, result); - - // Remove safely - collection.remove({}, {safe:true}, function(err, result) { - test.equal(null, err); - - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldPerformMultipleSaves = function(test) { - client.createCollection("multiple_save_test", function(err, collection) { - var doc = { - name: 'amit', - text: 'some text' - }; - - //insert new user - collection.save(doc, {safe:true}, function(err, r) { - collection.find({}, {name: 1}).limit(1).toArray(function(err, users){ - var user = users[0] - - if(err) { - throw new Error(err) - } else if(user) { - user.pants = 'worn' - - collection.save(user, {safe:true}, function(err, result){ - test.equal(null, err); - test.equal(1, result); - - test.done(); - }) - } - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySaveDocumentWithNestedArray = function(test) { - var db = new Db(MONGODB, new Server('localhost', 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, db) { - db.createCollection("save_error_on_save_test", function(err, collection) { - // Create unique index for username - collection.createIndex([['username', 1]], true, function(err, result) { - var doc = { - email: 'email@email.com', - encrypted_password: 'password', - friends: - [ '4db96b973d01205364000006', - '4db94a1948a683a176000001', - '4dc77b24c5ba38be14000002' ], - location: [ 72.4930088, 23.0431957 ], - name: 'Amit Kumar', - password_salt: 'salty', - profile_fields: [], - username: 'amit' }; - //insert new user - collection.save(doc, {safe:true}, function(err, doc) { - - collection.find({}).limit(1).toArray(function(err, users) { - test.equal(null, err); - var user = users[0] - user.friends.splice(1,1) - - collection.save(user, function(err, doc) { - test.equal(null, err); - - // Update again - collection.update({_id:new ObjectID(user._id.toString())}, {friends:user.friends}, {upsert:true, safe:true}, function(err, result) { - test.equal(null, err); - test.equal(1, result); - - db.close(); - test.done(); - }); - }); - }); - }); - }) - }); - }); -} - -/** - * @ignore - */ -exports.shouldPeformCollectionRemoveWithNoCallback = function(test) { - client.collection("remove_with_no_callback_bug_test", function(err, collection) { - collection.save({a:1}, {safe:true}, function(){ - collection.save({b:1}, {safe:true}, function(){ - collection.save({c:1}, {safe:true}, function(){ - collection.remove({a:1}, {safe:true}, function() { - // Let's perform a count - collection.count(function(err, count) { - test.equal(null, err); - test.equal(2, count); - test.done(); - }); - }) - }); - }); - }); - }); -}, - -/** - * Example of retrieving a collections indexes - * - * @_class collection - * @_function indexes - * @ignore - */ -exports.shouldCorrectlyRetriveACollectionsIndexes = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Crete the collection for the distinct example - db.createCollection('simple_key_based_distinct', function(err, collection) { - - // Create a geo 2d index - collection.ensureIndex({loc:"2d"}, function(err, result) { - test.equal(null, err); - - // Create a simple single field index - collection.ensureIndex({a:1}, function(err, result) { - test.equal(null, err); - - // List all of the indexes on the collection - collection.indexes(function(err, indexes) { - test.equal(3, indexes.length); - - db.close(); - test.done(); - }); - }) - }) - }); - }); -} - -/** - * Example of retrieving a collections stats - * - * @_class collection - * @_function stats - * @ignore - */ -exports.shouldCorrectlyReturnACollectionsStats = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Crete the collection for the distinct example - db.createCollection('collection_stats_test', function(err, collection) { - - // Insert some documents - collection.insert([{a:1}, {hello:'world'}], {safe:true}, function(err, result) { - - // Retrieve the statistics for the collection - collection.stats(function(err, stats) { - test.equal(2, stats.count); - - db.close(); - test.done(); - }); - }); - }); - }); -} - - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/connect_test.js b/test/connect_test.js deleted file mode 100644 index 564c6fea66a..00000000000 --- a/test/connect_test.js +++ /dev/null @@ -1,147 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - connect = mongodb.connect, - gleak = require('../dev/tools/gleak'), - Script = require('vm'), - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var clientUrl = 'mongo://localhost:27017/' + MONGODB + (useSSL == true ? '?ssl=true' : ''); - -/** - * @ignore - */ -function connectionTester(test, testName) { - return function(err, db) { - test.equal(err, null); - db.collection(testName, function(err, collection) { - test.equal(err, null); - var doc = {foo:123}; - collection.insert({foo:123}, {safe:true}, function(err, docs) { - test.equal(err, null); - db.dropDatabase(function(err, done) { - db.close(); - test.equal(err, null); - test.ok(done); - test.done(); - }); - }); - }); - }; -}; - -/** - * @ignore - */ -exports.testConnectNoOptions = function(test) { - connect(clientUrl, connectionTester(test, 'testConnectNoOptions')); -}; - -/** - * @ignore - */ -exports.testConnectDbOptions = function(test) { - connect(clientUrl, - { db: {native_parser: (process.env['TEST_NATIVE'] != null)} }, - connectionTester(test, 'testConnectDbOptions')); -}; - -/** - * @ignore - */ -exports.testConnectServerOptions = function(test) { - connect(clientUrl, - { server: {auto_reconnect: true, poolSize: 4} }, - connectionTester(test, 'testConnectServerOptions')); -}; - -/** - * @ignore - */ -exports.testConnectAllOptions = function(test) { - connect(clientUrl, - { server: {auto_reconnect: true, poolSize: 4}, - db: {native_parser: (process.env['TEST_NATIVE'] != null)} }, - connectionTester(test, 'testConnectAllOptions')); -}; - -/** - * @ignore - */ -exports.testConnectGoodAuth = function(test) { - var user = 'testConnectGoodAuth', password = 'password'; - // First add a user. - connect(clientUrl, function(err, db) { - test.equal(err, null); - db.addUser(user, password, function(err, result) { - test.equal(err, null); - db.close(); - restOfTest(); - }); - }); - - function restOfTest() { - var url = 'mongo://' + user + ':' + password + '@localhost:27017/' + MONGODB + (useSSL == true ? '?ssl=true' : ''); - connect(url, connectionTester(test, 'testConnectGoodAuth')); - } -}; - -/** - * @ignore - */ -exports.testConnectBadAuth = function(test) { - var url = 'mongo://slithy:toves@localhost:27017/' + MONGODB + (useSSL == true ? '?ssl=true' : ''); - connect(url, function(err, db) { - test.ok(err); - test.ok(db); - db.close(); - test.done(); - }); -}; - -/** - * @ignore - */ -exports.testConnectBadUrl = function(test) { - test.throws(function() { - connect('mango://localhost:27017/' + MONGODB, function(err, db) { - test.ok(false, 'Bad URL!'); - }); - }); - test.done(); -}; - -/** - * Example of a simple url connection string. - * - * @_class db - * @_function Db.connect - * @ignore - */ -exports.shouldCorrectlyDoSimpleCountExamples = function(test) { - // Connect to the server - Db.connect('mongodb://localhost:27017/integration_tests' + (useSSL == true ? '?ssl=true' : ''), function(err, db) { - test.equal(null, err); - - db.close(); - test.done(); - }); -} - - -/** - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} diff --git a/test/connection/connection_pool_test.js b/test/connection/connection_pool_test.js deleted file mode 100644 index a3d6abe7474..00000000000 --- a/test/connection/connection_pool_test.js +++ /dev/null @@ -1,102 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - Buffer = require('buffer').Buffer, - gleak = require('../../dev/tools/gleak'), - fs = require('fs'), - ConnectionPool = require('../../lib/mongodb/connection/connection_pool').ConnectionPool; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - callback(); -} - -exports['Should Correctly create a pool instance with the expected values'] = function(test) { - var connectionPool = new ConnectionPool('localhost', 2000, 1, null, {timeout:100, noDelay:true}); - test.equal(100, connectionPool.socketOptions.timeout); - test.equal(true, connectionPool.socketOptions.noDelay); - test.equal(null, connectionPool.socketOptions.encoding); - test.equal(0, connectionPool.socketOptions.bufferSize); - test.done(); -} - -exports['Should correctly fail due to no server'] = function(test) { - var connectionPool = new ConnectionPool('localhost', 2000, 4, null, {timeout:100, noDelay:true}); - - // // Add event handler that will fire once the pool is ready - connectionPool.on("poolReady", function(err, result) { - }) - - // Add event handler that will fire when it fails - connectionPool.on("error", function(err, connection) { - test.equal(0, connectionPool.connections.length) - test.equal(0, connectionPool.openConnections.length) - test.done(); - }); - - // Start the pool - connectionPool.start(); -} - -exports['Should Correctly create a pool of connections and receive an ok when all connections are active'] = function(test) { - var connectionPool = new ConnectionPool('localhost', 27017, 4, {timeout:100, noDelay:true}); - - // Add event handler that will fire once the pool is ready - connectionPool.on("poolReady", function() { - connectionPool.stop(); - test.done(); - }) - - // Start the pool - connectionPool.start(); -} - -exports['Should Correctly connect and then force a restart creating new connections'] = function(test) { - var connectionPool = new ConnectionPool('localhost', 27017, 4, {timeout:100, noDelay:true}); - var done = false; - - // Add event handler that will fire once the pool is ready - connectionPool.on("poolReady", function() { - // Restart - if(done) { - connectionPool.stop(); - test.done(); - } else { - // Trigger stop - connectionPool.restart(); - done = true; - } - }) - - // Start the pool - connectionPool.start(); -}, - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/connection/message_parser_test.js b/test/connection/message_parser_test.js deleted file mode 100644 index 1052dcae89f..00000000000 --- a/test/connection/message_parser_test.js +++ /dev/null @@ -1,436 +0,0 @@ -// var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - Buffer = require('buffer').Buffer, - gleak = require('../../dev/tools/gleak'), - Connection = require('../../lib/mongodb/connection/connection').Connection; - -var assertBuffersEqual = function(test, buffer1, buffer2) { - if(buffer1.length != buffer2.length) test.fail("Buffers do not have the same length", buffer1, buffer2); - - for(var i = 0; i < buffer1.length; i++) { - test.equal(buffer1[i], buffer2[i]); - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - callback(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - callback(); -} - -exports['Should correctly parse perfectly aligned message from socket'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(10); - var value = 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - assertBuffersEqual(test, buffer, data); - test.done(); - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer); -}, - -exports['Should correctly parse perfectly aligned double message from socket'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(20); - var value = 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Adjust the index - index = index + 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - buffer[index+4] = 0xa; - - // var result index - var resultIndex = 0; - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - assertBuffersEqual(test, buffer.slice(resultIndex, resultIndex + 10), data); - resultIndex = resultIndex + 10; - - if(resultIndex === buffer.length) { - test.done(); - } - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - // Execute parsing of message - dataHandler(buffer); -} - -exports['Should correctly parse message + in two packets from socket'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(10); - var value = 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - assertBuffersEqual(test, buffer, data); - test.done(); - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer.slice(0, 6)); - dataHandler(buffer.slice(6)); -}, - -exports['Should correctly parse message + in two packets from socket and partial third one'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(20); - var value = 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Adjust the index - index = index + 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - buffer[index + 4] = 0xff; - buffer[index + 5] = 0xff; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - assertBuffersEqual(test, buffer.slice(0, 10), data); - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer.slice(0, 6)); - dataHandler(buffer.slice(6, 15)); - - // Check status of the parser - test.equal(5, self.bytesRead); - test.equal(10, self.sizeOfMessage); - assertBuffersEqual(test, buffer.slice(10, 15), self.buffer.slice(0, 5)); - test.equal(null, self.stubBuffer); - // Finish test - test.done(); -} - -exports['Should correctly parse message + in two packets from socket and smaller than 4 bytes additional one'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(20); - var value = 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Adjust the index - index = index + 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - assertBuffersEqual(test, buffer.slice(0, 10), data); - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer.slice(0, 6)); - dataHandler(buffer.slice(6, 13)); - - // Check status of the parser - test.equal(0, self.bytesRead); - test.equal(0, self.sizeOfMessage); - test.equal(null, self.buffer); - assertBuffersEqual(test, buffer.slice(10, 13), self.stubBuffer); - test.done(); -} - -exports['Should correctly parse message + in two packets from socket and smaller than 4 bytes additional one then rest of the message'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(20); - var value = 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Adjust the index - index = index + 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - buffer[index + 4] = 0xff; - buffer[index + 5] = 0xff; - buffer[index + 6] = 0xff; - buffer[index + 7] = 0xff; - buffer[index + 8] = 0xfd; - buffer[index + 9] = 0xfe; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - assertBuffersEqual(test, buffer.slice(0, 10), data); - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer.slice(0, 6)); - dataHandler(buffer.slice(6, 13)); - dataHandler(buffer.slice(13, 19)); - - // Check status of the parser - test.equal(9, self.bytesRead); - test.equal(10, self.sizeOfMessage); - test.equal(null, self.stubBuffer); - assertBuffersEqual(test, buffer.slice(10, 19), self.buffer.slice(0, 9)); - // Test done - test.done(); -} - -exports['Should correctly parse message + in two packets from socket and smaller than 4 bytes additional one then partial message'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(20); - var value = 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Adjust the index - index = index + 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - // Add data to check - buffer[index + 4] = 0xff; - buffer[index + 5] = 0xff; - buffer[index + 6] = 0xff; - buffer[index + 7] = 0xff; - buffer[index + 8] = 0xfd; - buffer[index + 9] = 0xfe; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - assertBuffersEqual(test, buffer.slice(0, 10), data); - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer.slice(0, 6)); - dataHandler(buffer.slice(6, 13)); - dataHandler(buffer.slice(13, 15)); - - // Check status of the parser - test.equal(5, self.bytesRead); - test.equal(10, self.sizeOfMessage); - test.equal(null, self.stubBuffer); - assertBuffersEqual(test, buffer.slice(10, 15), self.buffer.slice(0, 5)); - // Test done - test.done(); -} - -exports['Should correctly parse message + in two packets from socket and smaller than 4 bytes additional one then partial message'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(40); - var value = 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - var value = 20; - // Adjust the index - index = index + 10; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - var value = 15; - // Adjust the index - index = index + 20; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - assertBuffersEqual(test, buffer.slice(0, 10), data); - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer.slice(0, 6)); - dataHandler(buffer.slice(6, 15)); - dataHandler(buffer.slice(15, 27)); - - // Check status of the parser - test.equal(17, self.bytesRead); - test.equal(20, self.sizeOfMessage); - test.equal(null, self.stubBuffer); - assertBuffersEqual(test, buffer.slice(10, 27), self.buffer.slice(0, 17)); - // Test done - test.done(); -} - -exports['Corrupt the message baby'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(40); - var value = -40; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - test.equal('parseError', message) - // test.equal('socketHandler', data.err) - }}; - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer.slice(0, 6)); - dataHandler(buffer.slice(6, 15)); - dataHandler(buffer.slice(15, 27)); - test.done(); -} - -exports['Corrupt the message baby but catch the log error'] = function(test) { - // Data object - var index = 0; - var buffer = new Buffer(40); - for(var i = 0; i < buffer.length; i++) buffer[i] = 0; - var value = -40; - // Encode length at start according to wire protocol - buffer[index + 3] = (value >> 24) & 0xff; - buffer[index + 2] = (value >> 16) & 0xff; - buffer[index + 1] = (value >> 8) & 0xff; - buffer[index] = value & 0xff; - - // Dummy object for receiving message - var self = {maxBsonSize: (4 * 1024 * 1024 * 4 * 3), emit:function(message, data) { - test.equal('parseError', message) - }}; - - // Count the number of errors - var totalCountOfErrors = 0; - - // Add a logger object - self.logger = { - doDebug:true, - doError:true, - doLog:true, - - error:function(message, object) { - totalCountOfErrors = totalCountOfErrors + 1; - if(totalCountOfErrors == 3) { - test.done(); - } - }, - - log:function(message, object) { - }, - - debug:function(message, object) { - } - } - - // Create a connection object - var dataHandler = Connection.createDataHandler(self); - - // Execute parsing of message - dataHandler(buffer.slice(0, 6)); - dataHandler(buffer.slice(6, 15)); - dataHandler(buffer.slice(15, 27)); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} \ No newline at end of file diff --git a/test/connection_test.js b/test/connection_test.js deleted file mode 100644 index 54abf61df14..00000000000 --- a/test/connection_test.js +++ /dev/null @@ -1,170 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - connect = mongodb.connect, - Script = require('vm'), - Collection = mongodb.Collection, - Server = mongodb.Server, - ServerManager = require('../test/tools/server_manager').ServerManager, - mongodb = require('../lib/mongodb'); - -// Test db -var MONGODB = 'integration_tests'; -var client = null; - -function connectionTester(test, testName, callback) { - return function(err, db) { - test.equal(err, null); - db.collection(testName, function(err, collection) { - test.equal(err, null); - var doc = {foo:123}; - collection.insert({foo:123}, {safe:true}, function(err, docs) { - test.equal(err, null); - db.dropDatabase(function(err, done) { - test.equal(err, null); - test.ok(done); - callback(); - }); - }); - }); - }; -}; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldThrowErrorDueToSharedConnectionUsage = function(test) { - var server = new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}); - - try { - var db = new Db(MONGODB, server, {native_parser: (process.env['TEST_NATIVE'] != null)}); - var db1 = new Db(MONGODB, server, {native_parser: (process.env['TEST_NATIVE'] != null)}); - } catch(err) { - test.done(); - } -} - -exports.testCloseNoCallback = function(test) { - var db = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(connectionTester(test, 'testCloseNoCallback', function() { - var dbCloseCount = 0, connectionCloseCount = 0, poolCloseCount = 0; - // Ensure no close events are fired as we are closing the connection specifically - db.on('close', function() { dbCloseCount++; }); - - var connectionPool = db.serverConfig.connectionPool; - var connections = connectionPool.getAllConnections(); - - // Force the connection close, should not trigger close command - db.serverConfig.connectionPool.stop(); - // Test done - test.equal(0, dbCloseCount); - test.done(); - })); -} - -exports.testCloseWithCallback = function(test) { - var db = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}),{native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(connectionTester(test, 'testCloseWithCallback', function() { - var dbCloseCount = 0, connectionCloseCount = 0, poolCloseCount = 0; - // Ensure no close events are fired as we are closing the connection specifically - db.on('close', function() { dbCloseCount++; }); - - var connectionPool = db.serverConfig.connectionPool; - var connections = connectionPool.getAllConnections(); - - // Ensure no close events are fired as we are closing the connection specifically - for(var i = 0; i < connections.length; i++) { - connections[i].on("close", function() { test.ok(false); }); - } - - db.close(function() { - // Test done - test.equal(0, dbCloseCount); - test.done(); - }); - })); -} - -exports.testShouldCorrectlyCloseOnUnopedConnection = function(test) { - var db = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}),{native_parser: (process.env['TEST_NATIVE'] != null)}); - db.close(); - test.done(); -} - -exports.testConnectUsingDefaultHostAndPort = function(test) { - var db = new Db(MONGODB, new Server("127.0.0.1", mongodb.Connection.DEFAULT_PORT, {auto_reconnect: true, poolSize: 4, ssl:useSSL}),{native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, db) { - test.equal(null, err); - test.done(); - db.close(); - }) -} - -exports.testConnectUsingSocketOptions = function(test) { - var db = new Db(MONGODB, new Server("127.0.0.1", mongodb.Connection.DEFAULT_PORT, {auto_reconnect: true, poolSize: 4, socketOptions:{keepAlive:100}, ssl:useSSL}),{native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, db) { - test.equal(null, err); - test.equal(100, db.serverConfig.checkoutWriter().socketOptions.keepAlive) - test.done(); - db.close(); - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/cursor_test.js b/test/cursor_test.js deleted file mode 100644 index 89b4d594c63..00000000000 --- a/test/cursor_test.js +++ /dev/null @@ -1,1965 +0,0 @@ -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = require('../lib/mongodb').Db, - Cursor = require('../lib/mongodb').Cursor, - Collection = require('../lib/mongodb').Collection, - Step = require('step'), - fs = require('fs'), - Server = require('../lib/mongodb').Server; - -var MONGODB = 'integration_tests'; -var useSSL = process.env['USE_SSL'] != null ? true : false; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * An example showing the information returned by indexInformation - * - * @_class cursor - * @_function toArray - */ -exports.shouldCorrectlyExecuteToArray = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection to hold our documents - db.createCollection('test_array', function(err, collection) { - - // Insert a test document - collection.insert({'b':[1, 2, 3]}, {safe:true}, function(err, ids) { - - // Retrieve all the documents in the collection - collection.find().toArray(function(err, documents) { - test.equal(1, documents.length); - test.deepEqual([1, 2, 3], documents[0].b); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyExecuteToArrayAndFailOnFurtherCursorAccess = function(test) { - client.createCollection('test_to_a', function(err, collection) { - test.ok(collection instanceof Collection); - collection.insert({'a':1}, {safe:true}, function(err, ids) { - collection.find({}, function(err, cursor) { - cursor.toArray(function(err, items) { - // Should fail if called again (cursor should be closed) - cursor.toArray(function(err, items) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - - // Should fail if called again (cursor should be closed) - cursor.each(function(err, item) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example iterating over a query using the each function of the cursor. - * - * @_class cursor - * @_function each - * @ignore - */ -exports.shouldCorrectlyFailToArrayDueToFinishedEachOperation = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection - db.createCollection('test_to_a_after_each', function(err, collection) { - test.equal(null, err); - test.ok(collection instanceof Collection); - - // Insert a document in the collection - collection.insert({'a':1}, {safe:true}, function(err, ids) { - - // Grab a cursor - collection.find(function(err, cursor) { - - // Execute the each command, triggers for each document - cursor.each(function(err, item) { - - // If the item is null then the cursor is exhausted/empty and closed - if(item == null) { - - // Show that the cursor is closed - cursor.toArray(function(err, items) { - test.ok(err != null); - - // Let's close the db - test.done(); - db.close(); - }); - }; - }); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyExecuteCursorExplain = function(test) { - client.createCollection('test_explain', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, r) { - collection.find({'a':1}, function(err, cursor) { - cursor.explain(function(err, explaination) { - test.ok(explaination.cursor != null); - test.ok(explaination.n.constructor == Number); - test.ok(explaination.millis.constructor == Number); - test.ok(explaination.nscanned.constructor == Number); - - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyExecuteCursorCount = function(test) { - client.createCollection('test_count', function(err, collection) { - collection.find(function(err, cursor) { - cursor.count(function(err, count) { - test.equal(0, count); - - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 10; i++) { - collection.insert({'x':i}, {safe:true}, group()); - } - }, - - function finished() { - collection.find().count(function(err, count) { - test.equal(10, count); - test.ok(count.constructor == Number); - }); - - collection.find({}, {'limit':5}).count(function(err, count) { - test.equal(10, count); - }); - - collection.find({}, {'skip':5}).count(function(err, count) { - test.equal(10, count); - }); - - collection.find(function(err, cursor) { - cursor.count(function(err, count) { - test.equal(10, count); - - cursor.each(function(err, item) { - if(item == null) { - cursor.count(function(err, count2) { - test.equal(10, count2); - test.equal(count, count2); - // Let's close the db - test.done(); - }); - } - }); - }); - }); - - client.collection('acollectionthatdoesn', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - }); - }) - } - ) - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyExecuteSortOnCursor = function(test) { - client.createCollection('test_sort', function(err, collection) { - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 5; i++) { - collection.insert({'a':i}, {safe:true}, group()); - } - }, - - function finished() { - collection.find(function(err, cursor) { - cursor.sort(['a', 1], function(err, cursor) { - test.ok(cursor instanceof Cursor); - test.deepEqual(['a', 1], cursor.sortValue); - }); - }); - - collection.find(function(err, cursor) { - cursor.sort('a', 1, function(err, cursor) { - cursor.nextObject(function(err, doc) { - test.equal(0, doc.a); - }); - }); - }); - - collection.find(function(err, cursor) { - cursor.sort('a', -1, function(err, cursor) { - cursor.nextObject(function(err, doc) { - test.equal(4, doc.a); - }); - }); - }); - - collection.find(function(err, cursor) { - cursor.sort('a', "asc", function(err, cursor) { - cursor.nextObject(function(err, doc) { - test.equal(0, doc.a); - }); - }); - }); - - collection.find(function(err, cursor) { - cursor.sort([['a', -1], ['b', 1]], function(err, cursor) { - test.ok(cursor instanceof Cursor); - test.deepEqual([['a', -1], ['b', 1]], cursor.sortValue); - }); - }); - - collection.find(function(err, cursor) { - cursor.sort('a', 1, function(err, cursor) { - cursor.sort('a', -1, function(err, cursor) { - cursor.nextObject(function(err, doc) { - test.equal(4, doc.a); - }); - }) - }); - }); - - collection.find(function(err, cursor) { - cursor.sort('a', -1, function(err, cursor) { - cursor.sort('a', 1, function(err, cursor) { - cursor.nextObject(function(err, doc) { - test.equal(0, doc.a); - }); - }) - }); - }); - - collection.find(function(err, cursor) { - cursor.nextObject(function(err, doc) { - cursor.sort(['a'], function(err, cursor) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - }); - }); - }); - - collection.find(function(err, cursor) { - cursor.sort('a', 25, function(err, cursor) { - cursor.nextObject(function(err, doc) { - test.ok(err instanceof Error); - test.equal("Illegal sort clause, must be of the form [['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]", err.message); - }); - }); - }); - - collection.find(function(err, cursor) { - cursor.sort(25, function(err, cursor) { - cursor.nextObject(function(err, doc) { - test.ok(err instanceof Error); - test.equal("Illegal sort clause, must be of the form [['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]", err.message); - // Let's close the db - test.done(); - }); - }); - }); - } - ); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyThrowErrorOnToArrayWhenMissingCallback = function(test) { - client.createCollection('test_to_array', function(err, collection) { - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 2; i++) { - collection.save({'x':1}, {safe:true}, group()); - } - }, - - function finished() { - collection.find(function(err, cursor) { - test.throws(function () { - cursor.toArray(); - }); - test.done(); - }); - } - ) - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldThrowErrorOnEachWhenMissingCallback = function(test) { - client.createCollection('test_each', function(err, collection) { - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 2; i++) { - collection.save({'x':1}, {safe:true}, group()); - } - }, - - function finished() { - collection.find(function(err, cursor) { - test.throws(function () { - cursor.each(); - }); - test.done(); - }); - } - ) - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyHandleLimitOnCursor = function(test) { - client.createCollection('test_cursor_limit', function(err, collection) { - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 10; i++) { - collection.save({'x':1}, {safe:true}, group()); - } - }, - - function finished() { - collection.find().count(function(err, count) { - test.equal(10, count); - }); - - collection.find(function(err, cursor) { - cursor.limit(5, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(5, items.length); - // Let's close the db - test.done(); - }); - }); - }); - } - ); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyReturnErrorsOnIllegalLimitValues = function(test) { - client.createCollection('test_limit_exceptions', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, docs) {}); - collection.find(function(err, cursor) { - cursor.limit('not-an-integer', function(err, cursor) { - test.ok(err instanceof Error); - test.equal("limit requires an integer", err.message); - }); - }); - - collection.find(function(err, cursor) { - cursor.nextObject(function(err, doc) { - cursor.limit(1, function(err, cursor) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - }); - }); - }); - - collection.find(function(err, cursor) { - cursor.close(function(err, cursor) { - cursor.limit(1, function(err, cursor) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlySkipRecordsOnCursor = function(test) { - client.createCollection('test_skip', function(err, collection) { - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 10; i++) { - collection.insert({'x':i}, {safe:true}, group()); - } - }, - - function finished() { - collection.find(function(err, cursor) { - cursor.count(function(err, count) { - test.equal(10, count); - }); - }); - - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(10, items.length); - - collection.find(function(err, cursor) { - cursor.skip(2, function(err, cursor) { - cursor.toArray(function(err, items2) { - test.equal(8, items2.length); - - // Check that we have the same elements - var numberEqual = 0; - var sliced = items.slice(2, 10); - - for(var i = 0; i < sliced.length; i++) { - if(sliced[i].x == items2[i].x) numberEqual = numberEqual + 1; - } - test.equal(8, numberEqual); - - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - } - ) - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyReturnErrorsOnIllegalSkipValues = function(test) { - client.createCollection('test_skip_exceptions', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, docs) {}); - collection.find(function(err, cursor) { - cursor.skip('not-an-integer', function(err, cursor) { - test.ok(err instanceof Error); - test.equal("skip requires an integer", err.message); - }); - }); - - collection.find(function(err, cursor) { - cursor.nextObject(function(err, doc) { - cursor.skip(1, function(err, cursor) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - }); - }); - }); - - collection.find(function(err, cursor) { - cursor.close(function(err, cursor) { - cursor.skip(1, function(err, cursor) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldReturnErrorsOnIllegalBatchSizes = function(test) { - client.createCollection('test_batchSize_exceptions', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, docs) {}); - collection.find(function(err, cursor) { - cursor.batchSize('not-an-integer', function(err, cursor) { - test.ok(err instanceof Error); - test.equal("batchSize requires an integer", err.message); - }); - }); - - collection.find(function(err, cursor) { - cursor.nextObject(function(err, doc) { - cursor.nextObject(function(err, doc) { - cursor.batchSize(1, function(err, cursor) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - }); - }); - }); - }); - - collection.find(function(err, cursor) { - cursor.close(function(err, cursor) { - cursor.batchSize(1, function(err, cursor) { - test.ok(err instanceof Error); - test.equal("Cursor is closed", err.message); - - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyHandleChangesInBatchSizes = function(test) { - client.createCollection('test_not_multiple_batch_size', function(err, collection) { - var records = 6; - var batchSize = 2; - var docs = []; - for(var i = 0; i < records; i++) { - docs.push({'a':i}); - } - - collection.insert(docs, {safe:true}, function() { - collection.find({}, {batchSize : batchSize}, function(err, cursor) { - //1st - cursor.nextObject(function(err, items) { - //cursor.items should contain 1 since nextObject already popped one - test.equal(1, cursor.items.length); - test.ok(items != null); - - //2nd - cursor.nextObject(function(err, items) { - test.equal(0, cursor.items.length); - test.ok(items != null); - - //test batch size modification on the fly - batchSize = 3; - cursor.batchSize(batchSize); - - //3rd - cursor.nextObject(function(err, items) { - test.equal(2, cursor.items.length); - test.ok(items != null); - - //4th - cursor.nextObject(function(err, items) { - test.equal(1, cursor.items.length); - test.ok(items != null); - - //5th - cursor.nextObject(function(err, items) { - test.equal(0, cursor.items.length); - test.ok(items != null); - - //6th - cursor.nextObject(function(err, items) { - test.equal(0, cursor.items.length); - test.ok(items != null); - - //No more - cursor.nextObject(function(err, items) { - test.ok(items == null); - test.ok(cursor.isClosed()); - - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyHandleBatchSize = function(test) { - client.createCollection('test_multiple_batch_size', function(err, collection) { - //test with the last batch that is a multiple of batchSize - var records = 4; - var batchSize = 2; - var docs = []; - for(var i = 0; i < records; i++) { - docs.push({'a':i}); - } - - collection.insert(docs, {safe:true}, function() { - collection.find({}, {batchSize : batchSize}, function(err, cursor) { - //1st - cursor.nextObject(function(err, items) { - test.equal(1, cursor.items.length); - test.ok(items != null); - - //2nd - cursor.nextObject(function(err, items) { - test.equal(0, cursor.items.length); - test.ok(items != null); - - //3rd - cursor.nextObject(function(err, items) { - test.equal(1, cursor.items.length); - test.ok(items != null); - - //4th - cursor.nextObject(function(err, items) { - test.equal(0, cursor.items.length); - test.ok(items != null); - - //No more - cursor.nextObject(function(err, items) { - test.ok(items == null); - test.ok(cursor.isClosed()); - - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldHandleWhenLimitBiggerThanBatchSize = function(test) { - client.createCollection('test_limit_greater_than_batch_size', function(err, collection) { - var limit = 4; - var records = 10; - var batchSize = 3; - var docs = []; - for(var i = 0; i < records; i++) { - docs.push({'a':i}); - } - - collection.insert(docs, {safe:true}, function() { - collection.find({}, {batchSize : batchSize, limit : limit}, function(err, cursor) { - //1st - cursor.nextObject(function(err, items) { - test.equal(2, cursor.items.length); - - //2nd - cursor.nextObject(function(err, items) { - test.equal(1, cursor.items.length); - - //3rd - cursor.nextObject(function(err, items) { - test.equal(0, cursor.items.length); - - //4th - cursor.nextObject(function(err, items) { - test.equal(0, cursor.items.length); - - //No more - cursor.nextObject(function(err, items) { - test.ok(items == null); - test.ok(cursor.isClosed()); - - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldHandleLimitLessThanBatchSize = function(test) { - client.createCollection('test_limit_less_than_batch_size', function(err, collection) { - var limit = 2; - var records = 10; - var batchSize = 4; - var docs = []; - for(var i = 0; i < records; i++) { - docs.push({'a':i}); - } - - collection.insert(docs, {safe:true}, function() { - collection.find({}, {batchSize : batchSize, limit : limit}, function(err, cursor) { - //1st - cursor.nextObject(function(err, items) { - test.equal(1, cursor.items.length); - - //2nd - cursor.nextObject(function(err, items) { - test.equal(0, cursor.items.length); - - //No more - cursor.nextObject(function(err, items) { - test.ok(items == null); - test.ok(cursor.isClosed()); - - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldHandleSkipLimitChaining = function(test) { - client.createCollection('test_limit_skip_chaining', function(err, collection) { - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 10; i++) { - collection.insert({'x':1}, {safe:true}, group()); - } - }, - - function finished() { - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(10, items.length); - - collection.find(function(err, cursor) { - cursor.limit(5, function(err, cursor) { - cursor.skip(3, function(err, cursor) { - cursor.toArray(function(err, items2) { - test.equal(5, items2.length); - - // Check that we have the same elements - var numberEqual = 0; - var sliced = items.slice(3, 8); - - for(var i = 0; i < sliced.length; i++) { - if(sliced[i].x == items2[i].x) numberEqual = numberEqual + 1; - } - test.equal(5, numberEqual); - - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); - } - ) - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyHandleLimitSkipChainingInline = function(test) { - client.createCollection('test_limit_skip_chaining_inline', function(err, collection) { - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 10; i++) { - collection.insert({'x':1}, {safe:true}, group()); - } - }, - - function finished() { - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(10, items.length); - - collection.find(function(err, cursor) { - cursor.limit(5).skip(3).toArray(function(err, items2) { - test.equal(5, items2.length); - - // Check that we have the same elements - var numberEqual = 0; - var sliced = items.slice(3, 8); - - for(var i = 0; i < sliced.length; i++) { - if(sliced[i].x == items2[i].x) numberEqual = numberEqual + 1; - } - test.equal(5, numberEqual); - - // Let's close the db - test.done(); - }); - }); - }); - }); - } - ) - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCloseCursorNoQuerySent = function(test) { - client.createCollection('test_close_no_query_sent', function(err, collection) { - collection.find(function(err, cursor) { - cursor.close(function(err, cursor) { - test.equal(true, cursor.isClosed()); - // Let's close the db - test.done(); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyRefillViaGetMoreCommand = function(test) { - var COUNT = 1000; - - client.createCollection('test_refill_via_get_more', function(err, collection) { - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < COUNT; i++) { - collection.save({'a': i}, {safe:true}, group()); - } - }, - - function finished() { - collection.count(function(err, count) { - test.equal(COUNT, count); - }); - - var total = 0; - var i = 0; - collection.find({}, {}, function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) { - total = total + item.a; - } else { - test.equal(499500, total); - - collection.count(function(err, count) { - test.equal(COUNT, count); - }); - - collection.count(function(err, count) { - test.equal(COUNT, count); - - var total2 = 0; - collection.find(function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) { - total2 = total2 + item.a; - } else { - test.equal(499500, total2); - collection.count(function(err, count) { - test.equal(COUNT, count); - test.equal(total, total2); - // Let's close the db - test.done(); - }); - } - }); - }); - }); - } - }); - }); - } - ) - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyRefillViaGetMoreAlternativeCollection = function(test) { - client.createCollection('test_refill_via_get_more_alt_coll', function(err, collection) { - - Step( - function insert() { - var group = this.group(); - - for(var i = 0; i < 1000; i++) { - collection.save({'a': i}, {safe:true}, group()); - } - }, - - function finished() { - collection.count(function(err, count) { - test.equal(1000, count); - }); - - var total = 0; - collection.find(function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) { - total = total + item.a; - } else { - test.equal(499500, total); - - collection.count(function(err, count) { - test.equal(1000, count); - }); - - collection.count(function(err, count) { - test.equal(1000, count); - - var total2 = 0; - collection.find(function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) { - total2 = total2 + item.a; - } else { - test.equal(499500, total2); - collection.count(function(err, count) { - test.equal(1000, count); - test.equal(total, total2); - // Let's close the db - test.done(); - }); - } - }); - }); - }); - } - }); - }); - } - ) - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCloseCursorAfterQueryHasBeenSent = function(test) { - client.createCollection('test_close_after_query_sent', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, r) { - collection.find({'a':1}, function(err, cursor) { - cursor.nextObject(function(err, item) { - cursor.close(function(err, cursor) { - test.equal(true, cursor.isClosed()); - // Let's close the db - test.done(); - }) - }); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyExecuteCursorCountWithFields = function(test) { - client.createCollection('test_count_with_fields', function(err, collection) { - collection.save({'x':1, 'a':2}, {safe:true}, function(err, doc) { - collection.find({}, {'fields':['a']}).toArray(function(err, items) { - test.equal(1, items.length); - test.equal(2, items[0].a); - test.equal(null, items[0].x); - }); - - collection.findOne({}, {'fields':['a']}, function(err, item) { - test.equal(2, item.a); - test.equal(null, item.x); - test.done(); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyCountWithFieldsUsingExclude = function(test) { - client.createCollection('test_count_with_fields_using_exclude', function(err, collection) { - collection.save({'x':1, 'a':2}, {safe:true}, function(err, doc) { - collection.find({}, {'fields':{'x':0}}).toArray(function(err, items) { - test.equal(1, items.length); - test.equal(2, items[0].a); - test.equal(null, items[0].x); - test.done(); - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyExecuteEnsureIndexWithNoCallback = function(test) { - var docs = []; - - for(var i = 0; i < 1; i++) { - var d = new Date().getTime() + i*1000; - docs[i] = {createdAt:new Date(d)}; - } - - // Create collection - client.createCollection('shouldCorrectlyExecuteEnsureIndexWithNoCallback', function(err, collection) { - // ensure index of createdAt index - collection.ensureIndex({createdAt:1}) - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - // Find with sort - collection.find().sort(['createdAt', 'asc']).toArray(function(err, items) { - if (err) logger.error("error in collection_info.find: " + err); - test.equal(1, items.length); - test.done(); - }) - }) - }); -} - -/** - * @ignore - * @api private - */ -exports.shouldCorrectlyInsert5000RecordsWithDateAndSortCorrectlyWithIndex = function(test) { - var docs = []; - - for(var i = 0; i < 5000; i++) { - var d = new Date().getTime() + i*1000; - docs[i] = {createdAt:new Date(d)}; - } - - // Create collection - client.createCollection('shouldCorrectlyInsert5000RecordsWithDateAndSortCorrectlyWithIndex', function(err, collection) { - // ensure index of createdAt index - collection.ensureIndex({createdAt:1}, function(err, indexName) { - test.equal(null, err); - - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - // Find with sort - collection.find().sort(['createdAt', 'asc']).toArray(function(err, items) { - if (err) logger.error("error in collection_info.find: " + err); - test.equal(5000, items.length); - test.done(); - }) - }) - }); - }); -} - -/** - * An example showing the information returned by indexInformation - * - * @_class cursor - * @_function rewind - */ -exports['Should correctly rewind and restart cursor'] = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - var docs = []; - - // Insert 100 documents with some data - for(var i = 0; i < 100; i++) { - var d = new Date().getTime() + i*1000; - docs[i] = {'a':i, createdAt:new Date(d)}; - } - - // Create collection - db.createCollection('Should_correctly_rewind_and_restart_cursor', function(err, collection) { - test.equal(null, err); - - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - // Grab a cursor using the find - var cursor = collection.find({}); - // Fetch the first object off the cursor - cursor.nextObject(function(err, item) { - test.equal(0, item.a) - // Rewind the cursor, resetting it to point to the start of the query - cursor.rewind(); - - // Grab the first object again - cursor.nextObject(function(err, item) { - test.equal(0, item.a) - - db.close(); - test.done(); - }) - }) - }) - }); - }); -} - -/** - * @ignore - * @api private - */ -exports['Should correctly execute count on cursor'] = function(test) { - var docs = []; - - for(var i = 0; i < 1000; i++) { - var d = new Date().getTime() + i*1000; - docs[i] = {'a':i, createdAt:new Date(d)}; - } - - // Create collection - client.createCollection('Should_correctly_execute_count_on_cursor', function(err, collection) { - test.equal(null, err); - - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - var total = 0; - // Create a cursor for the content - var cursor = collection.find({}); - cursor.count(function(err, c) { - // Ensure each returns all documents - cursor.each(function(err, item) { - if(item != null) { - total++; - } else { - cursor.count(function(err, c) { - test.equal(1000, c); - test.equal(1000, total); - test.done(); - }) - } - }); - }) - }) - }); -} - -/** - * @ignore - * @api private - */ -exports['should be able to stream documents'] = function(test) { - var docs = []; - - for (var i = 0; i < 1000; i++) { - docs[i] = { a: i+1 }; - } - - // Create collection - client.createCollection('Should_be_able_to_stream_documents', function(err, collection) { - test.equal(null, err); - - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - var paused = 0 - , closed = 0 - , resumed = 0 - , i = 0 - , err - - var stream = collection.find().stream(); - - stream.on('data', function (doc) { - test.equal(true, !! doc); - test.equal(true, !! doc.a); - - if (paused > 0 && 0 === resumed) { - err = new Error('data emitted during pause'); - return done(); - } - - if (++i === 3) { - test.equal(false, stream.paused); - stream.pause(); - test.equal(true, stream.paused); - paused++; - - setTimeout(function () { - test.equal(true, stream.paused); - stream.resume(); - test.equal(false, stream.paused); - resumed++; - }, 20); - } - }); - - stream.on('error', function (er) { - err = er; - done(); - }); - - stream.on('close', function () { - closed++; - done(); - }); - - function done () { - test.equal(undefined, err); - test.equal(i, docs.length); - test.equal(1, closed); - test.equal(1, paused); - test.equal(1, resumed); - test.strictEqual(stream._cursor.isClosed(), true); - test.done(); - } - }) - }) -} - -/** - * @ignore - * @api private - */ -exports['immediately destroying a stream prevents the query from executing'] = function(test) { - var i = 0 - , docs = [{ b: 2 }, { b: 3 }] - , doneCalled = 0 - - client.createCollection('immediately_destroying_a_stream_prevents_the_query_from_executing', function(err, collection) { - test.equal(null, err); - - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - var stream = collection.find().stream(); - - stream.on('data', function () { - i++; - }) - stream.on('close', done); - stream.on('error', done); - - stream.destroy(); - - function done (err) { - test.equal(++doneCalled, 1); - test.equal(undefined, err); - test.strictEqual(0, i); - test.strictEqual(true, stream._destroyed); - test.done(); - } - }); - }); -} - -/** - * @ignore - * @api private - */ -exports['destroying a stream stops it'] = function(test) { - client.createCollection('destroying_a_stream_stops_it', function(err, collection) { - test.equal(null, err); - - var docs = []; - for (var ii = 0; ii < 10; ++ii) docs.push({ b: ii+1 }); - - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - var finished = 0 - , i = 0 - - var stream = collection.find().stream(); - - test.strictEqual(null, stream._destroyed); - test.strictEqual(true, stream.readable); - - stream.on('data', function (doc) { - if (++i === 5) { - stream.destroy(); - test.strictEqual(false, stream.readable); - } - }); - - stream.on('close', done); - stream.on('error', done); - - function done (err) { - ++finished; - setTimeout(function () { - test.strictEqual(undefined, err); - test.strictEqual(5, i); - test.strictEqual(1, finished); - test.strictEqual(true, stream._destroyed); - test.strictEqual(false, stream.readable); - test.strictEqual(true, stream._cursor.isClosed()); - test.done(); - }, 150) - } - }); - }); -} - -/** - * @ignore - * @api private - */ -exports['cursor stream errors']= function(test) { - var client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - test.equal(null, err); - - client.createCollection('cursor_stream_errors', function(err, collection) { - test.equal(null, err); - - var docs = []; - for (var ii = 0; ii < 10; ++ii) docs.push({ b: ii+1 }); - - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - var finished = 0 - , closed = 0 - , i = 0 - - var stream = collection.find({}, { batchSize: 5 }).stream(); - - stream.on('data', function (doc) { - if (++i === 5) { - client.close(); - } - }); - - stream.on('close', function () { - closed++; - }); - - stream.on('error', done); - - function done (err) { - ++finished; - setTimeout(function () { - test.equal('no open connections', err.message); - test.equal(5, i); - test.equal(1, closed); - test.equal(1, finished); - test.equal(true, stream._destroyed); - test.equal(false, stream.readable); - test.equal(true, stream._cursor.isClosed()); - test.done(); - }, 150) - } - }); - }); - }); -} - -/** - * @ignore - * @api private - */ -exports['cursor stream pipe']= function(test) { - client.createCollection('cursor_stream_pipe', function(err, collection) { - test.equal(null, err); - - var docs = []; - ;('Aaden Aaron Adrian Aditya Bob Joe').split(' ').forEach(function (name) { - docs.push({ name: name }); - }); - - // insert all docs - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - var filename = '/tmp/_nodemongodbnative_stream_out.txt' - , out = fs.createWriteStream(filename) - - // hack so we don't need to create a stream filter just to - // stringify the objects (otherwise the created file would - // just contain a bunch of [object Object]) - var toString = Object.prototype.toString; - Object.prototype.toString = function () { - return JSON.stringify(this); - } - - var stream = collection.find().stream(); - stream.pipe(out); - - stream.on('error', done); - stream.on('close', done); - - function done (err) { - Object.prototype.toString = toString; - test.strictEqual(undefined, err); - var contents = fs.readFileSync(filename, 'utf8'); - test.ok(/Aaden/.test(contents)); - test.ok(/Aaron/.test(contents)); - test.ok(/Adrian/.test(contents)); - test.ok(/Aditya/.test(contents)); - test.ok(/Bob/.test(contents)); - test.ok(/Joe/.test(contents)); - fs.unlink(filename); - test.done(); - } - }); - }); -} - -/** - * A simple example showing the count function of the cursor. - * - * @_class cursor - * @_function count - * @ignore - */ -exports.shouldCorrectlyUseCursorCountFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Creat collection - db.createCollection('cursor_count_collection', function(err, collection) { - test.equal(null, err); - - // Insert some docs - collection.insert([{a:1}, {a:2}], {safe:true}, function(err, docs) { - test.equal(null, err); - - // Do a find and get the cursor count - collection.find().count(function(err, count) { - test.equal(null, err); - test.equal(2, count); - - db.close(); - test.done(); - }) - }); - }); - }); -} - -/** - * A simple example showing the use of sort on the cursor. - * - * @_class cursor - * @_function sort - * @ignore - */ -exports.shouldCorrectlyPeformSimpleSorts = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection - db.createCollection('simple_sort_collection', function(err, collection) { - test.equal(null, err); - - // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { - test.equal(null, err); - - // Do normal ascending sort - collection.find().sort([['a', 1]]).nextObject(function(err, item) { - test.equal(null, err); - test.equal(1, item.a); - - // Do normal descending sort - collection.find().sort([['a', -1]]).nextObject(function(err, item) { - test.equal(null, err); - test.equal(3, item.a); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of limit on the cursor - * - * @_class cursor - * @_function limit - * @ignore - */ -exports.shouldCorrectlyPeformLimitOnCursor = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection - db.createCollection('simple_limit_collection', function(err, collection) { - test.equal(null, err); - - // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { - test.equal(null, err); - - // Limit to only one document returned - collection.find().limit(1).toArray(function(err, items) { - test.equal(null, err); - test.equal(1, items.length); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of skip on the cursor - * - * @_class cursor - * @_function skip - * @ignore - */ -exports.shouldCorrectlyPeformSkipOnCursor = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection - db.createCollection('simple_skip_collection', function(err, collection) { - test.equal(null, err); - - // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { - test.equal(null, err); - - // Skip one document - collection.find().skip(1).nextObject(function(err, item) { - test.equal(null, err); - test.equal(2, item.a); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of batchSize on the cursor, batchSize only regulates how many - * documents are returned for each batch using the getMoreCommand against the MongoDB server - * - * @_class cursor - * @_function batchSize - * @ignore - */ -exports.shouldCorrectlyPeformBatchSizeOnCursor = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection - db.createCollection('simple_batch_size_collection', function(err, collection) { - test.equal(null, err); - - // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { - test.equal(null, err); - - // Do normal ascending sort - collection.find().batchSize(1).nextObject(function(err, item) { - test.equal(null, err); - test.equal(1, item.a); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of nextObject. - * - * @_class cursor - * @_function nextObject - * @ignore - */ -exports.shouldCorrectlyPeformNextObjectOnCursor = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection - db.createCollection('simple_next_object_collection', function(err, collection) { - test.equal(null, err); - - // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { - test.equal(null, err); - - // Do normal ascending sort - collection.find().nextObject(function(err, item) { - test.equal(null, err); - test.equal(1, item.a); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the cursor explain function. - * - * @_class cursor - * @_function explain - * @ignore - */ -exports.shouldCorrectlyPeformSimpleExplainCursor = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection - db.createCollection('simple_explain_collection', function(err, collection) { - test.equal(null, err); - - // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { - test.equal(null, err); - - // Do normal ascending sort - collection.find().explain(function(err, explaination) { - test.equal(null, err); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the cursor streamRecords function. - * - * @_class cursor - * @_function streamRecords - * @ignore - */ -exports.shouldStreamDocumentsUsingTheStreamRecords = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a lot of documents to insert - var docs = [] - for(var i = 0; i < 100; i++) { - docs.push({'a':i}) - } - - // Create a collection - db.createCollection('test_streamingRecords_function', function(err, collection) { - test.equal(null, err); - - // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { - // Peform a find to get a cursor - var stream = collection.find().streamRecords({fetchSize:1000}); - - // Execute find on all the documents - stream.on('end', function() { - db.close(); - test.done(); - }); - - stream.on('data', function(data) { - test.ok(data != null); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the cursor stream function. - * - * @_class cursor - * @_function stream - * @ignore - */ -exports.shouldStreamDocumentsUsingTheStreamFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a lot of documents to insert - var docs = [] - for(var i = 0; i < 100; i++) { - docs.push({'a':i}) - } - - // Create a collection - db.createCollection('test_stream_function', function(err, collection) { - test.equal(null, err); - - // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { - // Peform a find to get a cursor - var stream = collection.find().stream(); - - // Execute find on all the documents - stream.on('close', function() { - db.close(); - test.done(); - }); - - stream.on('data', function(data) { - test.ok(data != null); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the cursor close function. - * - * @_class cursor - * @_function close - * @ignore - */ -exports.shouldStreamDocumentsUsingTheCloseFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a lot of documents to insert - var docs = [] - for(var i = 0; i < 100; i++) { - docs.push({'a':i}) - } - - // Create a collection - db.createCollection('test_close_function_on_cursor', function(err, collection) { - test.equal(null, err); - - // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { - // Peform a find to get a cursor - var cursor = collection.find(); - - // Fetch the first object - cursor.nextObject(function(err, object) { - test.equal(null, err); - - // Close the cursor, this is the same as reseting the query - cursor.close(function(err, result) { - test.equal(null, err); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the cursor close function. - * - * @_class cursor - * @_function isClosed - * @ignore - */ -exports.shouldStreamDocumentsUsingTheIsCloseFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a lot of documents to insert - var docs = [] - for(var i = 0; i < 100; i++) { - docs.push({'a':i}) - } - - // Create a collection - db.createCollection('test_is_close_function_on_cursor', function(err, collection) { - test.equal(null, err); - - // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { - // Peform a find to get a cursor - var cursor = collection.find(); - - // Fetch the first object - cursor.nextObject(function(err, object) { - test.equal(null, err); - - // Close the cursor, this is the same as reseting the query - cursor.close(function(err, result) { - test.equal(null, err); - test.equal(true, cursor.isClosed()); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/cursorstream_test.js b/test/cursorstream_test.js deleted file mode 100644 index 037b71b1f3a..00000000000 --- a/test/cursorstream_test.js +++ /dev/null @@ -1,230 +0,0 @@ -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = require('../lib/mongodb').Db, - Cursor = require('../lib/mongodb').Cursor, - Collection = require('../lib/mongodb').Collection, - fs = require('fs'), - Server = require('../lib/mongodb').Server; - -var MONGODB = 'integration_tests'; -var useSSL = process.env['USE_SSL'] != null ? true : false; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * A simple example showing the use of the cursorstream pause function. - * - * @_class cursorstream - * @_function pause - * @ignore - */ -exports.shouldStreamDocumentsUsingTheCursorStreamPauseFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a lot of documents to insert - var docs = [] - for(var i = 0; i < 1; i++) { - docs.push({'a':i}) - } - - // Create a collection - db.createCollection('test_cursorstream_pause', function(err, collection) { - test.equal(null, err); - - // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { - // Peform a find to get a cursor - var stream = collection.find().stream(); - - // For each data item - stream.on("data", function(item) { - // Check if cursor is paused - test.equal(false, stream.paused); - // Pause stream - stream.pause(); - // Check if cursor is paused - test.equal(true, stream.paused); - - // Restart the stream after 1 miliscecond - setTimeout(function() { - stream.resume(); - // Check if cursor is paused - test.equal(false, stream.paused); - }, 1); - }); - - // When the stream is done - stream.on("close", function() { - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the cursorstream resume function. - * - * @_class cursorstream - * @_function resume - * @ignore - */ -exports.shouldStreamDocumentsUsingTheCursorStreamResumeFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a lot of documents to insert - var docs = [] - for(var i = 0; i < 1; i++) { - docs.push({'a':i}) - } - - // Create a collection - db.createCollection('test_cursorstream_resume', function(err, collection) { - test.equal(null, err); - - // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { - // Peform a find to get a cursor - var stream = collection.find().stream(); - - // For each data item - stream.on("data", function(item) { - // Check if cursor is paused - test.equal(false, stream.paused); - // Pause stream - stream.pause(); - // Check if cursor is paused - test.equal(true, stream.paused); - - // Restart the stream after 1 miliscecond - setTimeout(function() { - - // Resume the stream - stream.resume(); - - // Check if cursor is paused - test.equal(false, stream.paused); - }, 1); - }); - - // When the stream is done - stream.on("close", function() { - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the cursorstream resume function. - * - * @_class cursorstream - * @_function destroy - * @ignore - */ -exports.shouldStreamDocumentsUsingTheCursorStreamDestroyFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a lot of documents to insert - var docs = [] - for(var i = 0; i < 1; i++) { - docs.push({'a':i}) - } - - // Create a collection - db.createCollection('test_cursorstream_destroy', function(err, collection) { - test.equal(null, err); - - // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { - // Peform a find to get a cursor - var stream = collection.find().stream(); - - // For each data item - stream.on("data", function(item) { - // Destroy stream - stream.destroy(); - }); - - // When the stream is done - stream.on("close", function() { - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/custom_pk_test.js b/test/custom_pk_test.js deleted file mode 100644 index 5cf9c61e34d..00000000000 --- a/test/custom_pk_test.js +++ /dev/null @@ -1,107 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldCreateRecordsWithCustomPKFactory = function(test) { - // Custom factory (need to provide a 12 byte array); - var CustomPKFactory = function() {} - CustomPKFactory.prototype = new Object(); - CustomPKFactory.createPk = function() { - return new ObjectID("aaaaaaaaaaaa"); - } - - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {ssl:useSSL}), {'pk':CustomPKFactory, native_parser: (process.env['TEST_NATIVE'] != null)}); - p_client.open(function(err, p_client) { - p_client.dropDatabase(function(err, done) { - p_client.createCollection('test_custom_key', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, doc) { - collection.find({'_id':new ObjectID("aaaaaaaaaaaa")}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(1, items.length); - - p_client.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -exports.testConnectBadUrl = function(test) { - test.throws(function() { - connect('mango://localhost:27017/' + MONGODB, function(err, db) { - test.ok(false, 'Bad URL!'); - }); - }); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/db_test.js b/test/db_test.js deleted file mode 100644 index 44d6e36872a..00000000000 --- a/test/db_test.js +++ /dev/null @@ -1,1441 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - DBRef = require('../lib/mongodb/bson/db_ref').DBRef, - Code = require('../lib/mongodb/bson/code').Code, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleIllegalDbNames = function(test) { - // Assert rename - try { - new Db(5); - } catch(err) { - test.ok(err instanceof Error); - test.equal("database name must be a string", err.message); - } - - try { - new Db(""); - } catch(err) { - test.ok(err instanceof Error); - test.equal("database name cannot be the empty string", err.message); - } - - try { - new Db("te$t", function(err, collection) {}); - } catch(err) { - test.equal("database names cannot contain the character '$'", err.message); - } - - try { - new Db(".test", function(err, collection) {}); - } catch(err) { - test.equal("database names cannot contain the character '.'", err.message); - } - - try { - new Db("\\test", function(err, collection) {}); - } catch(err) { - test.equal("database names cannot contain the character '\\'", err.message); - } - - try { - new Db("\\test", function(err, collection) {}); - } catch(err) { - test.equal("database names cannot contain the character '\\'", err.message); - } - - try { - new Db("test test", function(err, collection) {}); - } catch(err) { - test.equal("database names cannot contain the character ' '", err.message); - } - - test.done(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformAutomaticConnect = function(test) { - var automatic_connect_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null), retryMiliSeconds:50}); - automatic_connect_client.open(function(err, automatic_connect_client) { - // Listener for closing event - var closeListener = function(has_error) { - // Let's insert a document - automatic_connect_client.collection('test_object_id_generation.data2', function(err, collection) { - // Insert another test document and collect using ObjectId - collection.insert({"name":"Patty", "age":34}, {safe:true}, function(err, ids) { - test.equal(1, ids.length); - test.ok(ids[0]._id.toHexString().length == 24); - - collection.findOne({"name":"Patty"}, function(err, document) { - test.equal(ids[0]._id.toHexString(), document._id.toHexString()); - // Let's close the db - automatic_connect_client.close(); - test.done(); - }); - }); - }); - }; - - // Add listener to close event - automatic_connect_client.on("close", closeListener); - automatic_connect_client.close(); - }); -} - -/** - * An example that shows how to force close a db connection so it cannot be reused. - * - * @_class db - * @_function close - * @ignore - */ -exports.shouldCorrectlyFailOnRetryDueToAppCloseOfDb = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch a collection - db.collection('shouldCorrectlyFailOnRetryDueToAppCloseOfDb', function(err, collection) { - - // Insert a document - collection.insert({a:1}, {safe:true}, function(err, result) { - test.equal(null, err); - - // Force close the connection - db.close(true, function(err, result) { - - // Attemp to insert should fail now with correct message 'db closed by application' - collection.insert({a:2}, {safe:true}, function(err, result) { - test.equal('db closed by application', err.message); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A whole bunch of examples on how to use eval on the server. - * - * @_class db - * @_function eval - * @ignore - */ -exports.shouldCorrectlyExecuteEvalFunctions = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Evaluate a function on the server with the parameter 3 passed in - db.eval('function (x) {return x;}', [3], function(err, result) { - test.equal(3, result); - }); - - // Evaluate a function on the server with the parameter 3 passed in no lock aquired for eval - // on server - db.eval('function (x) {return x;}', [3], {nolock:true}, function(err, result) { - test.equal(3, result); - }); - - // Evaluate a function on the server that writes to a server collection - db.eval('function (x) {db.test_eval.save({y:x});}', [5], function(err, result) { - // Locate the entry - client.collection('test_eval', function(err, collection) { - collection.findOne(function(err, item) { - test.equal(5, item.y); - }); - }); - }); - - // Evaluate a function with 2 parameters passed in - db.eval('function (x, y) {return x + y;}', [2, 3], function(err, result) { - test.equal(5, result); - }); - - // Evaluate a function with no parameters passed in - db.eval('function () {return 5;}', function(err, result) { - test.equal(5, result); - }); - - // Evaluate a statement - db.eval('2 + 3;', function(err, result) { - test.equal(5, result); - }); - - // Evaluate a statement using the code object - db.eval(new Code("2 + 3;"), function(err, result) { - test.equal(5, result); - }); - - // Evaluate a statement using the code object including a scope - db.eval(new Code("return i;", {'i':2}), function(err, result) { - test.equal(2, result); - }); - - // Evaluate a statement using the code object including a scope - db.eval(new Code("i + 3;", {'i':2}), function(err, result) { - test.equal(5, result); - test.done(); - }); - - // Evaluate an illegal statement - db.eval("5 ++ 5;", function(err, result) { - test.ok(err instanceof Error); - test.ok(err.message != null); - // Let's close the db - test.done(); - }); - - db.close(); - test.done(); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyDereferenceDbRef = function(test) { - client.createCollection('test_deref', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, ids) { - collection.remove({}, {safe:true}, function(err, result) { - collection.count(function(err, count) { - test.equal(0, count); - - // Execute deref a db reference - client.dereference(new DBRef("test_deref", new ObjectID()), function(err, result) { - collection.insert({'x':'hello'}, {safe:true}, function(err, ids) { - collection.findOne(function(err, document) { - test.equal('hello', document.x); - - client.dereference(new DBRef("test_deref", document._id), function(err, result) { - test.equal('hello', document.x); - - client.dereference(new DBRef("test_deref", 4), function(err, result) { - var obj = {'_id':4}; - - collection.insert(obj, {safe:true}, function(err, ids) { - client.dereference(new DBRef("test_deref", 4), function(err, document) { - - test.equal(obj['_id'], document._id); - collection.remove({}, {safe:true}, function(err, result) { - collection.insert({'x':'hello'}, {safe:true}, function(err, ids) { - client.dereference(new DBRef("test_deref", null), function(err, result) { - test.equal(null, result); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }) - }) - }) - }); -} - -/** - * An example of illegal and legal renaming of a collection - * - * @_class collection - * @_function rename - * @ignore - */ -exports.shouldCorrectlyRenameCollection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Open a couple of collections - db.createCollection('test_rename_collection', function(err, collection1) { - db.createCollection('test_rename_collection2', function(err, collection2) { - - // Attemp to rename a collection to a number - try { - collection1.rename(5, function(err, collection) {}); - } catch(err) { - test.ok(err instanceof Error); - test.equal("collection name must be a String", err.message); - } - - // Attemp to rename a collection to an empty string - try { - collection1.rename("", function(err, collection) {}); - } catch(err) { - test.ok(err instanceof Error); - test.equal("collection names cannot be empty", err.message); - } - - // Attemp to rename a collection to an illegal name including the character $ - try { - collection1.rename("te$t", function(err, collection) {}); - } catch(err) { - test.ok(err instanceof Error); - test.equal("collection names must not contain '$'", err.message); - } - - // Attemp to rename a collection to an illegal name starting with the character . - try { - collection1.rename(".test", function(err, collection) {}); - } catch(err) { - test.ok(err instanceof Error); - test.equal("collection names must not start or end with '.'", err.message); - } - - // Attemp to rename a collection to an illegal name ending with the character . - try { - collection1.rename("test.", function(err, collection) {}); - } catch(err) { - test.ok(err instanceof Error); - test.equal("collection names must not start or end with '.'", err.message); - } - - // Attemp to rename a collection to an illegal name with an empty middle name - try { - collection1.rename("tes..t", function(err, collection) {}); - } catch(err) { - test.equal("collection names cannot be empty", err.message); - } - - // Insert a couple of documents - collection1.insert([{'x':1}, {'x':2}], {safe:true}, function(err, docs) { - - // Attemp to rename the first collection to the second one, this will fail - collection1.rename('test_rename_collection2', function(err, collection) { - test.ok(err instanceof Error); - test.ok(err.message.length > 0); - - // Attemp to rename the first collection to a name that does not exist - // this will be succesful - collection1.rename('test_rename_collection3', function(err, collection) { - test.equal("test_rename_collection3", collection.collectionName); - - // Ensure that the collection is pointing to the new one - collection1.count(function(err, count) { - test.equal(2, count); - db.close(); - test.done(); - }); - }); - }); - }) - }); - }); - }); -} - -/** - * An example of a simple single server db connection - * - * @_class db - * @_function open - * @ignore - */ -exports.shouldCorrectlyOpenASimpleDbSingleServerConnection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - db.close(); - test.done(); - }); -} - -/** - * An example of a simple single server db connection and close function - * - * @_class db - * @_function close - * @ignore - */ -exports.shouldCorrectlyOpenASimpleDbSingleServerConnection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Close the connection with a callback that is optional - db.close(function(err, result) { - test.equal(null, err); - - test.done(); - }); - }); -} - -/** - * An example of retrieveing the information of all the collections. - * - * @_class db - * @_function collectionsInfo - * @ignore - */ -exports.shouldCorrectlyRetrieveCollectionInfo = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Create a collection - db.createCollection('test_collections_info', function(err, r) { - test.equal(null, err); - - // Return the information of a single collection name - db.collectionsInfo("test_collections_info").toArray(function(err, items) { - test.equal(1, items.length); - - // Return the information of a all collections, using the callback format - db.collectionsInfo(function(err, cursor) { - - // Turn the cursor into an array of results - cursor.toArray(function(err, items) { - test.ok(items.length > 0); - - db.close(); - test.done(); - }); - }) - }); - }); - }); -} - -/** - * An example of retrieveing the collection names for a database. - * - * @_class db - * @_function collectionNames - * @ignore - */ -exports.shouldCorrectlyRetrieveCollectionInfo = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Create a collection - db.createCollection('test_collections_info', function(err, r) { - test.equal(null, err); - - // Return the information of a single collection name - db.collectionNames("test_collections_info", function(err, items) { - test.equal(1, items.length); - - // Return the information of a all collections, using the callback format - db.collectionNames(function(err, items) { - test.ok(items.length > 0); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * An example of retrieving a collection from a db using the collection function. - * - * @_class db - * @_function collection - * @ignore - */ -exports.shouldCorrectlyAccessACollection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Grab a collection without a callback no safe mode - var col1 = db.collection('test_correctly_access_collections'); - - // Grab a collection with a callback but no safe operation - db.collection('test_correctly_access_collections', function(err, col2) { - test.equal(null, err); - - // Grab a collection with a callback in safe mode, ensuring it exists (should fail as it's not created) - db.collection('test_correctly_access_collections', {safe:true}, function(err, col3) { - test.ok(err != null); - - // Create the collection - db.createCollection('test_correctly_access_collections', function(err, result) { - - // Retry to get the collection, should work as it's now created - db.collection('test_correctly_access_collections', {safe:true}, function(err, col3) { - test.equal(null, err); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * An example of retrieving all collections for a db as Collection objects - * - * @_class db - * @_function collections - * @ignore - */ -exports.shouldCorrectlyRetrieveAllCollections = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Create the collection - db.createCollection('test_correctly_access_collections', function(err, result) { - - // Retry to get the collection, should work as it's now created - db.collections(function(err, collections) { - test.equal(null, err); - test.ok(collections.length > 0); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleFailedConnection = function(test) { - var fs_client = new Db(MONGODB, new Server("127.0.0.1", 25117, {auto_reconnect: false, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - fs_client.open(function(err, fs_client) { - test.ok(err != null) - test.done(); - }) -} - -/** - * @ignore - */ -exports.shouldCorrectlyResaveDBRef = function(test) { - client.dropCollection('test_resave_dbref', function() { - client.createCollection('test_resave_dbref', function(err, collection) { - test.ifError(err); - - collection.insert({'name': 'parent'}, {safe : true}, function(err, objs) { - test.ok(objs && objs.length == 1 && objs[0]._id != null); - var parent = objs[0]; - var child = {'name' : 'child', 'parent' : new DBRef("test_resave_dbref", parent._id)}; - - collection.insert(child, {safe : true}, function(err, objs) { - test.ifError(err); - - collection.findOne({'name' : 'child'}, function(err, child) { //Child deserialized - test.ifError(err); - test.ok(child != null); - - collection.save(child, {save : true}, function(err) { - test.ifError(err); //Child node with dbref resaved! - - collection.findOne({'parent' : new DBRef("test_resave_dbref", parent._id)}, - function(err, child) { - test.ifError(err); - test.ok(child != null);//!!!! Main test point! - test.done(); - }) - }); - }); - }); - }); - }); - }); -}, - -/** - * An example of dereferencing values. - * - * @_class db - * @_function dereference - * @ignore - */ -exports.shouldCorrectlyDereferenceDbRefExamples = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Get a second db - var secondDb = db.db('integration_tests_2'); - - // Create a dereference example - secondDb.createCollection('test_deref_examples', function(err, collection) { - - // Insert a document in the collection - collection.insert({'a':1}, {safe:true}, function(err, ids) { - - // Let's build a db reference and resolve it - var dbRef = new DBRef('test_deref_examples', ids[0]._id, 'integration_tests_2'); - - // Resolve it including a db resolve - db.dereference(dbRef, function(err, item) { - test.equal(1, item.a); - - // Let's build a db reference and resolve it - var dbRef = new DBRef('test_deref_examples', ids[0]._id); - - // Simple local resolve - secondDb.dereference(dbRef, function(err, item) { - test.equal(1, item.a); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * An example of using the logout command for the database. - * - * @_class db - * @_function logout - * @ignore - */ -exports.shouldCorrectlyLogoutFromTheDatabase = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Add a user to the database - db.addUser('user', 'name', function(err, result) { - test.equal(null, err); - - // Authenticate - db.authenticate('user', 'name', function(err, result) { - test.equal(true, result); - - // Logout the db - db.logout(function(err, result) { - test.equal(true, result); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * An example of using the authenticate command. - * - * @_class db - * @_function authenticate - * @ignore - */ -exports.shouldCorrectlyAuthenticateAgainstTheDatabase = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Add a user to the database - db.addUser('user', 'name', function(err, result) { - test.equal(null, err); - - // Authenticate - db.authenticate('user', 'name', function(err, result) { - test.equal(true, result); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * An example of adding a user to the database. - * - * @_class db - * @_function addUser - * @ignore - */ -exports.shouldCorrectlyAuthenticateAgainstTheDatabase = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Add a user to the database - db.addUser('user', 'name', function(err, result) { - test.equal(null, err); - - db.close(); - test.done(); - }); - }); -} - -/** - * An example of dereferencing values. - * - * @_class db - * @_function removeUser - * @ignore - */ -exports.shouldCorrectlyAddAndRemoveUser = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Add a user to the database - db.addUser('user', 'name', function(err, result) { - test.equal(null, err); - - // Authenticate - db.authenticate('user', 'name', function(err, result) { - test.equal(true, result); - - // Logout the db - db.logout(function(err, result) { - test.equal(true, result); - - // Remove the user from the db - db.removeUser('user', function(err, result) { - - // Authenticate - db.authenticate('user', 'name', function(err, result) { - test.equal(false, result); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the creation of a collection. - * - * @_class db - * @_function createCollection - * @ignore - */ -exports.shouldCorrectlyCreateACollection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Create a capped collection with a maximum of 1000 documents - db.createCollection("a_simple_collection", {capped:true, size:10000, max:1000, safe:true}, function(err, collection) { - test.equal(null, err); - - // Insert a document in the capped collection - collection.insert({a:1}, {safe:true}, function(err, result) { - test.equal(null, err); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * A simple example executing a command against the server. - * - * @_class db - * @_function dropCollection - * @ignore - */ -exports.shouldCorrectlyExecuteACommandAgainstTheServer = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Execute ping against the server - db.command({ping:1}, function(err, result) { - test.equal(null, err); - - // Create a capped collection with a maximum of 1000 documents - db.createCollection("a_simple_create_drop_collection", {capped:true, size:10000, max:1000, safe:true}, function(err, collection) { - test.equal(null, err); - - // Insert a document in the capped collection - collection.insert({a:1}, {safe:true}, function(err, result) { - test.equal(null, err); - - // Drop the collection from this world - db.dropCollection("a_simple_create_drop_collection", function(err, result) { - test.equal(null, err); - - // Verify that the collection is gone - db.collectionNames("a_simple_create_drop_collection", function(err, names) { - test.equal(0, names.length); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example creating, dropping a collection and then verifying that the collection is gone. - * - * @_class db - * @_function command - * @ignore - */ -exports.shouldCorrectlyCreateDropAndVerifyThatCollectionIsGone = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Execute ping against the server - db.command({ping:1}, function(err, result) { - test.equal(null, err); - - db.close(); - test.done(); - }); - }); -} - -/** - * A simple example creating, dropping a collection and then verifying that the collection is gone. - * - * @_class db - * @_function renameCollection - * @ignore - */ -exports.shouldCorrectlyRenameACollection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Create a collection - db.createCollection("simple_rename_collection", {safe:true}, function(err, collection) { - test.equal(null, err); - - // Insert a document in the collection - collection.insert({a:1}, {safe:true}, function(err, result) { - test.equal(null, err); - - // Rename the collection - db.renameCollection("simple_rename_collection", "simple_rename_collection_2", function(err, collection2) { - test.equal(null, err); - - // Retrieve the number of documents from the collection - collection2.count(function(err, count) { - test.equal(1, count); - - // Verify that the collection is gone - db.collectionNames("simple_rename_collection", function(err, names) { - test.equal(0, names.length); - - // Verify that the new collection exists - db.collectionNames("simple_rename_collection_2", function(err, names) { - test.equal(1, names.length); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example using lastError on a single connection with a pool of 1. - * - * @_class db - * @_function lastError - * @ignore - */ -exports.shouldCorrectlyUseLastError = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Create a collection - db.createCollection("simple_rename_collection", {safe:true}, function(err, collection) { - test.equal(null, err); - - // Insert a document in the collection - collection.insert({a:1}, function(err, result) { - test.equal(null, err); - - // Execute lastError - db.lastError(function(err, result) { - test.equal(null, err); - test.equal(null, result[0].err); - - // Pick a specific connection and execute lastError against it - var connection = db.serverConfig.checkoutWriter(); - // Execute lastError - db.lastError({}, {connection:connection}, function(err, result) { - test.equal(null, err); - test.equal(null, result[0].err); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A simple example using previousError to return the list of all errors, might be deprecated in the future. - * - * @_class db - * @_function previousErrors - * @ignore - */ -exports.shouldCorrectlyUsePreviousError = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Create a collection - db.createCollection("simple_previous_error_coll", {safe:true}, function(err, collection) { - test.equal(null, err); - - // Force a unique index - collection.ensureIndex({a:1}, {unique:true}, function(err, result) { - test.equal(null, err); - - // Force some errors - collection.insert([{a:1}, {a:1}, {a:1}, {a:2}], function(err, result) { - - // Pick a specific connection and execute lastError against it - var connection = db.serverConfig.checkoutWriter(); - - // Execute previousErrors - db.previousErrors({connection:connection}, function(err, result) { - test.equal(null, err); - test.equal(1, result.length); - test.ok(result[0].err != null); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A simple example using resetErrorHistory to clean up the history of errors. - * - * @_class db - * @_function resetErrorHistory - * @ignore - */ -exports.shouldCorrectlyUseResetErrorHistory = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Create a collection - db.createCollection("simple_reset_error_history_coll", {safe:true}, function(err, collection) { - test.equal(null, err); - - // Force a unique index - collection.ensureIndex({a:1}, {unique:true}, function(err, result) { - test.equal(null, err); - - // Force some errors - collection.insert([{a:1}, {a:1}, {a:1}, {a:2}], function(err, result) { - // Pick a specific connection and execute lastError against it - var connection = db.serverConfig.checkoutWriter(); - - // Reset the error history - db.resetErrorHistory({connection:connection}, function(err, result) { - - // Execute previousErrors and validate that there are no errors left - db.previousErrors({connection:connection}, function(err, result) { - test.equal(null, err); - test.equal(1, result.length); - test.equal(null, result[0].err); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * A more complex createIndex using a compound unique index in the background and dropping duplicated documents - * - * @_class db - * @_function createIndex - */ -exports.shouldCreateComplexIndexOnTwoFields = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('more_complex_index_test', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the index - collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Create an index on the a field - db.createIndex('more_complex_index_test', {a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { - - // Show that duplicate records got dropped - collection.find({}).toArray(function(err, items) { - test.equal(null, err); - test.equal(4, items.length); - - // Peform a query, with explain to show we hit the query - collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { - test.equal(null, err); - test.ok(explanation[0].indexBounds.a != null); - test.ok(explanation[0].indexBounds.b != null); - - db.close(); - test.done(); - }); - }) - }); - }); - }); - }); -} - -/** - * A more complex ensureIndex using a compound unique index in the background and dropping duplicated documents. - * - * @_class db - * @_function ensureIndex - */ -exports.shouldCreateComplexEnsureIndex = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('more_complex_ensure_index_test', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the index - collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Create an index on the a field - db.ensureIndex('more_complex_ensure_index_test', {a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { - - // Show that duplicate records got dropped - collection.find({}).toArray(function(err, items) { - test.equal(null, err); - test.equal(4, items.length); - - // Peform a query, with explain to show we hit the query - collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { - test.equal(null, err); - test.ok(explanation[0].indexBounds.a != null); - test.ok(explanation[0].indexBounds.b != null); - - db.close(); - test.done(); - }); - }) - }); - }); - }); - }); -} - -/** - * A Simple example of returning current cursor information in MongoDB - * - * @_class db - * @_function cursorInfo - */ -exports.shouldCorrectlyReturnCursorInformation = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('cursor_information_collection', function(err, collection) { - test.equal(null, err); - - // Create a bunch of documents so we can force the creation of a cursor - var docs = []; - for(var i = 0; i < 1000; i++) { - docs.push({a:'hello world hello world hello world hello world hello world hello world hello world hello world'}); - } - - // Insert a bunch of documents for the index - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - // Let's set a cursor - var cursor = collection.find({}, {batchSize:10}); - cursor.nextObject(function(err, item) { - test.equal(null, err); - - // Let's grab the information about the cursors on the database - db.cursorInfo(function(err, cursorInformation) { - test.ok(cursorInformation.totalOpen > 0); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * An examples showing the creation and dropping of an index - * - * @_class db - * @_function dropIndex - */ -exports.shouldCorrectlyCreateAndDropIndex = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('create_and_drop_an_index', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the index - collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Create an index on the a field - collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { - - // Drop the index - db.dropIndex("create_and_drop_an_index", "a_1_b_1", function(err, result) { - test.equal(null, err); - - // Verify that the index is gone - collection.indexInformation(function(err, indexInformation) { - test.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); - test.equal(null, indexInformation.a_1_b_1); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * An example showing how to force a reindex of a collection. - * - * @_class db - * @_function reIndex - */ -exports.shouldCorrectlyForceReindexOnCollection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('create_and_drop_all_indexes', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the index - collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4, c:4}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Create an index on the a field - collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { - - // Force a reindex of the collection - db.reIndex('create_and_drop_all_indexes', function(err, result) { - test.equal(null, err); - test.equal(true, result); - - // Verify that the index is gone - collection.indexInformation(function(err, indexInformation) { - test.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); - test.deepEqual([ [ 'a', 1 ], [ 'b', 1 ] ], indexInformation.a_1_b_1); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * An example showing the information returned by indexInformation - * - * @_class db - * @_function indexInformation - */ -exports.shouldCorrectlyShowTheResultsFromIndexInformation = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('more_index_information_test', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the index - collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Create an index on the a field - collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { - - // Fetch basic indexInformation for collection - db.indexInformation('more_index_information_test', function(err, indexInformation) { - test.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); - test.deepEqual([ [ 'a', 1 ], [ 'b', 1 ] ], indexInformation.a_1_b_1); - - // Fetch full index information - collection.indexInformation({full:true}, function(err, indexInformation) { - test.deepEqual({ _id: 1 }, indexInformation[0].key); - test.deepEqual({ a: 1, b: 1 }, indexInformation[1].key); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * An examples showing the dropping of a database - * - * @_class db - * @_function dropDatabase - */ -exports.shouldCorrectlyShowTheResultsFromIndexInformation = function(test) { - var db = new Db('integration_tests_to_drop', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection - db.createCollection('more_index_information_test', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the index - collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Let's drop the database - db.dropDatabase(function(err, result) { - test.equal(null, err); - - // Get the admin database - db.admin().listDatabases(function(err, dbs) { - // Grab the databases - dbs = dbs.databases; - // Did we find the db - var found = false; - - // Check if we have the db in the list - for(var i = 0; i < dbs.length; i++) { - if(dbs[i].name == 'integration_tests_to_drop') found = true; - } - - // We should not find the databases - test.equal(false, found); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/error_test.js b/test/error_test.js deleted file mode 100644 index 9f22a4d14cd..00000000000 --- a/test/error_test.js +++ /dev/null @@ -1,311 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -// Test the error reporting functionality -exports.shouldCorrectlyRetrieveErrorMessagesFromServer = function(test) { - // Just run with one connection in the pool - var error_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize:1, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Open the db - error_client.open(function(err, error_client) { - error_client.resetErrorHistory(function() { - error_client.error(function(err, documents) { - test.equal(true, documents[0].ok); - test.equal(0, documents[0].n); - - // Force error on server - error_client.executeDbCommand({forceerror: 1}, function(err, r) { - test.equal(0, r.documents[0].ok); - test.ok(r.documents[0].errmsg.length > 0); - // Check for previous errors - error_client.previousErrors(function(err, documents) { - test.equal(true, documents[0].ok); - test.equal(1, documents[0].nPrev); - test.equal("forced error", documents[0].err); - - // Check for the last error - error_client.error(function(err, documents) { - test.equal("forced error", documents[0].err); - // Force another error - error_client.collection('test_error_collection', function(err, collection) { - collection.findOne({name:"Fred"}, function(err, document) { - // Check that we have two previous errors - error_client.previousErrors(function(err, documents) { - test.equal(true, documents[0].ok); - test.equal(2, documents[0].nPrev); - test.equal("forced error", documents[0].err); - - error_client.resetErrorHistory(function() { - error_client.previousErrors(function(err, documents) { - test.equal(true, documents[0].ok); - test.equal(-1, documents[0].nPrev); - - error_client.error(function(err, documents) { - test.equal(true, documents[0].ok); - test.equal(0, documents[0].n); - - // Let's close the db - error_client.close(); - - error_client.error(function(err, documents) { - test.ok(err instanceof Error); - test.equal('no open connections', err.message); - test.done(); - }); - }); - }) - }); - }); - }); - }); - }) - }); - }); - }); - }); - }); -} - -// Test the last status functionality of the driver -exports.shouldCorrectlyExecuteLastStatus = function(test) { - // Just run with one connection in the pool - var error_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize:1, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Open the db - error_client.open(function(err, client) { - client.createCollection('test_last_status', function(err, collection) { - test.ok(collection instanceof Collection); - test.equal('test_last_status', collection.collectionName); - - // Get the collection - client.collection('test_last_status', function(err, collection) { - // Remove all the elements of the collection - collection.remove(function(err, result) { - // Check update of a document - collection.insert({i:1}, function(err, ids) { - test.equal(1, ids.length); - test.ok(ids[0]._id.toHexString().length == 24); - - // Update the record - collection.update({i:1}, {"$set":{i:2}}, function(err, result) { - // Check for the last message from the server - client.lastStatus(function(err, status) { - test.equal(true, status[0].ok); - test.equal(true, status[0].updatedExisting); - // Check for failed update of document - collection.update({i:1}, {"$set":{i:500}}, function(err, result) { - client.lastStatus(function(err, status) { - test.equal(true, status[0].ok); - test.equal(false, status[0].updatedExisting); - - // Check safe update of a document - collection.insert({x:1}, function(err, ids) { - collection.update({x:1}, {"$set":{x:2}}, {'safe':true}, function(err, document) { - }); - - collection.update({x:1}, {"$set":{x:2}}, {'safe':true}); - - collection.update({y:1}, {"$set":{y:2}}, {'safe':true}, function(err, result) { - test.equal(0, result); - - // Let's close the db - error_client.close(); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -exports.shouldFailInsertDueToUniqueIndex = function(test) { - client.createCollection('test_failing_insert_due_to_unique_index', function(err, r) { - client.collection('test_failing_insert_due_to_unique_index', function(err, collection) { - collection.ensureIndex([['a', 1 ]], true, function(err, indexName) { - collection.insert({a:2}, {safe: true}, function(err, r) { - test.ok(err == null); - collection.insert({a:2}, {safe: true}, function(err, r) { - test.ok(err != null); - test.done(); - }) - }) - }) - }) - }) -} - -// Test the error reporting functionality -exports.shouldFailInsertDueToUniqueIndexStrict = function(test) { - var error_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - error_client.open(function(err, error_client) { - error_client.dropCollection('test_failing_insert_due_to_unique_index_strict', function(err, r) { - error_client.createCollection('test_failing_insert_due_to_unique_index_strict', function(err, r) { - error_client.collection('test_failing_insert_due_to_unique_index_strict', function(err, collection) { - collection.ensureIndex([['a', 1 ]], true, function(err, indexName) { - collection.insert({a:2}, {safe:true}, function(err, r) { - test.ok(err == null); - collection.insert({a:2}, {safe:true}, function(err, r) { - test.ok(err != null); - error_client.close(); - test.done(); - }) - }) - }) - }) - }) - }); - }); -} - -exports['safe mode should pass the disconnected error to the callback'] = function (test) { - var error_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - var name = 'test_safe_mode_when_disconnected'; - error_client.open(function(err, error_client) { - test.ok(err == null); - error_client.resetErrorHistory(function() { - error_client.dropCollection(name, function() { - error_client.createCollection(name, function(err, collection) { - test.ok(err == null); - collection.insert({ inserted: true }, { safe: true }, function (err) { - test.ok(err == null); - error_client.close(); - - collection.insert({ works: true }, { safe: true }, function (err) { - test.ok(err instanceof Error); - test.equal('no open connections', err.message); - - collection.update({ inserted: true }, { inserted: true, x: 1 }, { safe: true }, function (err) { - test.ok(err instanceof Error); - test.equal('no open connections', err.message); - - collection.remove({ inserted: true }, { safe: true }, function (err) { - test.ok(err instanceof Error); - test.equal('no open connections', err.message); - - collection.findOne({ works: true }, function (err) { - test.ok(err instanceof Error); - test.equal('no open connections', err.message); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -exports.shouldHandleAssertionError = function(test) { - client.createCollection('test_handle_assertion_error', function(err, r) { - client.collection('test_handle_assertion_error', function(err, collection) { - collection.insert({a:{lat:50, lng:10}}, {safe: true}, function(err, docs) { - test.ok(err == null); - - var query = {a:{$within:{$box:[[1,-10],[80,120]]}}}; - - // We don't have a geospatial index at this point - collection.findOne(query, function(err, docs) { - test.ok(err instanceof Error); - - collection.ensureIndex([['a', '2d' ]], true, function(err, indexName) { - test.ok(err == null); - - collection.findOne(query, function(err, doc) { - test.ok(err == null); - - var invalidQuery = {a:{$within:{$box:[[-10,-180],[10,180]]}}}; - - client.admin().serverInfo(function(err, result){ - collection.findOne(invalidQuery, function(err, doc) { - if(parseInt((result.version.replace(/\./g, ''))) < 200) { - test.ok(err instanceof Error); - } else { - test.equal(null, err); - test.equal(null, doc); - } - - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/exception_handling_test.js b/test/exception_handling_test.js deleted file mode 100644 index 1ba34b352c8..00000000000 --- a/test/exception_handling_test.js +++ /dev/null @@ -1,101 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldCorrectlyHandleThrownError = function(test) { - client.createCollection('shouldCorrectlyHandleThrownError', function(err, r) { - try { - client.collection('shouldCorrectlyHandleThrownError', function(err, collection) { - debug(someUndefinedVariable); - }); - } catch (err) { - test.ok(err != null); - test.done(); - } - }); -} - -exports.shouldCorrectlyHandleThrownErrorInRename = function(test) { - // Catch unhandled exception - process.on("uncaughtException", function(err) { - // Remove listener - process.removeAllListeners("uncaughtException"); - test.done() - }) - - // Execute code - client.createCollection('shouldCorrectlyHandleThrownErrorInRename', function(err, r) { - client.collection('shouldCorrectlyHandleThrownError', function(err, collection) { - collection.rename("shouldCorrectlyHandleThrownErrorInRename2", function(err, result) { - debug(someUndefinedVariable); - }) - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/find_test.js b/test/find_test.js deleted file mode 100644 index 40ba87c4773..00000000000 --- a/test/find_test.js +++ /dev/null @@ -1,1647 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - Code = require('../lib/mongodb/bson/code').Code, - Long = require('../lib/mongodb/bson/long').Long, - Step = require('step'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var POOL_SIZE = 4; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * Test a simple find - * @ignore - */ -exports.shouldCorrectlyPerformSimpleFind = function(test) { - client.createCollection('test_find_simple', function(err, r) { - var collection = client.collection('test_find_simple', function(err, collection) { - var doc1 = null; - var doc2 = null; - - // Insert some test documents - collection.insert([{a:2}, {b:3}], {safe:true}, function(err, docs) { - doc1 = docs[0]; - doc2 = docs[1] - - // Ensure correct insertion testing via the cursor and the count function - collection.find(function(err, cursor) { - cursor.toArray(function(err, documents) { - test.equal(2, documents.length); - - collection.count(function(err, count) { - test.equal(2, count); - - // Fetch values by selection - collection.find({'a': doc1.a}, function(err, cursor) { - cursor.toArray(function(err, documents) { - test.equal(1, documents.length); - test.equal(doc1.a, documents[0].a); - // Let's close the db - test.done(); - }); - }); - }); - }) - }); - }); - }); - }); -} - -/** - * Test a simple find chained - * @ignore - */ -exports.shouldCorrectlyPeformSimpleChainedFind = function(test) { - client.createCollection('test_find_simple_chained', function(err, r) { - var collection = client.collection('test_find_simple_chained', function(err, collection) { - var doc1 = null; - var doc2 = null; - - // Insert some test documents - collection.insert([{a:2}, {b:3}], {safe:true}, function(err, docs) { - doc1 = docs[0]; - doc2 = docs[1] - - // Ensure correct insertion testing via the cursor and the count function - collection.find().toArray(function(err, documents) { - test.equal(2, documents.length); - - collection.count(function(err, count) { - test.equal(2, count); - - // Fetch values by selection - collection.find({'a': doc1.a}).toArray(function(err, documents) { - test.equal(1, documents.length); - test.equal(doc1.a, documents[0].a); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * Test advanced find - * @ignore - */ -exports.shouldCorrectlyPeformAdvancedFinds = function(test) { - client.createCollection('test_find_advanced', function(err, r) { - var collection = client.collection('test_find_advanced', function(err, collection) { - var doc1 = null, doc2 = null, doc3 = null; - - // Insert some test documents - collection.insert([{a:1}, {a:2}, {b:3}], {safe:true}, function(err, docs) { - var doc1 = docs[0], doc2 = docs[1], doc3 = docs[2]; - - // Locate by less than - collection.find({'a':{'$lt':10}}).toArray(function(err, documents) { - test.equal(2, documents.length); - // Check that the correct documents are returned - var results = []; - // Check that we have all the results we want - documents.forEach(function(doc) { - if(doc.a == 1 || doc.a == 2) results.push(1); - }); - test.equal(2, results.length); - }); - - // Locate by greater than - collection.find({'a':{'$gt':1}}).toArray(function(err, documents) { - test.equal(1, documents.length); - test.equal(2, documents[0].a); - }); - - // Locate by less than or equal to - collection.find({'a':{'$lte':1}}).toArray(function(err, documents) { - test.equal(1, documents.length); - test.equal(1, documents[0].a); - }); - - // Locate by greater than or equal to - collection.find({'a':{'$gte':1}}).toArray(function(err, documents) { - test.equal(2, documents.length); - // Check that the correct documents are returned - var results = []; - // Check that we have all the results we want - documents.forEach(function(doc) { - if(doc.a == 1 || doc.a == 2) results.push(1); - }); - test.equal(2, results.length); - }); - - // Locate by between - collection.find({'a':{'$gt':1, '$lt':3}}).toArray(function(err, documents) { - test.equal(1, documents.length); - test.equal(2, documents[0].a); - }); - - // Locate in clause - collection.find({'a':{'$in':[1,2]}}).toArray(function(err, documents) { - test.equal(2, documents.length); - // Check that the correct documents are returned - var results = []; - // Check that we have all the results we want - documents.forEach(function(doc) { - if(doc.a == 1 || doc.a == 2) results.push(1); - }); - test.equal(2, results.length); - }); - - // Locate in _id clause - collection.find({'_id':{'$in':[doc1['_id'], doc2['_id']]}}).toArray(function(err, documents) { - test.equal(2, documents.length); - // Check that the correct documents are returned - var results = []; - // Check that we have all the results we want - documents.forEach(function(doc) { - if(doc.a == 1 || doc.a == 2) results.push(1); - }); - test.equal(2, results.length); - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * Test sorting of results - * @ignore - */ -exports.shouldCorrectlyPerformFindWithSort = function(test) { - client.createCollection('test_find_sorting', function(err, r) { - client.collection('test_find_sorting', function(err, collection) { - var doc1 = null, doc2 = null, doc3 = null, doc4 = null; - // Insert some test documents - collection.insert([{a:1, b:2}, - {a:2, b:1}, - {a:3, b:2}, - {a:4, b:1} - ], {safe:true}, function(err, docs) { - doc1 = docs[0]; - doc2 = docs[1]; - doc3 = docs[2]; - doc4 = docs[3] - - // Test sorting (ascending) - collection.find({'a': {'$lt':10}}, {'sort': [['a', 1]]}).toArray(function(err, documents) { - test.equal(4, documents.length); - test.equal(1, documents[0].a); - test.equal(2, documents[1].a); - test.equal(3, documents[2].a); - test.equal(4, documents[3].a); - - // Test sorting (descending) - collection.find({'a': {'$lt':10}}, {'sort': [['a', -1]]}).toArray(function(err, documents) { - test.equal(4, documents.length); - test.equal(4, documents[0].a); - test.equal(3, documents[1].a); - test.equal(2, documents[2].a); - test.equal(1, documents[3].a); - - // Test sorting (descending), sort is hash - collection.find({'a': {'$lt':10}}, {sort: {a: -1}}).toArray(function(err, documents) { - test.equal(4, documents.length); - test.equal(4, documents[0].a); - test.equal(3, documents[1].a); - test.equal(2, documents[2].a); - test.equal(1, documents[3].a); - - // Sorting using array of names, assumes ascending order - collection.find({'a': {'$lt':10}}, {'sort': ['a']}).toArray(function(err, documents) { - test.equal(4, documents.length); - test.equal(1, documents[0].a); - test.equal(2, documents[1].a); - test.equal(3, documents[2].a); - test.equal(4, documents[3].a); - - // Sorting using single name, assumes ascending order - collection.find({'a': {'$lt':10}}, {'sort': 'a'}).toArray(function(err, documents) { - test.equal(4, documents.length); - test.equal(1, documents[0].a); - test.equal(2, documents[1].a); - test.equal(3, documents[2].a); - test.equal(4, documents[3].a); - - // Sorting using single name, assumes ascending order, sort is hash - collection.find({'a': {'$lt':10}}, {sort: {'a':1}}).toArray(function(err, documents) { - test.equal(4, documents.length); - test.equal(1, documents[0].a); - test.equal(2, documents[1].a); - test.equal(3, documents[2].a); - test.equal(4, documents[3].a); - - collection.find({'a': {'$lt':10}}, {'sort': ['b', 'a']}).toArray(function(err, documents) { - test.equal(4, documents.length); - test.equal(2, documents[0].a); - test.equal(4, documents[1].a); - test.equal(1, documents[2].a); - test.equal(3, documents[3].a); - - // Sorting using empty array, no order guarantee should not blow up - collection.find({'a': {'$lt':10}}, {'sort': []}).toArray(function(err, documents) { - test.equal(4, documents.length); - - /* NONACTUAL */ - // Sorting using ordered hash - collection.find({'a': {'$lt':10}}, {'sort': {a:-1}}).toArray(function(err, documents) { - // Fail test if not an error - test.equal(4, documents.length); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * Test the limit function of the db - * @ignore - */ -exports.shouldCorrectlyPerformFindWithLimit = function(test) { - client.createCollection('test_find_limits', function(err, r) { - client.collection('test_find_limits', function(err, collection) { - var doc1 = null, doc2 = null, doc3 = null, doc4 = null; - - // Insert some test documents - collection.insert([{a:1}, - {b:2}, - {c:3}, - {d:4} - ], {safe:true}, function(err, docs) { - doc1 = docs[0]; - doc2 = docs[1]; - doc3 = docs[2]; - doc4 = docs[3] - - // Test limits - collection.find({}, {'limit': 1}).toArray(function(err, documents) { - test.equal(1, documents.length); - }); - - collection.find({}, {'limit': 2}).toArray(function(err, documents) { - test.equal(2, documents.length); - }); - - collection.find({}, {'limit': 3}).toArray(function(err, documents) { - test.equal(3, documents.length); - }); - - collection.find({}, {'limit': 4}).toArray(function(err, documents) { - test.equal(4, documents.length); - }); - - collection.find({}, {}).toArray(function(err, documents) { - test.equal(4, documents.length); - }); - - collection.find({}, {'limit':99}).toArray(function(err, documents) { - test.equal(4, documents.length); - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * Test find by non-quoted values (issue #128) - * @ignore - */ -exports.shouldCorrectlyFindWithNonQuotedValues = function(test) { - client.createCollection('test_find_non_quoted_values', function(err, r) { - client.collection('test_find_non_quoted_values', function(err, collection) { - // insert test document - collection.insert([{ a: 19, b: 'teststring', c: 59920303 }, - { a: "19", b: 'teststring', c: 3984929 }], {safe:true} , function(err, r) { - - collection.find({ a: 19 }).toArray(function(err, documents) { - test.equal(1, documents.length); - test.done(); - }); - }); - }); - }); -} - -/** - * Test for querying embedded document using dot-notation (issue #126) - * @ignore - */ -exports.shouldCorrectlyFindEmbeddedDocument = function(test) { - client.createCollection('test_find_embedded_document', function(err, r) { - client.collection('test_find_embedded_document', function(err, collection) { - // insert test document - collection.insert([{ a: { id: 10, value: 'foo' }, b: 'bar', c: { id: 20, value: 'foobar' }}, - { a: { id: 11, value: 'foo' }, b: 'bar2', c: { id: 20, value: 'foobar' }}], {safe:true}, function(err, r) { - - // test using integer value - collection.find({ 'a.id': 10 }).toArray(function(err, documents) { - test.equal(1, documents.length); - test.equal('bar', documents[0].b); - }); - - // test using string value - collection.find({ 'a.value': 'foo' }).toArray(function(err, documents) { - // should yield 2 documents - test.equal(2, documents.length); - test.equal('bar', documents[0].b); - test.equal('bar2', documents[1].b); - test.done(); - }); - }); - }); - }); -} - -/** - * Find no records - * @ignore - */ -exports.shouldCorrectlyFindNoRecords = function(test) { - client.createCollection('test_find_one_no_records', function(err, r) { - client.collection('test_find_one_no_records', function(err, collection) { - collection.find({'a':1}, {}).toArray(function(err, documents) { - test.equal(0, documents.length); - // Let's close the db - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformFindByWhere = function(test) { - client.createCollection('test_where', function(err, collection) { - test.ok(collection instanceof Collection); - collection.insert([{'a':1}, {'a':2}, {'a':3}], {safe:true}, function(err, ids) { - collection.count(function(err, count) { - test.equal(3, count); - - // Let's test usage of the $where statement - collection.find({'$where':new Code('this.a > 2')}).count(function(err, count) { - test.equal(1, count); - }); - - collection.find({'$where':new Code('this.a > i', {i:1})}).count(function(err, count) { - test.equal(2, count); - - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformFindsWithHintTurnedOn = function(test) { - client.createCollection('test_hint', function(err, collection) { - collection.insert({'a':1}, {safe:true}, function(err, ids) { - client.createIndex(collection.collectionName, "a", function(err, indexName) { - collection.find({'a':1}, {'hint':'a'}).toArray(function(err, items) { - test.equal(1, items.length); - }); - - collection.find({'a':1}, {'hint':['a']}).toArray(function(err, items) { - test.equal(1, items.length); - }); - - collection.find({'a':1}, {'hint':{'a':1}}).toArray(function(err, items) { - test.equal(1, items.length); - }); - - // Modify hints - collection.hint = 'a'; - test.equal(1, collection.hint['a']); - collection.find({'a':1}).toArray(function(err, items) { - test.equal(1, items.length); - }); - - collection.hint = ['a']; - test.equal(1, collection.hint['a']); - collection.find({'a':1}).toArray(function(err, items) { - test.equal(1, items.length); - }); - - collection.hint = {'a':1}; - test.equal(1, collection.hint['a']); - collection.find({'a':1}).toArray(function(err, items) { - test.equal(1, items.length); - }); - - collection.hint = null; - test.ok(collection.hint == null); - collection.find({'a':1}).toArray(function(err, items) { - test.equal(1, items.length); - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformFindByObjectID = function(test) { - client.createCollection('test_find_by_oid', function(err, collection) { - collection.save({'hello':'mike'}, {safe:true}, function(err, docs) { - test.ok(docs._id instanceof ObjectID || Object.prototype.toString.call(docs._id) === '[object ObjectID]'); - - collection.findOne({'_id':docs._id}, function(err, doc) { - test.equal('mike', doc.hello); - - var id = doc._id.toString(); - collection.findOne({'_id':new ObjectID(id)}, function(err, doc) { - test.equal('mike', doc.hello); - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReturnDocumentWithOriginalStructure= function(test) { - client.createCollection('test_find_by_oid_with_subdocs', function(err, collection) { - var c1 = { _id: new ObjectID, comments: [], title: 'number 1' }; - var c2 = { _id: new ObjectID, comments: [], title: 'number 2' }; - var doc = { - numbers: [] - , owners: [] - , comments: [c1, c2] - , _id: new ObjectID - }; - - collection.insert(doc, {safe:true}, function(err, docs) { - collection.findOne({'_id':doc._id}, {safe:true,fields: undefined}, function(err, doc) { - if (err) console.error('error', err); - test.equal(2, doc.comments.length); - test.equal('number 1', doc.comments[0].title); - test.equal('number 2', doc.comments[1].title); - - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyRetrieveSingleRecord = function(test) { - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - p_client.open(function(err, p_client) { - client.createCollection('test_should_correctly_retrieve_one_record', function(err, collection) { - collection.insert({'a':0}, {safe:true}, function(err, r) { - p_client.collection('test_should_correctly_retrieve_one_record', function(err, usercollection) { - usercollection.findOne({'a': 0}, function(err, result) { - p_client.close(); - - test.done(); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleError = function(test) { - client.createCollection('test_find_one_error_handling', function(err, collection) { - // Try to fetch an object using a totally invalid and wrong hex string... what we're interested in here - // is the error handling of the findOne Method - try { - collection.findOne({"_id":ObjectID.createFromHexString('5e9bd59248305adf18ebc15703a1')}, function(err, result) {}); - } catch (err) { - test.done(); - } - }); -} - -/** - * Test field select with options - * @ignore - */ -exports.shouldCorrectlyPerformFindWithOptions = function(test) { - client.createCollection('test_field_select_with_options', function(err, r) { - var collection = client.collection('test_field_select_with_options', function(err, collection) { - var docCount = 25, docs = []; - - // Insert some test documents - while(docCount--) docs.push({a:docCount, b:docCount}); - collection.insert(docs, {safe:true}, function(err,retDocs) { - docs = retDocs; - - collection.find({},{ 'a' : 1},{ limit : 3, sort : [['a',-1]] }).toArray(function(err,documents){ - test.equal(3,documents.length); - documents.forEach(function(doc,idx){ - test.equal(undefined,doc.b); // making sure field select works - test.equal((24-idx),doc.a); // checking limit sort object with field select - }); - }); - - collection.find({},{},10,3).toArray(function(err,documents){ - test.equal(3,documents.length); - documents.forEach(function(doc,idx){ - test.equal(doc.a,doc.b); // making sure empty field select returns properly - test.equal((14-idx),doc.a); // checking skip and limit in args - }); - - test.done(); - }); - }); - }); - }); -} - -/** - * Test findAndModify a document - * @ignore - */ -exports.shouldCorrectlyFindAndModifyDocument = function(test) { - client.createCollection('test_find_and_modify_a_document', function(err, collection) { - // Test return new document on change - collection.insert({'a':1, 'b':2}, {safe:true}, function(err, doc) { - // Let's modify the document in place - collection.findAndModify({'a':1}, [['a', 1]], {'$set':{'b':3}}, {'new':true}, function(err, updated_doc) { - test.equal(1, updated_doc.a); - test.equal(3, updated_doc.b); - - // Test return old document on change - collection.insert({'a':2, 'b':2}, {safe:true}, function(err, doc) { - // Let's modify the document in place - collection.findAndModify({'a':2}, [['a', 1]], {'$set':{'b':3}}, {safe:true}, function(err, result) { - test.equal(2, result.a); - test.equal(2, result.b); - - // Test remove object on change - collection.insert({'a':3, 'b':2}, {safe:true}, function(err, doc) { - // Let's modify the document in place - collection.findAndModify({'a':3}, [], {'$set':{'b':3}}, {'new': true, remove: true}, function(err, updated_doc) { - test.equal(3, updated_doc.a); - test.equal(2, updated_doc.b); - - // Let's upsert! - collection.findAndModify({'a':4}, [], {'$set':{'b':3}}, {'new': true, upsert: true}, function(err, updated_doc) { - test.equal(4, updated_doc.a); - test.equal(3, updated_doc.b); - - // Test selecting a subset of fields - collection.insert({a: 100, b: 101}, {safe:true}, function (err, ids) { - collection.findAndModify({'a': 100}, [], {'$set': {'b': 5}}, {'new': true, fields: {b: 1}}, function (err, updated_doc) { - test.equal(2, Object.keys(updated_doc).length); - test.equal(ids[0]['_id'].toHexString(), updated_doc._id.toHexString()); - test.equal(5, updated_doc.b); - test.equal("undefined", typeof updated_doc.a); - test.done(); - }); - }); - }); - }) - }); - }) - }); - }) - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteFindOneWithAnInSearchTag = function(test) { - client.createCollection('shouldCorrectlyExecuteFindOneWithAnInSearchTag', function(err, collection) { - // Test return new document on change - collection.insert({'tags':[]}, {safe:true}, function(err, docs) { - // Fetch the id - var id = docs[0]._id - - Step( - function findFirst() { - var self = this; - - collection.findOne({_id:id}, function(err, doc) { - test.equal(null, err) - test.ok(doc != null); - - // Perform atomic push operation - collection.update({_id:id}, {'$push':{comments:{title:'1'}}}, {safe:true}, self); - }) - }, - - function findSecond(err, result) { - var self = this; - test.equal(1, result); - test.equal(null, err); - - collection.findOne({_id:id}, function(err, doc) { - test.equal(null, err) - test.ok(doc != null); - test.deepEqual(1, doc.comments.length); - - // Perform atomic push operation - collection.update({_id:id}, {'$push':{comments:{title:'2'}}}, {safe:true}, self); - }) - }, - - function findThird(err, result) { - var self = this; - test.equal(1, result); - test.equal(null, err); - - collection.findOne({_id:id}, function(err, doc) { - test.equal(null, err) - test.ok(doc != null); - test.deepEqual(2, doc.comments.length); - - // Perform atomic push operation - collection.update({_id:id}, {'$push':{comments:{title:'3'}}}, {safe:true}, self); - }) - }, - - function findFourth(err, result) { - var self = this; - test.equal(1, result); - test.equal(null, err); - - collection.findOne({_id:id}, function(err, doc) { - test.equal(null, err) - test.ok(doc != null); - test.deepEqual(3, doc.comments.length); - // Perform atomic push operation - collection.update({_id:id}, {'$pushAll':{comments:[{title:'4'}, {title:'5'}]}}, {safe:true}, self); - }) - }, - - function findFourth(err, result) { - var self = this; - test.equal(1, result); - test.equal(null, err); - - collection.findOne({_id:id}, function(err, doc) { - test.equal(null, err) - test.ok(doc != null); - test.deepEqual(5, doc.comments.length); - test.done(); - }) - } - ) - }) - }); -} - -/** - * @ignore - */ -exports['ShouldCorrectlyLocatePostAndIncValues'] = function(test) { - client.createCollection('shouldCorrectlyExecuteFindOneWithAnInSearchTag', function(err, collection) { - // Test return new document on change - collection.insert({title:'Tobi', - author:'Brian', - newTitle:'Woot', meta:{visitors:0}}, {safe:true}, function(err, docs) { - // Fetch the id - var id = docs[0]._id - - collection.update({_id:id}, {$inc:{ 'meta.visitors': 1 }}, {safe:true}, function(err, result) { - test.equal(1, result); - test.equal(null, err); - - collection.findOne({_id:id}, function(err, item) { - test.equal(1, item.meta.visitors); - test.done() - }) - }); - }); - }); -} - -/** - * Test findAndModify a document - * @ignore - */ -exports['Should Correctly Handle FindAndModify Duplicate Key Error'] = function(test) { - client.createCollection('FindAndModifyDuplicateKeyError', function(err, collection) { - collection.ensureIndex(['name', 1], {unique:true}, function(err, index) { - // Test return new document on change - collection.insert([{name:'test1'}, {name:'test2'}], {safe:true}, function(err, doc) { - // Let's modify the document in place - collection.findAndModify({name: 'test1'}, [], {$set: {name: 'test2'}}, {}, function(err, updated_doc) { - test.equal(null, updated_doc); - test.ok(err != null); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should correctly return null when attempting to modify a non-existing document'] = function(test) { - client.createCollection('AttemptToFindAndModifyNonExistingDocument', function(err, collection) { - // Let's modify the document in place - collection.findAndModify({name: 'test1'}, [], {$set: {name: 'test2'}}, {}, function(err, updated_doc) { - test.equal(null, updated_doc); - test.ok(err == null || err.errmsg.match("No matching object found")) - test.done(); - }); - }); -} - -/** - * @ignore - */ -exports['Should correctly handle chained skip and limit on find with toArray'] = function(test) { - client.createCollection('skipAndLimitOnFindWithToArray', function(err, collection) { - collection.insert([{a:1}, {b:2}, {c:3}], {safe:true}, function(err, result) { - - collection.find().skip(1).limit(1).toArray(function(err, items) { - test.equal(null, err); - test.equal(1, items.length); - test.equal(2, items[0].b) - test.done(); - }) - }); - }); -} - -/** - * @ignore - */ -exports['Should correctly pass timeout options to cursor'] = function(test) { - client.createCollection('timeoutFalse', function(err, collection) { - collection.find({},{timeout:false},function(err, cursor) { - test.equal(false, cursor.timeout); - }); - collection.find({},{timeout:true},function(err, cursor) { - test.equal(true, cursor.timeout); - }); - collection.find({},{},function(err, cursor) { - test.equal(true, cursor.timeout); - }); - - test.done(); - }); -} - -/** - * Test findAndModify a document with strict mode enabled - * @ignore - */ -exports.shouldCorrectlyFindAndModifyDocumentWithDBStrict = function(test) { - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {strict:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - p_client.open(function(err, p_client) { - p_client.createCollection('shouldCorrectlyFindAndModifyDocumentWithDBStrict', function(err, collection) { - // Test return old document on change - collection.insert({'a':2, 'b':2}, {safe:true}, function(err, doc) { - // Let's modify the document in place - collection.findAndModify({'a':2}, [['a', 1]], {'$set':{'b':3}}, {new:true}, function(err, result) { - test.equal(2, result.a) - test.equal(3, result.b) - p_client.close(); - test.done(); - }) - }); - }); - }); -} - -/** - * Test findAndModify a document that fails in first step before safe - * @ignore - */ -exports.shouldCorrectlyFindAndModifyDocumentThatFailsInFirstStep = function(test) { - client.createCollection('shouldCorrectlyFindAndModifyDocumentThatFailsInFirstStep', function(err, collection) { - // Set up an index to force duplicate index erro - collection.ensureIndex([['failIndex', 1]], {unique:true}, function(err, index) { - // Setup a new document - collection.insert({'a':2, 'b':2, 'failIndex':1}, function(err, doc) { - - // Let's attempt to upsert with a duplicate key error - collection.findAndModify({'c':2}, [['a', 1]], {'a':10, 'b':10, 'failIndex':1}, {safe:true, upsert:true}, function(err, result) { - test.equal(null, result); - test.ok(err.errmsg.match("duplicate key error index")); - test.done(); - }) - }); - }); - }); -} - -/** - * Test findAndModify a document that fails in first step before safe - * @ignore - */ -exports.shouldCorrectlyFindAndModifyDocumentThatFailsInSecondStepWithNoMatchingDocuments = function(test) { - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {strict:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - p_client.open(function(err, p_client) { - p_client.createCollection('shouldCorrectlyFindAndModifyDocumentThatFailsInSecondStepWithNoMatchingDocuments', function(err, collection) { - // Test return old document on change - collection.insert({'a':2, 'b':2}, function(err, doc) { - - // Let's modify the document in place - collection.findAndModify({'a':2}, [['a', 1]], {'$set':{'b':3}}, {safe:{w:200, wtimeout:1000}}, function(err, result) { - test.equal(null, result); - test.ok(err != null); - p_client.close(); - test.done(); - }) - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should correctly return new modified document'] = function(test) { - client.createCollection('Should_correctly_return_new_modified_document', function(err, collection) { - var id = new ObjectID(); - var doc = {_id:id, a:1, b:1, c:{a:1, b:1}}; - - collection.insert(doc, {safe:true}, function(err, result) { - test.ok(err == null); - - // Find and modify returning the new object - collection.findAndModify({_id:id}, [], {$set : {'c.c': 100}}, {new:true}, function(err, item) { - test.equal(doc._id.toString(), item._id.toString()); - test.equal(doc.a, item.a); - test.equal(doc.b, item.b); - test.equal(doc.c.a, item.c.a); - test.equal(doc.c.b, item.c.b); - test.equal(100, item.c.c); - test.done(); - }) - }); - }); -} - -/** - * Should correctly execute findAndModify that is breaking in prod - * @ignore - */ -exports.shouldCorrectlyExecuteFindAndModify = function(test) { - client.createCollection('shouldCorrectlyExecuteFindAndModify', function(err, collection) { - var self = {_id : new ObjectID()} - var _uuid = 'sddffdss' - - collection.findAndModify( - {_id: self._id, 'plays.uuid': _uuid}, - [], - {$set : {'plays.$.active': true}}, - {new: true, fields: {plays: 0, results: 0}, safe: true}, - function(err, contest) { - test.done(); - }) - }); -} - -/** - * @ignore - */ -exports['Should correctly return record with 64-bit id'] = function(test) { - client.createCollection('should_correctly_return_record_with_64bit_id', function(err, collection) { - var _lowerId = new ObjectID(); - var _higherId = new ObjectID(); - var lowerId = new Long.fromString('133118461172916224', 10); - var higherId = new Long.fromString('133118461172916225', 10); - - var lowerDoc = {_id:_lowerId, id: lowerId}; - var higherDoc = {_id:_higherId, id: higherId}; - - collection.insert([lowerDoc, higherDoc], {safe:true}, function(err, result) { - test.ok(err == null); - - // Select record with id of 133118461172916225 using $gt directive - collection.find({id: {$gt: lowerId}}, {}, function(err, cur) { - test.ok(err == null); - - cur.toArray(function(err, arr) { - test.ok(err == null); - test.equal(arr.length, 1, 'Selecting record via $gt directive on 64-bit integer should return a record with higher Id') - test.equal(arr[0].id.toString(), '133118461172916225', 'Returned Id should be equal to 133118461172916225') - test.done() - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should Correctly find a Document using findOne excluding _id field'] = function(test) { - client.createCollection('Should_Correctly_find_a_Document_using_findOne_excluding__id_field', function(err, collection) { - var doc = {_id : new ObjectID(), a:1, c:2} - // insert doc - collection.insert(doc, {safe:true}, function(err, result) { - // Get one document, excluding the _id field - collection.findOne({a:1}, {fields:{'_id': 0}}, function(err, item) { - test.equal(null, item._id); - test.equal(1, item.a); - test.equal(2, item.c); - - collection.find({a:1}, {fields:{'_id':0}}).toArray(function(err, items) { - var item = items[0] - test.equal(null, item._id); - test.equal(1, item.a); - test.equal(2, item.c); - test.done(); - }) - }) - }); - }); -} - -/** - * @ignore - */ -exports['Should correctly execute find and findOne queries in the same way'] = function(test) { - client.createCollection('Should_correctly_execute_find_and_findOne_queries_in_the_same_way', function(err, collection) { - var doc = {_id : new ObjectID(), a:1, c:2, comments:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}; - // insert doc - collection.insert(doc, {safe:true}, function(err, result) { - - collection.find({_id: doc._id}, {comments: {$slice: -5}}).toArray(function(err, docs) { - test.equal(5, docs[0].comments.length) - - collection.findOne({_id: doc._id}, {comments: {$slice: -5}}, function(err, item) { - test.equal(5, item.comments.length) - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should correctly execute find and findOne queries with selector set to null'] = function(test) { - client.createCollection('Should_correctly_execute_find_and_findOne_queries_in_the_same_way', function(err, collection) { - var doc = {_id : new ObjectID(), a:1, c:2, comments:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}; - // insert doc - collection.insert(doc, {safe:true}, function(err, result) { - - collection.find(null, {comments: {$slice: -5}}).toArray(function(err, docs) { - test.equal(5, docs[0].comments.length) - - collection.findOne(null, {comments: {$slice: -5}}, function(err, item) { - test.equal(5, item.comments.length) - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandlerErrorForFindAndModifyWhenNoRecordExists = function(test) { - client.createCollection('shouldCorrectlyHandlerErrorForFindAndModifyWhenNoRecordExists', function(err, collection) { - collection.findAndModify({'a':1}, [], {'$set':{'b':3}}, {'new': true}, function(err, updated_doc) { - test.equal(null, err); - test.equal(null, updated_doc); - test.done(); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteFindAndModifyShouldGenerateCorrectBSON = function(test) { - var transaction = {}; - transaction.document = {}; - transaction.document.type = "documentType"; - transaction.document.id = new ObjectID(); - transaction.transactionId = new ObjectID(); - transaction.amount = 12.3333 - - var transactions = []; - transactions.push(transaction); - // Wrapping object - var wrapingObject = { - funds : { - remaining : 100.5 - }, - - transactions:transactions - } - - client.createCollection('shouldCorrectlyExecuteFindAndModify', function(err, collection) { - collection.insert(wrapingObject, {safe:true}, function(err, doc) { - test.equal(null, err); - - collection.findOne({_id:doc[0]._id, 'funds.remaining': {$gte: 3.0}, 'transactions.id': {$ne: transaction.transactionId}}, function(err, item) { - test.ok(item != null) - - collection.findAndModify({_id:doc[0]._id, 'funds.remaining': {$gte: 3.0}, 'transactions.id': {$ne: transaction.transactionId}}, [], {$push: {transactions: transaction}}, {new: true, safe: true}, function(err, result) { - test.done(); - }); - }) - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteMultipleFindsInParallel = function(test) { - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize:10, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - p_client.open(function(err, p_client) { - p_client.createCollection('tasks', function(err, collection) { - var numberOfOperations = 0; - - // Test return old document on change - collection.insert({'a':2, 'b':2}, {safe:true}, function(err, doc) { - collection.find({"user_id":"4e9fc8d55883d90100000003","lc_status":{"$ne":"deleted"},"owner_rating":{"$exists":false}}, - {"skip":0,"limit":10,"sort":{"updated":-1}}, function(err, cursor) { - cursor.count(function(err, count) { - numberOfOperations = numberOfOperations + 1; - if(numberOfOperations == 2) { - test.done(); - p_client.close(); - } - }) - }); - - collection.find({"user_id":"4e9fc8d55883d90100000003","lc_status":{"$ne":"deleted"},"owner_rating":{"$exists":false}}, - {"skip":0,"limit":10,"sort":{"updated":-1}}, function(err, cursor) { - cursor.count(function(err, count) { - numberOfOperations = numberOfOperations + 1; - if(numberOfOperations == 2) { - test.done(); - p_client.close(); - } - }) - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReturnErrorFromMongodbOnFindAndModifyForcedError = function(test) { - client.createCollection('shouldCorrectlyReturnErrorFromMongodbOnFindAndModifyForcedError', function(err, collection) { - var q = { x: 1 }; - var set = { y:2, _id: new ObjectID() }; - var opts = { new: true, upsert: true }; - // Original doc - var doc = {_id: new ObjectID(), x:1}; - - // Insert original doc - collection.insert(doc, {safe:true}, function(err, result) { - collection.findAndModify(q, [], set, opts, function (err, res) { - test.ok(err != null); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteFindAndModifyUnderConcurrentLoad = function(test) { - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize:10, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - var running = true; - - p_client.open(function(err, p_client) { - // Create a collection - p_client.collection("collection1", function(err, collection) { - // Wait a bit and then execute something that will throw a duplicate error - setTimeout(function() { - var id = new ObjectID(); - - collection.insert({_id:id, a:1}, {safe:true}, function(err, result) { - test.equal(null, err); - - collection.insert({_id:id, a:1}, {safe:true}, function(err, result) { - running = false; - test.done(); - p_client.close(); - }); - }); - }, 200); - }); - - p_client.collection("collection2", function(err, collection) { - // Keep hammering in inserts - var insert = function() { - process.nextTick(function() { - collection.insert({a:1}); - if(running) process.nextTick(insert); - }); - } - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyIterateOverCollection = function(test) { - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize:1, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - var numberOfSteps = 0; - - // Open db connection - p_client.open(function(err, p_client) { - // Create a collection - p_client.createCollection('shouldCorrectlyIterateOverCollection', function(err, collection) { - for(var i = 0; i < 1000; i++) { - collection.insert({a:1, b:2, c:{d:3, f:'sfdsffffffffffffffffffffffffffffff'}}); - } - - collection.find({}, {}, function(err,cursor) { - cursor.count(function(err,count) { - cursor.each(function(err, obj) { - if (obj == null) { - p_client.close(); - test.equal(1000, numberOfSteps); - test.done(); - } else { - numberOfSteps = numberOfSteps + 1; - } - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyErrorOutFindAndModifyOnDuplicateRecord = function(test) { - var p_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {strict:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - p_client.open(function(err, p_client) { - p_client.createCollection('shouldCorrectlyErrorOutFindAndModifyOnDuplicateRecord', function(err, collection) { - // Test return old document on change - collection.insert([{'login':'user1'}, {'login':'user2'}], {safe:true}, function(err, docs) { - var id = docs[1]._id; - // Set an index - collection.ensureIndex('login', {unique:true}, function(err, result) { - // Attemp to modify document - collection.findAndModify({_id: id}, [], { $set: {login: 'user1'} }, {}, function(err, user){ - test.ok(err != null); - p_client.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * An example of using find with a very large in parameter - * - * @ignore - */ -exports.shouldPerformSimpleFindInArray = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_find_in_array', function(err, collection) { - test.equal(null, err); - - var docs = []; - for(var i = 0; i < 100; i++) docs.push({a:i}); - - // Insert some test documentations - collection.insert(docs, {safe:true}, function(err, result) { - test.equal(null, err); - - // Find all the variables in a specific array - var inArray = []; - for(var i = 0; i < 100; i++) docs.push(i); - - // Fin all in - collection.find({a:{$in:docs}}).toArray(function(err, items) { - test.equal(null, err); - test.equal(100, items.length); - - db.close(); - test.done(); - }); - }); - }); - }); -} - - -/** - * A whole set of different ways to use the findAndModify command. - * - * The first findAndModify command modifies a document and returns the modified document back. - * The second findAndModify command removes the document. - * The second findAndModify command upserts a document and returns the new document. - * @_class collection - * @_function findAndModify - */ -exports.shouldPerformSimpleFindAndModifyOperations = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_find_and_modify_operations_', function(err, collection) { - test.equal(null, err); - - // Insert some test documentations - collection.insert([{a:1}, {b:1}, {c:1}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Simple findAndModify command returning the new document - collection.findAndModify({a:1}, [['a', 1]], {$set:{b1:1}}, {new:true}, function(err, doc) { - test.equal(null, err); - test.equal(1, doc.a); - test.equal(1, doc.b1); - - // Simple findAndModify command returning the new document and - // removing it at the same time - collection.findAndModify({b:1}, [['b', 1]], - {$set:{b:2}}, {remove:true}, function(err, doc) { - - // Verify that the document is gone - collection.findOne({b:1}, function(err, item) { - test.equal(null, err); - test.equal(null, item); - - // Simple findAndModify command performing an upsert and returning the new document - // executing the command safely - collection.findAndModify({d:1}, [['b', 1]], - {d:1, f:1}, {new:true, upsert:true, safe:true}, function(err, doc) { - test.equal(null, err); - test.equal(1, doc.d); - test.equal(1, doc.f); - - db.close(); - test.done(); - }) - }); - }); - }); - }); - }); - }); -} - -/** - * An example of using findAndRemove - * - * @_class collection - * @_function findAndRemove - */ -exports.shouldPerformSimpleFindAndModifyOperations = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_find_and_modify_operations_', function(err, collection) { - test.equal(null, err); - - // Insert some test documentations - collection.insert([{a:1}, {b:1}, {c:1}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Simple findAndModify command returning the new document and - // removing it at the same time - collection.findAndRemove({b:1}, [['b', 1]], function(err, doc) { - test.equal(null, err); - test.equal(1, doc.b); - - // Verify that the document is gone - collection.findOne({b:1}, function(err, item) { - test.equal(null, err); - test.equal(null, item); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A simple query using the find method on the collection. - * - * @_class collection - * @_function find - */ -exports.shouldPeformASimpleQuery = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_query', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the testing - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Peform a simple find and return all the documents - collection.find().toArray(function(err, docs) { - test.equal(null, err); - test.equal(3, docs.length); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple query showing the explain for a query - * - * @_class collection - * @_function find - */ -exports.shouldPeformASimpleExplainQuery = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_explain_query', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the testing - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Peform a simple find and return all the documents - collection.find({}, {explain:true}).toArray(function(err, docs) { - test.equal(null, err); - test.equal(1, docs.length); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple query showing skip and limit - * - * @_class collection - * @_function find - */ -exports.shouldPeformASimpleLimitSkipQuery = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_limit_skip_query', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the testing - collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Peform a simple find and return all the documents - collection.find({}, {skip:1, limit:1, fields:{b:1}}).toArray(function(err, docs) { - test.equal(null, err); - test.equal(1, docs.length); - test.equal(null, docs[0].a); - test.equal(2, docs[0].b); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple query using findOne - * - * @_class collection - * @_function findOne - */ -exports.shouldPeformASimpleLimitSkipFindOneQuery = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_limit_skip_find_one_query', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the testing - collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Peform a simple find and return all the documents - collection.findOne({a:2}, {fields:{b:1}}, function(err, doc) { - test.equal(null, err); - test.equal(null, doc.a); - test.equal(2, doc.b); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple query using find and fields - */ -exports.shouldPeformASimpleLimitSkipFindWithFields = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_find_with_fields', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the testing - collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Peform a simple find and return all the documents - collection.find({a:2}, ['b']).toArray(function(err, docs) { - test.equal(null, err); - test.equal(1, docs.length); - test.equal(null, docs[0].a); - test.equal(2, docs[0].b); - - // Peform a simple find and return all the documents - collection.find({a:2}, {b:1}).toArray(function(err, docs) { - test.equal(null, err); - test.equal(1, docs.length); - test.equal(null, docs[0].a); - test.equal(2, docs[0].b); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A simple query using find and fields - */ -exports.shouldPeformASimpleLimitSkipFindWithFields2 = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a collection we want to drop later - db.createCollection('simple_find_with_fields_2', function(err, collection) { - test.equal(null, err); - - // Insert a bunch of documents for the testing - collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Peform a simple find and return all the documents - collection.find({a:2}, {fields: ['b']}).toArray(function(err, docs) { - test.equal(null, err); - test.equal(1, docs.length); - test.equal(null, docs[0].a); - test.equal(2, docs[0].b); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/geo_search_test.js b/test/geo_search_test.js deleted file mode 100644 index fa8ba83036f..00000000000 --- a/test/geo_search_test.js +++ /dev/null @@ -1,145 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - Long = require('../lib/mongodb/bson/long').Long, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * Example of a simple geoNear query across some documents - * - * @_class collection - * @_function geoNear - * @ignore - */ -exports.shouldCorrectlyPerformSimpleGeoNearCommand = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch the collection - db.collection("simple_geo_near_command", function(err, collection) { - - // Add a location based index - collection.ensureIndex({loc:"2d"}, function(err, result) { - - // Save a new location tagged document - collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {safe:true}, function(err, result) { - - // Use geoNear command to find document - collection.geoNear(50, 50, {query:{a:1}, num:1}, function(err, docs) { - test.equal(1, docs.results.length); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * Example of a simple geoHaystackSearch query across some documents - * - * @_class collection - * @_function geoHaystackSearch - * @ignore - */ -exports.shouldCorrectlyPerformSimpleGeoHaystackSearchCommand = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch the collection - db.collection("simple_geo_haystack_command", function(err, collection) { - - // Add a location based index - collection.ensureIndex({loc: "geoHaystack", type: 1}, {bucketSize: 1}, function(err, result) { - - // Save a new location tagged document - collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {safe:true}, function(err, result) { - - // Use geoNear command to find document - collection.geoHaystackSearch(50, 50, {search:{a:1}, limit:1, maxDistance:100}, function(err, docs) { - test.equal(1, docs.results.length); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/gridstore/grid_store_file_test.js b/test/gridstore/grid_store_file_test.js deleted file mode 100644 index 7ff564c7de1..00000000000 --- a/test/gridstore/grid_store_file_test.js +++ /dev/null @@ -1,947 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - ObjectID = require('../../lib/mongodb/bson/objectid').ObjectID, - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - GridStore = mongodb.GridStore, - Chunk = mongodb.Chunk, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4}), {native_parser: (process.env['TEST_NATIVE'] != null)}); -var useSSL = process.env['USE_SSL'] != null ? true : false; -var native_parser = (process.env['TEST_NATIVE'] != null); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyFailDueToMissingChunks = function(test) { - var FILE = "empty.test.file"; - client.collection('fs.files', function(err, collection) { - collection.insert({filename: FILE, - "contentType" : "application/json; charset=UTF-8", - "length" : 91, - "chunkSize" : 262144, - "aliases" : null, - "metadata" : {}, - "md5" : "4e638392b289870da9291a242e474930"}, - {safe:true}, function(err, result) { - new mongodb.GridStore(client, FILE, "r").open(function (err, gs) { - gs.read(function(err, data) { - test.ok(err != null); - gs.close(function (){}); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyWriteASmallPayload = function(test) { - var gridStore = new GridStore(client, "test_gs_small_write", "w"); - gridStore.open(function(err, gridStore) { - - gridStore.write("hello world!", function(err, gridStore) { - - gridStore.close(function(err, result) { - - client.collection('fs.files', function(err, collection) { - - collection.find({'filename':'test_gs_small_write'}, function(err, cursor) { - - cursor.toArray(function(err, items) { - test.equal(1, items.length); - var item = items[0]; - test.ok(item._id instanceof ObjectID || Object.prototype.toString.call(item._id) === '[object ObjectID]'); - - client.collection('fs.chunks', function(err, collection) { - var id = ObjectID.createFromHexString(item._id.toHexString()); - - collection.find({'files_id':id}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(1, items.length); - test.done(); - }) - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyWriteSmallFileUsingABuffer = function(test) { - var gridStore = new GridStore(client, "test_gs_small_write_with_buffer", "w"); - gridStore.open(function(err, gridStore) { - var data = new Buffer("hello world", "utf8"); - - gridStore.write(data, function(err, gridStore) { - gridStore.close(function(err, result) { - client.collection('fs.files', function(err, collection) { - collection.find({'filename':'test_gs_small_write_with_buffer'}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(1, items.length); - var item = items[0]; - test.ok(item._id instanceof ObjectID || Object.prototype.toString.call(item._id) === '[object ObjectID]'); - - client.collection('fs.chunks', function(err, collection) { - collection.find({'files_id':item._id}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(1, items.length); - test.done(); - }) - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldSaveSmallFileToGridStore = function(test) { - var gridStore = new GridStore(client, "test_gs_small_file", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello world!", function(err, gridStore) { - gridStore.close(function(err, result) { - client.collection('fs.files', function(err, collection) { - - collection.find({'filename':'test_gs_small_file'}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(1, items.length); - - // Read test of the file - GridStore.read(client, 'test_gs_small_file', function(err, data) { - test.equal('hello world!', data); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyOverwriteFile = function(test) { - var gridStore = new GridStore(client, "test_gs_overwrite", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello world!", function(err, gridStore) { - gridStore.close(function(err, result) { - var gridStore2 = new GridStore(client, "test_gs_overwrite", "w"); - gridStore2.open(function(err, gridStore) { - gridStore2.write("overwrite", function(err, gridStore) { - gridStore2.close(function(err, result) { - - // Assert that we have overwriten the data - GridStore.read(client, 'test_gs_overwrite', function(err, data) { - test.equal('overwrite', data); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the usage of the seek method. - * - * @_class gridstore - * @_function seek - * @ignore - */ -exports.shouldCorrectlySeekWithBuffer = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Create a file and open it - var gridStore = new GridStore(db, "test_gs_seek_with_buffer", "w"); - gridStore.open(function(err, gridStore) { - // Write some content to the file - gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) { - // Flush the file to GridFS - gridStore.close(function(result) { - - // Open the file in read mode - var gridStore2 = new GridStore(db, "test_gs_seek_with_buffer", "r"); - gridStore2.open(function(err, gridStore) { - // Seek to start - gridStore.seek(0, function(err, gridStore) { - // Read first character and verify - gridStore.getc(function(err, chr) { - test.equal('h', chr); - }); - }); - }); - - // Open the file in read mode - var gridStore3 = new GridStore(db, "test_gs_seek_with_buffer", "r"); - gridStore3.open(function(err, gridStore) { - // Seek to 7 characters from the beginning off the file and verify - gridStore.seek(7, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('w', chr); - }); - }); - }); - - // Open the file in read mode - var gridStore5 = new GridStore(db, "test_gs_seek_with_buffer", "r"); - gridStore5.open(function(err, gridStore) { - // Seek to -1 characters from the end off the file and verify - gridStore.seek(-1, GridStore.IO_SEEK_END, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('!', chr); - }); - }); - }); - - // Open the file in read mode - var gridStore6 = new GridStore(db, "test_gs_seek_with_buffer", "r"); - gridStore6.open(function(err, gridStore) { - // Seek to -6 characters from the end off the file and verify - gridStore.seek(-6, GridStore.IO_SEEK_END, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('w', chr); - }); - }); - }); - - // Open the file in read mode - var gridStore7 = new GridStore(db, "test_gs_seek_with_buffer", "r"); - gridStore7.open(function(err, gridStore) { - - // Seek forward 7 characters from the current read position and verify - gridStore.seek(7, GridStore.IO_SEEK_CUR, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('w', chr); - - // Seek forward -1 characters from the current read position and verify - gridStore.seek(-1, GridStore.IO_SEEK_CUR, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('w', chr); - - // Seek forward -4 characters from the current read position and verify - gridStore.seek(-4, GridStore.IO_SEEK_CUR, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('o', chr); - - // Seek forward 3 characters from the current read position and verify - gridStore.seek(3, GridStore.IO_SEEK_CUR, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('o', chr); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySeekWithString = function(test) { - var gridStore = new GridStore(client, "test_gs_seek", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello, world!", function(err, gridStore) { - gridStore.close(function(result) { - var gridStore2 = new GridStore(client, "test_gs_seek", "r"); - gridStore2.open(function(err, gridStore) { - gridStore.seek(0, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('h', chr); - }); - }); - }); - - var gridStore3 = new GridStore(client, "test_gs_seek", "r"); - gridStore3.open(function(err, gridStore) { - gridStore.seek(7, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('w', chr); - }); - }); - }); - - var gridStore4 = new GridStore(client, "test_gs_seek", "r"); - gridStore4.open(function(err, gridStore) { - gridStore.seek(4, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('o', chr); - }); - }); - }); - - var gridStore5 = new GridStore(client, "test_gs_seek", "r"); - gridStore5.open(function(err, gridStore) { - gridStore.seek(-1, GridStore.IO_SEEK_END, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('!', chr); - }); - }); - }); - - var gridStore6 = new GridStore(client, "test_gs_seek", "r"); - gridStore6.open(function(err, gridStore) { - gridStore.seek(-6, GridStore.IO_SEEK_END, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('w', chr); - }); - }); - }); - - var gridStore7 = new GridStore(client, "test_gs_seek", "r"); - gridStore7.open(function(err, gridStore) { - gridStore.seek(7, GridStore.IO_SEEK_CUR, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('w', chr); - - gridStore.seek(-1, GridStore.IO_SEEK_CUR, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('w', chr); - - gridStore.seek(-4, GridStore.IO_SEEK_CUR, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('o', chr); - - gridStore.seek(3, GridStore.IO_SEEK_CUR, function(err, gridStore) { - gridStore.getc(function(err, chr) { - test.equal('o', chr); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyAppendToFile = function(test) { - var fs_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - fs_client.open(function(err, fs_client) { - fs_client.dropDatabase(function(err, done) { - var gridStore = new GridStore(fs_client, "test_gs_append", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello, world!", function(err, gridStore) { - gridStore.close(function(err, result) { - - var gridStore2 = new GridStore(fs_client, "test_gs_append", "w+"); - gridStore2.open(function(err, gridStore) { - gridStore.write(" how are you?", function(err, gridStore) { - gridStore.close(function(err, result) { - - fs_client.collection('fs.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(1, count); - - GridStore.read(fs_client, 'test_gs_append', function(err, data) { - test.equal("hello, world! how are you?", data); - - fs_client.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing how to rewind and overwrite the file. - * - * @_class gridstore - * @_function rewind - * @ignore - */ -exports.shouldCorrectlyRewingAndTruncateOnWrite = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Create a new file - var gridStore = new GridStore(db, fileId, "w"); - // Open the file - gridStore.open(function(err, gridStore) { - // Write to the file - gridStore.write("hello, world!", function(err, gridStore) { - // Flush the file to disk - gridStore.close(function(err, result) { - - // Reopen the file - gridStore = new GridStore(db, fileId, "w"); - gridStore.open(function(err, gridStore) { - // Write some more text to the file - gridStore.write('some text is inserted here', function(err, gridStore) { - - // Let's rewind to truncate the file - gridStore.rewind(function(err, gridStore) { - - // Write something from the start - gridStore.write('abc', function(err, gridStore) { - - // Flush the data to mongodb - gridStore.close(function(err, result) { - - // Verify that the new data was written - GridStore.read(db, fileId, function(err, data) { - test.equal("abc", data); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySaveEmptyFile = function(test) { - var fs_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - fs_client.open(function(err, fs_client) { - fs_client.dropDatabase(function(err, done) { - var gridStore = new GridStore(fs_client, "test_gs_save_empty_file", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("", function(err, gridStore) { - gridStore.close(function(err, result) { - fs_client.collection('fs.files', function(err, collection) { - collection.count(function(err, count) { - test.equal(1, count); - }); - }); - - fs_client.collection('fs.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - - fs_client.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the usage of the eof method. - * - * @_class gridstore - * @_function eof - * @ignore - */ -exports.shouldCorrectlyDetectEOF = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Open the file in write mode - var gridStore = new GridStore(db, 'test_gs_empty_file_eof', "w"); - gridStore.open(function(err, gridStore) { - // Flush the empty file to GridFS - gridStore.close(function(err, gridStore) { - - // Open the file in read mode - var gridStore2 = new GridStore(db, 'test_gs_empty_file_eof', "r"); - gridStore2.open(function(err, gridStore) { - // Verify that we are at the end of the file - test.equal(true, gridStore.eof()); - - db.close(); - test.done(); - }) - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldEnsureThatChunkSizeCannotBeChangedDuringRead = function(test) { - var gridStore = new GridStore(client, "test_gs_cannot_change_chunk_size_on_read", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello, world!", function(err, gridStore) { - gridStore.close(function(err, result) { - - var gridStore2 = new GridStore(client, "test_gs_cannot_change_chunk_size_on_read", "r"); - gridStore2.open(function(err, gridStore) { - gridStore.chunkSize = 42; - test.equal(Chunk.DEFAULT_CHUNK_SIZE, gridStore.chunkSize); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldEnsureChunkSizeCannotChangeAfterDataHasBeenWritten = function(test) { - var gridStore = new GridStore(client, "test_gs_cannot_change_chunk_size_after_data_written", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello, world!", function(err, gridStore) { - gridStore.chunkSize = 42; - test.equal(Chunk.DEFAULT_CHUNK_SIZE, gridStore.chunkSize); - test.done(); - }); - }); -} - -/** - * checks if 8 bit values will be preserved in gridstore - * - * @ignore - */ -exports.shouldCorrectlyStore8bitValues = function(test) { - var gridStore = new GridStore(client, "test_gs_check_high_bits", "w"); - var data = new Buffer(255); - for(var i=0; i<255; i++){ - data[i] = i; - } - - gridStore.open(function(err, gridStore) { - gridStore.write(data, function(err, gridStore) { - gridStore.close(function(err, result) { - // Assert that we have overwriten the data - GridStore.read(client, 'test_gs_check_high_bits', function(err, fileData) { - // change testvalue into a string like "0,1,2,...,255" - test.equal(Array.prototype.join.call(data), - Array.prototype.join.call(new Buffer(fileData, "binary"))); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldAllowChangingChunkSize = function(test) { - var gridStore = new GridStore(client, "test_change_chunk_size", "w"); - gridStore.open(function(err, gridStore) { - gridStore.chunkSize = 42 - - gridStore.write('foo', function(err, gridStore) { - gridStore.close(function(err, result) { - var gridStore2 = new GridStore(client, "test_change_chunk_size", "r"); - gridStore2.open(function(err, gridStore) { - test.equal(42, gridStore.chunkSize); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldAllowChangingChunkSizeAtCreationOfGridStore = function(test) { - var gridStore = new GridStore(client, "test_change_chunk_size", "w", {'chunk_size':42}); - gridStore.open(function(err, gridStore) { - gridStore.write('foo', function(err, gridStore) { - gridStore.close(function(err, result) { - var gridStore2 = new GridStore(client, "test_change_chunk_size", "r"); - gridStore2.open(function(err, gridStore) { - test.equal(42, gridStore.chunkSize); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyCalculateMD5 = function(test) { - var gridStore = new GridStore(client, "new-file", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write('hello world\n', function(err, gridStore) { - gridStore.close(function(err, result) { - var gridStore2 = new GridStore(client, "new-file", "r"); - gridStore2.open(function(err, gridStore) { - test.equal("6f5902ac237024bdd0c176cb93063dc4", gridStore.md5); - gridStore.md5 = "can't do this"; - test.equal("6f5902ac237024bdd0c176cb93063dc4", gridStore.md5); - - var gridStore2 = new GridStore(client, "new-file", "w"); - gridStore2.open(function(err, gridStore) { - gridStore.close(function(err, result) { - var gridStore3 = new GridStore(client, "new-file", "r"); - gridStore3.open(function(err, gridStore) { - test.equal("d41d8cd98f00b204e9800998ecf8427e", gridStore.md5); - test.done(); - }); - }) - }) - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyUpdateUploadDate = function(test) { - var now = new Date(); - var originalFileUploadDate = null; - - var gridStore = new GridStore(client, "test_gs_upload_date", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write('hello world\n', function(err, gridStore) { - gridStore.close(function(err, result) { - - var gridStore2 = new GridStore(client, "test_gs_upload_date", "r"); - gridStore2.open(function(err, gridStore) { - test.ok(gridStore.uploadDate != null); - originalFileUploadDate = gridStore.uploadDate; - - gridStore2.close(function(err, result) { - var gridStore3 = new GridStore(client, "test_gs_upload_date", "w"); - gridStore3.open(function(err, gridStore) { - gridStore3.write('new data', function(err, gridStore) { - gridStore3.close(function(err, result) { - var fileUploadDate = null; - - var gridStore4 = new GridStore(client, "test_gs_upload_date", "r"); - gridStore4.open(function(err, gridStore) { - test.equal(originalFileUploadDate.getTime(), gridStore.uploadDate.getTime()); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySaveContentType = function(test) { - var ct = null; - - var gridStore = new GridStore(client, "test_gs_content_type", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write('hello world\n', function(err, gridStore) { - gridStore.close(function(err, result) { - - var gridStore2 = new GridStore(client, "test_gs_content_type", "r"); - gridStore2.open(function(err, gridStore) { - ct = gridStore.contentType; - test.equal(GridStore.DEFAULT_CONTENT_TYPE, ct); - - var gridStore3 = new GridStore(client, "test_gs_content_type", "w+"); - gridStore3.open(function(err, gridStore) { - gridStore.contentType = "text/html"; - gridStore.close(function(err, result) { - var gridStore4 = new GridStore(client, "test_gs_content_type", "r"); - gridStore4.open(function(err, gridStore) { - test.equal("text/html", gridStore.contentType); - test.done(); - }); - }) - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySaveContentTypeWhenPassedInAtGridStoreCreation = function(test) { - var gridStore = new GridStore(client, "test_gs_content_type_option", "w", {'content_type':'image/jpg'}); - gridStore.open(function(err, gridStore) { - gridStore.write('hello world\n', function(err, gridStore) { - gridStore.close(function(result) { - - var gridStore2 = new GridStore(client, "test_gs_content_type_option", "r"); - gridStore2.open(function(err, gridStore) { - test.equal('image/jpg', gridStore.contentType); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReportIllegalMode = function(test) { - var gridStore = new GridStore(client, "test_gs_unknown_mode", "x"); - gridStore.open(function(err, gridStore) { - test.ok(err instanceof Error); - test.equal("Illegal mode x", err.message); - test.done(); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySaveAndRetrieveFileMetadata = function(test) { - var gridStore = new GridStore(client, "test_gs_metadata", "w", {'content_type':'image/jpg'}); - gridStore.open(function(err, gridStore) { - gridStore.write('hello world\n', function(err, gridStore) { - gridStore.close(function(err, result) { - - var gridStore2 = new GridStore(client, "test_gs_metadata", "r"); - gridStore2.open(function(err, gridStore) { - test.equal(null, gridStore.metadata); - - var gridStore3 = new GridStore(client, "test_gs_metadata", "w+"); - gridStore3.open(function(err, gridStore) { - gridStore.metadata = {'a':1}; - gridStore.close(function(err, result) { - - var gridStore4 = new GridStore(client, "test_gs_metadata", "r"); - gridStore4.open(function(err, gridStore) { - test.equal(1, gridStore.metadata.a); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldNotThrowErrorOnClose = function(test) { - var gridStore = new GridStore(client, "test_gs_metadata", "w", {'content_type':'image/jpg'}); - gridStore.open(function(err, gridStore) { - gridStore.write('hello world\n', function(err, gridStore) { - gridStore.close(function(err, result) { - - var gridStore2 = new GridStore(client, "test_gs_metadata", "r"); - gridStore2.open(function(err, gridStore) { - gridStore.close(function(err, fo) { - test.ok(err == null); - test.ok(fo == null); - test.done(); - }) - }); - }); - }); - }); -} - -/** - * A simple example showing the usage of the tell method. - * - * @_class gridstore - * @_function tell - * @ignore - */ -exports.shouldCorrectlyExecuteGridstoreTell = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Create a new file - var gridStore = new GridStore(db, "test_gs_tell", "w"); - // Open the file - gridStore.open(function(err, gridStore) { - // Write a string to the file - gridStore.write("hello, world!", function(err, gridStore) { - // Flush the file to GridFS - gridStore.close(function(err, result) { - - // Open the file in read only mode - var gridStore2 = new GridStore(db, "test_gs_tell", "r"); - gridStore2.open(function(err, gridStore) { - - // Read the first 5 characters - gridStore.read(5, function(err, data) { - test.equal("hello", data); - - // Get the current position of the read head - gridStore.tell(function(err, position) { - test.equal(5, position); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the usage of the seek method. - * - * @_class gridstore - * @_function getc - * @ignore - */ -exports.shouldCorrectlyRetrieveSingleCharacterUsingGetC = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Create a file and open it - var gridStore = new GridStore(db, "test_gs_getc_file", "w"); - gridStore.open(function(err, gridStore) { - // Write some content to the file - gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) { - // Flush the file to GridFS - gridStore.close(function(result) { - - // Open the file in read mode - var gridStore2 = new GridStore(db, "test_gs_getc_file", "r"); - gridStore2.open(function(err, gridStore) { - - // Read first character and verify - gridStore.getc(function(err, chr) { - test.equal('h', chr); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/gridstore/grid_store_stream_test.js b/test/gridstore/grid_store_stream_test.js deleted file mode 100644 index 8214a66793e..00000000000 --- a/test/gridstore/grid_store_stream_test.js +++ /dev/null @@ -1,310 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - fs = require('fs'), - ObjectID = require('../../lib/mongodb/bson/objectid').ObjectID, - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - GridStore = mongodb.GridStore, - Chunk = mongodb.Chunk, - Step = require("step"), - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4}), {native_parser: (process.env['TEST_NATIVE'] != null)}); -var useSSL = process.env['USE_SSL'] != null ? true : false; -var native_parser = (process.env['TEST_NATIVE'] != null); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyWriteLargeFileStringAndReadBack = function(test) { - var db = client; - var fileId = new ObjectID(); - var gridStore = new GridStore(db, fileId, "w", {root:'fs'}); - gridStore.chunkSize = 5000; - - gridStore.open(function(err, gridStore) { - Step( - function writeData() { - var group = this.group(); - var d = ''; - for(var j = 0; j < 5000;j++) { - d = d + '+'; - } - - for(var i = 0; i < 15000; i += 5000) { - gridStore.write(d, false, group()); - } - }, - - function readAsStream() { - gridStore.close(function(err, result) { - var gotEnd = false; - var endLen = 0; - - var gridStore = new GridStore(db, fileId, "r"); - gridStore.open(function(err, gridStore) { - var stream = gridStore.stream(true); - - stream.on("data", function(chunk) { - endLen += chunk.length - // Test length of chunk - test.equal(5000, chunk.length); - // Check each chunk's data - for(var i = 0; i < 5000; i++) test.equal('+', String.fromCharCode(chunk[i])); - }); - - stream.on("end", function() { - gotEnd = true; - }); - - stream.on("close", function() { - test.equal(15000, endLen); - test.equal(true, gotEnd); - test.done(); - }); - }); - }); - } - ) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyWriteLargeFileBufferAndReadBack = function(test) { - var db = client; - var fileId = new ObjectID(); - var gridStore = new GridStore(db, fileId, "w", {root:'fs'}); - gridStore.chunkSize = 5000; - - gridStore.open(function(err, gridStore) { - Step( - function writeData() { - var group = this.group(); - var d = new Buffer(5000); - for(var j = 0; j < 5000;j++) { - d[j] = 43; - } - - for(var i = 0; i < 15000; i += 5000) { - gridStore.write(d, false, group()); - } - }, - - function readAsStream() { - gridStore.close(function(err, result) { - var gotEnd = false; - var endLen = 0; - - var gridStore = new GridStore(db, fileId, "r"); - gridStore.open(function(err, gridStore) { - var stream = gridStore.stream(true); - - stream.on("data", function(chunk) { - endLen += chunk.length - // Test length of chunk - test.equal(5000, chunk.length); - // Check each chunk's data - for(var i = 0; i < 5000; i++) test.equal('+', String.fromCharCode(chunk[i])); - }); - - stream.on("end", function() { - gotEnd = true; - }); - - stream.on("close", function() { - test.equal(15000, endLen); - test.equal(true, gotEnd); - test.done(); - }); - }); - }); - } - ) - }); -} - -/** - * A simple example showing the usage of the stream method. - * - * @_class gridstore - * @_function stream - * @ignore - */ -exports.shouldCorrectlyReadFileUsingStream = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Open a file for reading - var gridStoreR = new GridStore(db, "test_gs_read_stream", "r"); - // Open a file for writing - var gridStoreW = new GridStore(db, "test_gs_read_stream", "w"); - // Read in the data of a file - var data = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png"); - - var readLen = 0; - var gotEnd = 0; - - // Open the file we are writting to - gridStoreW.open(function(err, gs) { - // Write the file content - gs.write(data, function(err, gs) { - // Flush the file to GridFS - gs.close(function(err, result) { - - // Open the read file - gridStoreR.open(function(err, gs) { - - // Create a stream to the file - var stream = gs.stream(true); - - // Register events - stream.on("data", function(chunk) { - // Record the length of the file - readLen += chunk.length; - }); - - stream.on("end", function() { - // Record the end was called - ++gotEnd; - }); - - stream.on("close", function() { - // Verify the correctness of the read data - test.equal(data.length, readLen); - test.equal(1, gotEnd); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should return same data for streaming as for direct read'] = function(test) { - var gridStoreR = new GridStore(client, "test_gs_read_stream", "r"); - var gridStoreW = new GridStore(client, "test_gs_read_stream", "w", {chunkSize:56}); - // var data = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png"); - var data = new Buffer(100); - for(var i = 0; i < 100; i++) { - data[i] = i; - } - - var readLen = 0; - var gotEnd = 0; - - gridStoreW.open(function(err, gs) { - gs.write(data, function(err, gs) { - gs.close(function(err, result) { - gridStoreR.open(function(err, gs) { - var chunks = []; - - var stream = gs.stream(true); - stream.on("data", function(chunk) { - readLen += chunk.length; - chunks.push(chunk); - }); - stream.on("end", function() { - ++gotEnd; - }); - stream.on("close", function() { - test.equal(data.length, readLen); - test.equal(1, gotEnd); - - // Read entire file in one go and compare - var gridStoreRead = new GridStore(client, "test_gs_read_stream", "r"); - gridStoreRead.open(function(err, gs) { - gridStoreRead.read(function(err, data2) { - // Put together all the chunks - var streamData = new Buffer(data.length); - var index = 0; - for(var i = 0; i < chunks.length; i++) { - chunks[i].copy(streamData, index, 0); - index = index + chunks[i].length; - } - - // Compare data - for(var i = 0; i < data.length; i++) { - test.equal(data2[i], data[i]) - test.equal(streamData[i], data[i]) - } - - test.done(); - }) - }) - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/gridstore/grid_store_test.js b/test/gridstore/grid_store_test.js deleted file mode 100644 index 9d9082186ad..00000000000 --- a/test/gridstore/grid_store_test.js +++ /dev/null @@ -1,1351 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - fs = require('fs'), - ObjectID = require('../../lib/mongodb/bson/objectid').ObjectID, - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - GridStore = mongodb.GridStore, - Chunk = mongodb.Chunk, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -// var MONGODB = 'ruby-test-db'; -var client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4}), {native_parser: (process.env['TEST_NATIVE'] != null)}); -var useSSL = process.env['USE_SSL'] != null ? true : false; -var native_parser = (process.env['TEST_NATIVE'] != null); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * A simple example showing the usage of the Gridstore.exist method. - * - * @_class gridstore - * @_function GridStore.exist - * @ignore - */ -exports.shouldCorrectlyExecuteGridStoreExistsByObjectId = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Open a file for writing - var gridStore = new GridStore(db, null, "w"); - gridStore.open(function(err, gridStore) { - - // Writing some content to the file - gridStore.write("hello world!", function(err, gridStore) { - - // Flush the file to GridFS - gridStore.close(function(err, result) { - - // Check if the file exists using the id returned from the close function - GridStore.exist(db, result._id, function(err, result) { - test.equal(true, result); - }) - - // Show that the file does not exist for a random ObjectID - GridStore.exist(db, new ObjectID(), function(err, result) { - test.equal(false, result); - }); - - // Show that the file does not exist for a different file root - GridStore.exist(db, result._id, 'another_root', function(err, result) { - test.equal(false, result); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySafeFileAndReadFileByObjectId = function(test) { - var gridStore = new GridStore(client, null, "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello world!", function(err, gridStore) { - gridStore.close(function(err, result) { - - // Let's read the file using object Id - GridStore.read(client, result._id, function(err, data) { - test.equal('hello world!', data); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteGridStoreExists = function(test) { - var gridStore = new GridStore(client, "foobar", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello world!", function(err, gridStore) { - gridStore.close(function(err, result) { - GridStore.exist(client, 'foobar', function(err, result) { - test.equal(true, result); - }); - - GridStore.exist(client, 'does_not_exist', function(err, result) { - test.equal(false, result); - }); - - GridStore.exist(client, 'foobar', 'another_root', function(err, result) { - test.equal(false, result); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing the usage of the eof method. - * - * @_class gridstore - * @_function GridStore.list - * @ignore - */ -exports.shouldCorrectlyExecuteGridStoreList = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Open a file for writing - var gridStore = new GridStore(db, "foobar2", "w"); - gridStore.open(function(err, gridStore) { - - // Write some content to the file - gridStore.write("hello world!", function(err, gridStore) { - // Flush to GridFS - gridStore.close(function(err, result) { - - // List the existing files - GridStore.list(db, function(err, items) { - var found = false; - items.forEach(function(filename) { - if(filename == 'foobar2') found = true; - }); - - test.ok(items.length >= 1); - test.ok(found); - }); - - // List the existing files but return only the file ids - GridStore.list(db, {id:true}, function(err, items) { - var found = false; - items.forEach(function(id) { - test.ok(typeof id == 'object'); - }); - - test.ok(items.length >= 1); - }); - - // List the existing files in a specific root collection - GridStore.list(db, 'fs', function(err, items) { - var found = false; - items.forEach(function(filename) { - if(filename == 'foobar2') found = true; - }); - - test.ok(items.length >= 1); - test.ok(found); - }); - - // List the existing files in a different root collection where the file is not located - GridStore.list(client, 'my_fs', function(err, items) { - var found = false; - items.forEach(function(filename) { - if(filename == 'foobar2') found = true; - }); - - test.ok(items.length >= 0); - test.ok(!found); - - // Write another file to GridFS - var gridStore2 = new GridStore(db, "foobar3", "w"); - gridStore2.open(function(err, gridStore) { - // Write the content - gridStore2.write('my file', function(err, gridStore) { - // Flush to GridFS - gridStore.close(function(err, result) { - - // List all the available files and verify that our files are there - GridStore.list(db, function(err, items) { - var found = false; - var found2 = false; - - items.forEach(function(filename) { - if(filename == 'foobar2') found = true; - if(filename == 'foobar3') found2 = true; - }); - - test.ok(items.length >= 2); - test.ok(found); - test.ok(found2); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPeformGridStoreReadLength = function(test) { - var gridStore = new GridStore(client, "test_gs_read_length", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello world!", function(err, gridStore) { - gridStore.close(function(err, result) { - // Assert that we have overwriten the data - GridStore.read(client, 'test_gs_read_length', 5, function(err, data) { - test.equal('hello', data); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReadFromFileWithOffset = function(test) { - var gridStore = new GridStore(client, "test_gs_read_with_offset", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello, world!", function(err, gridStore) { - gridStore.close(function(err, result) { - // Assert that we have overwriten the data - GridStore.read(client, 'test_gs_read_with_offset', 5, 7, function(err, data) { - test.equal('world', data); - }); - - GridStore.read(client, 'test_gs_read_with_offset', null, 7, function(err, data) { - test.equal('world!', data); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleMultipleChunkGridStore = function(test) { - var fs_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - fs_client.open(function(err, fs_client) { - fs_client.dropDatabase(function(err, done) { - var gridStore = new GridStore(fs_client, "test_gs_multi_chunk", "w"); - gridStore.open(function(err, gridStore) { - gridStore.chunkSize = 512; - var file1 = ''; var file2 = ''; var file3 = ''; - for(var i = 0; i < gridStore.chunkSize; i++) { file1 = file1 + 'x'; } - for(var i = 0; i < gridStore.chunkSize; i++) { file2 = file2 + 'y'; } - for(var i = 0; i < gridStore.chunkSize; i++) { file3 = file3 + 'z'; } - - gridStore.write(file1, function(err, gridStore) { - gridStore.write(file2, function(err, gridStore) { - gridStore.write(file3, function(err, gridStore) { - gridStore.close(function(err, result) { - fs_client.collection('fs.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(3, count); - - GridStore.read(fs_client, 'test_gs_multi_chunk', function(err, data) { - test.equal(512*3, data.length); - fs_client.close(); - - test.done(); - }); - }) - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the usage of the puts method. - * - * @_class gridstore - * @_function puts - * @ignore - */ -exports.shouldCorrectlyReadlinesAndPutLines = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Open a file for writing - var gridStore = new GridStore(db, "test_gs_puts_and_readlines", "w"); - gridStore.open(function(err, gridStore) { - - // Write a line to the file using the puts method - gridStore.puts("line one", function(err, gridStore) { - - // Flush the file to GridFS - gridStore.close(function(err, result) { - - // Read in the entire contents - GridStore.read(db, 'test_gs_puts_and_readlines', function(err, data) { - test.equal("line one\n", data.toString()); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleUnlinkingWeirdName = function(test) { - var fs_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - fs_client.open(function(err, fs_client) { - fs_client.dropDatabase(function(err, done) { - var gridStore = new GridStore(fs_client, "9476700.937375426_1271170118964-clipped.png", "w", {'root':'articles'}); - gridStore.open(function(err, gridStore) { - gridStore.write("hello, world!", function(err, gridStore) { - gridStore.close(function(err, result) { - fs_client.collection('articles.files', function(err, collection) { - collection.count(function(err, count) { - test.equal(1, count); - }) - }); - - fs_client.collection('articles.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(1, count); - - // Unlink the file - GridStore.unlink(fs_client, '9476700.937375426_1271170118964-clipped.png', {'root':'articles'}, function(err, gridStore) { - fs_client.collection('articles.files', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - }) - }); - - fs_client.collection('articles.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - - fs_client.close(); - test.done(); - }) - }); - }); - }) - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the usage of the GridStore.unlink method. - * - * @_class gridstore - * @_function GridStore.unlink - * @ignore - */ -exports.shouldCorrectlyUnlink = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Open a new file for writing - var gridStore = new GridStore(db, "test_gs_unlink", "w"); - gridStore.open(function(err, gridStore) { - - // Write some content - gridStore.write("hello, world!", function(err, gridStore) { - - // Flush file to GridFS - gridStore.close(function(err, result) { - - // Verify the existance of the fs.files document - db.collection('fs.files', function(err, collection) { - collection.count(function(err, count) { - test.equal(1, count); - }) - }); - - // Verify the existance of the fs.chunks chunk document - db.collection('fs.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(1, count); - - // Unlink the file (removing it) - GridStore.unlink(db, 'test_gs_unlink', function(err, gridStore) { - - // Verify that fs.files document is gone - db.collection('fs.files', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - }) - }); - - // Verify that fs.chunks chunk documents are gone - db.collection('fs.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - - db.close(); - test.done(); - }) - }); - }); - }) - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyUnlinkAnArrayOfFiles = function(test) { - var fs_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - fs_client.open(function(err, fs_client) { - fs_client.dropDatabase(function(err, done) { - var gridStore = new GridStore(fs_client, "test_gs_unlink_as_array", "w"); - gridStore.open(function(err, gridStore) { - gridStore.write("hello, world!", function(err, gridStore) { - gridStore.close(function(err, result) { - fs_client.collection('fs.files', function(err, collection) { - collection.count(function(err, count) { - test.equal(1, count); - }) - }); - - fs_client.collection('fs.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(1, count); - - // Unlink the file - GridStore.unlink(fs_client, ['test_gs_unlink_as_array'], function(err, gridStore) { - fs_client.collection('fs.files', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - }) - }); - - fs_client.collection('fs.chunks', function(err, collection) { - collection.count(function(err, count) { - test.equal(0, count); - fs_client.close(); - - test.done(); - }) - }); - }); - }) - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyWriteFileToGridStore= function(test) { - var gridStore = new GridStore(client, 'test_gs_writing_file', 'w'); - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); - - gridStore.open(function(err, gridStore) { - gridStore.writeFile('./test/gridstore/test_gs_weird_bug.png', function(err, doc) { - GridStore.read(client, 'test_gs_writing_file', function(err, fileData) { - test.equal(data.toString('hex'), fileData.toString('hex')); - test.equal(fileSize, fileData.length); - - // Ensure we have a md5 - var gridStore2 = new GridStore(client, 'test_gs_writing_file', 'r'); - gridStore2.open(function(err, gridStore2) { - test.ok(gridStore2.md5 != null) - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyWriteFileToGridStoreUsingObjectId= function(test) { - var gridStore = new GridStore(client, null, 'w'); - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); - - gridStore.open(function(err, gridStore) { - gridStore.writeFile('./test/gridstore/test_gs_weird_bug.png', function(err, doc) { - - GridStore.read(client, doc._id, function(err, fileData) { - test.equal(data.toString('hex'), fileData.toString('hex')); - test.equal(fileSize, fileData.length); - - // Ensure we have a md5 - var gridStore2 = new GridStore(client, doc._id, 'r'); - gridStore2.open(function(err, gridStore2) { - test.ok(gridStore2.md5 != null) - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformWorkingFiledRead = function(test) { - var gridStore = new GridStore(client, "test_gs_working_field_read", "w"); - var data = fs.readFileSync("./test/gridstore/test_gs_working_field_read.pdf", 'binary'); - - gridStore.open(function(err, gridStore) { - gridStore.write(data, function(err, gridStore) { - gridStore.close(function(err, result) { - // Assert that we have overwriten the data - GridStore.read(client, 'test_gs_working_field_read', function(err, fileData) { - test.equal(data.length, fileData.length); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReadAndWriteFile = function(test) { - var gridStore = new GridStore(client, "test_gs_weird_bug", "w"); - var data = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png", 'binary'); - - gridStore.open(function(err, gridStore) { - gridStore.write(data, function(err, gridStore) { - gridStore.close(function(err, result) { - // Assert that we have overwriten the data - GridStore.read(client, 'test_gs_weird_bug', function(err, fileData) { - test.equal(data.length, fileData.length); - test.done(); - }); - }); - }); - }); -} - - -/** - * A simple example showing the usage of the read method. - * - * @_class gridstore - * @_function read - * @ignore - */ -exports.shouldCorrectlyWriteAndReadJpgImage = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Read in the content of a file - var data = fs.readFileSync('./test/gridstore/iya_logo_final_bw.jpg'); - // Create a new file - var gs = new GridStore(db, "test", "w"); - // Open the file - gs.open(function(err, gs) { - // Write the file to GridFS - gs.write(data, function(err, gs) { - // Flush to the GridFS - gs.close(function(err, gs) { - - // Define the file we wish to read - var gs2 = new GridStore(db, "test", "r"); - // Open the file - gs2.open(function(err, gs) { - // Set the pointer of the read head to the start of the gridstored file - gs2.seek(0, function() { - // Read the entire file - gs2.read(function(err, data2) { - // Compare the file content against the orgiinal - test.equal(data.toString('hex'), data2.toString('hex')); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReadAndWriteBuffersMultipleChunks = function(test) { - var gridStore = new GridStore(client, null, 'w'); - // Force multiple chunks to be stored - gridStore.chunkSize = 5000; - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); - - gridStore.open(function(err, gridStore) { - - // Write the file using write - gridStore.write(data, function(err, doc) { - gridStore.close(function(err, doc) { - - // Read the file using readBuffer - new GridStore(client, doc._id, 'r').open(function(err, gridStore) { - gridStore.read(function(err, data2) { - test.equal(data.toString('base64'), data2.toString('base64')); - test.done(); - }) - }); - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReadAndWriteBuffersSingleChunks = function(test) { - var gridStore = new GridStore(client, null, 'w'); - // Force multiple chunks to be stored - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); - - gridStore.open(function(err, gridStore) { - - // Write the file using writeBuffer - gridStore.write(data, function(err, doc) { - gridStore.close(function(err, doc) { - - // Read the file using readBuffer - new GridStore(client, doc._id, 'r').open(function(err, gridStore) { - gridStore.read(function(err, data2) { - test.equal(data.toString('base64'), data2.toString('base64')); - test.done(); - }) - }); - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReadAndWriteBuffersUsingNormalWriteWithMultipleChunks = function(test) { - var gridStore = new GridStore(client, null, 'w'); - // Force multiple chunks to be stored - gridStore.chunkSize = 5000; - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); - - gridStore.open(function(err, gridStore) { - - // Write the buffer using the .write method that should use writeBuffer correctly - gridStore.write(data, function(err, doc) { - gridStore.close(function(err, doc) { - - // Read the file using readBuffer - new GridStore(client, doc._id, 'r').open(function(err, gridStore) { - gridStore.read(function(err, data2) { - test.equal(data.toString('base64'), data2.toString('base64')); - test.done(); - }) - }); - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyReadAndWriteBuffersSingleChunksAndVerifyExistance = function(test) { - var gridStore = new GridStore(client, null, 'w'); - // Force multiple chunks to be stored - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); - - gridStore.open(function(err, gridStore) { - - // Write the file using writeBuffer - gridStore.write(data, function(err, doc) { - gridStore.close(function(err, doc) { - - // Read the file using readBuffer - GridStore.exist(client, doc._id, function(err, result) { - test.equal(null, err); - test.equal(true, result); - - client.close(); - test.done(); - }); - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySaveDataByObjectID = function(test) { - var id = new ObjectID(); - var gridStore = new GridStore(client, id, 'w'); - - gridStore.open(function(err, gridStore) { - gridStore.write('bar', function(err, gridStore) { - gridStore.close(function(err, result) { - - GridStore.exist(client, id, function(err, result) { - test.equal(null, err); - test.equal(true, result); - - client.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCheckExistsByUsingRegexp = function(test) { - var gridStore = new GridStore(client, 'shouldCheckExistsByUsingRegexp.txt', 'w'); - - gridStore.open(function(err, gridStore) { - gridStore.write('bar', function(err, gridStore) { - gridStore.close(function(err, result) { - - GridStore.exist(client, /shouldCheck/, function(err, result) { - test.equal(null, err); - test.equal(true, result); - - client.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing opening a file using a filename, writing to it and saving it. - * - * @_class gridstore - * @_function open - * @ignore - */ -exports.shouldCorrectlySaveSimpleFileToGridStoreUsingFilename = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Create a new instance of the gridstore - var gridStore = new GridStore(db, 'ourexamplefiletowrite.txt', 'w'); - - // Open the file - gridStore.open(function(err, gridStore) { - - // Write some data to the file - gridStore.write('bar', function(err, gridStore) { - test.equal(null, err); - - // Close (Flushes the data to MongoDB) - gridStore.close(function(err, result) { - test.equal(null, err); - - // Verify that the file exists - GridStore.exist(db, 'ourexamplefiletowrite.txt', function(err, result) { - test.equal(null, err); - test.equal(true, result); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing opening a file using an ObjectID, writing to it and saving it. - * - * @_class gridstore - * @_function open - * @ignore - */ -exports.shouldCorrectlySaveSimpleFileToGridStoreUsingObjectID = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Create a new instance of the gridstore - var gridStore = new GridStore(db, fileId, 'w'); - - // Open the file - gridStore.open(function(err, gridStore) { - - // Write some data to the file - gridStore.write('bar', function(err, gridStore) { - test.equal(null, err); - - // Close (Flushes the data to MongoDB) - gridStore.close(function(err, result) { - test.equal(null, err); - - // Verify that the file exists - GridStore.exist(db, fileId, function(err, result) { - test.equal(null, err); - test.equal(true, result); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing how to write a file to Gridstore using file location path. - * - * @_class gridstore - * @_function writeFile - * @ignore - */ -exports.shouldCorrectlySaveSimpleFileToGridStoreUsingWriteFile = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Read the filesize of file on disk (provide your own) - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; - // Read the buffered data for comparision reasons - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Write the file to gridFS - gridStore.writeFile('./test/gridstore/test_gs_weird_bug.png', function(err, doc) { - - // Read back all the written content and verify the correctness - GridStore.read(db, fileId, function(err, fileData) { - test.equal(data.toString('hex'), fileData.toString('hex')) - test.equal(fileSize, fileData.length); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing how to write a file to Gridstore using a file handle. - * - * @_class gridstore - * @_function writeFile - * @ignore - */ -exports.shouldCorrectlySaveSimpleFileToGridStoreUsingWriteFileWithHandle = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Read the filesize of file on disk (provide your own) - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; - // Read the buffered data for comparision reasons - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); - - // Open a file handle for reading the file - var fd = fs.openSync('./test/gridstore/test_gs_weird_bug.png', 'r', 0666); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Write the file to gridFS using the file handle - gridStore.writeFile(fd, function(err, doc) { - - // Read back all the written content and verify the correctness - GridStore.read(db, fileId, function(err, fileData) { - test.equal(data.toString('hex'), fileData.toString('hex')); - test.equal(fileSize, fileData.length); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing how to use the write command with strings and Buffers. - * - * @_class gridstore - * @_function write - * @ignore - */ -exports.shouldCorrectlySaveSimpleFileToGridStoreUsingWriteWithStringsAndBuffers = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Write a text string - gridStore.write('Hello world', function(err, gridStore) { - - // Write a buffer - gridStore.write(new Buffer('Buffer Hello world'), function(err, gridStore) { - - // Close the - gridStore.close(function(err, result) { - - // Read back all the written content and verify the correctness - GridStore.read(db, fileId, function(err, fileData) { - test.equal('Hello worldBuffer Hello world', fileData.toString()); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing how to use the write command with strings and Buffers. - * - * @_class gridstore - * @_function close - * @ignore - */ -exports.shouldCorrectlySaveSimpleFileToGridStoreUsingClose = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Write a text string - gridStore.write('Hello world', function(err, gridStore) { - - // Close the - gridStore.close(function(err, result) { - test.equal(err, null); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * A simple example showing how to access the chunks collection object. - * - * @_class gridstore - * @_function chunkCollection - * @ignore - */ -exports.shouldCorrectlyAccessChunkCollection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Access the Chunk collection - gridStore.chunkCollection(function(err, collection) { - test.equal(err, null); - test.ok(collection instanceof Collection); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * A simple example showing how to use the instance level unlink command to delete a gridstore item. - * - * @_class gridstore - * @_function unlink - * @ignore - */ -exports.shouldCorrectlySaveSimpleFileToGridStoreUsingCloseAndThenUnlinkIt = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Write a text string - gridStore.write('Hello world', function(err, gridStore) { - - // Close the - gridStore.close(function(err, result) { - test.equal(err, null); - - // Open the file again and unlin it - new GridStore(db, fileId, 'r').open(function(err, gridStore) { - - // Unlink the file - gridStore.unlink(function(err, result) { - test.equal(null, err); - - // Verify that the file no longer exists - GridStore.exist(db, fileId, function(err, result) { - test.equal(null, err); - test.equal(false, result); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing how to access the files collection object. - * - * @_class gridstore - * @_function collection - * @ignore - */ -exports.shouldCorrectlyAccessFilesCollection = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Access the Chunk collection - gridStore.collection(function(err, collection) { - test.equal(err, null); - test.ok(collection instanceof Collection); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * A simple example showing reading back using readlines to split the text into lines by the seperator provided. - * - * @_class gridstore - * @_function GridStore.readlines - * @ignore - */ -exports.shouldCorrectlyPutACoupleOfLinesInGridStoreAndUseReadlines = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Write one line to gridStore - gridStore.puts("line one", function(err, gridStore) { - - // Write second line to gridStore - gridStore.puts("line two", function(err, gridStore) { - - // Write third line to gridStore - gridStore.puts("line three", function(err, gridStore) { - - // Flush file to disk - gridStore.close(function(err, result) { - - // Read back all the lines - GridStore.readlines(db, fileId, function(err, lines) { - test.deepEqual(["line one\n", "line two\n", "line three\n"], lines); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing reading back using readlines to split the text into lines by the seperator provided. - * - * @_class gridstore - * @_function readlines - * @ignore - */ -exports.shouldCorrectlyPutACoupleOfLinesInGridStoreAndUseInstanceReadlines = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Our file ID - var fileId = new ObjectID(); - - // Open a new file - var gridStore = new GridStore(db, fileId, 'w'); - - // Open the new file - gridStore.open(function(err, gridStore) { - - // Write one line to gridStore - gridStore.puts("line one", function(err, gridStore) { - - // Write second line to gridStore - gridStore.puts("line two", function(err, gridStore) { - - // Write third line to gridStore - gridStore.puts("line three", function(err, gridStore) { - - // Flush file to disk - gridStore.close(function(err, result) { - - // Open file for reading - gridStore = new GridStore(db, fileId, 'r'); - gridStore.open(function(err, gridStore) { - - // Read all the lines and verify correctness - gridStore.readlines(function(err, lines) { - test.deepEqual(["line one\n", "line two\n", "line three\n"], lines); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the usage of the read method. - * - * @_class gridstore - * @_function GridStore.read - * @ignore - */ -exports.shouldCorrectlyPutACoupleOfLinesInGridStoreRead = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Create a new file - var gridStore = new GridStore(db, null, "w"); - // Read in the content from a file, replace with your own - var data = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png"); - - // Open the file - gridStore.open(function(err, gridStore) { - // Write the binary file data to GridFS - gridStore.write(data, function(err, gridStore) { - // Flush the remaining data to GridFS - gridStore.close(function(err, result) { - - // Read in the whole file and check that it's the same content - GridStore.read(client, result._id, function(err, fileData) { - test.equal(data.length, fileData.length); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/gridstore/grid_test.js b/test/gridstore/grid_test.js deleted file mode 100644 index ec13722609d..00000000000 --- a/test/gridstore/grid_test.js +++ /dev/null @@ -1,189 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../../lib/mongodb').native() : require('../../lib/mongodb').pure(); - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - GridStore = mongodb.GridStore, - Grid = mongodb.Grid, - Chunk = mongodb.Chunk, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4}), {native_parser: (process.env['TEST_NATIVE'] != null)}); -var useSSL = process.env['USE_SSL'] != null ? true : false; -var native_parser = (process.env['TEST_NATIVE'] != null); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * A simple example showing the usage of the put method. - * - * @_class grid - * @_function put - * @ignore - */ -exports.shouldPutFileCorrectlyToGridUsingObjectId = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Create a new grid instance - var grid = new Grid(db, 'fs'); - // Some data to write - var originalData = new Buffer('Hello world'); - // Write data to grid - grid.put(originalData, {}, function(err, result) { - // Fetch the content - grid.get(result._id, function(err, data) { - test.deepEqual(originalData.toString('hex'), data.toString('hex')); - - db.close(); - test.done(); - }); - }); - }); -} - -/** - * A simple example showing the usage of the get method. - * - * @_class grid - * @_function get - * @ignore - */ -exports.shouldPutAndGetFileCorrectlyToGridUsingObjectId = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Create a new grid instance - var grid = new Grid(db, 'fs'); - // Some data to write - var originalData = new Buffer('Hello world'); - // Write data to grid - grid.put(originalData, {}, function(err, result) { - // Fetch the content - grid.get(result._id, function(err, data) { - test.deepEqual(originalData.toString('base64'), data.toString('base64')); - - // Should fail due to illegal objectID - grid.get('not an id', function(err, result) { - test.ok(err != null); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldFailToPutFileDueToDataObjectNotBeingBuffer = function(test) { - var grid = new Grid(client, 'fs'); - var originalData = 'Hello world'; - // Write data to grid - grid.put(originalData, {}, function(err, result) { - test.ok(err != null); - test.done(); - }) -} - -/** - * A simple example showing the usage of the delete method. - * - * @_class grid - * @_function delete - * @ignore - */ -exports.shouldCorrectlyWriteFileAndThenDeleteIt = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // Create a new grid instance - var grid = new Grid(client, 'fs'); - // Some data to write - var originalData = new Buffer('Hello world'); - // Write data to grid - grid.put(originalData, {}, function(err, result) { - - // Delete file - grid.delete(result._id, function(err, result2) { - test.equal(null, err); - test.equal(true, result2); - - // Fetch the content, showing that the file is gone - grid.get(result._id, function(err, data) { - test.ok(err != null); - test.equal(null, data); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/gridstore/iya_logo_final_bw.jpg b/test/gridstore/iya_logo_final_bw.jpg deleted file mode 100644 index 0f07b9e3a4c88c5bea3393e65c2d30b8bada9c71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 74008 zcmeFZ2UL^Y)-D=F1q&i#08v2&MFNN@O+ca|O?pW}j|NbRh*1!!QBlz#ARt9RqS6x} zf;6SX7LhI;K|uovO+XS5UI@uu_z_rBwfbI&+;j2o93d6ST=HOn)fIoDj_ z_wv8NwwyLJF@&vJ4THIZe=z|53 zhuwm$U9)ln_iF{$g8%E+tzElr{RSbS^+G}$gg0yiw++IZHf>t@FCro;Dk35wE-o&y z{U5hg>(;H?uzrJ>u&|i8=w?yzf4uO2_W}PkOjJmqVAZU^DpA;K(NzMXtN8C%Jp&UI zT(xoo4}Ra)tQAk)7}F}sZ3#hg2L z^-fYw`G;=SFHIxN`M}8J+={xMk$Ej+d(UfkQ}QZ5_Kq$n95r$93cB|w|7HE>F$kf3 z+R;0hm`Z-t&^Nva7QPzHaxKunx-~)q0={59q5^AHX1vxK%y=FCM%>}2#Xq;bY5OjF z5^jULJaa@&P5-8NyzRbcZY6I8ue7T(PDM!AB>?G2Zr`tAASLhakJ4mkzIb;)p<{@1 z>tR;uf1k1;`oAXqFX#Mkrp)hyZ4&rBO;H#U#&$1h9Is#cuw?XdhK>$y=fh|_rnM+F zUWCEu`E=AkDQ)`0QVU|*5j#H=HUbYUR9Tv-!wG4&Z1aYx}?J^uTSoH12)QH0xZnMh(-y*jI03Zt;V!UnH?z(W1@U zWPME}f*A!8P1?Kouq5@brj4(j-1l}wHGckj*C{=`z%ZJghd4Gy%)SQHTI|V(aiaOK zN5LbBlc9rWQoY)!N;H#`?ynS8o>|`wThPT*`98=@Nx|C3Z|M4A+R90*VbJEB9Q^1x8tM;Po zk}6S6wYf8wW5E;=8d~HPlMBv`L+<9o4iQvK*K*{O;@_0kWjLL=SY&qi%B|~zLWcce z6?E4t1zwn7acZ7t^7pmB9$isR{1p9Co+6Mk7-eO5dB;wa0I~AHlj6~}7KmTREP40} z&Jhzfy)}(0+d#)Zey1%p#HDr-GK)J^EPHpvOuQ<{>FR zI{Ta-WzBhPYW(@oB`*@F67#Xvu!p9q`#Qss-Fu_#=Wmt?UvU59xXr13E<14B&4py&??hb$F8^b|6)4+_`-!8H z{6n|-?B=x1$@xx&%$Li zoKNF!XWmG(r_6YFKF{f;bP`6bfd?T69gUXvlNPgyRlM6WoQUPQEJC{%A4ayP(EjNS zSv>H3`UP$?n~+>4b7aDLjFLTeX&E>A=Bj(b^*!P6S-J&Ji_%nG#+)>2PUWRB3wIj^ z97CV=^_2Is&~q1?Q5Rk-cn9$d`yX8}6Az~L7;0QC9#d!jayRCd=10jT5o@b(ElPcL z+b|!d7Nlq;g-tDudc1$`hG+cu@b%j+I3C@WGK}?iBWBr?kw$F+ghS)#MZMc@df8+b z%^e{+c885S$33-IeR&)iikg*A=EFud(^Ss(a~TI_rx4Y6+&DV_2~nYGi>@j3O+|@nIRX znIc4q-?Td)X3wieS%LsE@3#;5lod4eaRA-U&CMRuK1RQju>R)yqWIya2A7N?8xO~> zs!b@QAJjD6bbbA@;FC!{4E_~hN+@b>{&95=fk|x)!?vKU-W|-$9W$~fu8)v3yLpIf zuc(O6=UqUtC6+h)v5c1OXJsIXKt2pLgO-32`LLtHEIzDR=AcSaK=TpP(h{dU>Zxu; z?Z%cZuQ${yQpH-siZSg3&YeL>N!@bE?+YK+sa}qNc5u@8u>Cz5gvko>9D@SHKlgfGhZi zF7aVD1NY{?61vP#99qg;RqSCX0?mPcv3?Uk889d49_r~Zs=WMz@-gAPSQ*}q0_40b z2t3A+535ItESLGw7(T>WIc_7kjvY~1x;T!U+qyszqoeDW`@z=`(1>LX&LGd&{0bko z>L_x2BRt%lHt);JU$&>rwHhWJP!m3A^4QIi?4%;Ud&8@}dHFLq7##~jOp9ZV5!e?)QJg_81Ix3}!7h0WhG)@TZ-94{@#Y~J-l1{qjN%0pP-4r@pt{-Q zhh={IzSKKCUNRW;$ANFPwiWAEnR!IO4X{n2I1*(g|;p8EQ=P>Iq zowtq#(v4bic+5jae$PX06`nPy=2>fBMlCFGeRuw2c!TjbV?OMMSVEX2Wmc9m-&D?r zB@+@-6U$Q!O6RZ61cew!Up*jiX*>hee06+el#W#)wCsT)HHCJqiw?4cwr@r(?%-V( z;50TNA3DZFcs%n;(!S~4Juha~^TEpM_2?6ooW>qfD2hRw)z%B+!}9%3ElttJa{x8i zC8GxnuHsqPJa*0&Zmc^77H>HsqXRji*cnfsdZD`=tJn4UL|ws;KT8ruv6wy;c;a)y zM;bR>&x8*ve@3XUpksZ3gii82gCg0KMk(|Q=0~NGS2dltA2x=^8{a&#CLVRlZ#&a& z*9@kaFsn6~ik-Xoi8dxZ!fQ~q8$1OJ<`d_>gf-!A=*t|}-pkSzol-sy3-bu~pa&$J zU@JUKg>_7%fj~kg9r$!Z{mu)ox#q1<=la5nl^L706FrA_%2@?|#ba0o@5LM~)e9Sb zR+h(oe~e5r?xl!4xsO_01)!BP{8)tD%6=X+f-#6ibrtMz?4o}4{@IJz{_M7h6=loj z*8y%nR52|);B4s>ZUaa9=}~r9ALOP#Y>-`3im&%?>-p}LlZYLX%{va8pCD$X3UY@l zM#OIi?RuYaMw|ZX`Qgvr59mr4bz(g85!|jBOkX&PBlwUu0%(L%R{Y|}9lH!%>(CwU zd$P)^?ytUfOs^f~9$n`xU4^5z_-Q~_CmQt5cZX7gzfAdu)L-axw9@`CC~$-4XkD9* z`qj$)PUV^IvgP&n$jk}*5uZ;ti9iiNS&&f+?<~6}CL-&Lqvw44=Qp~nZ^je54mjPv z;lq}sZ2ym*-o%G#AhiK%HjmEUEvq?PXDOv)@pFfm!oiEH*D=Rm_|MW6h}A13oXUqu z(>OgmbvoL7`3Gr2rU#IX6^35Qhk4Z6Q)W9j=lL)>%SW`IyZoTTsu%kq~=a}A=b;<2U{N$eT4;J6WYV*WmAAdApKyGF<6Ad^VYZhsN( z+8*B17$D6K+5kmnp;?4$j>n7{afb;!6QmXh_-Zn95}Og+w&7aYX}U{&sL>#?Dt_TU zs`_`nFpA_dGjpdNF6zj64g=Gb0=&^albeke5ui&p?!0P7N;GE*4|PDl+&m z_DLVo!uonX%*vj^0U@KxZ_aX@j?Jc}*_!%7>x-QGKejoacy>bR@KeOcv9ZG?ag_)I zL&Pm^7NxzL>hMe1_b$Mn3O?}jyvoj4rRc$n*L^!d#3B`wN#m8R*&Wm9%* zizW|EW6FujV9lz}p15*;kKV(Ko#l+77XrkmG-Vna2Wj&9`}~#->WH-+z$V`T3^n)T z!+aZ&kft62n&#nE_%Qih)a8gkA`0@k9jdVFK=0UMsu-@HELO6 z_Jr_)jumB4vymerp_z-=*3`((XhB^qopd8*ML8$t6gh*LM#@!$EkM0WkTeeAoezWZGmUZEm9; zVgU=s@80nEI#3dc6D#Gxx&f&$uLXGcc$rtvHzkDb*SdH<{u+dNGW$gX!5!fo8`jQE z3HW-llMl=6a_y_*NU#;n+9&1L`xZhTYBYPlG1ECL_9R#UK>&5E7efUXsQpXFWUfJmId?Z^+R zu&t;lqjl|)%h-6lQOI-1K61;C=E@U}00xr(2?lCUbARj(zX&n12z9uj1soOmH%}-R zI;OgkLZkj=W{W2MsAz0*-n*3}f7*8;PfkZdH1v{3}82*H**mt)(gg z@I8_W))wzKp&;{ILJb-@lPa^2%Aj^*HC!NEU1QI@>*dAVg>!PYdAtYF9_8O$PA=YU zcoTWJw7&?L{Y)&Ek<1A~^1lBhbZtTn4#_}t6&9PY{O%iI9g>tCoat0xe^N!EaV%4U zN<|{g!aVz{QO+{@!#2`{@L)@jkqyQtQF^0Zla|OSfXu;Uh&ck3J#o*z~2-)CPc@2 z5n9dyP3KgA?`D#?X(V{)JkV1zAC?f)!}}aKn6HX?LTK?N)bNY|+0ahrp6-W-#uSV; z%oLk!xf9)kE68~gdkJ9hxku_1BeBDd1$6Vel+vpemFhB8ooCms*V}o}jmf5CQ#i?Os3FSj`O9}7cCzmHg!r1S#yZ2{15k+kIIN~r&c z$Mj-TQU{rv6RzY^Szc`hoy8yh2Rk&{zG&ubSj>2IZSXEticuiLbpzj?%^k1=CKxI+ zrw;Hp=uHzc4+}Qeh2Z>4+1#LjzqUtSCW#93^c7>zG!4GO7-ak&fY&Q)~O)1 zwfYqX9z+@joKZ%O59_x^4)-&tpJ+|kMw$Z8-3y(HNqe93p?%op&1j2nD_J!2Yb5q| zOfRL0Hj1Lj5#r~049jIa`UH~()rr*Ctea9c>^SLink6o>DK+|iMI1%=&Ft6vMq{?b z;%TVi7=a^Vz&`d~8uk1Xo8C#laMqP=DtmQvyQP5StyN=n`%acVjrs7*Q>1k8I%MsV4R?!r?Auw}#Zljp;} z=!q;oCDv+lCu`VAPod<3uaM+t871Q+n$7YKsdv7p^7|%l;C3Pd>xuw>Ob1-%e;rg} zJ`Sc2LK@W^5VEUi3mJ&lGZ-ATL!=SQec&j_TRj0N1_(LcUW3!9Snjz<-u_C;Y$oqA z5-=!II)No6vKSQ!5BK_833PESFy07lQ^?TGcE)K!qPX&>oY8KsB#wF?siC~DnA^(9 zE`1w+up+d75*2?g&a%B=Gvb{pW}BB_&h;0x*F^0k-|I^=m@z6Vb}5oe7oM&FfV5?tpv_J0;Dxbm`n~^On?Uqa#=k~gTsV{clm_( zg~gbUy_6roMntq0lWNbh;Y}oXRnd!_r#uq{;kU7K&W3|OVh|k5me_{=2*40lXE=5Y zDfo=|G=@wVT9*_K%~a_SYQOFyBq0`cc$eLp%6W!dQu6T*p^7v|QBQHvJx@)o5>qqY zu2JB9#8F#yQL`fd6T+en0%^@~D|E9K0OoTBH36u!i0&E?Yk&P)K7Vhb$v2-wRoQ;R0Ju$O;0Cf&~e>ech>hxGQzoNFIFzSs#E zO7H#wpfyYL9&{VhRiV0}`7lxFLgN)l8Ik-eo~GB2r33nLXf{eVe_Z=&>N$Jix%c8Z zfpGgKwo+*C20Il*I%<-ZD#M9(9AU;jWN|#YYkbH~PG9u>_SMu>#~l)*!I+PFtyE>g z5kK#v9NWhyEGtcG^cYS$m927>b^{->;|_2v(+|#J_d!K7a}NGX z>YZwnr^BX>?Tf?3D_{%KUL~Gec-8qhkJ3mOIpptjOp~M6XkB(ZenQ&}BXNDh<<#}= z5s&6o$s(EX5X?Ul7gH`Ur~0aq*rf~3giXJTH-D7-DSTKRl?%8>G#-^e2$5f`n`4ky zs>ZlNvC zzCk0r{y@TvF6stwaBPlD5)Im2`j6D2^S`AQAgo}L=3+H@7$~7J16v^x{Nd>u>prJs zg(Mjn~5Qf5EH z1r#XX8@Xs%0*FT?rLp?Wlkr+iH?_K^=(uv3uLkxcd#(Qi*%{&EqYh3u?VTva72*Z{ zG+m4HH7AWcp?9KlzvwRKqRgx-Y9jazms0oeYz^Uci@9(QP(zQya$*)+)64E~dg5$! zqH)*SkGUBI+B;s^@YCdJ;Ik{=R+kjRpX}}-QvMQ--#1R<#Yil$GCX=+tjYer4g$a{*UCWI~BE+ibk(R$uT!I@t7UtSRis7vE8=7-Lr6=l#IQl($W!$V!8j_3Flvv~ zA&fi5@)CZ~#*0AF=ATUONtqv1hizUKF|F+`vs9^DmzH~C-`C-{zuFq~HzZ$Wlq7i{ z7+r@*;u#Qzzp*Ws%fxu*wTQ(u-W44_Y~Mg6h){q}jf;n(erBu`8P7xOcXuN9>1M3Y z^F1sb?&F~=qrU|8|udUY7@o2)X4?(*6%!< zb-P-B!!Cht2iRFpSs<4Dcz7Dy)SCOeq*M0| zD=9j(wcyl)9a`zeNlAHM7StlXd+i!^ihXN!A59F4{4(+@2($F}6e zoxPNkf8fR=W}Ib!m&?tJZvw>HB%mCC?DcLS%?Ta?Y0eBLmgh-mITr2<#d0K?wSUDv z+4mta-`m#tbBmv{tcqBBWK@G>m@FJ8Gpi)?m^P;j$g;^V>>LIjxV%wt#BbTunh$Fa zOI}9N?Q5Z3po={P8q$`PDkDRx6}h8YGo9I zSk!OEauNf1o@~SH;e6fPwFQnb8U7u?6-_^`Kd}hiw9)nP(J(Cviwn{fP((gJ7}={r zPzWu%!mJ`3q*Jn+XH##yjGruQcqAL6xAT;Z|Llb0Jl)lLMC1@HEwrl;dS;40zyC#u zGRKj!c=Lz?b<3~{;@T%%{z~C_mXM4bK~T9h!%iZyxrw_giFIaDR<)W1_rDps&1nU% z*<6;Zk_!(Vxd>9er1dc7=qs&VimxLqb5bZ1$i-ccZFyNyeoJ?0%L%`M@pBh)+_)T& z@FaElv|HC_=7p;0;1RaRxz`0N!<+i^VKbKUBIeeG5)?!ZsRpkXY6YiD*>i<4Y zl(ZcwDi?C&``CR3seLSQ1-Z+6hKuf(A{q?q;9;i2AUH?+n3WRWwFV#PPTegwTb?oD zcj;STyo7Xu=Btv>Vhq6aPfVU;uruw{L~S9mYF7Ex!sSJ}Dtaxbu9hU0yvSXs#5 zi=%~jl~lO5Y0P!PPvXr-LgF6jI(X;{%7j!7E&r>J_SfN8cPPOuCrZ^FrfhNlmEKj) z1PE>Yo-HNv-l%axD+*-Ovi^qt@Qc3j@Tb=4TX_W0he8MGG!(z~NO zLLe&Bo=e3uEBznF{Mx~X6&hXbS(Ae5i4@ot7Bp9ccuhdiRQGd>IR4=mA}q|&#*^nu z#p6$(5$xGGb47>`J0EMIMGk|Sq1G$VJH4o5Em6|<{oN}K?5BiV^XC$_%XMol%*-w? zGN=dW&c}C0e3~TIW_?1A99D0Z(eF@8qaohped%?i`zSAAbyqWzq2l?J&z5I;6vL<7Bt%mhZy!=Qs7pD0AN9@Eh@%53HosCy z9V(M(&2%no?>mxmE8UK|^}AE7Yc<$Ioo*3pY-NUJWS z1SvM9k`l`*7reFIKWvv=Eq-cZXFj$!Q78anY@apm<-d17OCiDCiie|k`i{jyhp65NBHv0R=M;evxdG82nVR4 zs7K+LaI4;+G=p01YtB?b=u5~i`)G_$m%xNXeEw77z|&W%Lyb{e2RGdGF|d79y$qPq zP)_|E2-?r4F~$0IvoV=@jlxY4xd&GbXA`<*3=uH|uuIX1ZI0dwHeB=trV2 zYuI{ZUZ%;Gao?C>=nFrh& zmP|uzQ>^B=byHtYl6dc!<<5e*{D;!cpFr`_0>KVNA=$2pUPVw{W9t4V+Y8i>*|ax| zSrb)>K}nh$-aTamGxA3OfG5t9_VL_hbG&+aZ7GBks}h-3lIP-IM?=%AI1c_%ds(B2>M3WCAY( zk%&2M;dVR}@4TmD;r#H2e6mweuHp3oOQvsNgzir&)+8y*j=Lw~IrI1%A7>P&u4zk1 zM6rx6YKmvit>)IU10VPgHnlbn7I_O`uSz?xGcs5bmC=E7=N@c3lNIW8__mE+n>UV} zR2vLj>|*zRsjDxbvw_Ts?Uo`PQsGaPI43uM`FwQW$vLFYFdn@NdIz0BDy#R)bx>)h zK^T{Eso3N)TML`xo%?ncZhN)Pw*IQe?oa-7S07?dtxLj*NS6*K=aht|tBc8v&dDDs z``*3Nx8AY!iMrPp9M!G327D>DQ>9R8FS{-c?NrYwkItAnxF_e*^;C`M$R-uA zFR8(E4l0^%(55AGTLTE^cOI@kmd%j7TY2BOR0W~&db%7jqoU^$?&{*L5ewmS$AhmX zm2>^}cFQ?<_{6xgPZrI(ZrcUgPcqpg_T8YVK^u&aj9 zNhP`x8tfQQs4B)73O+?|(;`Q2Mr1%oPM7uQerGm|FFO=~j*pgxQCYa#HcplwJyM?@ zvq1T(JCg+H|X&Vc^)iyYm+!p3z(Ctg# zQ&pk1a6O+fVO{SXd~^Mpoxsnr%w^4HLW-*+d*FG|qHBI=d5@P^%9jtQ*thQj#)x_0 zxKUtSoasm0s%*ugv}|wN&wWbwUEW)(OC;>-U1Aheu%p;@r#TO$rqgtX^6ImK1R9Fh zmqq0vX{m-glZ5UG>s#dB)5%+%^AvrGaELatOF4V-F_pQiYal)MI_+g=wo?UmM4|b* zpPwyUKO7hC039Cs_%r+h&-SZ}DO3NF(p;f9m;JIM7q>0+R6<<>;z84(m%XZ>hwC0< z&AWP1qMmiTZkiw~a76m)m9xx7*3grn;CDXDMwQ-kcHVY2B$4+HC*UaOaF9>7=#-M| z2=z<1J9w=<61ES&&hRekz6J@~F}$57sOciAbCC&1rgymYI7TWqf${J}!I) zo?#$fi<7Bz;XF-FQm~))u)Bw#WeM?mQfggM1)1$Y1Cd=xOMx0UShb7_wwnvPF zJQizKZ9SO0F7XQCZJ+I?j4YKcGFz99_QNfZW`q`H&>KJnn7L>g#iKBamQ?}d0di?W zO9NGogDQ(uVznVNQ$)w<=5zLy4dp+!=HAtt&BkLoTraaDxkJ;;_tK6P9F0hp;#VW* zwr^c#sbRgdb$PHer{ebrCYrwK7y zvuJDFAsBONpM!(B{%Y+lfs&Ll5seQ>JtSh1c1THfE6*L;tKPxw@!HVs)VQm``SyA?BPyp(n8>h3;Gs;=4Ap3< z_7ytPTI<4rXGP0&`8|ypv-@P?qjNXc@Rw)rvKHkKz}|TFWCh3-v_jtqrwUC5?Acs! zS7X&wd&wt}?TP(kbO#Bh5zknrg*2x`v!-K_D}LMvHuH=UkdsxpgwE5r0#IF61jPr- zbR=v4An(a{y2E+q19=|4m2-EM?S#VxJv@U71J#<3gLpa?FzOZ+PpR^ItY{;SqT?N3 z#rjn7gsXn)I;Ebt#H@|RLk9)(k7q|~OP#^ zLC)Vir%Q)>J*V4Oh!Lyq(QW;dvvunM7wtdY%6ldT52kUMh#n5r8Off=1y+r~QQ;np z?CQ1QAh|t1;vUTuX^3qUX>`#|@tszip-v!3B857)14b-pHA#kpZ$d$DNVTfnP{ZQf z{KM+HEGW(VL0wSRS0n#hzV+6%YI=%$FB?h=!h?Ib%>5DPb9kP+T;HsAgp$q6yGEZ~ zZ}{@`DpZkE5Y~eDIVDL!aLX+rp;~iLs{94&1J>4z0t)Z)K1HaF1@;S6#0TdD*CE(c zOJGLA*QQ5QAi8Nt)zE~uo_-Iyq5bOD?sl8IvQ+l1N))u4?ivJ1J>-64oA6;}zuR%F zNa^|5W|FSVlFL`n6*hy(aZdg2acaWkv!&iIe^C)4Ekzk3*WY^&%^!vX{&5$>vFjDY-8<6Kf)Q zmq`vjw5GwIU9_oL0>bOptBWM>G$Wb(txdxsQioOQ4G}*JP>&!Zj*K(=;%!#!L9d^E zU%gy?OBa)}g&9>pSGlZ-yA-f-_tss#(*3vszf&DM9J>8$wyzh-cXj%_ZkJK_K6}9Z zg^4vZ-sN0J=18NAoIP*kIQ!}&-}7$ga_4>I+LZ2hj$utZEHmNPHY4Uh^^BzE5`^XW zH0EpX z-eGU()>zKH*A*<+XWO<~CR1MvT(;B#UBi6XE#0rSe3&+i+QYLyNEpvRJ z+*TDo(Y1NPnlU@R83Dcfcl|;&BpyD}zSE!9a%@9)!&PEG+B8ksP^LFY)K9KK@>)S0 zMF8xNZilD^T$am@_GS5;FP|HI=WcDK*WcVTd?)d94B`WF)SISZ_`TE{ zpw}@1s~R;b6_^2N5kFpKNG`i28%Gq@z6SI2t2yXpkwAvB?!hLaZfg9CK zcHS1Dy&wE34-Z`$W01Sc#l|Hx7Q@Kf5Blvh^^~=?X*YYbP2`al1)$vsVkD9qlIaBDn@E<7Xv;7f;GZ#7QHkbxBu2@l0+jDXsQ2^4E)% zJwLJp=bj=|IO4{K`B11}xAz0>o!*()ld;Va7L}GN%jd_7y}#MW6x{T@@rHWH5Yen# z0opmrm}hrhl|KKns_Z_jJoSmw=tAu0f;U+L%NR*YXU0S$i4&)1z(MB+J?Znrrs~56TWRDrzX>%y z$VrrP|0R+9Omu-I<-*?-Gj$%uhiF&uRZXsm@4f$w3{^vp^sPBPW)RrU?_ zDIS@-C&^7ZLVSiiHm4Qf*CKM%rT_UgjFkqtv2uU6T!ptN&+a_@9FlW?@p1OA8Wytg zn9Eou#4*YEsOaxhDSI{gHo>REOJQmq0+jx==9u`WyfZYKs?yJD z^Ny`=Z(jE$RyTC;E;n*;-To;>(T5e*e%H`T!GCi+3Xg0fQV1=E_G7P@x$y)|HF~P( zNYpytlPz8u0e4ty4TrX0zNYe_k?u(oJ`UHSjDURrGK~vL1+CbH9=L<%dnr zgX8!~Az7Rd-JXS56#E$N%RUc|e=O66=UM1yuXgbg_9WDYdnIK&+($9qe{S~y_|VKD z^yv+EP~`l89xkJT)#r?FpPX%Wvvjjp*U=e8OX#=ds|b$$z@wd*tp_0_4^Q{tL_QAi zkvSB8&S+yDNa7T|N`mWsl!$hXI-lTbYDx_-_)vXJL#=POy05-#7j>=~?S{`E$82>O zFe7+7*uSv4y5rO4cktlYVM~&~2x9!zU{WZ{AvAHsR4jYEqtLSJ%N=``+M1cwMmER$ zo>t-VTL2f-Dub?bN_nSWcIfsqKU*s9vT6Ax)c8KURXy(Jom|&VpbKWeh+9<5jq7A^ zKXSiyT~I#g9}rZERQ%jhp;@7Md&AQ`o_bPTU2nyiBQQ-Ar}fd?QmZ-?i{U6QYz!)J zH4Qm@aQqHhZuc*PXR%3$U&uzEDr4G+G#{qvyT6jCL%DaMMrc=;d$8mL-Glu4O$X9;iravRm@yFKLx zOzf##I%*7TTE{2!yYepiV8j!Q@B&Wux0Cj7z7^%Z?zYJe9CeTA5{`O>Th56EBzqV* zv^?R+K?_n=>4%9%X`D{f#-x3fM|BWa&g~}Mx!>^q0v@$v5c(j~RF;+$v3R6O$~mpy z`zj_*?qcLqMFksVZxWP_N(egtF$2wws<--#vI#-W{h z;q3JG=P?K7D1t#dZ=+BzPnyV|S%;XXHY4kIoo}I~NKL2uQx6ASRz}(+$=}pTW0&06 zRgITE;dVw(?$``^k05ubt2}M@OAd)8kyQG4?~w*(;lbMC%T@uRnRn}C`>7up`SPrJ z*1AZRmcOMOB)wj_`Ucau$uW?;p+4Z~wvfnmkuQfDFFT~Pmu|=+B&Y~iuqqNpD&zLt zIc6ed;=TuEB={xaxT>8dtHS^fkwz501te_`h{}yI{^;SMQoQDZA!1gg!JN?G>c-yx z5>grQJ)s6%GcFGbbV$8Gq`t8s~wYd0X{Mmhid3#=%scW8`@7xybaO}~EEzlK?e53WUQ)A!qAxnz6>Zf)WR8n>(@bDPUy^F^V zD5*`PoebY~QgI<{9hSATvfdI@3=Vd*K3vHMqAg|uqL4=brM%kg;pKNG%*h;~xnwpy zWF^VYR9}62qb;%4Ey>}0lF7)`q@c%HNf`BWfx3_G&B*n@&8lA(eTA@1QkIXD!0}3h zVa?)IONJ7gFvH^;NEwJl8fU3V+UgTcrOYHWEod94Ii>a`mS^V+xf{Bd-RYCR^k%(c zbE3CM;04so0AfBCq>)ihgeJ;R;1%Jl%cGjbN)?-n8Lef`9!Lyz)8cQOQD+) z#E`Ulw^@%@8ODS`o6|o?Kjq?x`9iO^t&V`Z{suwxvM#FZ?tv%Uqy^wEV~oPZYvk%9 zE=~%jKKGvJckPKAvgK?5GbEy-c73imrxOp#1E4xki7Qf#D27XtTPbzCB`mnyvUh5m zzz#pcYgorhJiYM|BWihmXHgVrZpqq& z+T`{nW4JS8c!@zdjiX5I2I88hqZ}Et^wAypP1|yxc@Qi}<2^BmTeCNbt4@4VMP;j^ zH130M(A|t6AM~?PIdO2rSUXrz@mB8QlMeXF;4}W)ARJ{w9I=d8xZznAZ2g28IBoHM z-L^AAKefn%7Rce13C|Ak43_R7s^FJk{xD1-&`u#9&OFgrSBn?`TEOy-5k{z7A7Vk; z(r08hk_xx|=Y!r(uyoWlvlZ#*iNRgP;C7-6@=e{9>uNBJfPxs5_u;+dZz+Ea%2`#^ zKn7wk2mBboHA;8}V%icO2*^$ceMRu#Dc1}{TP)n^9o***qBQ6Cs3R7rGANs_k>94Q zj7PC>dt11z0x|y~-L3&FvIFh}mibTT&nf@1Kkcu5#ojdx%3B3u7<0g*s{u=qa^vY_=fw^3wJAEfsyo3AQSuuieQaM;cKUl*gvFsf@ za1*LXlH$CgAN2ie-GUcyDtgPS!5dR-0_4~eZKjI%_a1#nh9V`gUAN02V*1;E5peD!fD;fc2^v7zz zg8nhinxXy}Ko$9=*T|2|R+eJp2{dAc8XZiKw&BAhf+)7nJ(o{KG%l9DwkeI9OdXKr zY&8?2ySludSra{~$f4VPR$ci6lLWZEfhzjXE$e?}c<9$fh#Ffs%8rgo{H-iBc!UCv z%upy`eBc7Di?aL6kAN%vV>pY!SB3=q!a+o@*~)6a{HeSD*=l=sqKfo-$?cW@rMy4< zX2o@WuiHHHx5~_N5Lxxa+LcCtV{H-MdcHj_-g|HMSllNqlx1LKe%>S2`f{#5=#xn; zo7^5LmOGBQ`kIiivk5G4qZw*9(7VH5%ePT9`+XGrU!*cct1DOZTL4Uzj3YOskW0V? zP%%*ZpUVEj2?1*S!)}4;7HuRJ4Vf>ldZ|S=4PlvXM613Q?u@`$wShvB{oJCe-E*jX zoF-gwB6K}2e7V@pgPP`>e!IHDld^=*aGUC76vX$1gnYc!T~bg?>a*?Wjp-#<{+8cw z^9LpZ|U;TMDA>}+&;ZZ03=6|WXY{ybZZc?jGD zd`N^5F%JO1%EuiJM|zlM%l4Uh}q7XyG7`GzW5lqHNW$_i05%6=w&SR0&{6Pnbp^SF@Z4rgqqTh^8s-i=l1;zB(4*B6tLx!H83>QQWCkz5{M&3aHZv)4m0$2S5 zGm5^cqCq72PAvQ%L`kDRFHcRyI_V&A0u(1NJ&Y~ju0q%)b&Y7=*7$YI;3!Jf(~hXQO;Ko+xutMl>Dn@85H7V{=r+duB>k%HtNqd+r!?Y*++2z)Rprr?ijX z+*cv-$x?0WqNfRJL2^&7Y!@Dr>^;c2n_>2n;<-4LpQ}3hVo}prFGjV3tAXH%906oW z#dUPgu%)i2g4EQyf)NY1*`!1~CK8HlEC~u98E^LvcFplN%FlAi9>!(tJD!7h05q(W zLXO&xcm_~0&J5-BS3rGb@aM_QqCb=x@LQ>vziW5}C;&YCmtNP>F}GI6Z|&mpk&me6 zcT(OS`QVc<`gGUvy#-*4WW@fj#+eG@3qK|3an`ljujb>;Kl{H_*o4TEI`L@y*wTu& zKmc0_Sydgs{)EimVGC#y!~k?6-BE#9_}kw9xc{5suY@wPpQO$fkybdmw6@c~XRB95 zg@%prJI7`@d7kJUL}Te-i%hfdZfaL(SJ+DFR!Sx?*r9RE>vYUPD?M+ndk zQsQQ)6A5r@fLPmAQQ#s_X7*19BNzSk6Efo|!-tC?7!H4 z_Z-k(qFe^Y2#V3$|IXp4exJa(d!yn~yov1XuoK^!XAUj3ARb-P`g@!QMq3HOofgF) ztQb|TiYBg5tUrj>%Ke|?x5-}kEiw?QSBPUG-4*QmX!RG>J%cFD#H(2nQo22IV#PlD zw-VlOpTR_aX_yZbb2Y6_KCC-sc{MJI^q!G-?sugBFDv>(Qb26z1wtm_cli$OzYK7D zrGA(9f3f%G(NO>I|FGUIv}&6ul}b?~NzrDRkS(&mOo$0>5)zVart(f2BxEUT*=I13 zeVevX5we%HM%F@h!tHKRW7_viQh{m!}1eeQGaKkjqX@uHY{UeCwldR)u%dfp>H z#c(&0s$sSr)v=vix#nBK8z^RPz1`z^p?gKZ-GVJj53VzezDp6sw@c&e9j68y=$ZpE zCaP<+^tD9z)%z+gufk@6&%DEvcU*$!ZbOva(QWvZyAx0K#B9&C*m2^HyM=k2CEu}- z1f~Hen@QX8AN@rYAGIXAdRy%bw!3&{ z6IS#jx`e!?MYrD_5UU`?3s60Qt|)AtM>56^fz&g7_>c~WP~GK{8vPyhZjbWc3i`OU zfTFK&7%NPP;_)Dl6n&Dh@s;G%W7d=v1ynB_WWRb-Akv^7AVT>94K<7r22v}705e+P zF(nUi?^K~)`|W0PiSlWz03@ux<6KTbqMOe^-FSD? z0V3)7I5Rzv@9aiRtlJ_7fypDN?f{XAijZ4QD6^ufpX)L4cNq9PN2rU(@F9r>?sAG7 zB@ZG)d&}E`t_QVE5sESHm6DQ}v&h2-6>0)vsoVa@bWgXC@mooKhuGl}htFE*dN#g& zh5M8tW1{hb$rGczDB-uZD89uo8DW@7qU6f^0A_`c!fhdjCbIhw(|23K7C>e|@VmrYVRANEq+PW|oo*3X7x7;^Y0!;-*7|GoM_P9e$GwuO0viIcc0 z_?I0^oCLhd-BA(%VM2=deQEj<|v zEVZ}#do3o#-gvVdW(*vmR!?tQ7UW+rg>tKL1(O2&0Q(aJaT+ZCXQz2xkD~n%Jp5T^ zQzwL92U%4K4s=e0<3WNcWYk^fd8>>#p{s0)$KYY>!o&G9h;*Zih&OVS~Ic4>Bpt*TXyu8<6 z>Ro!1vJ69Ot`*SDE=f+y=BZ+^3Lb+xC|G-*A<)ea4@S;o+V6WI=whpVr3yPiZ4YplTPIjpp`5R4|vdeF~gY z6Wt^@`eM!oW5ex1rsPctZOC4lasI}xEn5#^;RIahY1WuU&eJwwnvLjiH}eX45Y}l~FQ#VMIsfOE(9P%-(&0K8NkU{7^ zKz!T2XFt!L|EUwnQP`F!n%H{sTowG_1^Aa>x5;Hy)JVcpvr<+vd%^RB1n zO>Mh|%`I|2GD}T0tPexUa(vE6yHQ^&x#OivN{;Sw!N+q?#sd)17x$k=qDiek`2c3d z)k#>}e?&xF9j_~Eud4j)tSd=6lUAx_SC}!$(#XS(S1lh~KAKk^n-Z$#6Et;MZRKat zAJKQ&GWcgKqbeoB*s18}EDx2lc~0wVg&(gC(Aak5f&2~YbiFFvqqvCcha=1^GcLCz zbtmKqt@c-ol+0wfpJH5}gt=OBokxl01fiLT2S!mY58Fg=DS^2fUF4Du)}Vug?cTw~ z5BU@S(s&&ABaX??N5d#_Y;q-c_ki|>heUYb`5ga!sLx3|z@+Rgp!j5>4*+9Pfbj|h ziI}2s`_G?dVl$~^DwaukS3t?mM8ypHK!Jy3Y`H6KXA5Dppq|`fxuwErYM=LuS&269 zPt@w+@$c;iobA1rtM2ZvOc2C~T@c-iEdQfuQqfc(!)pmQug2Y4yfl=(wiv$(@>bnQ zMJbq^4edW=m+HuK1jBI6h`HKp-Y#OVf((^>$fc?kosT@OXYIUxtY}|M>e1z!!=P&= zIOyzK7m1g7a6ZU~3rIAP1KWUy$^T?<3edC}q;g&rP(PEl4ZjhZ8Hyb|5z--ZRYQjtGnq3O>+{XArFjt{eJ; zMAQvgaADa-;`;NS48)Y=@rw@~K|_Hx94MerV0Hb;R0@+)!F}Mat~I*4F+EWi(~jHI z;!VHevR_~IGM+FRWmtM<5-mH-Mhj~r+gk&xo*Ok8aI~O3gN8Xf6eN;!ZI9OK+TdF& z1b!&DSyQ32@ON(Se>pbOf(1i3_dck?@FT5iMJXYGySiw>vzk00V5PgHUx3DsACxg`U}4NP7uty z6A0%~cLG~arvTlDu-j6zndk$$55JRBVIRVS&pzxB4&KsO{j@bDonFH8B^W2<9M@x` zz640jnCHId9ScN@cvK)6X4qA-c*^6T(XO_j$W+GZ@P7m+e|G15>MC!k;YKZ!B~N_ctoi6eE(?ZUR*mTdRZ-Kk zu6E0mJ><(e7tw#b=xp1JME?9wdJUEbU8H}k6D$>P!IB|u!Xt7uC*%-s$NY!LAtd7w zIjUls(XhjKqZ7KZ+DH(7pmd)4FFJ=e-^itN)Wx3QJ|J9wYrcjvAk_nH6O z?eoxm-G_^nN;Y{V!G6yQa3=IErF#UX>Ag_~S@?!C3ouLKhXneRhyIgxG{a*qakmY+ zd3ehKB96BlXc)&89FP8B=n>Dg@m2&L_|G89JaoZ|@E#n4hH$+pKN&Mi-9TQs_>6K;tUupLLJl2sOa?Z^u zcIRdl5Y6rfm$#V3-HR8SlAc<{-%T!EcoW?)IowRzX=Y1nYywR%F;LTn0hi8jmzkZuvte@PN`u zHj}c7>(-vacaEVC)HA<>JELe&0I1F;$2V(}s2H_FJ zR{_n{>u@oI78iJO9sGP0mtW^8mA4@Ct{wPwehv2W{5+3rc?-g+0iI1Ff!yV~rQIlo zjA6*;ywe9Cg*ttn0^s>53hx1Y6nHOqpn&({C9DI8XWg&3hgRh01*b^1y3Tap8y-Y#w2s_LQX+= z)7KTwuNb>j8}<*#7>i`0i}a-ZH@~=v!g1v19AQd=;5>}{07gJ82IzJ{efPiCh4;YC z=W}-mtQh(L>ypZ&VdE$KuQ6Uhy>qMGNmVm>(f;L~O*4$t!M-*@gX1h?S}i#%;D0>m zN28E-l{9j8j6SOyO6*SS^RiF;MwG|{DjDa~XJ_G)VI|-Lw#LD&^FZNcAkfhG6fDCZ z52FC035IvcpKxXi~o{_i9mT>10y%L#ifdg!NweZ%sE`tv8(lPS~WxcX>gl@ zo92>Np(oNwU#aA05?nSmaAoKZ!G40^ljMxn z*@3X+t(Xq-g*5hHlU_pVrJ@$8#UBos>U4IiwAImnoSFMXWyt(X*icB{+W!)ib&t~- zovW%hRZG>Z^*(PbFDdZ(;o_YO-#-Krkf`p^Xe#li5Q9MHJIa}rbGCVJ{OG!ae*W&@ zo;I(1#_2MU0g*&=Ryqq;6>j!0Kt1N@OmcE*U`gU%onuw0kp08X%HQ0E#`TEr7oU$o zv1lcem#sjv!NAu4fFM`m@D_I-f+#2bAt?Eij{Dw9%*N)^V~_pVyNfJU`o^zuwj5fz zcUp3EIgjdXp4AUqHE(h;-{>l6cv6>GwM<@prI$K3hIrAEh-grSOFo}>a?bR3QTXvU zb(>%Km*xDLY*2Ip%}JxiCG^+f9vQ`)_hqsCdeayc2+5|YLaq#BVQZ8Sw=`oe#}&Xi zY48v#zvWdhxJ_Y75uiSS>p9WqKT-nx#J?UOj)w{zH-O~2Q7FH-$Mq&Z-pBT9K5GIk z7E53LG+la!&a}aJ<^Nk#8Ep|X^cFR*mpdnGx4dAV-Qeb1L0@F>ZI+it%L029*V>C2 z2Q}mr{-y0+7n^v%Fm3O}=ga2AY{+GjV{Tz`gk9ewHf>FhEA{WnFVH{X{Oax3Fv(9- zTke0ND3gmbKT*FszJtDxUwrqx5{u5aMNe4p2d0+Q;wIt}l`f2l2X>!Q7&!KU^YFya+v_(ch4ov?(44zIxiKu|-B@ET^>L|v`u_Sv z(RAH%6~$@3gb{|3x9C{0YO$-oX;$2+3$4uobJlCd;_(aT?m>_8d2cI9OVUu3Gp0Q; z&ic~nW9-0VqBdj-c&$J1Lv=6jAtSl{P+Z!l0f9?R5&PQ~!j!0QE7>x}vv7*)vZZHJ zipk2&hP!gkxg^R^>^T($Q~^+kTbzvLfw{U+&riL<>79#%C_`YbifSY#aXHo~?jm088 zO<5@E^>zjnlt0iaD{;6!sdH^sP4-8%6FZ*Gu3b~&;4yQ}Fz{;@oXVG=KP#;p&U9&4 z=g*@*4~{R)e_#;&@uLsNlbL!2c?`pDN>~T0HynFdjn^r}88!;#H+FAx#*N(L!PU`k z8)o}MGU_#+2%`}nqwrcSf8BhEOBpYx)o_o>>OGn1j_^*S`nK9MDLlU+?cy1J>;2Yr38pV1`h16r zW0Sl!EkPlo*IT~YE2`+8F^o4`XBbW4e*EI|#g@>9MYvZDod1JYa7gi7 z<$GS3dUVXe&!v6g`+S8XQ5i?)RGH<3Gx)wJj5Rnfa8amJ-@$cWDAw#Zrr!s3hTh6goMW1DXH{o=DcMCc-yEz(!Hqj>zujEu?1znGW$g9QD!!!)9~d21-X zo|c)R`P0Pe01PGhfP9BumY>kY>sZm%Bc;ghe4<=wS^xAGpI&}|7v3c6e*CKJSBJMs z=39}=PAytv@R6DMJ*%Hw_J-|0Mw(7}|31ayeT~V-BcJt*MifhNP7-W^FW$`5z?zH24U-b{HxKwDR=Ttn)&4x7hm~e zd{5a5oUO2%iO3pqSx&w5*T(TmDU&wC<)7AmT|cq8DT(wcCJQn76NB+Wcr{;a{A-Lp z(CB9P#WKbRAzktsm=sRqqD=bD%buqvS0JkabIM$kG(Z7J#`uK6Ba7{X;aygnR!!I_ z&y3(pIgb5%_#e7lSI&E+VDe>J?1a$-g-Kg|T<}!+?`%L{0m{ax_XJ$JaC81>uDVeM zt#@14to#|*(mKo_#7+gz;3Eu3Wxc_;FJ}S})qlf~+stsfY(lo?VE?&ae9q4H*QtYh z9Ysj*v&dy+NNfcjhG3nwe5`kr&X!Dzlk0onG&+Yai({u^e58#o?Kt5Wh zQk~aoX2@PReQUbQ%lC`#tUjD{%QAk# zjaO00RFsJt-C!A@RUGRF7Kf4#_}ewhh$FZrQ5uHm@ttp9R$8juUz1-JcFp!M^pE^5 zaq~jYVfvW=;n=unxl)A~nrznYtx}H1NK0YVc2_;aByz-f2`#~PX6TVy!oV}B>KN~J z%FYYj)PE{QZfStr;+MD&dOHSi5oPBKJ`Nw%zSK#tm)49g$g@#%TxBS#_Kmbw{Z$(@DJuAC2*=jm=h2J0c3Z99Radv042@~ zpsZ88RdK*b{Iq&X0?P%#R z3ufwwD^J59WhS?$gsO9c`WL&NU6{jWjD9Gx{kq|~ZAF)QiR09n@pj=~d}ZAW{k{3~ zu+!p`6~m`W3hQ$PwzkYvo7^7gP}a~AQ!v#83xA~VQt0KZ9IJ}5(0Z-Wv?qB0!7aNd z>|q!;{dO1bQz-nhbK4$x1fVrFwAcfNVU{?es5plxv^1fV}7Wrzf)4_6@Wq9WXLBA{;201f;h0RC^DUDdG_uI>2o`=Q-Yx@Ydk zogL9s5NSFu`V(B@Nf1NZxCT4PWm^=25aXTL!OaIi<_Pj?1_F^({I!gX!1nr0Ql%x& z*L@LF>3oeLUL8ANqS{y^Ha`4sjcWl+`M#K*M!f8r0q-!2M#c-F3IB(Nt>S*?K2^@e&4Gl~NP77kh~2Ki!V>7y5` zab1qvKUuVC)!^$%Z4PNhBO9#@Ua9`#+i1h=JjP6);~@>|o=}hj-2kr2FviZLUV)xc zMg1s{n5ip} zK1g4=_*8iO2%ic4S(~f>tgXUB6&u=LL3)qDc9fSwo=?Jm_xbI?H_xA!TeRinB3FL& zSL*)&BIdeAo^DCK&eJiz*t@{hTpLntdGNFR4L@UH%J$#bd%E75(kElA0;mG&1}uRY zAD%&0`;(sv*mlkYWJP%N_G!h9Q79wQ+zVFn3TOM0jAEA%RbJNB1F>lsC1`Euq)VKYT5T| zl1}d!C_A6RxU}g(Yr~a`PNkkdE!ei?GP5yU6#I4W@=luFRL!*ty(bPz0^9j>oPzEU zz4e^QiCjNGQy&%TiB0J~xHT$utU;mFOh7BW>C4oeAkdBvuK!GiIijZ;We2al+M;)| zK%2UeVH2jHfmk(~dis=MDL|NQ)~Rk_u>b_{1#F3m9UkO>Ktb=A>&+)cm`aCOam{2Z zfajk;^HU~2UCmWJDqJC?wvB5o;6)TtV92%p++-Wiq)_&tVWCy$9)0F+x9j+}+6j?L zZJ8lOJyW_s7M>yeZ_oCLlADv>u!Z`Df zG@+#=9E%nE)-xvBJzkWN?lmDQr9Gp(8(aSQ?(#b`8$w7R5CzrtKGWX(Q?piY-QEWk zz5$tcL!K#ZBg5qj3t9NyNYZ|G%*Bj@yBp(w@u@ah5k3_MEX&1(8)ymj>VBdgbm1}- zWTU%D(VdZTU!)dT)yI(D6g|6?^W~DaaI@_`0XTV@qql*z85y~fU8#_*rx3VzG%LjP z+^(4RK-0*W_Y#@V;>asfW|>%g!^wBLOB=6Ev(51gU!M9If59^L>8d&j$E|lU-bO1K zrGq(#!$aT(2^-V+FpmRAD8b{K5t|jrDy|X&XZPE7@N6~j{J`1KP-k}~D6s6}1eBQo zTs&XrgHoTtvft1549HK#gekk0VDAMw8J}E%nu?3L|9l1^gFm^<9W0jKpeVJja+6BT zkmEk-EhIPuEX+QCgxam}PltxSuPbrw^qG_iYg(i9zRHQ3eSP_^v?kf_T2xMnK<8VG zPQZ=%$P7wDPkQrxdp6oZC}*WpaqpB|8ohG2+1NWu zXQZ6$9I8B8cEr4o@b@pihpVvfa65nT$>?=YMJ3qvFJn35yDm~`mlz~hCq3cFVUE@n zWXgS6#YTa1XE&OjQs%#^yhWKCJ=0D%{E$^VFm}4}!iE{wzfUE9Ed#(%V%9)sI7n*L4_F0b3rz5s8!r&3h_G{znhCq1&%?>j|rFr z_z+?Up2<*jt>?Nm;7f7<_p?1!vo8J1FSTIh*qJ7@h}_$RE>Q@Pcf zKk+lQ7fxSyR(AD>N~-m)JO=Yp!e5KTCom&)olTX9KE$y(%hND=g}xV=ptHMDdMKBh zWQYX2sr8NN`hm-sMx~7GWiyLnvsIL8$RsKpqdvFuql2CfGBV8mCed@--QPgzK;3=pAtOAk1=#2KZ!<}4Gkqwi*T6^MGw$iBaWNR%&6~j zChy^}s?&E{n;TiipEYr5IpZwf> zxYBXIt)-fOjR(bFUY?q2pMK?>p+v}@uur>LQ5VBvWLPHtPB@nz>Q?U8f*yo8cLM9SXHHW z#aWXg(FiM{M^P&`ZvXd9#hapLXQL>y+6VWuS7F1LJdo+QR0$b1?Py4@&v?vK+)*_l zr5rKWXeW|*rT1IiK5WFFEj?SstvFJ0P5nmpGerS0j6T%s%EH)>*?u9a_C3RjEf4*iqE3EH5nZ>HDpwKf-)^Jm zk?)JGruT{^bhB)(bq<%RybDUI_{9fa&6l@*k@u1>cj#?Q4Bj6s@Z+7k;2Ue23%hT$ z?sAdIBbI;iE;UBULPX$LV(JPb(Fv{b);Tzh7mdVm4DI0bo@SNG`P!)E8-fa0k5P+(hI)HHn7oa@E&VK>@);5Nrp5kSCd`WPRg>{KpjdoG6AnU@8d%yTV z0}&l|KfMK=48QZ(llgE*M|Ty~o!_!~BI;^?uc(nu;28&(PpT)r;d4Ts!wqKv2vk8H zxroptS$9oF+xu{4b<*P558_(J&rtGbGq_WsaT+yTr z+X?^NnsNpDLt+2jMHO`c+M5HP5pcvC9MvGjlO49BDM|Ja`{#$(t=W9I?>1T6MXTY8 z@Q>Fvkgaol1`~^0%8ED8y5DA*)eg}v+}^$Z#wgyp^M^8naDr$?s#faTsujNFqGhn$ z@Bs~tJD>MlywX)-kT=xD>g-#H@mz89acCjL`1eWGYIk7tpgGC%>11V4O%sE#e*TqT z$Ii5lHV%5dXIUki65?Y&XC&3{>vH%mlH>A=?`9W-H_}lGg|6MW{g!=hh$EFQ>F$?8 zT{tWf^mt+_6C09H;*kA@u`AH0yek#r2N=0MGgY~X=^k3yay{o^ud~3+tDw&@N*npv z!bd3Q0K7_Q0PzI2L>cz3!!*UmI`tyMEME+#KS@I z(*$9PxB`ONioFMTPAvx%*JDnU%NU>eL*1|u+;Qx0MC#1J(G-JxlP+bCNLCJ~%_FuZ-&=m(~D-W;K^#@4(imESE3 zfRYE+w2dfzZzo9(y&b!};W+8tE1-{Q>K~;7*Y*WPbmWK2SsaP^F+8WXb-B~pxapA1 z$U0WzH)sznTHSmlp__7vQvFqfvFk~P+LX*();NFjiFz|H4hySIyYi04_cI=KTOW$3~+IZ7tQNL>&sN0aU!|KaRs=xqV~F{ zTR_1oAnUeb$vWuY{y~@%Jn{u&q4MSdO1adYAXcTld0|*KOit80*`_JfoD2j`7w9ZJrvoWjQ)VF-Hn{?xK$L>?O&yc2kppS={EMN!M zZc;rVe0ipts3c8_pmzPV>xL=OzR{pC3&^KX$#mR&zMHN>>Rr_8$4G++=177QJDG~nz+T!ePvxq>##7XC3c6=!4ALEomu#N zQnh@?)y9cIg_z_V->(`a2iD{Mj->W&JiZOuQq(r;e(`C56!i&q#ptckyN@p9=c~v@ z4Yb>4d=e8SW2fJ=dcjyL%TrCdw|cy#jiofLV{8hhd)6zkM5E{hsr)W9%77&VDMCP_JiV#r?y zSsRI(Yi%Tz3D?eK*o;T?c;#W+p4O&IrN8(Ya@;|bqZ@!Q3()wD8gg`(3wiy4Q(}wA za+nL(Ws!w%LUoXtJ1mWFH(*wdm(NqyML(gBuO|WxnkR=HaPBfR;@%sAP|NtJp@Zxk zBi<5xTtdxYIeb~THN!?Rj`2}8D~u}?KapXw%-w81MAKsDOVNCO;vd^x_+eQN;moO|iT8 zwkZTBDqHk6eyneich`gewe1h>K?CnQDowSf_O;paVv$I{5$p!#Uwo?>1Ou&3%-PP! z4nw`etm}419ugnsW>i1!otsH;q5bXulilZOO$*twabrU8$zvh+1D{K-^h0lqod^n< zFv@V()@ayRs54o)zLz6)ck0x1hLdqOpop1zy`TIf4x(m^E!5*MNhJhCOsZl11GR*45H^pzp zRAbqlV?()|9q3J&WoJUB3=2ZU;0DpXci`{84aiv~TwE1^pOSGGWD{6{OETPr(h}TF z@rDK8urwDf^V2o6`=PjCMW(BYbvid=PQVHiB0J+OEg&%m2mLZ%uHIGJ*x4_Cb}@g7 z*HdS`(C5;%H6?f*7X|_jhD&v8 zxqj%Rb!uWiXh<+XJw{EV75;!BFmOxW(@@Nbx6RzIX_X9T2<~$~_`$4qpOj6?8SOQ{ z`20_>+RgIE*tRU+!xy<=bH`qg>Wo4iHaHXM3asr$NeVH!`TIGExYTk!- z$1K8gQ!H%F{w5~Hv|TugFQBO#eSSD32)Eb|r&Wig zM77%Ml2}%`GcQ;(e)N&GpD1L2luR@t1d@U0o7P8CcF7nUZbrIDW1(ifeKnP?b+rXm znS_`2x;?ukog|okO3`q6E_V&<={rj9a&T-${gr*z6S5ZjIS-q#O6wLE|CJRtT_wGq zg@;@Fwr9>Mou-Jx45@|&>kK9>hTgkhRwk8$Zyo3hi#pLL)hqQC^TN&zs=h7^!U8S> z(T|gQSK~$v^5^m#Nyay*eL5&Skv*%hKF%NlAoMvx*`SIthN`9$Sc*o*_3olEI(ux) ze31I_*3)~w)Hz2&f%YZ2#OAjkFz&4gnb~^jV{-p%gIqZPN+r4MQ`7~kAtz%oW~!}> zu_XLl?#_?m$}iaaGw2@ppLV`A1-3a55x5SnN7;3ZnbsWCGQrV2(>5YOeb*dMr%Vzhc~(6q`Y z%F-vX?bByY{G^Y*OA>5*VNI!xM%Ld=21&u=54z7@@IgPp`S}Cbln0=44c68bIh^(tkUUik;65G|a40CuUS2H;~GSoDIE?y)$t>tWaA_v-87`({sHT zJQy$W2p0qiM<}q3@A+Tjzn6?<&%*WTd}FvC!N`ff9j=dBmTXALe`2pGmQrO{KwSl- z@;t7BBu4KMjLo4*9|%oxp6ST!n!FOfJrOe!dg*PkHLdQF$&uh4_ZB&+KM@O5!ysyy z<3IU;a`!-H<`ZSR2;o}!BZeBged)^w#Sm6B%R!| zFV0ml%BO2lAc$%|W-6NC9EYJ_$CN}v&74Ve>ETvR>_*VnQ&*5Tx5%led%A+G8swT8 zz&LN_XlB}lG}4BM6w3kUO{zAIQVp>|PR_f!-!zAAs&W>q*^a9c6T;nN z7^C|%69(b3A8n0eU9BZ(XvfLzj1aQ&Wp>>7pbsOaVlT$c?nOqC_Vm2NZW|8%C7u(m z?Y`i9h4^mL8geR=^5F2&ucYo^k)g9r`1XBmH?3xmuYpn(N)o0(;?dkdn(M#h2#txcU9Es|vhy0gh(fq)H{o64ZR|Mh zcLh-gLepoardDIg@K0@yP}cQcX;2zdX76kgRm6PXDSiw^;{xa;d4^oGQkAr{hn_{v+RZ5N|IhI6TBva zZ@(pWXYFodjrEt;?zFf~A@3I5CWD8>b_<~|?t_H~#!|*YC%<-8o5KT5Th50(>`NIu zK8W#^-cBy-xyNcf-tMj@;ythmo7{_0DTMSfko#uTf_6U?*e4t&zV02&O`L^Z}E$9M&m%jK6_R zO>(~`kyupvwID`=pz^^O|Ec0T6thFYQZPZZ`MtCIY_$g={Nw(dusLtt^Y8*bzg7>U zGGBiojQTMM33;{3_KQsNYSRyW+`(9+xjStWA0_?{@H7Ij1XVj+_{sf$v~pRx}Qe}TFK5l~OpBK2-r2O(uhnVx0zU`hl>-Qok( z5j-A2^%F?#(Fh`b1yPQ|=)-#a;91cbH7P9;E&|H!Y-c%F%H;j1zZ`*85Sm(p9}dNM zF+d!79|jrP-Hl7@$8(&D?uQQOT*+a+cCue?f)^bLQGN>)JEZ~5-O{Xga|i31b1baz zUrU~Qnu@TCZI230o5C=3X2#*qju5>&e!?jpcnOEho7PR0r(i6$GxRe-xdYzbVpIzu zfx$B$d_fsp05A~AmD@b4HP_`;17}ko3`3G1TC^Y=8I7#Ii@}3I*8esh>g)h|D6+(O zdTwDG@G?^~raHWfA(z1C?|2uv?li2jmpTlqa7?!8dxA_R(X3aMe zG-idJA3HyO##Qfte(R{{dJnIQQ#P$l9`8pX!vHspp|EP?!pf8YH%*c$u*-LnsxS2C zI*Qwonyv?wkS$Q*~BjK2Nx#w=1k)xApRMBwkY>iI+-f_i!mFo5Ncf#ZTGCxlLR=&q* zs9moNONE=tprQUKfAXC3`|uWW20@1&c<<-^uR5n-#4=oVl#5>eZ3P!bdS@ljrPgUX ziip_I*;df0zqiGAT#nL2nwwz0ls5^lUtv}F0;RdGL zjI2)KqU+>lWGxSIKv;WVWmU;VQ~EyI&x#v{q5^XR)>`Q3jjG(KfiBqIvZPc!>gB^l z8MRW*BqyncH_!u9eFpN>OUcjS22Sx)y){SrI|vKzgdT2^)56a+UtGFGm9XKnP#aw2 zO1<$l-&fM}Mw8?X18d)%>y1w=KzJSx5Y`6>%fqJA$P_A*LYbz-d!ZfH;U137^u1EK zeApQin!S|QT9=R|Y}m`MK2dcqrF$(nLY-JQI@39zq%s=wX#M`aJOK@Q;{z!BW*?ZQ zyqcy&DPa?VFu|%iT&TrYp-@W`dNlFQtFU_xZy9}S>mysKM#1ZWOCkC=H!e&adu*Fr z_}DzkSK3KFr~c@GrHW}#oi2>`Eb|BGUmNvaJQXW#^Sx59?xE zY#Og@}CJpMMsb(Zg_=A@zaYKV`v%?)t&kjr*2iC@#{g`~_%jUJ&6ZdqLDPSSJ; zdzObARdX`d2Jmt1i1H>1y!)v3N8k0&)z%z=#q$xnl`j8*dB63-fM(m1ZWyFJmdyw~ip;!(cu{hqQ@yIpi)3W!Ox7ddo5i*$Mal!Bz4-42u`n)l)c`iwp8{K>`ljPB0w`LUX<0GLt@>8ELEr^`6(zDE(m`c z?+3I8p`gUZbB$|8o6iPY;ds43Jnx4zFjMawp%nd-O#g;wz$I7@l*&W!Lx4~*NHJbP z#w6I^t`|?#9I%Zg1X4GIU3L&RsBbQoV~eRl{NQJuJ~bNkeq}H1h}kFIzx$eGA+eDk zfA`Y&u7d_dL@^8B9vr5R;WO3;y~(%mEZ-#8mY_~d%`pgYDl&o~Fq=;aTXG2dcVl{} zNuBE!tikEwL5UozK?QqJwmq4?&r&Eqc(8kY_=Zb~{Li;DLCz&}kgQ{Ik6pGLSr%2L zTfNLvp-&L{RrF#whf+>Hwg!?#KeU+?9WK=-0uG-uDf>VefM0-l@**Ed$-nsaU#Ndd zG$~rK^z6+or5EOYyzPB|`xjpp!%~f02Bwd8AJu3`zc^O@1hdbvF~jAKRZ;6gtzDuc zVRzSXG?idZbxfAAJXaP0j_~gZ(H@R{!?*!ms^-KZGE4EpJ;pD-ueDkDIG!Use~Glp zCo#2eul-$i@EK(NZv=9URy}Vtlv%GIq4;bDKgc^ovUIwY*Wb*uSqjRS07O*4fEnin z46y9Hi07FN1>%~!&dP1EuYuhU_nx}K3aWbClxu0w-u~|F5jVJJ%&kQ4dV9_I^} z=R3SJ_T~y?^6fWJ68ypJlof{!?lj9O9ezwD)@6wn`6bl+JXJYE+`9i!{h3mP4VCbaXUT)h<{jIucH(Zxgw%sEm-nNHzY z^P`NMORQaFQsU(ZNzOp7%29o|#CPt_6r9c*?2{V&k@4ht&b_lad4X2>cNSyB0v02n zMv=@EEwwi?Leaue1XEHR&9xdD2YP^TG@ylRt4^xaAO zZG@s-!W3#A_O1=er~k1g@U1?VV&O|vJ6^+=k;GIWw@ErX`ac8<@Z@S8F6U-~&lH1( z2d=a~AqfRNz-9(H>lYu+?xOOjNpYH((<7;^BF>$SaZ`Krg5k&u`FQ-o*O28R1S_3@ zJgi+O(_Vd_*`a&e_Dcr&+I8mm5UE0~j>IF>@4K8WX5e>CQ;N#|;Rz`qJVh~<=tn2U z@ezX{3c-i5yLURfGl>;0n^gAvoK%lf{r3$T_c=Wh&@l{I%_G#Oay3!8LHmnLwqRcm z)Y2WzM#?*Jx`%)wn%N^J{wNkv<#V2EQ>{3RA;egwa6u>hY?bf5C)xB+y};=^no!`_7%V{}OP`Ew~DEd_)4{oxnQ(?TCU;cjNQW zfXD5_8z=0-+BWX_`6h+6V~Nk3hAD<=6j%W$c8I5XuQM#&SoCCK=&0N*Wi&$X#&BqP zaJ~>Eb+0oBd+Q@!9n0&4SxZ0q@b!7Oao_F>SoqeE#-c-Z_yvEU~mzQ7xisR>-s0bw>CvM7MnqC?nw>I_RQP-P3# zqDa{O7VF$qPrSCgC7W+|oQBgFEVyqimOvj*`#B+T3kO+verTvUDLAB%{PuNY=|Ya!QilFDQZ+IV zHx!3$2@*6MGMa&6BjgHtv0fiZMWa2DWt)=<92@W$)qHk0E+*(xt;^qA*B3gnqM(}1 z?w06TFnjEJ0DY|788DiKpsH1s6=q=4E*hKr`GGGeR9<4 z6!X+wdAGVAA6>r&aTdE$aWW>KVd5?_cDITU@z}UUBO+t`>*5bR15CTfO{TFbPt;Cp z7Guc^bdazhR)ye)o4f7DeU-#plxLC|cpAG~sArofCOn`+Vqi?LQ3;z)AA4BlDe8E# zwv*%DCe5yfY&PdwLRHsn)j}=OgjqMK%NerQoNF}8UwqeDmM`fIg^x&Pd027~=NhGJ zuCx0{4cn&F>KEVIznQ7;=)HT!dw%hGC{SI>#N`WGIlDG7Q~T(>5^QLU>g+R1v{W$b z(3@^|GIk-1g@{H#e~0I)G)F>Do;svlPCDU(iEc!zOGM9tj}evil~Q2=&bhB@)~T4- zn(}=vVoNqyr-zOP;v`EFh0GdDYE#-+PmQtBr6-tt(_*d+b@DGlXsIJQFjOS905&f7a6ypSklkBvp= zZm6}L^vM@CQ&D=fISBq`Cg~7qzk?m8r-RSaoUwx7cM?YJY-)6!bGEqDY1WYGy2Q6E zqUqeebzw)H_^r%f?yR=*j+~u%8y&=PF~?vElG^`jF#E55v;TTDA*T&2VBojQJT5;e zijl?nVk6D%S_Wg3(x?RU`jjMRY*4`=Y)mWh9BZ;JHX@RCdR1LPBm3+HBcq|M&T#D=zU&azDE=>6qi@BU~l zAD;dw-9=8!$3;E%a@}BdZftAS!F1Ij%ZnH-2l}Csm%G%GGLljim*T_dU;RXVvBB+- znGtdoq-w8?`<%ZNT2cSz;~b%=Ij3G0`a8F~oAFZ7+ZLP|^8_I@OqgD~6;hLNY9EGwk^c0Il%P(y9Pw0Y>7IySb2bCFflaogO_q2YQg zCT+$DOjb;&nvJ=`2^E>nElIySbhVR)(H*4AdKEe;UyU#c@E8lwq5tK%)Z=eSoUu>XKZ-e9y9~TTjN4YK^s)>Gy@% zt9`bA=je9c$A+Ha*qA1%#RNQu1r>PPc62j}hgZ$XsrjqT(l{r2Iz2;YvW)K!f7sML zq1Kdeb-*M38U(9<UU=ip zkGPSwGR8yA)n(^%<7Y-~tT_5`3{Eg{0C@t^!AM-T!aBo&WhK zBft2%nmO>2$_ps(e@~+P|6j)ccUL1VmKtwow%Nm_r8FSV>GEV+s%?hU9>w&iy=f}M zb;D$;ZHLL&23q3f$DD{{J@xva%k8qeUX&-GfAZ!Ay?YNE z;1I1V96uBr^XDXHXb<^wC@@9qLx;iG;ZSMo`jW;Zy+neZK%s9(uipi~tm9qx>`jAzJ8@0L|XON|`2U@G7O8RVKg)SupOyE_JTdXxYh)_ab3oTMk-a_ca^ALEcrOsP2 zqW{X)e5t)!QaSs!8^h%CW6Ol6mk*n%)9iMIr<~vJJ5*<-abIm9eX*0VTR5BAgFAA0 zWs*BVCkkmW6ff|!bJ+DpQ{}mrn%aW1GA7_u{$-6c9Ap)Yto(R*9LUWe{?gV8gA` z$0|BQp|^7DwP&01?sT&Vn)Y1{ncsXXJ~M2ML%O?GNw!~>F_w;^OS0#_oi-f)FtdKr z!|U(89s%}Ss-9fvQ@pWB^QGdg9R<{t45Ju)MVZaV@j*#^<9M;Zl(e~DO=8E%gt~$N zzDD&$lV>lv!T7!77)Aaw$iZgWm3EbQYV!A{1N~EjE8HX<<&Fwpur#2*(o9%^?A^J* z=%aO7Z=_dJkK-Q2XyW-g2iY_^0j1n?`PlW9g1Xu&UT*weh#132QTuq4i|45Wvqsq= zO*N+ZhaVf)83n%K8`<|z;_@^U3Be1CCiKn3fqCpj)bs4x4JYR0wKXg52KSkh$FP#h zUF0W2gZpx3i~X1PS+-2p;cxeJ=p$X>hp>Gw#<6Ovut6Wa@-taaN3{i|ZO1Mje(++- zSxrE+_%`f}&oGjt!9f?>9KkNmgmLacYNOqM7sXN!lmwfZkL;@y{`T$KwkwCflb_>Q z2BOh~iCvcoE`$jqjHXu&%e6OdSF3pki*~%IPRb!^zj@WQ)spYl)7LPfh})tOGBd3m zu9&P!?mI?$EIm&3ca*-IX;YuOXT89Mv%}t)zMCz{~I~k^TBXE0h`@K3-wh$_} zo+)W`c`0cgMZJ1Q@pPXlQQXMDfSioSh2Wy{9^{OmR-trPg?@-#nUn!2h{np!~7cD!{IIbsM;c^$_Z%`5_9Ht?&x}lXiu7bc`@PowEz?|z0<~WAF zqle)lx1QUO=56mt?fW^fVQuR9g6D-cE8iH~Q%2+$K=Xagn9=(UvHHzY!zJ`R#iO`K z+vX&@?S5X~)TC;1tH##;)6cVRNlO`~ip`woOW*{}EeL}q{(^AoW$M78d;MmXZLM$g z#5S+f+SD-hbU%h+SfZai-`)3|eeXD9obyit!>l#eTyY%QtedJ` z{9?TjKV7xoI)%?M_|A)?%|UwRf|DfZmIg5`nDp3fWX=@V{izb?7@e&J1Wk;3daiY^+ix!Y z8sPxDUo8(XY;6^nda`NqRUY>~omz>c!kLk`p&huh zN4m!K5gXbGkeha(gpCcc0u@EX1e@Uh#|A3au`Yv(Q{&vdxKg}Al=%rH?`|vZUa2fl zIRT~-igj@QrpaRV4{fFrVS1uH>=t_2F1b>5=9s!qn&h6dQpUk%+k$+b;_F`SPf5{T zbr+8xH&IDC^)MpO52>f{=Mmg0aE->A1245RTYb@=vR#S}M5>238TIz%OBxK0KpyvP zyv+82X8Qzqc|xxEdKrm@-RN3&0wHa{AAkZ1msub{y4MSG&Q=#(VM$SilsnLgssX{( z7cqW_-~b0J)9wXH)4tmZTM1a$_~*&|J2WUwx|S7DjL4rgt@AaIHG=Ad$Ca0r+rD|J z68~b)rHhI%V^|vJI`)7j>MpZ?fM0KSDwu2oq$9>0T#i9$ax%i zdl-QnFgyGv4gQ4z$aqjDA&ZLd-7UUZUzW76B$cJVP%Nr$chTWy)2#00LYOS7gyZzV zofSqkl<7zlhD4ej6pmp9-rD};bRXpMC*LE!y58kGdKa$y6vK*WN5P31$QXv7xw1)W zgKB&b0_IO*$5!up2iDgI>C7_k_3-Qq+*B#x=Xl2UGM(BYUi7RQ0CeDmB79wv&w|~v zntCdZ21B!eBMsq3ef{+WRN0t_Kta2F%eI;8Cn65PA{ewlKUxINfH9sb;YS>!IPT?` z$_GgXM7cHs_)*Skz`aH$FHl|F%`h}PU0$@`@Tq^0kgH}rHET*WS18P8KnuMM-+Cq%z1G6xGuqalO7~hF=pDj;Rw!ksm$w770+jSprRv7 zDVJmLb#4$}#55sxg`~t<8gk8`% z#rq>kDjaoJj)`P2Ug3(=F{&~bB%%yn2W~?`Jcbs8)XcpSgeMiw+x&SjY@?AtM zu!MuA3B;|&2eR~qissi!s-g>%;!mWXLWsaFzopp0H@wV!Ni%L=4wj&c3|x6!y(rfo z|0$*lese9)0Wn7$V07J{7;paD4^RJFdq-YF&Xd#8%gt=i_Ioef$Px2IHW&kG!vJ;{ z*xHpLz*a68w$!q@DWi_TG8w2g)2y=`^FH;^e50OD%YFJ)Qhiq*!?JM7u2J|*#Ujmh z@LHsLRQ0T?2oK&UVQ%$TjFmr&JX!Kpu9OgUocLK5RgQJQO-Ha3esiHf(v}BMxi%{* z#2HeXOk3v#jA$z%Zunu8OV;QWujx6#P^f9|xB6E~Gujv}Sh>(H7*hkm{L~>(nTE+8 zo#EISy8RHVOj=k8v&h~Hi#sEveIxIoXb$Y7Itah#HJ^g81mZn_CofH;LX!uQ#c3YN z3JL6b2DV@=;h9pOkHp?HwJGbeRp)ICGE#iKXYhr+{_}7JxCDEXN<7H-sX1ZzP}GJs;}Jl_+XnfFJryI>m{t+7;H^8Iy+|vAz`cPD-qR9Abk^2f_7Yx$Fx-#}~(vUHHwl@H7j+Qp1sOc2U<# z1e6ieuDVuBQ$w5|$INslD7YJJTm-L$R^`q0I^M$;8(E2SU7i$Eo)-7rjJXy&x2<(r zdL+@scQtimS8kTB3uf=TXIlY^ml)@@MeKI)frC>#xvmyNm64m}Sdd8rukGnu_}f`gETEw}ycepKT+q-P&p;J8{j?-1LNNtC*Gs=rWN zOH5v>T*hnvG1r$jnx5pZgW+g1ySsQ6>%@?#=C_Yf2@0fys-(xZ_k_G z1zQ2g>M!E5*n2}wulbDRO>Z7IGqWlIq>*iZb}0S9wyhIX!sat8+%;qfrm<6?FgW@bQFeW%%ZOwY$y?NG0~&1?nnGti}MjPsTM&8Jclb-pG#{T>M>u#%ui^ zko4mf?nYL}ZQg8OnmH{N1o;&VBR8kpGL&Qd$1+(pBg{zc=CIaP->PICL z7Wq7T)-452pKx}tSeWzGFqTdVhp?0>zgE^HgQwa65Yt#Fq?2n~Oax{dt1$-{zf{}MAP7616- z;pqhXJ!>ijkElYhIUAh`VtlDU0AbDxC4UgYZ^ zvZw?%LMrDjb61q#n+Xf&BUb3ow~`Hw&JK^?&k8h)+AXH$a~uGg{`3a_Q;&;uncc#S zkD`t6h*-NAs>HNnttz{Hptjq&z4o37_jYJj9s;&%pk7d!5x7G|rTHg35LazXlqnw} z?z+0`h)`;3)~fL9{9L05Pjl{*rJqEMc0?RomTNv%5?%Z=d4)3b@?NMpb;d zpgXVg%7}!^X{YDNLj@EAjrs&4h}*KYiE z5jjcupcvY?5|g+<(}%tgGwU|m1xw`E&#h^?GU-YF&Do*5(ul6|c2=Q-&(l+bGozn5 z156KrbA@x?0&6{M>cVlWivP{kqRd;IaqRl*cxw#<2rS_+QEsdJta8Q-f*WZep0Em+ z;%QT}^=c!kVQhUK^^rt^WyN|fmnqCZx3_4@Q>-UvY>@lu1O*$`V21!bxwrsoUKc&7 zGSt_&^YJI>=AJkd5R?-^?HrzUKf}9>8bf1qWor#J9>j2uP)$A31={kdW>~&Fv|J^+<B)Q1@|(A5 zs|9J5$0!!}A_`qK(fx%!?IPcce2kR5Ys#u^TbfVg z7vfB3-J|%UFXi8Vo5x7c*@bVTm@aiJsbX-Q`$igXm7vo5BKqQP z)w~^grg{WK(?DRqE+yDGoE}DVQ%HwjFv_yFV&ywsDrv}YZ6FjK-Hr)8ysvMcDa46? z{0=*X`6$*uDjP#GVG0w77?l3j3E0fThm4Q&Z9*?x>~cLThloP;y}!9mnRigjmo8vx zj4oZKbzGdkJ8(Af{K}^|*B~i_s1XR}anVlSbzs2>s_z(0&mQ$aRzxO?WNSHM_|`Bx z)#`P;Rj0d{A;nM%z)AqG%}XWPduUu2Icajw{6i)HOwL*z4XmI8oQ(t+j$X zHx#Vei|P*VQK>p>{vw{<8nHXb)6A)gE_ITFWVtamFC7h?YN#Gy_p3LF>U-GuKAbtR zBSG)YaBlT+Vy7%B1C!ff1y6=cvs1EcC8s*<%#;OOQnPOn^rPzaw#CF@K2Geh(~!W| z&^xTIPQ<7_dUYMK@o=!s%T2CCYZXV-zh{3P8i!$Ms7#X7ZyLN(?e$29t-#wsWO5$& zXWq4Q>aO?U7qE?}XFrmC@l|@^%}UmOotra1@k%h}C{nJgq8`y|)gDaFGw8N zB9n~!muHc-xfn8|m60QnvecU7!Tw7Bnh`zR*;bSNwzRZ29y!@FV$Iv5KB~{vFusxp zt25UZOV&-ka4}*!TMRe+=uR=u)EX$sVs36e>~;sU)e9AH$KwPq)1b z4RtuNgMkPDyYO%SsrG+pu4nf5oU;Afy86Qi`#&%PLj4as{{H)Aba^{mdQaf;{D%Og zjoz{Rxwovz{Qlfn_8{(XdSmNwQJahm8NN2eslFTDcjD6zf0J#r%EB zP6|lD=zw4_0%u)mAN2HHYq06h4UXfbI6Rm`2)t;bn6$P^jH#lpT(3xP@mTNgL+sz` z*{Me~N$uU$ zGgn51Gr>KiU_4rfb5j%-lv{np>?-pMj4KD4jE?b*)}}Y%_sfC=d(&OLmL(6~-A~jJ z4Mf{v=?dCrwuoRts5tpu(j}Qy=h2^)L3=lm!t;%gn^hCc6oIHzPB_D6uPe`|RU%#P z$kNQmV*o04j?oE_In+VIn0f^(lG?PAC!_bm=&?heLQm)0)%|Z2kfh;rmlkzkOgQkX zZxV!_e&6tjVe*!d_L(TeNo#77%!=(%j%b#=>GiWa@?+n4h@%~j1*Lb2bI_O=lYal1 zEX^`Ncck@`4Q zJqPndr)Q7*t*xVZuZ3=3y(E$-6Oeic(EH)-oh|ifMoJs~Dmh^;*>PAf0&0f*CjLa= zaBH=tgPQ8#`v^c59YrqUqJX@?MhGo6*LEN)!H8j09;{UT^4a9tRrs;{d^=zy-RO{j zAR}kugkooVWYba;+O*ZqxLc%8aSlB;rj-rj(-nl&G$h3EFGC)vJ;lFO2FKXYK!9)K zbgh;f`t4xPiSwMdA(7wlWg17B>kJ1bu9q=EJNxudf{*vr>(~T~MJdC|_qvZWtoXz; zZW89~NoU#X;QzRv!r+Xfl`)Fc2FBx4KJlYyQe^L?H%$LR+ zWhFuO{7QmlReRp=(o^=VoNEGL^5Cb%Q-4nR6WOpzVy*;N%V7NX*u_0^d7$oJ{msRu zNe8`g(X?QcCz~hSxg}PU+A2D%bxg8FYN#83F0UB&s~6(yF}*&$Sj(y^s;|gQ;gPY3 zQ*C(L+N2}sdCb6B_>RzSZNc>S1sg=u0rF|!9RDryT4^tsDz?A5Ks$FsdKH!Tm0lek zw!O*12h}VuvVDwC{PA5ntI*u z!5=!+SgfjXS-aLdSc(dBl5$^AEII*lY)U$@=4!exJIkYRrXgWaTH)O7jn5w2PS#tW zfKi^H!+OQ~0%A7Lpqg(!gQQvW`8%a4(vc9kn*hD`?%(BCL!yYCmCdSho`r z&<$jCkgqWW1|8k&ZOiv%&S3_j%f0vo-VB~~**3gczWP92m{ zSP=NwF(Y2G*VEnofC<-N6t|A{4l^)92K?U>bxW_E8}0(q0ITxjmnCiHF?>7<^;Y|Q zWuIo7Ln>ZRzwy1lU}OVqf;~M!Rb}mN&up`jst#*Ozx^=!+|+f^iU#i3w@;MJa7&`l zxovBnsHfnZM}tJH1BNxZLQAv5X|i5+i!;{3+jph7-_LmSu3lpKqWMlsslN5CQh4lS z;Ze>5?oKN}WSfx+iMv}k&nCT2C@+g{*^>d}i(+hKBXrM5);Rz%1=Lyz>eb&Y;y<4W z4Fh2Bn|Bqm<5(UvM7xH2z_}%JOOd!rQR7}n7({%Fr3@z=!IzL&6mq-Zm?2ZSZNsTb zmQKHufO={%U)5E1QJZA&{xc4g|BY}>|2WQ0cK4unlf%kN>kQn`<;gyojK_v?XlE*o z03z~9R z>k~(Q1lM=$II%?*S&Do3n`@TPk8hX(O9VQ@&7#!KO&6Dm)!hKL|A(HP=$t&BK`pZX z)FyDP-6P+{D|@WG!1;=f+m*>eO+KLyIj~I+&V%8BUQ2d%w|Z0ea&2Xw``IdowRp85 z3q1njBW`Gt6rr9#^&_jYz*(CebzYP7NT|$UXMjp5Rg%E$xX`|0PXb&h`f2se-P7yT zwU}uhv0h`)jrDSL>PptgN!uP2j}+Y+Iei*Z(^m$%7~eWSr!}i3r-H=rMR6mz0yM|d zl&OSJat0!f9?8@E42xm;87KOb{7lhizB?gdWaZr<#jW66AcS^-t+H?^m;+T;gMernEvW-P}O0I2S=*Q}q~jAmXbEky2uI4~&U~0+cxpQebezm?V{v>54cighAM@2!(p$8Y&qt0~{)Ar*|~V~TCC zJ&ig6n=lYMcde~4P3o%q6!(WpFD*{HEEeb3GxSB1%jAWc#UWSzyqGs|9cMXiwle}7 zSgSeyT}DSyv<>k*w^g_Pox^9uv%K=eBbgBm-4qMJ&Kaam3tweZ;^(eCzmmaX8G}-Wc}lD(@bc!COW1UC;meYBAW=gDWIf(^B)om1e9< zEL47`E4yfg7JNf)ySq%+<7hIJr4^z>K_AA1T;i^$fVElQT~1zj$a>|*<6n2G?crlphb*<0CC5ropDuBoQ$3XUj{@jF_3iS;#0}~P zeXI{2HNJ8-BY%|Q=o;wTs`ecH`A@n_Kci>}Z^boF$Z#y2i;q;C2|=8G=-`-JP}iXw zUix$Qmm++_MFu(1Lp_(KA=);uW6MLY7SB+GmW$rBD~N}Lc?-=m(-Sl4D1p!gkh+|UM_#joQPUYF&nV!cL-i=$c|gBCZ2j2&iC@F*pohZ z%P03Z|1=t+DYBg;aYFD0qlnsG?sInO+V%};QS#z`)yUOYdy-20MR%&RwCLkIS9F7s z=e}(cxpZJTNd0^+!buPehln#WtWRimQgY+gTQKI!Bl;ts;W_}gdwPx;!oE`pJ~}6h zinS-+=72#!Kb!~&03D2r=9kz}45|@)G#-p|u6x;&f><(49x~*Sf{;bPFL0j{I0^Me z7J(+H0XHg3bhf{(+E9Ew%vtKgPLBM~^6-j%Px=V1smK*Ho2H!VJr@AgVpsQ0>(s8s zn2~|2Yf#;ha`PYKyL2ABe=Ow}j-->BAsbhHLulC@nWsoU0z@Vs*Jq{cecR31HUZIx z)6ZAD^NH-xu=<)>E}&Qe0%LmEW`aVJ~}v85=&s8Y^lR zl+%mf@Dk0)l#nVotR=KZLl)K5pfgZTU^PcJ&rO`iM4KU$U0y`l8oSJ%>ASgQzP0;# z?CJMQ?Y=-e>eOJlhH0znKn8WomD{~wCZ?idRQ$EKhS|FLF-MILKnb%4H$}<;#7ajp zJKYAk_J~a*vEMY9f|*j`#Oi?|A|2W!bXt+zAtOF)kntvXl{98NwY5*Y8vV=L204dg zCR>e`v52k0wmh6jhg`!vxreLwa%8vbmVWpJ#CZO85=@2mBMDlA3Plh4@ixFGaJ}Th zQ1CNk%&&i(JaXPcK0K|UB*frl%}e|F#IT%*)!LZ#a(#S*Jv$T}iJhYq7po^`%=i1<^S2ZH;tO@k=Bb3G0y4&r0Xt6ye=Gofcx&@&31|y_ z4tuu||K^Qe*b&Y~%6HZ~;PGLfPe@oX?3A0UK__@Gx2&7j2Dk7yC4GFL*}@|VBt{3o z7g>!F;?!fP@RopM8|E|>dUfbSkyeD(fo=I5cEThp2iA;J#H~h`lQ(a(a2#=Wd;^4H zSw;1r@nx_a=^F5MKAWtH@GUg5%oI^*si&KlelmzVmvzaW1SVN@5U6FqMCc;R8o{P9 zFxDjpvk(RPyC$cMUhTq924cT>p1@@o z(~h>4zF1ynvR^7~vOK=$&~L7qm{;gS+z@}${F$m`rEI^7W%)muL4ni-xt^ z*_8Gl(H5p7qUNcZROrBEERc@K8OHj6j97znPs|sUT6n6oE;;HACiv^&U1}z3O|6nR z_zhW9BGw!Hjf^(69Y*g!Cmc2Mdoz;pj@<3&VP#SDe%h%jp|GT25n0eTDhpCYtGVhw zP_KY9AXjt)Y*l&C>8w0JUWItz-y&E|6YMnXeV_uoHnF;M7mN}9f6F5GqTwu3Q-d+P zp<5BrCM4;)Ar^7R15#3sUrXS**A_X`b{P+QO9ivwsR;(ii0H@Rv%1jr?Il29paf|F z*90G(5Q(#cpWS2Q9kT*?l}r8z4jput`X(5t@kqMzp<~BySM^kcJ${xE-F8BOTPD9iM|?3^3JfQppNo5<1*YWwB+GGG(oEZ|UJ>RsOp`hm5kdrA+7FL=9oEjytPjta6 z{{gyHDubK6VW028rYduc+aGamfd{e?bPf5OgW}wBMaSEDzGZ5MoR^x?49>ru^NiMU zSwoL~ao>Y0UxA5_5qNlpSi6~VEF&$1t{h!Gu75D~!K@Tl{<~g_2bOutt5U?}Lv<49 z5`2St5BxvJz>j1)f3_Z3&A+y-H&uC=wDG0G3R{Q-Rc?p<=NVS+Ezx~qHIS0~S)jW*X6tuwjS6i2=Dl7LDCy9~sSrs)e=FKfEG9xpdQqbDCj#Di8l?j53|A-e< zLPm1LWb8$ra@EsJV{-GJS6iYGOfH>}N^V3ajo%s&iRtStqNzG1Y87l*b(937U7)Fi zc_8?YOD1nLTcNi~|K#IGD=FxGf09@@Jnq4q(c--aVxVx^wDwp?5k(LCd z#UiUOv`e$9_r_HUz;nHbVTEFFG(EV~-9YOf8zNUQdFO^~Y>kdT4%$6`MbMpdLlcC6 z+JCj43&?Ch2Ixfp0uD*a>!p9CymJ5ka?%;*djPpkrtWhgL`}RB??}J-lv9#-ZeZzV z___2e4^1TWP*H-3TblKIRfs3x%miHgyrFWGN0{uHP(xmQwP>t5lC&WR#KktEJaFG6 zakM(*E0zrB0ij7?J*k{5J&bW>>Lggcd)X|L#Yg0AKAm-I>n!#1v`jC)4#9cQ+l>A` z(dNw*Dz{NsQnU_>hn;(~HY8~pnIZ#DQ#ns_einiyPQrR<6I*ht1hUm&qy^6)K_lgU`^wwco{%bqA`tdl7#`DFv$xe^c5%_`N=S4ucpbGNHHu4&B zornE>FvUm6qh%QEj0%0L#a^xWUA^@Vok10oO#-0HcFRuA3>RmdNSx-;Z~+E`9pg@2 z3))iNV^)lwFtf zln(4Oj?Q1#$e%z~QOGNX_Ers^BIw!s`o?UN6y1s~fq`BNh^DFU8HK|LnpAF5kNhfB z*5XZ)%g-&>CST)<<&|(x>(4IrN;y!cW6W!@AEK_^=ShnD z02RfTqFHS+vXlaj!;td@xEO7g&Cl$cy$KZ;Yy-T;*MCQqY4V}V{jlJpNpJnRoj3!tl76*@wDD$h@E)_-;e~pyN`L& z@D3Gm4$!6>qFpNd5*wYT(3g2}19xH;DQHa&_A49 zcRAm$~I;wq4@7 z8fW&99Pp$ky=Zz9HFz%<5-`XD-KN4gkU))ygPd_$4Q$3g(rYVF_9PF-s1Y2yXXtD| zhc$t-TA=K-277SqDnVCw^TC$G|18aahG3Z60-VZTbr!vyyCpB{1MXoCD`Cz3^wvBm zOho#h{K2k*pnscHBjJXY#@fuxi@xCL8T{FJiSOLgX9KE-o;75evZKI}0{Vj_yyeaK ziwmO^&;5mOn`$B6>Tw~}0I0i2Xtxky|7rPny=4}K+Z&;cDkH7;Ju567;fAm;r#;~n zz(vcV!oe4vVbMBUp^5yeyD~2Xx3-(lxOs>QoU4Bt_8x$xDEN**_M2TW@GLv7bBx_o z;mI=O3o8;AWz?$*FI4wm+h<$2_=8V3N*j?ab&>hw_$!wRq<`B#=UNXW^hLA<65=oO zsdVu^`YPc0=(uY#oxJSk&Jh(Z@gV zpqxLxG@DXBQzlk&!TZ)?;Wi2y`*jp^hw~tX5&qT2P$(g3{+A%0tH;7MDu4eu+t6p8 z=wx2ao_XS=j4JDBJ3OJLJXtw;Wk&KI_mQ2H{nj?;e*82vmOH=Mc>fR#NN3SoHO-kk zsTI!U2uYVR*W}pGJO(=pUY|{+di}f_SbLEh63|Z#;Aw?2!w7LzH4XKiLKBH37pb|= z&Vvbcde3@Bg|<{?ALTMH{@mBVGq~EW+cr$grU}_0P^SI&Zr9d$_NE5cnLR{8_eE~Q z*AxH$M5%&T?TU5Xqt;DbqnGC-<#h~dR1dcRXU3 z3>_}RdCak}#ad!0pKBH(UX|8Gyx{G06WUon4dO#E$$;@s&5%d@1~0ORXr!CkTW^Z!<$} zG~^y$SGSDylZG)SSZ$HYIva!pvW)lIUbpN|8^#;Q*KUZt{&ep-F6uC7{N9#DwH#bS zwEl08X(%E`7klRiJa%I(lO~1Iem5YqD5V`2(m(xDcApwEDKdW(LE*{;^rJ#FQ=(%X zp4jlPpFQSz)H<7umy)s#JnsHR>*S4SC9!k)xeq+ePyan~*O!_-SWSlLRv8IbJCi|g z%hh(dMe3rI$q5H70pq7OHoL8EhL%&}$6E(6k|sLBg`Qqghb76C zVMdMq$dy4VI3~tR-dJAA#NM3gaa$`n7pfR$j;#Ntw6*fUr5g-!$YWjF5`8_HteBspZkUNN7w6T@d{5Jf>+83pS;^#~@~&s-K2-yx6%fI} zIQt4yr>>Ubyl;ziy~({*n!Or?3GO0l=-^=|EJmC+U> zv!&W1R&6bd&(4Vk2PHU|#8E7;u--!ksL!Aw^MpMPF7OG+@a5PcIT+Q>%Qd~ZZ)+;v zxxJ&kyn4%>`|~9;$gi+L$m3n$RI?hOSxXT8TD`vbSvpid|D}FS2&e(ouQQ2EW-BhG z0aez6`;<^~uPoOldn|3P^XTU+(%z`pL)x~+ z{7M+)S7yANt3$l}&!&*~YzmmK&eredJeX*1u|XA zV3*^|(&pb>T$+!GRI(=49#h5?x7bpo5vM$1+biRvc#H>zQ8y6LOe>b z3u7s=!dzI^bR-kGNKne&{uOa&)$NhRL@Z^GYeU~jK=7kYq%V-=>ellxA3IuXRre1S zy|LCGyX~X&v+!!XQB}65`ChO`@8IH~NvZ_uos@;T=Gzfow_DsR+*OpfdAV-J%>I^K6;fPSxgvE;5ORt9y6lqr*|nVFOIK&*92 zD(kcK)-Mh9WA^!z z=PtkzU%4Te0ay!MrmmAGn!WIvRXq81=~VY(P+xq>1=On@j&I_JpkWQLHn=+ICQ0Iy zeYPYl-}caZGJ6ZHn!mq`61(FR+uU?)I2O>65cv8{2B2yPz+2q+n=sahS)+4&{L1!g zpREm|5-qzVTLQGI@4-H%&Ee}(I@9mgFb7k8NJ?WwosFViqhkj~!>^y)djPrgQ4vY8 z=!Wcg4ER|76W~6%vso#O2fd62p?$OCYr~yJ<*KnUI$bfj<=Tm-PUdmaC)AP5HSh+^ zK*3>^#7Bt3dU+^}&oEu@r|g}_76GFPM$**H{(w9Ub>ucy89l|L4X5dfyH5&T$nlR@R)Q;=z5Qh|)oRsoz{js#FSi!BB>W`QWReb(-+X z)3sZ5-r^jckAce+3u!WopH)T8#`wsbo6z53Pttf|IL-A4ZtilNClPQNe=O_$Y$-a~ zoi3;IjhO!v=Bxv&`hPB3uE6fNx>g!7(2ZIoux^nmAUE`$x$`%dZLB9^?W#Qq2wBki z;1_)qEYJ41D}466vAWq5$dmkO?#Rky;S*fPNvw11w2#ydWk!HKjg0G`!DrPF*prd; zv+3b$8v(&N1rml5eFt2=i65RM!I;o!_84{V4m;;AQu#9@Uc+ij5eLq-a@nd)K8neK ze-!kpBIS>XI(U)V9hxzA*pJ04V|h1^BV*SF2XFK zD0sO$vUMPIH$Y6!wN1p3lQ`FPQ*0SUZ1bqa_4p>~h4;&H)=3cEjXsLS@lz`-Fi!i| z)&1EXyj=N1k0%RrThR%2e#|EasRXH6)z|~h()K~|6C7RrFEYRGB4=tIu_qtVg&4ur zrM=}{IH$$c6CrJvO2HOZ0Y*A1?5^*vE9rr)EX@)xG%oW zZx-k@F!>2#1>Wn%WL~YRsh0SnaanQ2L-gl))f;O+#Uk$_mqTdl>?vp>I}q}POvRjG z^27m^pqKEOwWx^ZxWgtEeLmiTkFG0&Iyca^@!G%k%MB}R8jd(&?c!@&SXC1@{Y=o> z&_~WtETS8!LkH@qED(lOqH-)g?W$nC{&c<1V(-z`u8VxH*0*C02PZZ9m>k`@i(EaM zl08$Sm}-TMaoid7Tr^y%vZPS<+}c&H14#bAxl_iYJ1#i)Gij@JDDxPZy+w5GXl2u{ zaZgRaIY}e5BUqm&r02R3M2_vTF2%P8LJaJ2x;DyI=SD|L78<{S0tt8l9dq*)CQ<9n z=dKJEX7^UOiLWfWi=VVb*sICC9kVprGismz&ye>gsM&#|TM=A)F9~a}y*tsrRjh_T zW;*lz<)?nW=@*F4L_xJlJ}JOyNv|d@kk0~`xl9wEeP>IuVguo4Q2Y-Wwfq2T+MMX% zSpIi>>7SV%coL*DY*25fV%ha<3f?Vr9;L(Ner9Ubd&54K9NvxBRau_C`1k^lN5W+a2H-5SRcmk zs?z<y*glY)YCTtZyjkUtjg^T^z*Q76Q%|M=_e$#Y!` zSX{F}ajMeJ@}nox>UyOTS~YLoxAa))+s{pA+ul7d7|B~_Jpu98V1==6(I#3CqF2yK zMduGt8Zz=fpvr5Ivknh-9>?}59)E1=j|}>+7yN(9{;q{M3SVYuR2lqGtO&#>J*azKTj3L}1XWyA3#_J?Zr^rHEfC)z0=^`L z9a_csp2FmBu6!fK>mos#c~!(aU@7oy@(k2T+(Fk4|0UDjnMn2jd!jFEOEMaF94YT@ zn>%^o%YL=mbXdWz=@JEQ2sQ-Q0mtfm#ag)>nX8#T4^OW+_p~OqJ1EvzV%0e^a&x(H zSS=t5U*8MCG|~`sR1{odYGrk^*R!z3EAVQ`cI&F$nR0!SdbngA;eG&LVTEzLlsg_p z*I*p9ddpL+IE#i;XXaOy)vw7$#vOuv<^g#yT`MNBzYvL=u>W`n9$~#qvHZh*yck2@ zJaNPSQ|62>r3m-!oopaM3;dp-OW0PtufB$U(i(~Ue;T47BdJK zB95>F!8$&g?!3^>mqy>O%&1s-E;25^<$!R4w*&sC8^_8MNJ|HZ9_SkVBt)qTRjg|f z!&?l=sb0u)ymcLn&M795iWt;oW=;@>+9~@rdoj*8^>#$1zgr*wPXYS3ZO#=Z#&`S^>aRA+XQTGSQSKaeXv5; zFPlqFBu^wQaxyU^b}|FxEa~0fgcFG(fLlyIO;%YskNnQGZC`O%&?*pn^y1U|B>uk5 zRC`heP8vtQ;GJgT?A_UBtKn@qeVX5@gnlN&$fZe_YgF;Zm<;>98p$^K!~w)_mJPcQBfxfuoby zZur8K&9Cr3Vw9$T(-i<)PX~T^Tl>IT*s;qZn}I21o9gqEfT{A_u=#6aGHr$gA&QcHs#fJhSZc%W;9uZp>=;vVHTW>=>hcSJub>!q^zcR_9> zTEryrA4v%44sbKdm=0~^IIBrlRrMmxC^gcIJD-lo{=^O5-B)9I%1*HaB1%v*s91Jy zCabq~7?)Ijf>V;?D!ccVLs|Zh@f1JD4chfLs|BxLpIo2|Z zK5s@mFTCR|QCNnbF=u)1H^cJ@GxhXq`gruN7CrLbDb)K{55iJY68WLA; zCv?<&zI*q^6UT~YbyhTOjYq#6OxIGr>QT_?kJi^~vKPK&=i9Vm@@$)&YHF(;#7gx> z;+@oD@ELy-G8E+>Hp)Lc_wPNOtaR?jtZQLmIqdz4C?sGGT+|3_L77m5i1Gib;-NhA zb0a>XNLw|i^sdFr^g47EqFhskMnUTUK}9%S1}8D4UB&M1{x;eFvav1n_#8TTe0no* zGY39vPm1*XlgwC#P;;Y5a9Q?THpaNC+;gmX7CoBBne33kyJ-4jAz(`a2j{3P7gcOv z_E+Z`qZ+H38vniSE*{6- zy6|rd{M^j1#!% zU>~hB8D5wZq&KfMG)eSC9o0e~KyK)RrCwsWK&gYTqy!cZr{5loQxv+@^sB38;JD`X zj0|X-HN@`_>=!rZ!4>AmxlYyg&X~G)-rX!2!`M&vmlbzqcpb@9JF@mVBIt;(?61iA zZd9krf9>`;j^`4yhsmIu2ex8wy>qDx%`-Ui`FYikncMIQ-S0=l*Yn^5f&&HQ%Qt$i zT8iFWu0HTG=XGH9sh6)ONviB0?6PupH$$5i_JQBJVi)srjVrg%@cB3K^U;w{w<7!w zAX#DRM~6G5irU-{wjJu~+>e*j7lb(8nk?L-Qt($H;eS32Zi7pz=W|rp?-}$sP~D=( zGwO5MrJpQ8^E%oYn0V&D5z{OAk|BBtazvYp>pBhm!M#^0N72i~8dEDnyHatp<48&|tMa==nuHX=nz6 zVRCnA(j8@>1Gk?PmQa;p-wp?ZjJKfX0ksH;O(VodtC3->kH<1Q%AD6S1T1tTM!7|((;x|V}O0+ zS_l#|GEzN_=EtLovDRZ6C*!(S-OS!yEi#bbr+#N#`9KI@u}8`|^9j3jDZ-^)LuXw! zipt{?w#S`zG^q<=8DLK@;mPNG7Wmd%eQCMW1^vepGs-4kZFu;DS{?|u8v~bGL-1~s zs^RoQ{x54D#rq&MZ7GKB4;&nF%MK2-^yf|c>1()g0M5Z=k`xH1OW|a*nEa`k42|dg z-F0O;bx8PunpmQ_cw<-ibKwKl5dV>X-5RlG-q)T)#?g=AWdE=BzB8!Fwe1!wHbjvC ziWsE`Mv5p+T12D>Vn7I?M?nybfCz}8#fC_bE>)UQQrbIzRke#^wsr@Zub4L??HO;gWMj=4Ir{eoTWt)~&-uTu zt4u)!U+{YfC~Ike6N6!mb4Ek~;4;2XaoNq=8xudee$s{4$n;C;?hH7yYb9l70TVbv z)&c~@Nc;d(r`cPq*8kN*D|UGIzV#^A>uL_hGc&m%tS|qnefYqaqT`+&#eGU!}!C#S!4RZBQ55p_0cd@M$4TAL4nS-7L zgtB>{JI3eWCWRJU`4?CkuuKMBvl)pw&AwCF&^+$i;@Y+BcDqZpZ-4cw7Oze1d8@D& zJ)%$n@Q?l3VS$5LPi6rWEW`~RMeq^->707+XG8Z2Il;Affx@coDaqj@rGJwwP<&h( znY#smj~#W0A3$3D8u&3JvT6cYyn7v@n_61db3Ux*29Y{Bjm`R0s1dsV=^UT zEiXZlJ`p7&;&LQ22bLH}li5^y)jvoU1H5dY74{tl&4nt_+6WhVl5ek^JQ{zG`|EK8 zi$${mouyLO_%(W1>mYAS;>@B}lzCZy+S}hGK^vPq7dT17W|)yC=AmY+g2Dsns)r?B z$r?(SQ`yXkC29SD+PmHvZuodn)favR^_J&ZUsGOK{AgC5k8%;sOOWpzHb0>f?DGMi zy=)#41`L&!w0{Q3>89p1e+Sy@-x8gxnr&nEo=aWpAFtOEY}|IG+|`#cBWAO+ z-BnCw+OEBMbLX?yF4C}hHWwLVM+_OE0pr29H#;eu>MsyFbU|ZE@rUBr@MQ#%sZj1b zo+3TPwyn(SDSmNc{`%I=v>nY0ppDYAB{$~l7*_Ty?QXR+beCFwsT%8bMPd9^QcEb| z3vkZ*1&rwfHJe~nKiil!&~dimO1+g-+7R)>eoxeel;_h&5bMW*QVE!pVDV-+cuX(b zmZ*-gv804LxOH0$Mr=(VZ>b#yKT{Cq2U~5?A6SANkL;{*;-k zz{+NX{0uoEUy|i#+;qgsG~@Qb;LSVaV7=+B*I5sd!$iu(U%pcTrV9L*;!w~cww2^8 zpAtfjlYA{HYW$&*XWc=Bx!xrK0hf{%^cN&E#vfzt#dvLPE63$EURmbaQ@O?iC$*@X zgv)|v2IlYkvv>Xv=d_SIu`{374C-fvh0IAxMOR0j1s0IL=%pdV&sD3kN?cegbo4mM zDdW@m^qPnmfZKr4!nVIdLIH3uDq?gh#xeyP3+fQFufKgg_d7@2a~hVUM5;kfoXh|O zzT@&}mqMG5!Yp=S$l4PGYnFz!CA9HQ>esZgZ+NaY_kS~;pLv<}9JBuX9%<$<`g=Qz z?o#2ZI-iQiA1QFMu(Q@pdfZnS0eF-F{wy?eW1{o%uMAQ>%yvUsJBu*AJAb1J$PWmT zI5}T>7`el{%yi+Z=rtiC1)$T3Eg!Vz!xvGf5WUWDlYQmipDZhwf}|Evzd<$yvl5|~ z+_GS)Les!w>6n3rYnE}D>_?JS!Vl9^;EHWWe5XQ9t@vWs#&zvpg;D8JFI*<~kv;6H z6z}sOEqeWpQGhR&TarJv=GQ}cd5b1}iylhfE_5OMjVDm=#lBWnc*R$g;nZIR|2(De zW=IP)o-BKmB?w5-vK}xdGMv?#dYb91d8zz~7;t3q6ShNYf~_Y;&_%>fUb)Wzfhj>w z?EJF(CBBKC!W+9BabWhabPZdaNGSxqhJ?0jR;tv5-tf{-r5|R|$WQGmhtbSGyePqI z+JH%m!kTv1ysG|=_Q$U7KlKdP4{;_{eI3`mQOc;JW;=ecDvKOZ**OG@=yu!l zPB#arl!EINT>}9q$GEK$2+I}z&S8ZPp0=1Pp{uL_MQrU+lkPEe$h?fGlfAu$*0vYk z65oig{(jj%IZE769aXBCj%?%F6usNhG1J=i+i%%MF3&@$XOp%g*2QSpGr(a9x6=vo zOPhR|qd+2MRQcK#2YjM_9Ryn%_ehK4Y&VfhV9RD(^(PAjQjX1F)aL*<7vv5%FrEbM z6V#}7X(}b@h~w3pG0x7m$?tbN)^M+${zz*0w-}h=USu;y3UCTe$3T2{ zx*!9roPnokHh|Z`!6SCoFhGh(Vg0mfDuKoCA)9|phjZH(!!b7D|a0$f#$;s~5TL}1r zS;%nj7dMBaD3>bkjxBs^cC3HB9NG(XS7cz`*I*wPY1qgiHvkNr$5*yk$SZ{)(N!fz zUkWZyQGq<$G#Ppy^a$_M#p%=E=tJ<1=e>DSCvcJI??WWgP>~9aW4qp5_0P85p;isuV0_ zvHVHrVg2nXgClIEyEzM#E~!*zFf}>~;%_>Q54N~pLr0z2LBD5Z zG&>WSDG(=AgA@@7yS;ZBOo?gO6hJ^fayJY>q48VJ7sYmWu}GT=Y%_CR9fbA6UP(lx zcq)-5Sm-rp5W#;qND_|w#&bzvQETs@&w5Nk-72YT0RyP$)x&+%GpuPZiy-;tFIoL( zKXHC3BklP$Y@67;xYO&M6fgpo8oCeUe3xy=2gW?pO{Y9D);;${#@tL5p$FIH;llXL zcY!i_lPevY=6c(}oP#PJ-ov|k-wm_zt{yLIl%SMvin_u|0^T4OBIxcQ>Isl$Sm^Kb zEPB!>f->Hwj=Ja2rJ}CiT5n_6_O|3$*KLx?+NX7%rv8gH3 z1p0_}0zO0DD^gpsrM}!jUMV+TZtD+Qau2-8aa-wlVC2`$i5@E4b%Wdhpag!K(M;b= zf+9ZDy*$>Ga);1c9zK$D{MUO@Oedo516bu=$N17>h`M)QPf5TuyZGt|X-PMrF5YJo zjAx+v;E|Tcw&VuGSDagV{0}UGjR=4)B_1axAd_xn4OAC~Ql~UQumOCZ-ZIh`SE$AO zSxUm){dWV;1KIm%S`Ao${`E z(!5-;%{AtAk4WKWOFr1 ztj|5?H>K4ppIwQRJP;tM%vdU<02WK$N~N%pQeeK&e@QG};EElL0@9iT=DZ(qU52Z_ zbEFM`<(mS`1d26oxP?hF6RD1VfLsjSj#vl>ipUz+joR(o%r<8j0<2?%+y+=t*v4scGfGZB z*C||5trX$u5s+ArVw@XK@2hAF3cgDqkv{S9c`nd~R5{KyGp@ z$qc8!uy*R&Ih$6N{Gq8bC#Ki*i6OWDX%S$zo(|9~@rmx_tO@ZXi;~Rr8un&^KCpl# z|KChx7M-0_>?uJ(LA=Yn%V8Z?oJ)vg;n~S-AiM$XK`+6_!DLz?pX7b0o^Cat@r@pu zz(v}EKRUIQLCib4f+qRofZ`eN-o&@~ADL zwLVU@m2f;g*XmYhV`17Bqrqw1!I5w(HD&-OLp#QMBgJuQl)aGP`7S`| z=948B&Y+=V^m{Ef4t=(2#>Q3F>#q;n=3M?Y?Bz#!Tm##$)35J8QQNH-Lg_TO%z>Uh zx6N)YU7VE`RoNQUPZbk~`D>`SdlBdku2p?7KY%(Zp^hqZCfd$b1dvje4NqJeGA2%6q(-Ydi5uRCYO;8z>lw$FXNzzW>Xex3 zz>L6)qvt?{2```&b?414ajB1}kOZ@Pakw}$)jQh2;jG4X2hFfz`B6HQa(Jv44U)2zK2#B4Loyy z(ErNv;}Q+4j8nH{a>t6}u%{eX`c0-BuPhJg`j1R)THA|w{+Hm6frqQiG~2e!(qPNQ z>K+%f4!eSf7eU*u3%`t56K8<-NU-%#_lGHX+!_D-od}`gX0MB$J27OQ<|c_v3naxi zU>zBcYgXoeE{Aj8(tLNnQ$IR2!}NP-#*%}bsh3M$%S9zp)5dTEsRUxBWL4qX-B{() zB>C(FAXJGL5bh2X{IhFHQDxke76*Owfz;j%tQ^ zgVb8g8Y$z)Ca}HY4(0UD?}Iyzff!#`M%wn@xnvj2Vvd*JY7QcBh)H^%rFc=DRQ=ZS+UBeAofR8yd4L(%K#eh_Rn=!d>HdVboa}v`u#DZMz2i$3l!2hEl19Q>;ZP$|)&E-1Vyjwv z42vvg_-*+LJnwQK+d`U??`UXtBBnkDv9OPWck`o~zoYaN_n32EA5y|MN*-q*JS4&l z@Dl;-At3t*06ZWVmv0bD=YKJ~<7J>#H($!4=P@`LX8UJ;`~&yN*`tk5yYCru;TfUm zDzzTwPqCy;TGs6N#)BaIc3;+{v{ey%g;7`TZLsZalBc|{nvyvcbk|@UTLN(dF@#!h z&c!OXu-vYqYA+|<<}8uk2f{yk`3Pba#dcR7=wj7;kj^Py6VUrX^HgN@5h)J;WJM+U{RYmip!LZ=W(dle76qvcB?BypXM$PS9i$k}ZfF2QF=`gMIf^(y1EmGx(3nyc%s*vN~AJJ2u<$=XFgeUE^^6;aA^z4>;? zfz=t{BHb!h%%Ev%^51s(=nM`O&F(9_q&XG6lxL*n%A>Ir$GcxbH|^OrEi~`0)LR@v z1twvw6n92_L~&McRZmV$rkT`vxy(YnQUCqgC3rY1dMgmOpq?R2NU>;S?={T$7=5 z&%Q0Wg9_1Fb#KBW*S30+oESsqilw{b4|A{b3y}Ij29=o@O73@^fG2(tPJaDzsbq!U zNEEz|K$?xyueC>BU_-zA&7r%Dx|sBcs$R*fSw&W21Tdj#B);KpOF}K`04F#ZTy2Oj zeH(Jz>evGUKMfmu)Ns>RBIN~m>$2S!j`%aT$F-u!jw9Exd~eG%)?O)*=JL=Br7U_| zqUm&_MVX+g*Yah*?i%4R;8WRf@7Gpl2E7J~GNrC8b{H#~@#Z9LF1@VE6`J=vnFCg@ zL}1>_2v#1eryFC+YGKBt20nMkVbad9FSyI$R;3X&ZX11>QGx?0XEL_nrnmf3-HYt^ zIM`q!c@K$k{ph*?>9cA9$kFx?DYY(UEh9$VuJjzQ(0RDt$RoB?Dez!!aKpU%NNBq? zaN8&sk3dH)CwD?Z{sED^V8$P($f8qY-X|Y1><+%WedIGY)fXL#gEJHQtFoIxjuRiS zJPY4b5i-z@THXilttxti?ao?Zbuhc{SWK-g##CHS4eatLSW-HOnkmOarRT{S}PvlgbwRU>LHh0T}^Xx=RT{^Zo7CEILnrJJOe zcoeob{$YrUK}BWG!V^BX)n{l3@#^WeQoBmHd*4r@(0}Oaw7yliyv)1FS792B6PtVG zgLvoUw3z|!zz0Ma6M*;IS;4IPom9!Zkv`AvU?XNvEup&nhnxAykguiW*}Hh2fz3Q9s|~aRkKt*UbPFvJ&u7qv=98W^B_! zbe<`XL5`l!Cfx4A6iC1r<{v#m-U^Oxaqp8@NE3)P)LG*Uiwkyt&OKXBcn^lyK-=XJ z+bzq&nx6^op!VqA^raBl_10QRLqbFCCG?s;kpg0IBCR82W&G8X*TI;MrF+)xk1?`U zT)%VdZ6s25{Tk#=6RJ@AO*3l%GVli4q7D86f;U?nwBgQjGL7k!VVQ+z6IO4I z{;}uO9RT>>U!dbxnhnQ89rQQSdG zV_f2_2pt+W5p;e3QT072H3#gEL*S?1U`2&BDy!OfGR5Bf&cQ$Ro$>aG(Sn(I17hEn zWrydk$EG-ISUu=P2gK?CuzF|Tx#DDB$&eYReGT2wtdWN&4pPLg6}@vDO$!Z^nC>9N zPRV}A~ypsQF=wjBO(v)!ZxdzmmNCW{Ow>%@i;#|{k=>4#i+}dzFYZ&1_)zmL_ zyr%)!Lt33mups0XfN{2%sTTxWT(7LMpHdhimmZ^PY_vKa6qCU)*1|E$uL{p4j>;^Qrg#$&=V2J64wTp@a@nWOso6-`_?ha}$XuTomAu7E|hDoMVPiQvTt|$dJN*7Ea>Sv0Ph(*sSOiXMDg^AjENk)b6c24 zMo+a;;K{p?fH?;I7N5HaRs(B=A)0)S)!ggxaYXi;^0Pp6r@*cgr4_a`ezvTB8#2|F zEc?p=o(3lZD_qsL)=n3j!Ir(%%y8OMlSkGm_XNIP=f(U6V17wNia3ZaEzHOvTmpZD z^Y!g&(#Lz`VaDwF@*{}|zuu#*>~@&%D`IsR+wFyg0Y5XgnN4yFG`38V4GTu?mb3d7 z!D~zIlteE8BsV2`Or(kJ5wJ59iP5gUtzbi-KBVdb5uh;eJO7FY{iI5S_N%cwfNfzO zm%za>1tz0eDUs?L$XH~o#pOr0A9&)QPaS#(XMA$k2H!MUzYe*qMCy>1K3ZHFGey@T z_HPBUwym)JoX2f_IbbwwG&P=bC#s$8+gH^~qmT)Av>qy&6g~Dflwk!MqQK(NzMl^T z^N%vJ*mNxO*%2euNw%>Q#ud(`*>Y)(Hn3m&q+$&Rv;)T7>4qt^v3_^$h8w|SM8(o9 z89%1Rr_@~pPu+utG$xR8L(o90cYDJ8$M_{&RvG#@B~gBKk6pjg!)(Yl=ierK|2p17 zaApuZE{D!7-a2Lpkw}o8&#C&6D1&IqW>r7_<7d7o0W``DQ%hh*4?jQf%{wn8zJFV} zvxt%X5nG}xmNb}v_`FY9N8w%jjnC_OXvW`z3vw#Z3M5E~Guz`wn0JeA5#Fm~d_={h`pv!dEz;vcHp0Dl0`n!(AFg+eJ>tm^Wvyv(n3_!-VFk0oQBP(BN*R`&Zd zwQ%}1B2}4#gX2%JE3z9nFxOdiC}H+BovfQ@ye&B6-#hi)stXcoxY^%?d$ann4)v%H zL`Pnl%^C3VT#z2&3@i0`XSy+ckUOa@{O)#-t7?|E_3LXKCv8GGZQU>vhYR#wC1Y0h zS1InR)B;c+Mn{tt{e14A?n_RX`JdHuBwnP^dzj7{pXZyOs@1lLJ-W z7-us~cfsUtSnlAY1<>IBs3u4^S+R}@>755^<>F-y~MImbiTxZ-;5Yq|Y2 z{HE>2<|c{<<}yC~7|BtjVLrR+QP%(JQ`c&@F=SE%#N=08>%{BiE}zLI7YKpA(^4rPSX!8k)&#FM(+6|INSI z!D<0F!Jp|hZu5XUu4Go{Qe{!{oC=Icn{e71DN-hSk!P>mvlW_+COE*?DHoWT`H&wy zU$HeoHoxa_N_DC2c`Hjw=ljL=c>Xy#H9!UhfH7+{4bN=8d&H5!8gW*KPS$pHKQSt* zk$^ks4%n(EKL-Y`mHO7_dwm2aMaqlHLtd7Z#%tD#x+oPEmS}7}w9gG>_!mfKkj1O$ z*1A#%t3NB>7{RJM6HxY~GQw3PyfEuw`5slkfTEHnE81h{lIv}{T#8Axa*jYK^GJIC zxs!{wIbL$?Yb(#t{8=BdQ++3HWb~r|x6?6Z*-e$fP8-o(`4!3I6eL5(3ca#DB<-7xb?2;{0Z->iE<~LySAND8qA+(a z>dNJ@Ip8LV>z|7rPdc)K?URmd*XtSqN{FIzyGUP0TJ9Puii6N|8mWLhEzjL5bJiM) zoKaQSrJkSuv4Gq&^C9y7GJTBc&Z_@y4|+q&6d+8jWg7M+mKidfSm1vZa#JmRZ56hV z8MrHB=;dLu)D>dvZdRLuxgT4mpJuZ{tlGjPv)xK{SoJZkr|~Xk#n`i_^5&ZSbG*-` zF1>$v1+`iL&ZESUCW-`;FrJd48l+M~57|7|Bqk~~^)jJjz4soZ?H>u0#cHZA{Cs40 zB1E=^joy_r!3G5_Z}CM>vB3v`C734W;)kk3CJEBSv4iq{=7)w(1y;G8;%V_!BE$Iv zNOQwY?M)#4m^jW}OFLHH{rX`N%B*b5G{1E9_5o4c4~a@{cVl8TkPngv0o4d<=8rGo zhA=i3kJha(@ET1i2jY9xwt$p7C_&!43%VM(bcM;^itShEB^2JZ!%+{4&f8M|CGj7?o zY-Hy)g6+ATHjnprVBY!PVu0c_BwHb#-gou7TiC9$oA;=J=N+vp67LqKT068sLb#5ng4CR>TAvN2+q~%ME;;C@v$;y- zne$oaE_W`7>QZZ>~;hCYUjrD!*q) z3|r12kb4F=cYd0HOF?k3i^$YY=S#|}RdC|27g^Q~M`yTyGC2SUa=`gY4eT%kFBOzr zlp8*7ezC3olBjo-(npkg?T2dhCa$Q@z-`j&uViG>e7;ZKRqE!l_i})jSZMyWqY1rJ z(z#%S05;D)J)hAAi0=dcON2H}$cu>>;)0vsD|S^uJoe#tIc5Duu$m-0RDJ0>13u2R zfGHcvKTXQPY>E!p6=A52sGsu<8GG?*PhYZGr?kCF{PBXf5n-JTfH&7wMIKK&R-14+ zD9dS1S^ibtsr`#}Bx2@jZemxB^Bw?qiYhFez}rVW6h;tZ9OO7Qecqsxt0O1GUsgPv zZluOw?9-piDQCsM6w^6Sq~+k9un2q~2|%ENGxN_}Xz3FitpC(y_PCEvC7uuG^E56a zq9HJ{;?3vN5r%GSInR#?t5}~4dBAB;bRXQ?;@{2) zz+SY?w$?NNJ9(JG9?37%qNpFuxa>~H7xd6wU<~Y?!WzvQt0Rf%D?WF29&^9adj;jF z9`Nu2Y85#4+JTtc3Z1+P+D*?2m-lm1bDq3_HuGu}%<8m0sHTjg5VT3iRr5`!VW{M- z{Lz3o!t3HJP@ggjLu2z36-rU~29x0m11d2g@s6x4wye&_i3 z$q8tYKQ1 z=k?>$Z>Dx7JOb=b5E`OqH#!~Tw_pag4bJKS`5RL@!M}dFKZV6hU}_`gA)8@fEUR*p z@ZAWAgoBhn?&I%9=$-|q`<>439CEg=|DXAg9GQ6JX&~$%xV4kjK|k4Qi3&xR>Ej{; zwr1}lu@IT5vH~QYKbx`mNt>&Ess%Y(d3Z0QGGMuPSD&OKTdhJezF|CQ26A?%&1DcZ z8ky=zhwoB6JC62_8uCu@?U9^ARcdRVpIEmMAbng+ftm?TQW}`)qA80Dk9{wCIc$h! zS$u4fHDM8ep54X$*o9kmANy_k*q3Z`6u>hBAgoFjNzih7-KhRTVIklmM%SlNL&3I~ zBBAZZ%|4?>=dm#9`m8(KFh)IzD2Wv_;j}I6;%A^1X;pUwWpLHE90f8x-*gmBmES2= zhWSntl?I;taeXCs^-UO;X%(o|;D@QDPmpHkB6g z${!Br>5LdX37lL0T-n&DC(7B>`u4C9Al z=Qz*lOR%lbi{i0ho_NML`W`Xa{)4BK@W`X6{xz=;nDTtv$dnmbQ!gj*Mv%~nI}Zk0 zLT)+P@bh7a!;d9p(WO963>g{o^q^|(%40SyKYCP=C8vixj1IsNnDNP)#oCAV2Ifw6 zaTng$Z+-!_*3yY&MbT{F6IiH;+A=IxFP0o3dc?FVW1HT$5}(4XIyx!{Rdq8EcF&~C zz+Em@5vXAtki}<42RF=k7oFiTOF2ON!(#Z4ZuFmskAL7wposXZb^j&J{i~1tKlHEv z^CkWw#{c~!$gxwDyp$ooOg8o~`o@|J%W`7{w{o4IEd|JwG;4P7?;HRzeLn)CB8aZR zgs*NG0-*fUsNc&-)DFVPFi0B1lhg%QmNa615xZK-=7)Lx&*%LA{Csjt*JOGKgU^=; LjUXod{^@@K2r?wl diff --git a/test/gridstore/readstream_test.js b/test/gridstore/readstream_test.js deleted file mode 100644 index 5ced68a4205..00000000000 --- a/test/gridstore/readstream_test.js +++ /dev/null @@ -1,239 +0,0 @@ -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../../dev/tools/gleak'), - Db = require('../../lib/mongodb').Db, - ObjectID = require('../../lib/mongodb').ObjectID, - Cursor = require('../../lib/mongodb').Cursor, - Step = require("step"), - Collection = require('../../lib/mongodb').Collection, - GridStore = require('../../lib/mongodb').GridStore, - fs = require('fs'), - Server = require('../../lib/mongodb').Server; - -var MONGODB = 'integration_tests'; -var useSSL = process.env['USE_SSL'] != null ? true : false; -var client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); -var native_parser = (process.env['TEST_NATIVE'] != null); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * A simple example showing the use of the readstream pause function. - * - * @_class readstream - * @_function pause - * @ignore - */ -exports.shouldStreamDocumentsUsingTheReadStreamPauseFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // File id - var fileId = new ObjectID(); - // Create a file - var file = new GridStore(db, fileId, "w"); - file.open(function(err, file) { - // Write some content and flush to disk - file.write('Hello world', function(err, file) { - file.close(function(err, result) { - - // Let's create a read file - file = new GridStore(db, fileId, "r"); - // Open the file - file.open(function(err, file) { - // Peform a find to get a cursor - var stream = file.stream(); - - // For each data item - stream.on("data", function(item) { - // Check if stream is paused - test.equal(false, stream.paused); - // Pause stream - stream.pause(); - // Check if cursor is paused - test.equal(true, stream.paused); - - // Restart the stream after 1 miliscecond - setTimeout(function() { - stream.resume(); - // Check if cursor is paused - test.equal(false, stream.paused); - }, 1); - }); - - // For each data item - stream.on("end", function(item) {}); - // When the stream is done - stream.on("close", function() { - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the readstream resume function. - * - * @_class readstream - * @_function resume - * @ignore - */ -exports.shouldStreamDocumentsUsingTheReadStreamResumeFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // File id - var fileId = new ObjectID(); - // Create a file - var file = new GridStore(db, fileId, "w"); - file.open(function(err, file) { - // Write some content and flush to disk - file.write('Hello world', function(err, file) { - file.close(function(err, result) { - - // Let's create a read file - file = new GridStore(db, fileId, "r"); - // Open the file - file.open(function(err, file) { - // Peform a find to get a cursor - var stream = file.stream(); - - // For each data item - stream.on("data", function(item) { - // Check if stream is paused - test.equal(false, stream.paused); - // Pause stream - stream.pause(); - // Check if cursor is paused - test.equal(true, stream.paused); - - // Restart the stream after 1 miliscecond - setTimeout(function() { - stream.resume(); - // Check if cursor is paused - test.equal(false, stream.paused); - }, 1); - }); - - // For each data item - stream.on("end", function(item) {}); - // When the stream is done - stream.on("close", function() { - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple example showing the use of the readstream destroy function. - * - * @_class readstream - * @_function destroy - * @ignore - */ -exports.shouldStreamDocumentsUsingTheReadStreamDestroyFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - // File id - var fileId = new ObjectID(); - // Create a file - var file = new GridStore(db, fileId, "w"); - file.open(function(err, file) { - // Write some content and flush to disk - file.write('Hello world', function(err, file) { - file.close(function(err, result) { - - // Let's create a read file - file = new GridStore(db, fileId, "r"); - // Open the file - file.open(function(err, file) { - // Peform a find to get a cursor - var stream = file.stream(); - - // For each data item - stream.on("data", function(item) { - // Destroy the stream - stream.destroy(); - }); - - // When the stream is done - stream.on("close", function() { - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/gridstore/test_gs_weird_bug.png b/test/gridstore/test_gs_weird_bug.png deleted file mode 100644 index 1554dc3238dc94f4c8375b17b4b8d34a337d9c1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52184 zcmZs?by%BU6egJ9?waDzBE^ckYbmY;inO#)DDED-xE9*tR@~hK6e|+kC1`MW%QCw= zJ2U&^ujI?~B>8ghx#yMhCR{^J5f=-D1pokWm6hbQ005Myr^o;dw5NyWW>Q=L0L$a6 ztgMEztSp^|ll_;k-#!BX9>A$&OC6E{vc8fQW^}YKq4Y`=P6|#*RAKCt?{Ii6DEjCN ze-gYm4j`46OQ;4%qM+)(><1Abqmcnohp?+z3ZXq<%%m9z@G9-rj|NtuIvJ`)^Jm{?GC0GO5;0M3c5=HN;mRP?kv zYF1X>gEvxq9`5hx3BP&a+!U|!rfKo#OOtD|b5$2}c%y|mgZtTiH=P5bCr z27}W1uR&a5+jXDv8aM+sG2B_eK9&dtm3+J=;;l@TSAVpp+78mEegHu19nG$+#rSSQrz;^VsX>7sBwT~aQXYsaa$@2%dFg$LXzcC`q1~u&*RFK|VUtSbYrND!f51u);glB4lGv8uLsFHp&*tJr(l&d=j$hI}XpTJ# zybMNO<#)ho1*(PBz}g(%7^BjL8NpPJIXnO~p{8Bh7*hQh*qSou1lWHuPvpDet>l8g zDLTb5??c|sK+o0vh6kL!87Ztq;(LY!Y&Bl?Q2@^ayV(^XcSvC zHzqDeo(X%=qq=(HLD`D8jCK?WU(-IGyC%AKyqEWp^us}fOTA(tioz%lb_fK=DYGz4 z5_1yVVnQ(|^iQ7FrB;ll2+I}gQK3$;$W#VMO*Q*4 ze_E4EJ5xh4{LSC<9-)suRn#9pf8_Z1@Uh~n+;7luKz(wu+UuP3KTChwh?pZvB1OZU zdm18B!ZS%}i82$+lqlX_zhzS1P@Ys-jH4)6-`RB`7sJVRp&Q{BkGZRYGS%D$^hnR0XewAXy}``>n-hjan7jd(*s) ze5$;hyh|niw-+kDNhYssxu{>JGcGZS(>=(Ca;!5X($$#$(cP+ISI{$Z%imX+W31Ny zY|8P8v&N*?D7j{TvKrl~GOa$XW09=My2-AI)f3fI&@ zaRiRMQIAlMOiyG4*KEQ!bT@{UpS~gDMN9=7G8}pbafT`Limtd91Q$!YWxMO3aS&CsOEg-v;%^;Q z(P7-*y1(7)91O_}F%84&yz0ztwGRvqcn%gsDr0`BrHz=UOMECT&o7s1c(=hZ;p^z|80Dk^!bI;sINJ6TOMlY;m<|sO%YBLdLcCSHMYy%OB}?`WTQX8C zaxd9HMRAZi8O|he?7(I}Q`AcMuPBwf$AJ}$#p#>d{kFws?Ql^yrK6kkh~uGSb_+^V zQnQ$&u3NODtwXvCuj|6v^lFUjmCMSJ#NT-Mv5;$;GQM-HEseeyYX&eQKSRB(woT6D zV7am(>|Jo z`efz@>!usdn#>w8Gd$jfHN#@*N9a-MyR!#n8$y<`5^*E3ZLs^o(8Fee)ytgTyE;tG zT2D;Pm7vd9mCn^}^%~CAh1)_V%lb}d(xt%q&tsfO z!k1LN&@zq>s{=0=bN4P`US#le=KAl#4m`t z7w-4Zze!$A)@(_vI&WZxQ^0R7hwdgwd|3;kC0P4jZpZf}WH@}pnW zU6p0*Nk)SBiqo~Qpfj#hq?6^Tho_)F&wbH#!Cc#zxA*DrY3zRY0rCEeMf--1dZ`?` zHnVf^RY0^Svx3L1k(dvM#cmeLHG`@Q(Pq7S7n z)aJpaV)EC_)YRYXTEZSy5FTK9%H6l=e>iW^LxXDZ096#;%yH zWAjPW{IAn53eIZSlhsY1tNH6)8#zkLj!OIHM%?x;w^q*mMcvePjORQD&Thz+$g4Sr zOx|?}P0{arxUz1ITfv)0!ct_pR@$mh-$HevB{LOGCM}Dbqpl~-!xzqirFLm;Uma^M zlIO~j?IsSlR#g4%58v#4ZL;-iDVwQoXtS4J3Gr)rRB=x`GHw}c^0t9kX4!LF9WRgW zX0LkRd#_&+A9Z-fU7FpR_cHG1ruD7GMrQPj7v0M4#r`p`Sv_MMVO&y2&XAzmjBdZ@ zy@CF!Dz%)nl!uaL&P2b6&P;Vk-}bHA?U_|s9o*5MLnK`5-`EV#SUy%GO1ybooc5!) zhxZp+-Fc2;+5|mUgf|5*He|=cc4CDyEhMJ=>aQ0sUTzGY?L_ll|5~dsG+pTM^z-IR zZGh3cD7)vg$+&8T+O1{H#?5ozrVJ)rc>aE7|h|6{wJz?76v} z>AATI{=#WbfK*=?Dy{^a!;cE!O^Zy9UtsgTb|6G)<<1{DVs`sA%#$t{0H6aX%Sr2a z0QcK0<37MW;WvwEM+XbQ=tH#8XeuQXA~PiUhyfy76`K@s-j?;czKqjZqdL*erS!St zvL*H6`Qn?6U%!j%1~*x~KijY`B$Qgke~S2sf~-V9Nyjs~oz^{kbBI7tr70kzC|6RB z;)+)+HeO{Mw;$b5-*zLyGhT(xaw91~FereGW++i$!vA$~XpOYoqb|s+o%nV$=o0MJ z#yYhd-RH>>>)eZ$f|A)Kq)Y4NG@N7=;Yw+ZKk)w4Z_v&(Qm4OX`;l+Z zuLAU+vL?N=Hd_{XO#89Kzo<@=kDoc?Gz6W=*J&=dy@1vE7y8=M_+3GYwB;$ON|i(o zh%07t@oVfpDE0Oh-}>5>bDG|~)#8$LE2Uds*L~l>$J7`!?A z9NyEKpybiBPB>Rd&oq#y&S_fSzuN7oobOZZ;9>d!(|_lm0!Fs=NhX4^ypVh- zaQu9M?mxQ9P^aXxs=?V3Y7Km9s|^GCM3FA<)%ZjhFZ#MwKUkqnL^wLgCO1_f$=^fv4C zEA+B7i&9fZ`+=qWtT%6^e3t((Wqn}Xx2a=D+p@`$w&4*q(r*(LH419KR5nUgpDwpG zi{>3&zZ!IJ=jFIsBG)Y&h9BRFH=0^NGrqSX{FE1Ee2s!2ye)RQdWWbl8NDK(T0?#=5elSJqc^K7@kH&Z*7;0gWSIo7xG0^;NoDq&?~`Ua?5I6eKmBc$sw}XMtw-FI zukDeKX>`>WCPmgfSux|pY5f_5t5LxJCV(|Q>unb&yvn%nC}*dv3++fa@rt4UfysEis#^+c7i z6Y8Ha_8kBs+HNZd2_6Fm&rA@HM&CWC@+%SKphup*)U0);3AG)ymgzP3@NK21KOGL&)1ndDTpgf0k?cWe9{_M97^6V9V8{TJPOa24(t;ZMdmi)J2x>o zqkWW(m3ZB;@V`3I|6E*(fK7Fy4g0D7It7KeQ)zYJBQKxFj%3~_%sq9wwvv9&HOANxg}e(oe3{z3$?GaRX2ns(5Q{$O5nr&Z^slv*oY~uxXO3G%Ju192y`$h?qhZFi#mBL! zj_@tl*3b^mj+PAXjK1siAm<4R$Vyt+G>+H(lFiaXW9G;Ql8X_PMbQ~I^a^K0qat3r zhhSg#hZOIu&VbbyeBYky)&W1{!E0%(%ag8?0p)(KnOzUV&Lp!g4$d0nTJF^@U}$_a zcJowvm{CO}l)EI#?6kwb&A{Up2K(4$d0cXTdEBLj5YM6Z>;8{e3rdWZ({dyJ=}} zoMeyK*s!(54!AyLu6QVVH$1#Jec=}W%sGF8O9x8~D?*4qeymCj50|>cDV^JxoOx@M z&Z}OF+sQYWIyU2%=My}ljt15t(qDJxxe`M-J&%T>^jLA|96J-C1CvF>TJSn`Khz#< zxn)s)E>e==y@ME-U@=|qgOg_^%hk7-y~NP?K1uN~PULR+9jU+4MDPk6Qj3}CygVZ8 zI?N*+QlqJ7fIABEK|zWU5M%l?MVGql)@lwZf(&KN>F}uI<)ime%8j<==7#$t7v&4u zWP=4e;mce9qz>Q5RwhPV&oiYC6b3)ahl0%h{^LR%)pzu+S*+yfSVXvYwScak5>y?5 zZ~Z%w!aE1y{Ut|3{XaSbBM{xp@RwvKtKRasxVZkkG+P1Fo4f)wpI21sdi2w*}-f^Y<7~2W_W}2CNbK`k)n%o#gCBYtl zNVC)KUx8!lp{zoTM$}^ABEcf*vy<>`Zj?UV2KsO0-0hd&s=V@&bL=;-`#}r@v>(;u zu|x?t>uvwG{#;?Iaa7Vc&RgK6g-0t>$j1*M2!i&b<>XN%aCTL~x1GpN2e2Q8!2j3b z{tp%w0F8p+egNdXpOFYL5n#HHb3B((^Sd3#ylFFCVU_e*4Za^clDG|c9hon3dJ{>6 z=k@tvzR>GZ(t!|f^bAT9v7czw{ak^739s)lJR&x4WpX=hI56re=u-07O@%xU+)+aw zO(Z-hyOtQQY;996FKbQK-+GuF^~gy`76Y@S&8a79)K|-Thxe9tL84#&L+<|Xp6%m> zl#!THBRJqp0z9|=3Lrg z8UGHkM(?m%rjK252%n}v2EUh09;-P~>LdNX%hjR**Gwdo;*cb8&$?b8S!To0GgVUQ zgxNT@`Fa(zP%rhn2Ruvfp|!8<{KT?tYuILS`_a^3n6XtxWFgC*QU zXBXuZ^S#5ELT=1t;9d`^XQ^S?TL2;2bGr>YWaQ=*e_3aEAdB72mBRc-0ynfP;cZ>v zH5XZA^AY|6?aQjYWw*_$ySwhg_daQ^XAEPrNaVNwutShsYCeGtd^kE*T6@mdA{UmV7Okb_Y0e z3^34@S&hTN!|8WNTpFD!A`THGZWOTY5r$z{pX7b{eWd@5C{gbp1BWaVOY%S?$;vx| z%dgLD;b10M#8-t<`ES-$@(s-7EW|TDxfTcCUAos&j~{OY0uWr$!M~jHXcP@<)U(&*{}!v_WL-Uv zUiPv(R9r!n4-LKRG>lL2zoHS`s|!AZ&V;op`YFC6#g(XTUa?r z`JLwa$Bm3kolf#Xi)U%6DU-=fJ=AakrgwGzuhL8OQwhO{x@Qo%)C`FvCp|rVd@R|7 zP`%UTs%h?hQS#R3iC)~(%LVk$Gvy!H{(aCKwhFbbV@Tn;8eDGk&c~wnf9ygP>UyXK z872p|=I6`vA1p4Wi41viMFY=!&mMgwxNMreKU;Yi^eTq&Yqj$eCQEU%q;P&npcZx8 z{vGwxG7Wf?8G!8T=Vx+xun<9Ad}+ab<%GF__seh4}m(@!oTPP<=q%|J?TmF9$$D>Tt8>xdaJ0v&?I# zP+t~x(WpOa)MxvV@ae#Tyz*HsQ-z|Z6)YIyR-}`p!-HAHE(1gy*!vsll^MR=bb7Bn z%X*k7Bq=0R__4j9Kv6ACC_7LRk6JZAy&KST8_%f76tAR&vnG}@So8*bHhPDc)K>2{ zt9;8NOYG4=v-8d7$45ffD^8Q()zv4b&o=e^>Pl9y;Hf=NPrrhXq-(Et-JHSm>*{n( zJTG)H!@8T*L3G<$1&;J2SlM8Io%Y9z3KbPL){u|VVr2&&e{Rtk0R~HwG?9ac)2;h< zI-fHw-#HBsunW>tX8cSX-V-d`1S3$12*~Fu9TU?;ok6I`CBLbpA~6n7YRx8rS;6Q< zFp7!-d5g2;g9JOSfD3C9 z&zn!O>(!um>=w7fq@@=3lC5EjE&7f1@#W=L>+8f$h=;3O(F{{miM{!kbdQ4smr)o> zvS|}aQb5G{gu3jC3~_F^32M)UrMb?N7HK!x=@0=7Q;ltd!^2tMPfT#&OWs$O_X)SO zv|Qj5fe5eU=c27pKqSr0%^Ul3HK*H;54YYvACY=dJ4jAZp9n=F^@97h$n>&)c-1IE*edfR`vAMACZgA;JrRJ+wy_*mlu0dpii#uB1cWsXsUdUPVo9%7*|IQ>I2+i^~Rv%0g zByXVp?1(|c?a}6DW=9sn@qS$2Uw68Ej~^KlapzCEQ28GM2U9>ge-tbc{%Zdj3lg~B zdXn?`+~%XTUSJhp*Quh#M;|#GK;yzEYEclzPaEjkrJ4nD=a{kLG`5d9=)ecs^V5xL)&=9ddBsLc|r137w=gSb?2dk zrM(NOzvy&B>HJnYX1Cz8g|^4UvSNMF$X$I9rWKV#6zPcZ)4e}#c<<1H#yZR(%q61Z zM7XF-!J`2a`U)G5-iPlCgSQvk&;2Puog~1SgsSsj`)bem7#S!!@tn}I2c*M)yl=e4 zQNhrPRix{*U(kNo_Rk@@d)i(M<(K15D=}r(Kd#>iHR;iXVm;G%pJ;jII}C0R%#JFf z26@g%0wjLMhsKSQJ#>%au}AsG{#iN%SyBQ=q_AQS6sj|B9MxN%zk}*a7*26{?A~nC z`tB^D^=0%uL!7L2S{jU7`P})F)>ypd}4(_FzQpH&^|t*c@?wA3ID( z+P+&0Ga86BE$3q*y<*7e>>B~ENgE;gWNp(1BmD0Vvq=7VC}lw2WMuV#S0uSTx|*h% zwvowa{||!s|6Uk;McKXBl6e$up7M2I9}g_1l=KL3M!CvKrE%J|Zv`x^Yub+lIkU-2 zYB_6_JH>=_HWlih4Cr}b|8`joOl@bM-&3_r%M^n0cM&`w4l^r$#3Z-8mhtmyXG{E5 zUE2wfUc@E@@ZU4&)6&`PhbuKL#>ova6Fch;kXm<Uy7?Y*4bQXX5PMGmK2UXTX;PMI)5FbeO2ARvbOhIb)Rxj zm%DFx{d9AXC|cpOkB_n2(X#K^&Sylby4>NR0XN_npgvlZ8FTk}JsE=y;k}78jx?_g z9Ds!|X<)vgfMJtT_NtgPu;Cy}%P))ls;UL16#9bxvpsq&K&)O>2aKz7yuo9+_inaP z%7o?{u0p|#^cCl^$vPgAcN!(eAXa58wRP{?obOEbg~>xQLlt(o3_k6w=xQVD-by*< znW3{232_567Pg8?xHv6u+_NV&R-rb(uW4N^ZN|A|4eo}dq~TA3jGGK)H66cLK=q@l zV&?5<=%2=j8>c$@H$$D@FEt<~XWA7eRGe72czni5$5h5)F$WBnD#*P%k9%K_BSWh1 zZtfTmK!nQ-pKZT|t-b)$Lh9z&mS;SRf7QBFPlV-e;G1I6{lyhGd;;Xa{~Q3%+yE#6=go z9!l8-@k?bN;wdCL(?odE6l|56(||~Y3VA8RO#&1%y|eWF_nHe$@R!O7ku~KQxY+{C zA0pvf?Ua~O%=~cp5s}|n;;q{UOC_5XN7L4ny-^Q{3;OPy zM!@wuaxRmk=of+?GqW5H>|I=R>TMTZmFQQP`0Q0*ON4*`6NNyjX!TxfG_Z2o^?C>G zUlkXc;EL^e(NQWqj!K6KMxo?Pn;vpI5lhME4*w=$R;4R?hgM~aY{wel?4F#~9m@5X zXExnbt`6TwU(Z2p8*q-?f_mKjHC zvX}Q)h>vA|xY#qC^Zg4(GBXqjrSfz&I=KFRsqIQd)IHep2xHqnmJuWC-PSBTK65(| zj72GMS0i!}<~wzmS$1dDuj)S}iw>(;_nOiip~*rM^l4QDz)Gadp89Xkh$ICV?@I_C z>V7=Ad<2-B(|MX7W(ET0q6_gwzzmZDod1SvImEW~*|kqcn;G~#o;|jE42NKVq28LQ zE6+et6vT-+YX^hP2Wy#U}d7G!p{+qp^x=KHfQ$9xJr6k z_!{iYpEqUNY!GiT{@V7y&p1c~3$>R1ulT$4tav(bSFq`%Lo}H&6bE2R;%f99`sv{S zr%@>y4dcVE`Zlk}a+tJDJa>9Z$wc?J!AYT^mYUseJ{>-oAI^KNomL(Qg-=a1FJaDK znqSq_SlP^OrHsWFyL5rMMGSvI%qm(LbR@5<3gehBNcTIP0SHkkeW3}#m%VR*p)J@QGPCpD6sQ{B@j zJakO|d`v1?F9d=U-vnR53AWUMD>bjOvhRL4X|q{{P^f#Xu0F|x`4W>ymwB#V?>=a; z(i);ozYI8&4!((voyq$|%69yTBXo@%+sgm@x~(nCkUP4|WgrmTg>dM|;^?|qL#?w$ zeNo0JNzY=EStIT99lIsQ#@>A*5*uI0!2W(FT~U+(rh5AMnBr)iHlS$?3Dn?1K9>cvh01m|X@8N4k5O))D6DTi z#X|*s9?@BY@B1BpZh@Hy^Iss44$HoSoW^?^DQnw43xjUPec{FOZlds`2??&no$Scq z5w4Hp%Y1MAi-U9uY<|G(EjS2&*=mwWD>F`DL&%}TL+#hl?O$4(ly3VrPWz6_w0+NG zOy#;-<&{6w{Q($RS<*^xdyr%px~!#Fk@bo{lPF>!>nN8SH`8&Hl`zG>UHi>a&aq~U zk&VxU&#iy*Z``-#D)rEc zj1&i^SI)e|)fda?FG<4JG9pF>Zc2V&v9n_|Kuqo*>9BZUg41jK!2L3->QxI3^JFB9B&*rONFLwNyd`_sW3n7-s!>kp?EXrup8EvslcHG9>ApjZPOTx>2T|nW)6aS>>S> z;@qa!ed0#BFNtrESnat$({%i(Iali&YXP^k@UsJ%6CLop5nwt<7v~XJsw0iE%!!JR% zb7_ZhUK$l`96(SpI2Bp&k|Q%Q)bn-_)PPkisKc6GgdYMST;UKF7%XjOxA z>tp~chOkwtV&8lJ{k|KXt-Ri*?hT z_O~@jc2txFQsvwIjC&Bxu6q_17APYyEI+|4Y(}q#^YdD<)BbL)VB|YC224Yd=E*AW zvy8y+0HI?q1rs0o64ZOYiw>2KoFV~)0dclgRtTzy`#02JYT%{+jv-#>Ffm8&3N1Il z*!i1^GEzd=bp<1HmbY!iJ2hDtl2F^aB3?d~^vwUv0<^R5)T@0z_#LtJsA4&~oTWW& zJNt@PJJ$&nsg;<^!t0})NXv950XIEkPzvm`I~GnL2djc6cxTD3%;Z7<6Z2YZSfrk%w29;j))<$Hfp04gID277jx@p?S<3Y}w9^8^I2)Cwdud z0F^Ge8BOL2-+P?^4uD`^`30i^g?uEfE43uG0qy6TKkpmh)lRn-$^y1{4D)TQpK|%b zdt2uZV=n-1E98z5sLSt}5sKn5?2`Z%I_t-6T?5|A_o18KuL=6bno%@y%|AA?^nhqy z)q!M03zqMu#C@#+g-P!_D~rvq=WgC(z)8f`oZ0@JHQ|)fU#F+17_et&Ur!|F5?q%! zs(+B>dwbkIQ5a|aRTo(bmy1a>mIa96bQrX<({x4uEi-l9o>t~|r%t`0Vmhp3ruesC z++Qj_DywbuzrxX&n?&P8U7F03nVHwaafrA1fLutDv5ZbI@ z3aisVZoR`<>F-*|lru+XPU_C(N}JB`DaS)I;YT{I2}RJ&!pEMIls;%EbQOh?mgupA zL82`$e@RUWp1Lp)*ep%ejLM0u{$gqKhb2aRhY^DVVH7TA-4X0uS4rc#REutI`ucm zVaw(HW7vwdrfVE})R(ij_5ttphr6)KW?2KmEOD(PpWx`BMX0??zGt?9&>ku%ZQmMiwh;q}NcZv?tT60a@|@`s*eD zHAGs-qiIMK9s4_<)j!5N!c*vk5cH0cqjK?LO} z`6xTT@L<&glQr!N1>uN@+*|*&vb|8Yw^zcW8QK9kJM$aAh`ZPeIt`*78hA>|)P67A zJ1aHZ>^q605{gSyq>VN&+gzDANoAG$yG#ah*HiIB0F=0p z7>93|KZgZI-;TaMyH1x06S6jLNQR(W8ks02Cm|8U-fgb+BuMNxwDWVs(xI<$J$`&k z<0r()hbNS?98hVkOWN@;&lxbft$TEc_fOqlq(Coe<+e<(?q{hHc`$?vVnsmawXV%t z;Redm&rk?{%0d0MmwqGpMiUwKr}fH&=3^V1QGM{n-|!p-5EGHaTs;T-Qv{12REf(3 z&oa-c#t;H_Z2RV-wo6Hk~{Wss~{}>ieAnn znC9AbPsZuc7&AvA%lsT?u%Mtr$66|i(GqEelCaX*Qtm1HW%aU0sO;65D{D&XQ;bVL zR-6(0C*J57p++w7=mmAzt|{B5K9?jE3KirNlLTGtKBR?dqL-o#c!!1-TMNP5uLK#9 zWaulXMD->MkwI*;BlI|fBR^h~K6wD8-xetncrD+8raOIC{QY&Jfme&fV-azg!HFMi zo)L<#BOyK+tgz9V<9pt!CDQBrjm!mc$b<2rdS4*o&_D|da@2~an;2`^@Ih%R5skR9aV64{Q5iXB)jMs{M_kT0S#*s+%v0GRR$Di$9|SuBL6TQ z)PKCCJVQHy8+!h376jo^c$z)u(;V6%MQQ`SRP#TXOS=%0aCOy#l{u^jpEB*v1f3_9 z4YYrtkaOnhI@LbT3ZwfiJH8@`VNQ*jhURpzM{pH|gwg*;^?ciXmp@p5hbOoYEIn6e z!>on$#X+6;jFd2E1ueiN3HJrkF@zj87E9;S;T>?+-%r7S&%-UY81x-%&X2~FsJwAw z+T;5&_`V_MQ3|DRk6WS=Oxu0utuyJIU|kpGg+fkHR*5?UuT&tLxjkkkxOJrfU^PmX z^;gcrw zy!_hcZe}J`p{zCb9ksA0ujR@bfh5uLU=2g zqY11sco&VDtwE9_Q9PqH>fOf2N%H23Dhea_DJpjLSDXjQ+{#KP8tHzRzrmIl8B%@2 zH6!rxKNWY4gvo8S7{=!+xa(W>b4!52cI4ALdAI|#C39qK^Xw==3s61hNjmd1i0`?X zE;G{AnAzheJ^Fza;!D+ZZn-KQn=|fLQd?Uq4H3Nzm7x#2b8dW<&5GR0MPZTum;fT} zTCMatrF^8tQ*>2h7_|7Jlh^l=HTXLAtBZ8L)_a2E*4SPYEKd*$1qTEJ2m%OM*A>50 zRn1{pW#gAP7G%U%Q0yaQ9rfi1$qKLnfP@T0A+aoAvbLGWX96byEt%j{Bm#Lhp_(N{ z#WbX+SwQ8k`8Z%oj zBl*bK2LO=zW)C52Tl{0!IUFEKX^Fw6ME3q9?ANH(5M8b2)kU(!onFN;N?4u|AicV;PO z_=s>GQL%4R$-!Jmj{AF6rG@byROIjT`#z24ni{|8e3=iRl1S5zMD1~UinT5rot!}e zsMwC~rgo(V6|+bG9=$p}j65CURrXvBiOR^OI6`fdf<#jJchqZM52%09-H?3rFvdPi zmo!yq09V&vi@FvweIvhqg1LTV{J(%^pt?jZ8Wkhb%)c*tLgb442%a3m-R}Yfq*wTo zREhA+%o*~|i?bV%uE*5h3CD*mo)k!dr-L172@T8t212m+KN1AT=e#m~u*TXO-W|Li zUU_H349-=2`lFTqY=Ez+ph;;ZBH6a(8G_~T0!72$gj1@p!iYT1*-~Y9O45_cb~oD` zo$kI!@jZJ6D^fg5d#8H>JKJ_R-Y{Xu9d6w7}mAt1$hxs1b-vEp8Z6VtpxY^MykY!yg=$S>TsM(JNz|OvYtMVkPdye(tP{E z`%+Fr7R-v1bAaqDT+i&%Ow5fGZ~$EK@5mbi`q(|ks2r|{tg?)ZLAShsY}&TzdcTEB z0zPx?>Cy{j(y@)n*syH#oh8Lr!sEkp;do_Rt9cS`wS}5ntKSvpS6QH0Kg6lwlU3im zD+~ptk0f(nvkNc)JrGG+}nUl`8CmrU4iYiUI2KQyDjEbpFPT=CQIlV{FJ| z#h{s_WGPaVNWa{1553c_tU;xV#*1Pw3x?1lPK2;-L&l1-a*8n0Z1$!r4b80hvgpC| zk2n_vV-RKBV|vuACub^MpAq?JHSPIu&MOE3;>o6@Kc&W18tz}+b$#5*Ox%Mm`oYCM z-FdR&0`Voge!JbfwwYz2DcZZ1!n|9jA;{@8z{6=LFiC}`I1Hf& z$xF>_ym4cNMXtHSMPd!zf3884(4OCMLI)c_B?jG(`*WQShMK7{w@EjMli;&9jY1VX z*Nt%@{lFlx_+Y_I9?~m~H(KhaG$PIEGGLNMvFYI6R^G*A5@4KC6yrB@D*Q2Q&5U4o z$>IaR9BA|iAEFI41mJxBzG^Jje!nT;+iY0Iz^rZ(;NF4$Q4~l0p1bS#?0PBGCVlr| z9|d-C3+p`UydSx&o<+dqtPRxXA0kRpYcKs z$WZPbxM?Nzg4JBGmL{Z!3eOa2BfrvjI9vW3543Xm6V6NYK)CV1`x$m1c=p?EL?ia0?69RMO-E4UI(2xE&Z!+aXuxDwO{jHby~s=wLw(lFrR} ztOq0~rSwn22KE#0tBw>>Jb>hp^&S^TrDf7h$o2CD=0`;4xNvG zDs5+vk7+Ud>99k7^Dhx>J8n$(@wsFKdSC2LVXUj~I)?J}A&BUqxjaehI zBtDhdVTWlMRjo^9TW7H@t`3}wK?K5F(f)g?9^>KRW!b&D%G;(WGEA$B6t%n60Qpdst9UszvP&XhIQzNXJ<-V*hjM}}t+;`izA>$xYs5uV< zP~X$ykc~2Sn0PgMb{wy`cG~;m{e#cVW>mz!6eJwW%&4QBvqS7y>Yd+Z4GtF4tBsDw znXfJw7|Q_>GE|q)nkla~w0P6eKtHh& zJwG2TGE5f{yh;&9M$E>BX1~*Bjlux$>u?5CL0mT)vkOG*i`E$L7TqxLLi+mpbmiGI z8}byxZzKe;3RPuF3cWr`8<2kOl_$QLB18p6Cbp8qw*hG16=@V1-N<*W+X!t;-6Otb zmv^<~zNBNEVBw2(Hff_UZO@YK?(TTpRQuXT^YdS29tPOMhYHCD$LKJmQEior4GuL8 zAeTU~N7SBQTrkXZ0FM0idYlx|Uo*RX-D^`~%AqG&b&xALz{gD|*W1PqF{E2-`;Jsd zcO+Sulc9U}eopeo+s;B*SUg~tI#=)0LdR>28`Ip6epXgWxELWwUfem(Qf!+#=T~07 z^ZbBIvNn4^KedsJwg?fVg)uw_ym&16uQoQayPZM|SX)(y%G!p8y>=@XGr=dbN^j@U zSahIByCCjMrAag@F){J2&mwa)L6fnXC`scInv3S$v(sB9;2!|WC=z$X_NA{8aY8`h zku`Sl_Lb}hxQZ)l4!;=%>+w#oX?fI-JdM)9(8KS+8qk=SU0n`o%FHq=K43I9JKnW? zbZUxW0x-+?i>3svoHL&MT`0jv1lVgC9W7M1)wGERa3UFb4ptL$kd?n3NIb$8-{1ob z4Gr}_B?ELyy~QL*5GDPagZhMBnew(^lV2G$T4R#j+*yG>W@bti1;<<@SYGTj>Z`x? zD5(B$S3of0r8+y5?=!}18U;&YEh)6L9>cmcM#N)eHxmV7TB=@bE@jy#xhP-MJ2lg1I>11S`>oeyD zc191$IwuPDQ)J7+#$muRa}xw#7v#mhL6tB{M2bSfl*89?Xrqls=AA1Bp`UW& zoKM91q4y<30Jfao0s9LTGfa-lj2ems+jQ893)&6Xi{$^pKM}U0$$5}4v|`!&QN{z_ zc>Gggi(~C&{mly5i7rTyj8`f&vm^n;Y8z`8+Rs%}1};|VYs`wWqWeV)!9cAUK|8=~ zf?U*`#@;s)4tP&isWQebTMn__o-fY0mB3!3M4?)bYUa$$D^Wm^=oh8e#PEcl;4QVfXT=a{yQCUCgoNDn#S|qU+7$p?ur-@v%>K z5wb_6g+?K}QG~LmkTgVvlzlg5Y$0NZDBD!B6j`!lAF>u1OO`A%_OXwBjF~aN`~7@A z&-eTEeEa?9^_rJ^=Dx4%I?v-gj`KY3u3GLZth}V&PZKNqf%i1H%l4%r_r#A$Z{Z%yvv5 ztpl~iUPe7_AJQ8~?qi?6<;=iXv?~>EU$kUd_Ol~&Ojs6Qkf^a=nYgFXK`aRm<6g@w zfx!s{2d2le;zE9fwaAA`A73wl&l&dq)_mlo0j*wHS>gB*&ZHJa8>Fm1QxPlk=2|=I zx%Y%``rvxd{HvhP6Ug}+*HN9bFz{0wU1^EWtM+o2lWv+@xZQAe21%oHLV5K3bU6e$ zxvi2glEaVbPjqXXd9?PxtvdBkLGg*I^AQt=b->u?Gm`z>bd1wR-$?(LGP(Ky1F1eO z7rxi&;u_Lhd64$G(ej8a_1oXHlz%CJAB(n@mw%#8;(xjrwE&cJOIOP}qo4BSvQsBU zpaCUOE)gOxge4}e+1sUH!DnSKl=`Pzlf*~9@?RWPA^>)L%6!Bs>h9O*a(6qT&z-+Z zuuw+NVI#8;LtW}|Ep0XJ)7k<}&RiPEsSMKoSoL=7OH_M`faA%8< z;XbE~;7hL#`zYG+{EEN7+;U5Ne*Zda7;~Jcd02%w9#8#Qxr&!e_dxjEVA%l*Y;zhE zRQ@xL9s#GF)5A!f*z9^9W)b#2o1_r)9)l?!asPcZtuh#BOyTJO9UsbOW*LFmJ|cQKAzG$JtRlg&3_c{K-Np1>|J*04TWF1@fJ z^A&TFve&-x1#Wn@@LQp|wbK=&c%JRc<^Cp#k`R}oZz044hs5Xxs<&Xs=8rnRE5ZU9 zqoqz^4n{2iNfE06UWUIh=3`}&EY^B)VdE2DWXL}xIT2$&K=AM&t%&`8!ZcB0z`DpZ z4*g5&D_aFCz|pz4&UMo%1;~87iU*Fx!g+3vIlan?!)ft>zla#eg>^O!x*iQ zJr}O}>FN8&=*B0U?=|Eapq6)wT}i7I*vD}VriW_O3RU4264wi}x(*GZfH|n_-TU65hMQ@PFF1VOz(JcQnZrY?h#teJ4G*q56xH}vZlme; zyZp3-7MXM2Ia_r&#_3&U6tF&k9WE;yl3%jPe(t!N8^yg={}{-U+a&06I{)w z?9d};zQkgjI+IQffmDMoMV9R!l{lS{5Uk7z#P`BykwY7;(}mGoZXNO~( z-;Tb#rL%L$f5zsXXis|KS*3zL$!(de2t-e=l#Za_oGo+P)rj!0OmuwCZu-A_0k9KC z1T1x8K-{(}s@4_H)1NtpX;(h-+)`wwJSiM%KRaV^p4&$$%a*0&cGNRY-FLA#gIp%m zHj4Bm_T7kR8$wvQ*)JnF%V$HyO`y+nnp;~I_)wou1a#Sh`y<1*#t!Yjw6+0Y@gFL{ z)Bci(4g+-VP*>n)&2|bfIL%mSNzRPSK?d&yX$r6}DQkAP?RSP0o}HXP_O{O|v6rn( z5Y+M&AAY=2?=APehZlv??Ma+w2;NM(4n71+)NrE?jzzTv=&tsy^iv< z{|Gr1`yg&RKQ2&Pjsv`~t#*uFYbVjqKw?bfmqt?e&vHFmTwM)sxexBtuZvKV+i`0&rAq$ z_{GuMXBY6A2H}{%KJXN`Kc=4F={hUOs>|bYC^)3+gfG%?Z+)`pYE51q*S7{nJ}nkA z)%g7(2dP-s8ib~VP7MMRt=A|0(zJl@CG7F-VGc z`0A1G4>*_u#g~|!mEjSj+eLn{v=7xB4+^ibUlUjiMQ3)ub--U^Ax7CM1cy~Iu=*l> ze0Rx(*CI}zkhllgWlGg~Xat_QOWnzZ1TcxMec&8<5fMRB_ zv%g;>K@bCGw}|hOr?!>2<<7E5#jwY`F&3QBJ_lgZFMcal$FQ8}0)-MQH_(i=8B$54 zwW=bpD=u2ge03Y8BP`LvMrhqiA$@r-4OKhScSKPF#pq&{z-;=OIevd$NxgZqucF!E z$uyUuiInhMLt+x4+e=p|5K6$#dmngLM#u~=yd5QU+cwtmM{`D9pHi{swl@w4P`Rqc zsM_HhnbF%){xM}u}6_qEWVTF6e%jP5CW+yft3BB|>@lU#vNUGOowr1%F^t?^hKS&1@zj;ks z8|)*C3cF7d>uX@Ml0wo6uJqO6L@{&9!4$Qi9KAA6l2oy zm{Qz@tasYnl{@Tot_hlGKxJa_y&n3f%luBI2)8z{Jv}vKLzo_Pv;;VLc#-e8Ld8 zbLRZTFQQj;FS~QDX!7$HkDf6+(p*K=qAqZ)Rt zxVKMkNHP}b93<=Wz6`*9FIsdS*YUqTRrka~RqNg$_YuGWg3&5BiBkC2CJ8iC_}$~6 znx44_{B`|IpGhs(jPe+F-dgscL@bQH%h$b7p4T^sN#^d0^z|uy+@2%Rc~(=^rqipS zkNWlMMGQHcCH4P{;8($u!FBmNioO6iV}GI-0J@WFc|uK2{u+I1Gv% z+Sgi4u<4%(eUb@S4XPchR05T)NnE>>zy!!4Hv#zZBUy$;kBj;C8OskoIg*E--0ifh zygw2d!roDp6o9sZSDlh(Z^v~kxFs*VJ$=Rag54PgIZM#;8TPJ3mMc%0R8?*IcU>x7 zTsJ>m3F}}LIq#A;EqRGG37>phS4VZVW$gAO2NxSwOGTE1myGo5C?&YAI)v!L265|y zdq^eb4V!=f5S=d&z?h738V`eJo~zn0Kbz!(A=HXUs}sjt?3Awl@-lQ@Y zqH|tjEJ;1R_x|Hw{IUbFFAE|=VB$?roXt8fi!TA-l<(A(b+(#FyR8h zYaIHDI?v*CU5fhpuOzPy&AxfzBR@VrT?sR2$uZpj71_HH6xu zcRzjIA753^{5WJ6qY$8Y+3I$-F-?CKguOUJ`EhJ{{w+>d_M-9`!jv-5I(XCvw(Ppx z4Vd73@(D@|_QmEb7F+@eShPtF-06Jz7?h>{D*TN6iB%}qiEc!+>3vM_qY7Kijp-Z0X)RftID(+aTtmZYbirmb&z1Gc$Az~< z!f>~AnThjnEu0*`l}~w^h)Al|SReKuv|=(*wU|jCsxNVRV(waZ@67Cal_qwB?=Z%v zsE)b!@m}fQ%0fYA_g9R~zU%4sy@fGo3*0X^fqgN7ZDXeb{?`Wyy|BjyIR)->jU|?u zrVb*Y#f^E*Ukxuj3A?|de8GU@hY!_6_F&LV7Wzt%`s*yHe^E7RUs$37Q8RC0@9m$hlz6x_6p;E{H$F+Qkktz0kQ&~^4^># zJw}9AJrp5vpO|^eQ|2~`WOdWIuUUbnomj%*UzW3p#eBkx7T9|!FeehpVwY?al zufF0~eNlH2-;D3#%|gXXVXl(`d&X<|G8q=D#-3kM*-ick-ysQ?JwR`s@g8h33l_+OmNy+aGs-*&i=@?C=K4e!;_d>5F@`ReuZ9DTGa(qtaHDe zKRzvbET{5ONsJ(PR*u@qMU2VaKVBUD3!w-+PaO6?_Ic1pw}rE82X zfr{^qGhIQ4-Hy0V<22#<2y(ur8%I!f8+Iww(pqVEJR*8GX8SgHrzXyKy$l#9zot!* zUdLl3b4Zt@1b>a&U$ADtzRBdde#LAP+mFMQxLtZWg$p4L`IICP`~~o^{ zS4VBQ1hc2)Nu5Gn>EDIAOPJR^bv13uHy5Ns8)Ak<1>rysXh`W_rt@AjZ%KO=iGY4Z ztXdgp8HRS+g)SSa7f)`$<3eGbSx9{*)q@njc^eS!<08=ot6o`YR@#2n#SQX)YDGa< zAtKBVn3Qi;@{>Il<{KzkIxown@vC1)N2aYa!R#K>)MCHbuxDGShljb3Sa680i+$2F zHvC6BtTY%7UeM0cAVd)=b|*ck`tepP&e}{W8ftfLyRn`q=ViQ7!-KUuVtX|Qe(Bxk z9h)U|`-Y3n6cay4_rz=K7ON=Djx-KaK2}L-=5KW>R-4Z2Z775i1aL~b`tDwhx&DKz z=ATs?atPVyUhsj*Aej3V4RG1AGUL#;DxZYYWq3cj0Nig`bX+Bey z=AB!i-!FLmDl4WU=`@R{Ec7m!i@ss!i~RF8&~NT*ki(X31=&70y%A?sB?1_5X@!!C z+sw2kx-Og&tlI-4!#{yv9dzLljSnS5VzTm zvT9!V%I7Rw`%&*{3LdTdK*z9EMYy9ygjwK_N0WC*Gl@oV@?O5>HGNz%_)LDI7?MaD z+mO5hS^|Tg|FvQ{{}QCN?Q1)jY%Hr>b++n^C6h1?>*5(rQZzt!FvbNf-&fB#eyqvW z(y-L8h-ztl$u`WVoE4P7yt8O#I&3b4^|C@r+*tx5NEs$n8+$J1y#yk-`|Hzqod%(Y zE5qR4A>{|*3NDRPx_Y^Y&>ASE;>gb+2WE!PGR5wOEm+SZhZk=}yhoE3yl+?K@Ct^r z^+hI6^IKZ_9T)jjSd%{#rO!|@JLeSWptbp!=bF`RP5)w$8QdHPS1g#J1I?J{#*X9& z9*ef}^<|z5!DrrPzz_19w?<$ILqg3fF17EP1Bx#y>8B1AUXfwo(D3XVYb88rV`{y+ z|K)dQGCrvHZynsl#*CcZ1pCvow|1Q^;BkT6%X-T;k1gX4($bRjzitZ;G6|nDlL1vh za+zLBm^OBK0bX)LHJS!7Y6&1;)4_046Y3q*KWt8@dL)~(dx)*P*iH>$TVNPo2)-;b zr~nT>3|jAb6BJ0ka|eBUH@gcY5rEl#XOj)|CVZQItF3Cr!@Y2#Z-saHtc^`vhI7ks z*!KsVI$0}Ox1w0r1IAACKKOVmiZ4teL~`BB8#1b&bnVFR7AXO5W;J^$V!+-&pWoTh zMi}gFrwD`CwxfjIv!FMT7Nr%cOy?o$TH-+v(sGkdZK}=WLo*SNUR0)k$u*IJOf4GIgf4S?yJy zUl){&l!xfJxt)K(0X7KhilIiwAdZgg-}hY%S3!r|aDZG9!@OVd_4{nqZyMga7rrV` z=D(&s(LLQ#@v~)L0p!+mLHJU%C)bJqvoGe=4Ho@4g`D%xgWinLf8TxREBe>*Dmf0u z7h=xrY8<<3IPq&r4Q4Xfk5894*H<`PX)1)Tv$z6ly!=Mzt-$KU+XLv*8AF#P0X-qklV z+2n&LJ&zzW?Bm_{9%Ge!BOJ_d{!W>$1p8dlV7wWR#x`Xsf#Ai>PEAV_-~^e@x7x_% zvohtgPXypYRo9ELZb9_1D!0wgiG|@-Anul6z}uEFXI5)M7NZD`7!wf2oEPVXY+lm9oT79GJdXA%e?Pk|;0gv$Wd z-u?p6*wMzUMbUop`UFX=SO1PUS^^%eF2KGTx+q2@mP((L4*LaSh<$0*?%`V77!$c} zb!EMGzBph7dB-mq#Q$7M8e|hYJv%bhJ=OGvgjDpja&Nf3j`-M?zBn|2SdXG#1bWy8 zgnD>+njTn%JlKyOcTW=M82-!=k&tq!ImG4247GUwul8N*n&EecKyQ2VMsgx;6Kzpw zUx^A&O&P`sX_A}+7FcbEPLRaxuH1TOT6hE7*JaIy^h9sLih@LHac4mZgXgLZcZm08 z9Tf}_-qCg$Zam}%WTysb=-mLUD8CoXJiMcjxxwWg_KUfhQ9bK_qEo#Of~W#i8v zeEg$JJEEHN0lIyth&Fa9>9%04^Lm2T@v{fD7uZIESIcYsS>AdQIGnq$F1P}QpQZ$7 zr~$6kok`&E3B&$R57Y0G)GHb{xz3FZZ#)xPp5h-M?|&iILq0*$LxPBnpQw8tUr%H- z-x)kq{>#~zzZMpelS6r>owmdLJW7&<`^K0Ak$C8?4-9e0;O~nts$YOKriL42zS}dc zLM~{PiGn!96n2n=-dHgxEJ~;JF_>9vYTo-=;}W6w*nQ)|Pgfke(~{VqveVEsx!i9D z2G9)4P2}Da3yxELsyfN0MD_D)$occvxmw;@L{Q#4XLm3ooa3W!oGJ*RZK9lax3}hB zQU@S;zm~7+HUmQyrQ6;_PVC#lf+?t{6kBAp^*Fh_eL9-!gj%3NfxPJAG@()Hk^nnb zg7jOyuw<5obgLYI4bVIcyn0vY%QGobr(o0zu!HCoe)@SDJ>d!czl)KHr_77F@~Lh& zuQD9G(p>huTJLoIEC^4*iJjXSk#b-<*R<4Lu;^TfG>8$x?MKIj#(A*Qy=#xOWb1H; znrIPr-kO=*R_1j4nekSiq0B&fTiONW@DB{SCoi{Cr>KM`RacR3EBLJGeJe_45$IO} znH&1Z2QLr0LJ#BwmB+%;L|{y6D$grO5Nbh@>1?x5kjJLuX4jx-^XnJ1Q()q}c;OHO#B6T&P0MKOV#DI>8 zW&keoGlb~(SgZ!p{x>CKs+ZT(67;@s-)w1BKNkOH5`J)7NFyu#!N1ac5>5Ks*xeH| z3@my#@-BHxuy3SR%)`LA^{t2i%1pa-oBy$#brEI-t#wXK&#_bHU>{xXTkS<^d~#)- zPE{F}4W++7SiFnID}kBIF2s}hSl2F@h|aXUzQx6EUy7kI>KJclY}uJ-D?!p>0b65=lnhfUqy={aAeU5%01UHApruaQ21 zmD-GeViP%Xacs&Re99}Q>o1$U_z9zmD9CDWaH56+^lR%$&u)05t|XP}zH2;r=(tgc zYTibNlMq@BB$sv{B_@CFw_o<8;-=2&h4SZ+w1uTv z6}}3!@7eOc>qEIPN3Rz6Wd}Frcd!<$gs~BBZ0zw&*`4P+E^o*rY&|Uj-XAhd>Ym?$ zRjYpp4-;pxDusp0SWq7RKl2Cx$ZZ`-!E}>m+nxgRVI=Py7kGx3eg3D+ z1VZH5=7NRH+hfTLr}P+$EuD0XjKI&f@}<7W9%C8b?AJAO0*&u%62sXfnw3+|^~s(- zEp?#CyP!PRk7{YwA;OvEg--K6HIHJOEOMLMzV?Bw_-2dgm7E)SezY5T|JbvwNC1Xc zWq7%$P&>jLduA)~40)gg=BFdb{dSheg zt97U2O?Ss%{)Ivk4rgHmP)HY{;#_{~^qIB;=D6Lb{rKNcSZlZM?~al7N(RkC^x66< zpjuja{h$PWE*SaBTz_dyOW5ZFN8aCe=5{)7Eq2a+fA(|J=wqsN_}Vthi5{bKR8g+d zIM3)UA1(GEc5e}8RpA9<^uge$j)ztPLjzz++XUAxz#o65!xW|A0(NnAtrh%Y-x(Yv zESGO#r|?{>!wbbm65N&O{f)z|;~xLjKI+?%iJxad06;J{{&k`zl(%i<hy*^Q_~(P+bqs5XK`bG@3-|k5?(W+4JjfW$P3gwczG&Sy z=-kDGWZljb<>4P9MtzQ6{zT2EjR`pfvF6?=I7Z;)rmxy^hP zzf~Jk-T6B`C8dy9rLefTCKY^->$OlTy7S#8yOKmPa#$ABeqfmdbd!hc6rcEozI+}>g_~%tHW262jlTG~*%0$;p159rJRjPtq7AbO4+1KZV!{YJ6&M-3 zeFn3s&#ljhT6gxXjH`n4)&O?Oq(>EgPsO{iCYe{yr9xnGD;M>4+%m8FgWtwxXZZpR zs+8tdp3b>i!osa5U%#^Lkk9nqStKs@GY%Ymyy(jt=|FNV2gsbjL^r!8<6Hy&=)^dG zUI&dffKQqYTJhd`VDY=B=U3HTQ2h~2nlIxn`?)%gY8m*}cV;N)2U2j2vQu@uuav+Wc%BLR*Nf(6uVDVZ*{Hs89aMm5~@m^QgXoL+HmjX%dk0KVX7PYGS138n0SN#FKwKC!StWP;uiAynWIVH0Zf`NV%r$ z3+PQSl%???sF@(E!tT2DcFLL3)@url^0m^CEz3KRz*Jx==sl|b?_PjcfTl1UE3nM9 zxkS58lv;q-Z6}z5 z`ptFvu_WI`a~KyR9U2lK=r-cF@H})fXl`E9@V#N&OJ$?#A0_7s$8InCPngPxzbz7> z^u}%ZV96}~$8VO4iKB?D(~=2Kl!|k6L-SxtAIGb?(m>J|%wqGQ?)H*!j9DPwow^yZ0?qY%HG8b@v(~FCi2hU0~4Khj+MihxxECmBNF$udT+%ho&5F+ zeBTi>Ljyw`HTp;KK3GpROQ}8C-mBmdu;&bp&Fi#Y)S2>0)pjVXbI%FwWbafmW0rND z7awoL==j{>{-bcFtu=xckrx@dGO26_vY^Pd#Gy>}}x7Zs(w1gh{_m&3sc3)bvRTEn?8#^db5}Ia~3q@yc z>5_pF5$%`S$(ikLwO$fkT(c#YLgM2q$gz~7+KYDB72~-D1$PnQfCJRZR=}LTLShpn zRbO3Xa9>fmN*?(Y0=?*@Ko%(L6&p(Ea|;x6c?Z1L=a(;{ME&fvh{Hb z`^rmiP~7BkvCqa-%g%riWL}1nLXM?=-)ZAFoAX+zC(rK^7D`@`B!U;;!RM$qN-#F- z3zBA_SXyiWOWP#P+IqHwGnd?(r54cGB6+T*xysGwl)0+U zg7FdNnZgie?(S}{$-^eNeoOm6VW;X$KfFH*v+L4y2xt9PGSEkG8V=$-|1f*hy|}*i zxIrzYdtas}Hd>4E`M#!h$Yy)GQ5heKU#u$z3vAN-@Y#__RDE~NOe|8#s4$7009SvwmVGs0xl5!oa{y zwG8CJ&eFgW~{2)I*{*=hBQ)lA5BJ27E{PE+*&)(OAe+{{O#jd0;^yEEe?#)Kk zPf$fgpIORgP!yPtv29P? z7}{y}9}yTh`F9=8qZu~B8N+bC*S1BCvU=&JMoRPLrb=WLNWX%CF6~NM;qmd1uTK$4 z8ItV*+CAC`fmw@`f8zK53FJ87BL9SsqhS)iLzJhzqNv$vJY!UY&jCeb({ZvYo}xh6 z_evbE{?Es#SS%veq`bDOuuh)uRBj zorg?1py+RN?GJBN0d|amA1J{N4ho;=4Hgs3+MH81YROnT9FRyJu`!s0j>0qhwkIv=ER>lZ%P&=r-mC5@W!QwGX|%?uhES!hqn*-*zGcF zZ!w0olC&};4kkS2Nwaq|mkjXP^1Ahx2d}3?iu1x-nkt<}95T>%&Cs-O59(%1rgwfK zRkAN{QZIlr z9c|FzVccb?Js|1KR4nH)r}GY~LOv_5uKDsp&Rr7@HPGl~<=0=wzoS-Gv=N@(<2rYc zTBSABNAEX>*t>f=Il=xT-vG-ME-&Xfdoe7&c9Z`5`%1wO!Ny@{hcwXsDs{b14ViY_IWtDKm0CI%$q(eDy3alOQ1{Ar;%s~+u~d_@{G!S5xFM} zjt^TuP9<}O1!ABk_6|FgLqe{TjHEwH{`~Y|09Zk zdH2m3&BS`0TM4*;^HA0eeNb5{>OFlfVci5Yt4^8jh1=R^Uf|l>4{U-VLly8xJumIr zd-Ud(qgGa(p1ZAul+KcH$)wEE7KqAXH~u+V1(WC(!WDwJlR*nC{n}R7m`7^F5gXT1 zNwYtxjku8ck<8_trdiqljAdZnnmbbNx+HQ)oeIMQkj)Zw*K)~2G`12bs{)bw$bFA; zGb<5|DkNZXc~DTvpIiO64_!Kn&i!$bCoJKrv6^YbLui^LOU+O^5D&zz;Z*==0fV+7 zSH=;tf1WaCZ3{+qs@X5!<8psohj-tB@itRfE!-Kw@#hCpeL2kuMj#xqPd)qRjtWvS zlUq#qhL4XZc?lHidKv!=px~x`_f~Dk(txnNzu}pYwQ6Pt)k@!66TLyemga>J#jnen zmE>!MunxXaELz&^>>NmzAq&O}{;?*&QIQdFL{VKuk+Odz~4NmQqGX$3gcSrp>PA%}oZM|9Y}uY6kPc2x#VAxSQL`M<`UY92!8fD2G6;q(o@7wN;hn<;hHu$(2pG??kQztcs5? zuQOBI9i~uMhpF_|Fw=q*HwPei}? zxQ4Uj#pe}N!H`^;iNYgt9E1m92I7LN8@*=&pb{dmrMkCI3Gd|j)fld!rxup**F1j2x zLgX)8Sm$v++hC>&)xRm~J8{C%j%r?y24%@n3`0}$H+l~!ugdw*_c z)-GYJGFAcT_`xNvprABuK`nz~l%C(+`vQd`@ZJvy66e|jM(A$%&;ToWZM@P3+;uK@ zI*|yGlS@4S9Bh9&1I$b}M{g=oe^A1JE+ZBzvc0|ia1zWvQ(jFd(zubkQ z(k9z)F-uEJJHYD)UhO&>^BJ~bZ7$rayHzbT8>`4JtruG+%@|p~URSj093^tGWb_d; ztJlI+_@1e=LhAefPN0&J%}?zac?-HallNhfqR`n!)k_j5bd>1*v7Ok~7@qWK>Vn@) zY)ICYB$uC<7HVVa$E)+?qY+hG2(e9+%!=2XHe-ZphJ;bEr1Gprzpnwmq~8oB9b$iB zd|i3H98t`V!T$XDYU2cMCHp{9dFBklBU?Ctcr$!79eix2_?Zy!`Z96Nz_Mb|70ltm z%0tb~J5iv`e-@8(Q`T;VGZJ{28NO+nf4u6Cq|z*_>u}zl(Q}-k*+BWB*8`}?flKqO z88b^`(sb_F!rE{G@04}I*$y!$%x(_r*Lv}lKi0FkQ>N?{Qy7o$k!FL7T#fl^iEX6B zUr2#*vVt=5_O_(o>=xsHMKl)+ozAhDVqyM216`rqhLJN!Zb5Xrw79d8TyI27W^2Ts z_qeO}XPnw7XV=4PWTB0rn>e!wx=rUDr&$%ouvexxu-T@r%JkLv0&)KZOM8Ot^0P1no*U1U8lw6wjn5z3QJ+M1^=C0HYq{nyo!P8ay+ z&vwF$N!t51>W4od-W5%0{;Ol@dpIxa=7weurg5t*9UNVRh>u{R75Z;}Oa1L=o25q-FVOyQOYmJ-MQ zq#-v^^h`1C344*l-$m(zzg6tbNSYg-!P5m$!}#ryfoB!6gO>Cu%#BWa#N}-DLr3+4 z=3F&_{UDL!nTA5W4atd(ed!&t0ds!NgHHB==S-NL6{r(+{nr#QadU=z&3`ateQJlkfbNZ5^?t+;{I)US(y?KR{gX_+SEUC*sfB zhQ~42#dLa%O{;#weUIs8gB@6@hkBhhDWN_Le!N9D%oUX#IB2ehk0I=Xcb>}*R)3r% zgXz8*08_8B0V(Jf!saU$z>G>8Hd2&co1tSZcSw_7XH4A3lZQ1jA5I1u;K^4?6(m=wDM5J{qrDRfl>gl&dnkb~f9dbOm^58lABti-u zhdiB-m_X2{IgT}w61ONgrhvT3kiA!yTe;KrwprcxTlVZ`9f6c9S8#|jGk&!Ici*$k zcs-FLxb=nss8MeEc%8s}ed>G!ASvjg*)q&{sAnbe~BnpQTR{?B|L9v~DO0%}VDnZay&8)x-J zB)@CT)t4SVr_QA_hM}`+BtUbbl3A1@`q{Nbxcr({@R@t#dyt#>CTLdzNymMlex(h! z2TK>F+{3)Fw{t^N4n>WW*5`9T5fO^sK1BC zCJZ7Rn@QhY?z9PB0bUU*x+(NWG~lhdKDBL7jR1MhN`L@Bc~9eJoFc<}vIK1snXEpN zW6Tr~dTQ-Gp5eeb~|e#0j8qv&!btjbS9Cj&WatB1pTx;^D@BVW3 zT>1J(90&IC-Fs62v+6^B1V4X1(-nc3?ZD2%D;jHh5q?!6nNj;%CH<&fcjr4jsMWhL zoUswPAJJ&5g2Y&tlC~GHxV7ESes$xchS^l#h|!q4={EF*(AwSYOr(9ciUb_f9r9Te zwpr6ks%XIP;>_e%{`mUlVWAo?o-k5EJZcm+gaL^mDFv!I7BA-Ty8R#*VO-S4;&>)Ka3$H$VmY|eI?1gI7=jiJn+!zGj zezUzqLLv?Rg*CCE?wTehTpxsBHaF0;)j-!#dt~S-S}U?ft8wdx_wlX0H6}HMQA1sF zIT8!Sq)G%mkV`<3(rqn#yu1`?iv}D^Xj;X+rJgrczH4K_2g6?<4N4wPukR4)v?op1 z9qj7}ImtU6qUV>^>thBT1l5AP<+XNyJx~vD|IEy6L1 zXI28pA)&6HRJBPHj$ZLej`#0tWvf@&E*p4m&Pqb^A;_RlHcj~23W-1V7d)87T>})$ z8jNph8R(HvSF+0(h-8cD=4V*1_xPYR3Z+h8b$>C^ZL#Bmz>t5sogEI^Y@Z+4(f1MK z@={vC)7IgxxZK(VR=A&EuF`ja4NuM2Y~mjupRhB=YJE)=ooU$tMrhMVXtdD0`xwu6 z{~&UuYnHUtig?$Nl9r>44F}8K2j7HFd-G#*auC56u5D{;PFP38fO#J|*SEBw>15;M zx?*JHW_#XNFuVbBuVM6hfmvzVW|mfc2FXu;ZS-Q&dsmc>gKuSNLn2;=Giay3T+F*T zoft~c;HWh{N8z32OtD$VAS;=9&~&Qa!B@Kf39Y?Ro09sMk#VX;jxr-lX3+hXt4E|} zG+J9H6=c4}f_WT&fAuKL65nhj{wzRlnfa%YsMr1_Km42FU`D+92ch+8Nn`91Z*}(X ztEx*FU;)I4o#^f!8`IBty$Ipj2TZ8uCpLH%{0_SN>4DIU?LdfW3`&NwsVK4r=6_$C zc!1TcND`&EGf8lTWQj2=O}>S@jDW6sCyYQN;HaHW|` zU674k>qy?Vfh5+LnR2HpNFz{yLh!BJX|tj8*5gjq_aE_%Aqr3N+BU=Z>d#PdXw%IO z5$B6-e6-PY;n{E|-P$XXKb%$|v$erhmfyl$h9UQC&-=|9KUZ|N>b9Vb04-2{d#lIg z(lzz6Yj#fbrp9`8yx}ix_;T}Vc;PYsa=lnS92*b!vDvMB%>Q{B|5KNQfG74WK{I0% zm($rB@@H%=dQdIigb0Y$TH!(q6?R88lS`z4&FO|!7sL3=nttw%G|)=Jd|as8p6=^ zb+_A~9YS#X#j}vRn(ob%h4sM#b8^1w-g7SQ%ho=Y^~q+X=FKfiZqUS&YTIAd8Ib!McK7bjpG1B4n%UIDP53?f&EHm0 zjQyOQlug(ZS)8a?508iORrjOM7ul-1%7;4KOI+FQK4rfu&99Zy@ zjq74AA1Yr{glt-1S$#}7_YKNV=GN=X%=5be>l1HK(fE|k%PFEHnp)H%wqTuTj6d8X zbyqvmDC_kQ^cU#M&Mz5}&zGp=bhhp}*FL?Rv%&%&!8I7Ie0W{Xa-NAg)ZRoAnr@pDk$nsxB$>=%8uc80suh~YKJz@aO zr6X4jwLqg?;5)6?D!~x>?7wiL4Fd_Z4~p;#JzSIXI!X6WA3wt3{wr9qV)6g=4}t=`peHTYtBn3k`cqa649%aV|C>&_Ypw$-W04)Y z!1pJJxXZ!}`Wm;N{pXK(MY~P_O^xx&i#zhV= zNPFQ(Sp6jxMMCi@ecmh7L| zQ|v8+=kEsPy_?t}kVevOio7v&y?^>%&$u{667$A?Rc#}Y>2UaK)2oVzpF49YX88aG z^tCFdQzNy+uJ&bT-D`=!sc--|RB0x*Y*9u>ZSElb{FKF^2u&hhcL{i9kSpLH_p#K( z=?=rcdjU!z#M$bd2_NjdS4n=zdTqh47sS=kav6CDq~O`JXE)DRD`o{e_VukSuCJ_2 zJ$?H00AQqy>wR>HdnD5JroCCmzRve!O2Xv;ZV|im0bt=Aj)0|AV|S%} z_X%{kS@6M9tr&Nk-RFnt?%80brk%WxzW7i;4>L#nZ#5wKF$^>%Gk-hlpA)S8LPy&s z2QjPCaRdDSwRiRLOs{``gmOxz&N)dK$Eln{Bs3CRPdMb^u5(T#<8aRLkT9xYvylqF zb7n~%%ENTTI_H#;Vji~XM-=9%2Rdfc=6SJZG@Cu#-=f!@{`~!S-}m?5?`C^l?_JmX z^L~G>_jQ4~3G?&e$BVw`J+0)spSR1|>3t`U)!HY&bZLR@N5Nf8GNX&yJRIYaUk`e0 z)Nb<#H8_WtJuL@%xZk+d^1D(v_ez+wy-qnYlnU=L&`mij+w#qf^9|Mhf*(;>M`HA- zHM4V%z5Nea{V_mW@e%o5=c+=*u8)uCDRGX7i@Rs|1d;G2Sh~Oavji~<{&YGZVZtLwsM`|I3_PZu<`8cJAYgT^*QEO^;F>>gALoVdIh5RE*1+B7;$RaDM>I?% zvic{5Y{x5yE~ZcwvUsB;W1bw=-dp|G%{XXC-fIPduknQ zn-4B?o;*oYHphI1J+V)jR2OynJ*=us>lUslv$EL>o0ru@5Iuq1@-qEOp?tz4D{rn>${_$ZR4SI(ajz;pqQU-GqwR~%pJy?5}2}DV>4*-gXz?)ay{=yVlWCRV|eniN{onX?JOoyAJnaVJ_>M=}I4qxyY_@Qzbx-<4`8rBu$NX?XJIk~NFHDtq5) zre|@0AbwyB_K}BOhoaI=|f>xzN_T|nz5Z)Z_6Lx4$)~Ac;T-JbQLP2hfk-80@?c3Npp+zc*Qw( zI8}mTR}+Fut+|hwOSX8@_UOO1Jm5zws^>YvVL$8XM_3!iEHcIbi!){9!8Zx0)OO+~ zK7Cfe(UFEU+GKHrqJ4ROh&=t6C^O^hgV>ORf94>5n`sm1V{l&z9L19Q2vf8Mjk6&Je6lt!tsmY^w4ew;}FxB7jwkV#AZ56_s&qGqnLHxBJ)d% z6|=*(9C@Q+8NAQ24E{#`>u{cY*ynk+C=jUe&7jD}=NH*Cu+9(L3H)IcFI*D~h-CmvRC*f%YFzrF| z`5A+wq0$H~u~d{WByJFyGs??Z@&+c`2r>Ii#arJgT|nM=EO6sDnvu*5L{puD`d71B z>zBl3(7G5{7dhq@%%#T9fafGM=+L#9+&fxUuT5qR74(pfu=CmteS9;h&OO*xUs*UkxeS3byMhx5WS~oes;$ep`Cw)x*`QSYT*h(`NZrbgCM)n@v@isTVL1(e{&uHJ>u?lozSofWZovQA`falnKriU1% zp#{V|W;~_Yc#*Q6?cN?Lvl<(hU>LMrfrb0BTP`|BL^#43^`@#qW{JhkgNDz80$&~l z5?tBx@K&>?424rkd+#v!!Tkc5Xp7qr-&~dn|1n;SC@K`>o>GN0OiU(Ey~%zxp99;K zdnHs-k{aiFNN&5yO=%VmoSgDOs1lX?2c#VY#;&zS+onb{p9B2`t6K_3jf^vwLoNGm z^^ChgQ5~jjFy%n9qn~3olW^NXXQFDPb(_U6hCPTn|LIo#S{OFUF5S{%3b+=SPW!>Krw2srlqIOV|~2xs&jQ@EAo38;$3(^Dn5TZE`Tn05td59!U8L*;s;U-xB2GUw(z{3nR)s>)F_UNt*8+&u8H z+QFjjP*#%N{l3!Kmrg|+ImveL`^i&N1HX1+(Xyl>?bxw6is3oJLT>I^ZkTJF@9u(a zqr@iS!u;!=JP%t#xBEV1l!cc9poGyHt-WzAZ09&8jaFiuI2wCWFh3@l@SKGHbihtt zjQg5k$;_&7xsX;Yy_4pL>ip@EQjs?1u9S+0%jWdVTQ|9J_^&VYWoNP%VcvS~r&tdU zyp~M52HE^eL2CXPs84nZiqG9Kg`YLoSt*Nj@n9b7_RE;j8EX#x*&&jeU!%**NPb2x z>e7^H^=Fq!DrzY3xvlEMicC+)S9VhmC07pkck&yQ{%lVZ#uo1NPKpeZzvqH{PY{zVIE>UA7-;tkIa};4$soM; ztTb*s_SV^jXsgB>b{KYfK`N73NG&hii&UDlu>*K?zq%awwosyI%tG&;KZdwy`GRC~ z_-;aRXa3A1gUyb?nY&HjI(HkGlk;uP2lAHa+pU}?rEN*oGlSkywt0)rFShpBw+yXl zil#s$ zMc4&z>6G@Tu}vqs6GG`ZYf}2ymN6B%&vV%(F`bfaeqBV#Nd~pKo88KM9!Z@j)M-uD zmBsU*RL>mMi}qoiA7o1k8hf@P`Yml(c#{0y>P4MP6}0Qt%A)^4EDLz0Ms&0XmkSTM zi?4fkAm(1m<;&qGe%|!Vq5*a!R%cwnqWSTf0MP)^ z03`${A^sza3ffZ8mV%Lz_cgR?MuzX%!9T^juz4{?rdmRL0jfQ?0(ekSxuo@t+ yssCSRY)I8p5(ENy`rY9J-~Z1V{J%g8T9BH%o%x4fUj&8+`R<7K;mU)-7ycXKj|-Xr diff --git a/test/gridstore/test_gs_working_field_read.pdf b/test/gridstore/test_gs_working_field_read.pdf deleted file mode 100644 index 4b1247a542ca908c91f6b7baa038004a449e696a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 130253 zcmeEP2_TeP-yf+&qD6Z#r9@)PK2w(LOWDa58e@!oFk_c#rL<^wBPm+6NE=!#NzyK< zgtFeWNJwcgX1+5sM#O#J>vr#b@7H~%M>EfMp67qge?RB^&O!@40~MqyMgj>}gVWr+ zCDhd=5H?;6UkY5&pXN^Sro*G)hBO)#954)`1qaZTBoMkm6cU3L1Xl#VErMw7!DI^9 zv1Gt8syJ07Tv1mEj#5)2!p&$tUL?3KEhvB%L}GZ+{NW^jcLcc6i$RCegWc#}?p~yz za77g_3SCK9F1SpO!~l=iTZ&Rcs;Oa+L?jl4#iEoXG&LnC{_ecDL=Sx1@Bj)Np&!OD zv}S-CB@ouya7Iut?}sT|O;rsgfgqFMNL4lP;@X05ZDVV=2g#StzlKEjfg{Xl{*-UU zWBQ7BLRgR(3`&qc9HB=E@gh^K40W7^?|>Wf4)*45-V`zeJUG~m!G9}bKN1x@#Lml| z;R(lpH!-4kQ9VILfuA~{7Az=1x-`E4@Njs=1U8*4j_>MMS>?929d%g5GyJE zR8RsQJkm-6Vc_KpUJ8yd@CEehQOKa3cy&W(fOhed2s=bxvm92a!JSuE@ybc>b zi+cl3AJV;i@8O(Vr`6{#KYOnTV-dc^bAQR^Ew)|uhwb+xWVYIN9U8khW%0x_pJH(r z7ITx1oW7O(o-;e`^ksR+g(a7#>z#IAqxL8w&+d=6 zkU96Ofi2t$iLI8ocR1#3+fK>TI@|6qFZ_z1zUXv&&_d1F^e)k$JBDJI&E|C;hcw2K z*VZg0JzKKEW^;@=hb&s6ramupX5{h^i8Lh{VvKV=H|5Rg%3V`~9uyv(IL>A3yfc`a z8ExFPO78o|hS}7-)?am($ia4E8EVD9(DBX@d^%C z(>;F4SlGD5x4Qvv_BBBtm-3p6&#id8kZA~i3)28L<#9icvw2(!Sf-DGh=UnOPuFG$ z`*2@y>tGX242%t6A|fI%Bk&K#t%m8sMu~{iuapW2=8{@U0{W3V_p zfw)vxPv5}M$k@c%#&(sRy@Mm!o#H|D^zx=NfX!Xq|r+8h(RWoz7?z5DhbNciPo zVrts4<0nq0pE`Z<(&en|oGVwa-7LCQe7oe%-Fr{UpFVqD@uIS-zM=8g*G+HUzI)&P zspIpP&abSlZXR7CFi`!NbXCD5MMXg4iB5uP z!8pw3&J@lBo!*W4(wy>|nXJ7HDO)wim*;w&dN(Wi#NHE5?|mKby>j0Wer$JY&pFoi zF)zo>B+MkrZJXNT$Ayi}XD`3PqW3Iho8@H_4!F+o+9myq=%bVf=JAMd16kX4iG6dE z%GSR9L_cez_JZn?noB;zHm^`|;*6{9LDZ~1SY4N}ZhFA4hQ9K)C8_IDb9+jdZAPV) zPR6?)E-I8BXAG}98)P~w+Bjgt+4pieb}!`j%sxKflVdl^^oo|rr+C@uswb?ZTiuj> zR$HDlamIC~`Fn})UoO{6at+>C_hGGZWJ~q4ltUhKnET6OKR%_sEx5ye%!O^-TTquA zEz_HlyQ1FDu0D3d5_Kfy_}iRo30wUbJr%eE=MB>x>`RuO{WRUfD>Gx)rn_B5ej?7X zzh*G?xv)0Ixt+eza$!}LGhV2R2T$5N<5$+Dn>%v4D>{z49(GIGyZvwr^I-RZ35vHZ z;x3wUVJYvYcI$FsqaAv$Xij8HvP2p)V_he!Q_r%sp0f2DG_;(b1m9mfyT|OwtBm@@ z`Fm5Z-HqvBu9Fpcw2ZCPhVKk+KiM+3Q3I{hMvM899MNI>Ood@@nw)ljM()+gmnWjv zXSwKa2(h?DA?^BXApcdY9>Ja++P18|^rjC@BFZeg-Jqa-;%zy*=a?Nf4#g)|YCp`& zrA=9qezkD_?bREsy&E+goE@)3oS9-=nUNRTQT-76>m&7=&62h=Ny@68cfE5DCtg39 zx!3&R+`NLD8s?p+HjFRb#GDj8Ez0_rqX?;u4O1^aJz+5xO$okGDEHw&^Y)6V$Jr9B z&20&d37h7(Cu~x;J+jQ_`QnSN?>-$Ym7st(x0?@bx9^*_-R6H@MEdtTn^a z1)JXru)$FK$F#&C7PUQFxm^@zFB7oTz|yyO!BKic!m+W|das&&uF4#mmKqVj(qCetVsCf_i*;5EnM-!skQuHNYkFhSdc~UjDT#83t8#67SoR0H-9=m< zZeBZ&3mY?z3)_$w?;p>mP<}3CKOOqD&%nl#58W9~=v{PBGv#$5VXLFW<^asm!=?0sn z$FtKKzFt`B5sxv_3ve#oAA=DaT`)mDVu|6-aE_V!_zV}%=tY+k?|p1~MA}>bOo#GQA2QA*X5hX2PPOM>Kf9t~uJ`+H`oVLry?F8;?Cq&4l(^aL(4P$NCE~cwEal65gY$+4&(3j7x|{Y&)Oq-PW=FX@&Bv2 z9}OD~nR~t)^Z(x5e>I=YYPDmnZ#eVH)vn-bUP0deV+S1O96ovEv*lxv8*?NSQwvTi z-9&EKZo5Zo;i06xeksF97oV|t;)TQG`lSo?cS{#92!*5za;E<|&UAN0J)$MPv2~Nn z?tKIgNIqrLF;uJGqwTJspwmq(7wGFt?i@7lQj%$R| z_r#S7@`jZ*VYUTFMDEH?8(1SI4n;cZDogT9vrs zjMi{=jmPACyG9`NOWMfuj6W!8-(?vguMtWTf%Mn^GD+0CsyAMXTnb~Q)#3J^@$Oc8 zmifgXa_hpYK`WzL#$6BGJe&T=%)aBTrT$v8;Dc_B@fkCo?J+TL(dtm&K6cu+qQWaG z33|hYX-Hv;7DxORrj0yD`-1}alVoL~Fin_k{(m2)^-`V%MZ(Hq^?daH$86cLb> zeO1=v0%fvlZysUhTaEP8xZY{`(>A78Z|K?m>2kA;rLl4En_)adK2r-a9{n*G>hI2Y zprDKgBw7D3$y&?WQGcH%#k%(Xd3D%kBZ?$FN4+kRmqxU_dH0%{-)Gm|?OA(l7bMV! zldAsA2ChHeLjB#D4HT5wfTZdlCRKSXueNf-g0>xb#Shc3CN`=*ocFF;bVg(RbC5kG z%f+3$FvWxx`s~mQN6ah5oT)kF;e@L{nSt+*tx$h=G6MxAGa%vmhY8moi>>&a%=Z8X z#8!WIssaV2Dj;$Chl$gV$5#DW3w(cUh5oy<7HBAI0ZGoLjT>V3N)0e zfW+w^CQd&bTk)A%V5q*uR)2Ta0u5y?Aj$fNN!E|WR{a@^Z~a!7zdK`rfif15RQd%O+_ z$0;f-A1j-FzGw$mu`YYIJ>gR+6Vrx}QuJj_ab|J3wI?JctC5?*kD>(~bCX!+6uR$C zF4xJ6UA)-;QN);}Hd9>84Bv*W%VQtikU1>YX+Qp2fSCLOxNqmYZL;SLHyyI5kh_45YtZroL*vy%@+thO%}7lo-yNDZAL$ES~1&qy3m zI9LobVyF8L)$@S)@%)zkHbEZqlQ`isU^Ad8b3ezFIo2YMI3CP&e;4HpCjK5_1*)%B z&BzsP>uHhLde%Dtt(m$pp+}wEMBaeAFq?Q+{`ISF445PCUQ%?%R8=pfv2^>BE^>o) zeGg?FQSMa-${>=8{X%0;p5D2g71-m;EL@N)UoRc&xcTT)b@3DWC*DUaS=D~L_t0Zv zRMy2(2}H`S!ra1%RQUx`kq>8guE>9$wJq!;drEqB^~3pRD?%d>n+~R0h0_aK_Ta<_ zGZn7ABR$<;Sz!r8nE=zX~E4eYnWL{$3m_%p7S>uH8 zspMBzZ=JQfXRd-bPm1M50c$@MemJ1WZvwhokCN!i-M>)2;WHe5Yb9yXi zem)QN3yslp;m#qmxF^b2?j5i&2*90-dT~!VaY|rR+0v8a?m8N=S*+gnq+7K!a@VGp zHb~EIu2~jS(_Me|%LEe#=98&$Cl6m(CZ}}VD0RtF_G$5Do~dyMTF)pcd&UnlV1loE z_zF?&+h}ymh=U~}5+L35;mn}$;5Q$Hh7SfJfW;9&e!!i8|K{9}41)PCM*1yl)AA5G z0R|f?1=s0 zAr<%gj5gnx@T-^KR^Mz1_UCYrMWjS`Lbl}RuqEBsIpVbd2&4@lkASJ4qq#8F%(Km| zqMB0gyKiT<^(@cJ&(CY~ND8D!swetgzq{n3`ohD89!nnF+GD(6kI##O`byVJ)ZW=| zZnU!JF$y?HOJ*VJkTgr-&4(^7%)O#0rQ0VvGoVJJ`C(A#%lF3i?dGfyyAPFIm_b+D zGA?YKGlC1-Zpnp7-Rn)#dRwb0#;hNIoC|A@>&$Dc+0j^&fd05lzF6z~#~8AgDR=sE zVQEpUxm?&L)dVi=wsO_i_y~M_1TiJxqPjI_?*1Mevn)SKiVM3reFYcRD8nqeSm06G zjW1na%hGwrWV_{MhJ8%~+rh8np=UsK1=ttjD@Z;dT>|Mu$bNh?>5xu@bRwh^e?TW9 zIO4zj$}GeeP-}Y>^5<}2<<41=(H$)=(}BnR2qawaTp0BuvneTz&V`wVJZq`$<-#0g z>#`MU)~462Jw2Dhg=Ng<9n&3h1eO%unHJue9@@jXO#9mFIm+)%)s8n+M{8TV%L;10 z91+h+@y4fk$1)3=4Y)Ao^L0=OP(48W@F&QHv?R#BdJ^Q?%;YM2ICpbmnV&2CTwdiy zR>S}xMT{#rp#|dH_^uN*AVlSfJndkM>Bof^RNGq(+FLEd4?hK4%!=H|vfRk0F4Qbp zY8DLIgKFa6#sy)a>?x*OfG`C`!ML!CwEEg!Y_(lB4cp+_W~$X?h`1r$qrmBtAqxJ= zft#%u8fKr>jO!0)KU^pSgTDSpRUp!!)n;la&k?`hCd#>602E*)&80H8$8IaL5X*c$ zrxwQiki-fFKFxtIEsUB5Cn>%^bLz6yj26C^lB5q?#&=&%lr0yYvk(<{EPgUD=%Syp z3dDHqv09q7Nb81NpI}q+B0bt$UF3m3{G1EhM`r_I;ERDk5#XFEvdSa3`fBkLwI?i% z$buX%MF!T(&krBehY8Oum#)!xTch!ApM@xN(N9?gvPwJ#k>|`UYZFW9Iw{Mu34nE6 z4AV0w0sG;@h22{kEyAoMw0-3ysWexe%Da`l;LaBr_lUTiak~A#V0-1CTJCSZrlqcfF8h~Ni1gIqc<0P5W?hojr=6MWTszIwHMp=7_aiz_ z(*jktDyF|ZhBD!C5A@%FIuI=$uEN?8EQNA8R;cR@t)4}ivI2o!)dAw5^W92Gz=4|= zpL#I2EcdbK+Y>b4*1-fvVVZFs9R?lCrJ<95b0vgjvZwfPEGyciId@BA3wSPFxyvG; zcdLW6>XK7{hyLLZD^lRoIhAGscf2V5M62dgn(rE&fpEe0Je%cWA2a(gUudn`nS z=V0%Zu9s%bF3o~L7yXn~AkvW1W?I^1NE;~VraW#6yaDuU2pfzoxJa*W<+*g1TV+3k zaA3T?0zVaEa$$)= zPWd$=4%plcaRT>j*Ui2k>m(EfejQ9Pjql7U!cw>MeYqo}pi6+i`~S6GL~n6nbxF0K zc5-3s3Odbl`y8*hb|y>VD?6>A4$-?eQ=0kiVohFZ(#sWVQsa~)6;lDZKj~k)7Hg3x zh=xbEv&Mq~Rn0}U-M%@Q)EZ^ro*oJ!bHv}Y$z`(l7D#hp@3L$1k{))K?|r($?RL9C zyDhsmLzedZMB@^g3~j3G!|t-CUe7Dj@NxLKOz^8C`ts`Wvx{dJ+ks!<1&*p?b~Nm0 zIMY?&s9u{febj&wwyh_JrG=g5(4NQRoAqy8$hFM1W#XF+lfIfE`)t)%2)RZ}n1d;)Yu_)T?O^zG9^hwitp<%|7YDS4{ZfrlTDi>0oObKLzZ> zqhCJN^fuY7+QbQc62I)7g`gw# z+_EWMwI=GV$F&858*o7@`E%N%ZX3|83byIvq0>Bl22~5h4kMA0MrNB?YnNf`je?#< z*TgtUe$6k=lmMx${S;rjp4n;6knY7*S6r}4xpi;n9pHrT-YjFee9TY!CpXL_E&ik) z!Bis@vVZY8>_A{Mu-dqqDh7>2<55^JGl{?K_@D#d78=J20jPP)Xz}kup|L0;1_>4> z>AP>hfdTgooR7@E58Q#n;MK4M;e7)R47l&_nO{3-(Q@o}Q)+)}W*K=6TynJJsE(?W zr78Dfmnh0=zIk$zyJpwMiO&*yK5ETTZ`i!8lpQa*2fiW3HnKKtiyX;)%`T;79ddKo zPuBd>CZa1d?&8c&@)SeK(i9EZ=)X>f)4ccYwz6AaM-?Aj89sB)B%Ku6StTrK zQ%u2=&|Q!3znWV%ZO=-h3wPSzbGuX*i98@kV;9UP!9-vV6IW*qnVQC@p3g7D{#nkT zkp#;;{qDunesq>Ime=kBW~O~N+3)}B5>L=9=bvW98TLUIuh*ftJ!fl_=~2_hEq=KR zkJP+$G}Sov^&U2>LW5dqA&oatV z*uQk~GB2vqqh^$*K8T#*WGD$8A{mvi7B*9eqw4(=s2Gl&-P$mU$T%WM*2c*YYld z3qyC+_ikj?oyuR>yHj(bXpvw@%T&@-&wotZ_c)S~-UBz{A+X{gC;DqN6#a*)v6>+tg42 z;#MO16!9yk^w(x^3{NgAJ-~%|bas7=DryhqNY8)Hwj_rh31ikhuwYrQURUkSg;i-P z9)4pJ<~(!Z&Kd`D;*4KTb-8;w)9-F?l(Ez|-8}3X%~&Cd4ibe%3#Sd^Mm%l!59#JX z783W}MB(4Ikn3PYH659)E9=~rkDV_S9LwZzx!h9js0Ee}i)h@U8x*Ncgj$s=ZM9r~ zqgi{n@;8<)2yC}An%opX%9z01eJdeDlT>_Taq-O~oF=VVo*#4D?YGZ^-R}L$ZPl6) zDJohtb4JgiJqN~(jiJ1~4J({7Z)}YHk_PnpN4tBrD196q^u|T9UfCDk9<eC<27?aVS`R-*{ygTQMajyVWVwc&es2YKzT{sCRezg*3*vpqas9CU$z@dj7Gy# zX-h5iX3jXaT=kmWyxZ%fMx~_08JNzOgoS6BzaC;d`4z)6o+wnmtA!irYT5jrl}GNjt8l*}OZG~dkG8+P;St%{0> z{l)ovkNSjmD@H0zONiLLp~04cHV`eQO{|<4^YYfgxRo1xKCwgR)CatXT7|&)A5#0W zaJ)X<#1wlkEoA>oNB@?E)G|4JJNaAs^^Gwm{+EddvW;DgYYi`Lb6iw@m3^CS2<%`O z+nr_I?pRvrSg}5Mo9iU+`C?gF!Q(!asNa`FUA#I$;`+t)Z$`@}7lvd@^isI6joX-> zUs$d^vmIFDi>6t6b{+xD^>eP~N9te5$ z)vjedz$y`mTEr4LRuIdcw1~Z=bz<>?OXdoPqLLRl-3^n7vv|%$rc|o>O*R^LSSNR_|4EahOCUWNMO@1VVB78HqLjqZ>8j^@p!xJ#VKz6`^ zZ-FdMxVTJz;EYux64cN{uuxiG;5^{Kfcr)q03*>D>>t2W!Trvtx8+fx_zg8l7?O6_ zx8~gA*dsH{rg(a6?f4K-TDvhm&Rah#)zLB|eU**!>8a2DJ-Z>)ZPPpEFLfL067cGk z?-CID<7wQ8EFP5arsYJ zFH8Z}3m3+ohv9*}0Bes*kptttDm%bDH{sM)=D`*hpS}5StV~Mc0Okq^)%X*rfls32 z1yEPwSs|`{2ryaz0mhVv0ArUW=nTD@5?IL_2`eaM5I6zN~j~25M z*Vf8OY&lb%6Ccr5%Tn0J)7g!^DPUf@0BZ=~CxV&gU|#yI>m_-!OY-#jGtsSP_Q9@! zdFo&jf%Yt+nt-^V72<-wNf+qz^w4tI*+5&BFXGGvkZCDhCxobW{^qALCxgK$UI4*} z7!6}q;`@}G5U9uX5vvaM1S5uSsE^5?&srmll7f~w%B;{ur~MLrZw;s*dpBnNF4IHmlf0Hri7 z?1Ux2D1}Z!l`wKn0Gz}}Sla;DQ47XPLk9}5)Up6VR=XTap_H9=rfxb=L3SHH~TOH-R5GQutP6$I5g3*Y!{I`p$A7Gqm-Cl{ zcm?cBXw*P(X}fIzUf3S2FA{pg{2S)HK|9a7T($yOs4_7sGD!gV6b5}kRqzM7K%k)k zG8*%SYtJH=zJ(3+!wT3_A~}||ZPPh-D+H;bG9KSq>dV9c;1L+~_vh3BF9o-rhbte( z9s^v<;Ce2M4=hiU{n7w3-S`srl=3<)xehb77FfBXI--+?uG*@hm%Ria&x326_~@_4 z0}q7qSB%f-gNz(>Hnq-yzn;+h9Dbr(|HdUgM*TBT5&(+bww}sglIXM`A3lB5BR-V9 zZ7v@rR&`7=e|4fWg0%VS@yqx_QC0~cVy{et9^2OhP$dHw2VyCJ&k6}pW6d8{7d$N_ zvs#)rgoF-OBsHh4m+S0TeSVEKxz-%7>s9)}04|El`AV_;-fj5CE_qcs&mRo39GfL2WhD{u)~P zH*eL@@?>dwy8Q9W0Js~U)M}X2YSGFcz`Po)A^_bCRT#u1kYGIhXDfrLK%wbRA1{js zI`bpQ)^Fd1Vi0696eL-5`CmBz<+$71?hY{W~x3~jNI;=A*?Fq6xq*}oq&kNz zY+3X;s;1Ben3Cy^Y|xq-F(4x6_qztJKj{STL|qzH34yf#`~X)3(^6)tKz67 z5E3#32K^7i!PE zw({`|cnr$#tpgWHK^H+)@b_^+D&ReZc7yhnsq5r&Epx3EkBGGbke+*rB0T`42Neg4 zhEDz~DgiV(?9LY%_lUTiaj?DePa&vQ2hsMdcThfJL-1GDTyf`zS>dBBfKj))1t zVWC4%P5e`MLLatJ=9M5dHdi0dhaxy4W@%cpHXUptPpt)!3oIDA2&#g=lM56@05~HL zcjz+=`TRDLmv}2 z5Grw1s49et2chEq!%^`dWY2#Pnkf%d)iU6Gm2!vcP=vs@!vVNN-*b+IKmZ{Sz-|cC z1_HH#Ky4sUo4**;22wMSnt{{|q-G#B0|8177mxfa?Za;)z476>c&K4WB3cdCj~j-8 ztHF6k)zu{sHsJvjIKtlC&6`4INFc0(-5C5M#(pF!MFL^x<<9VgBQeN+pf@zYd>a93 z*h-2&6_kL-f@cEUFas}N1|*PeLr*u|%N+qtHkDf6Uu-QMIbujKaf(1erJ##r{`s;b5t z2{}v&b$Vk#Z0$sqRFv1X9#>TORhEU)K+e_am zY4F2UDftJB`@Y#aVLS4a$J(<&Z$yvC?O1z`DjDLMxI}jB>I zC$B5SSXOqL4RVH|%eCtjNh_{g{^IC;H7dLIfh(-}D;Flpq$W!-;|?pAp9@|)|K<$r z4*$TpmqQa~NVs~hJDPl9v*lfaXku)AK}%#?bwlY6r=keCZJ2j#z4;xt6PDif3SSWR z=yROys^Ai$g`umi>sU6e_o^?`hqjFiyKr(VwLJ4PBBn;8ec`XSpLgpkenoa=cQ&jN z^>1jIEpmAL`sdecSqNIuHm&i|rTODn3H85}8?pA*X-)HLu1~tJc47631sCalg=5O% zl#~z0MNXD}L)?j&WRSsllBe|Po(Apshw_WHD-@D*Klkb?*1w#~JZ+t+gvhYoSC6S! z;`?UCDTO5Owy!Ce)!~`c`>k+ZkVE zKm)P$9&_a1wFV!3e<0!za^l4q3nbkZU6MMzHvVX45=ZiVMq>d>F?OeX`{E@zxagS| z{T4s*MLF&G^?{A-v98^7x+m41kZxJ%b&9Rpo0E$rw|yim`BEy&3bozvz6$rrZOMU0 zj~}q=qS<;PjiWDo^l4JdHQtuF1RIv#vpDOu{_WDlY5VF+niPccWFbrRG9;~8fXt6KZ1pXO5g6~SpmN4;l77N1$|QxmnPP+h7yMn^MbxBa@* zm5083F|QIWlAYhi+|Grq(U33xcrh%+>^VH=*>PJg%poY-TjnPsdJrJ^-$ z0VbUCYQ^{EW{U$ZH&QO2d*0&ZUUTxz)t!rj-og zv~=^*kV~ZW>hbrTwh^Cup4_tM`m+T1jvMiA@B<{?X-j)RUg43Z{InkkI4lVRA(eS(H4^rCp z1O=DJvsSOBF*iGYHN(-Zwq1W6p^>t^HcP9hwDM!;y^7n>Do-%8Um4F@;pA`(L0^iH zY@R%-M?^gv7w<^j$n-(PFehG~Yrd*XonD_|Zd{iC2tljMH@KXQ-gW+rX>!uREwkyn zj7EB(;XID4huTNVL#B{H6_P!Pst#@KR zxnse&Pj}KyVv}#1iEE{n)wAVoNVa!PPF}p!v@`$7%jcV~<~^;+sC@g`bWt1n_S4mm zaNg=w4xg)?vp#F)Ut)pfX`BEy<5$j-*xQ;j_ulNbxmXx}W`~K~`D)|Ye!E@#szp}S zZHQ<$XSudF7HZ9o(x9ISTUMMux82~Nd$Fo2BTq*;J>!LB{XJw=;3FwQ=G5NPY?b=A z1)c?!Z;HB`Qch^sDLl)PpSykck_blPca6DkaE$yw@5ak%r=zUPFv+4E z3F#y8wIQUqQ(|B>!QC|YlW*08eH!9AAHO3sajyYwfs%m1r z{lwt|CaNY+%0uscS!I0X%(9o24U3hQRoy+->zw7vY+5^E(XC8r{Wf;kg{+4Q!q!yo z(DT0CqFLPOcKue3e@J+wStxZz)A{@boN_rS&V+}U=q2r?o7ngzlZr9B-#ebgJvyZn zINL8oOp?4;?C6V{n0(WA>bA?t(wqsOFJH-f>g$(rl4a{dp0nq{>5FF1y(Zt13a2l+ zpK~tkwoe&*LVc@*k5-#a>#Vz{9o~kzEXZd0)Hj~!JtZG`r4FB%dB|--$C%Q6GctRK z&7cX^Se~5q%=;>#e82wjy-|BkvwoZI>QMf^DvGvtoUg>uC!*zru)?T05ZV~TF; z7R$gcq zb^AHnHwSGG*+ZP!>^dtf?S`gIg}QCK)6HwNtr+H5&oZ_{8MWTfH`&z*# z!>X+%uI@W38@^yq*{gSvS=aJ%&t>Jmd7+gZ%ATTC-`a9K^DSq=)7Q`0N{yvbyBGyi z!$Lk(dWRfwKb-)JwJ?UO-ML#hlUN$tDbwDR)%O1D&1l8mqtWwN2|7>x7F@V$cfP#E z|HS4BALZ4C<97WzSzJyGt~g_fU6>hn?%ELyZnx0AD3*P6FiiC5l# z?fBB#p&1HfV-0(8UT^$o=7z+Wgy8hB6-AFcp1j^uf1t-KDRSvU$s4W4qRZB7ter}` zSpXK@lXhyZk$oEF)SxvjO8;tG(m_m2``jMqB>Zjsx@c!sV>Eu3n*C1YTF=bI83dd3 zW*fV`&vLFu`+o8An2~6snPHY@QSr*O+LlVWc&+TK(_vD3e5YMmzH(T_igw#`M^CfJ z#fdsI);zm>b#zd!-bC^)*}35w%!H{;a+hB>Z3H%>i?yh+bZ0{LR~OZGkKHH6J#XqZ zphlfHYPfS(PqmRyV!hqHqWszZM&@YXI= z>)5m&|ELLVDa9Jr4IgCXSnKPnCpFNdydx;b^Rkmp+-qNwrg|p#7EBI(=U2(SPve@k zsI-mGYujw4D`V^8i&M77XL_bgR9BvpFzxFs%`}be2KAK6&SOR|5Ur~)(aCetyUdge z+NQH7Ti4@@eCQ|N1+orC;hSboU!LN4HD!eveZBujvb;vzZdaqQ$fD;iGG%_BTb5QS zuTZuTm$5uIbGlk3#|hAJDAPB|(& zIXmCQC0c=vIJ~8+sPhm|;H$!pAUa=Bl}4+XV%kW=db1O zuu+`6Pd*SPa{U}^E-W*Ug=|Ze-Y7dd=W*TBEYsCGEAnd6g1%12OGR9|zUP7YDTQm- zl;6yYJuZIrwi5n&_M5T>^h!#ETG8_}N;Ng`J!f0?=!RXo#gS(b z>s)tM`Dd?jmU?6JeDb}XqE)9PlPk@kYzk3eG*(3(qQI)Ul0` z(lg&KUA4PjdTNdR%Xj%>H#%H-zJwv~7mHf*WOLE|#l`b>s>$n4Zd`CdYlWq&somB< zdeIWxUBxpe5tn=%h=k&|S=+5^ot@c6bxKM-<}RbKCu6 zPq1S3au+|Ttkqe#+j&oR9SlGjKjn)1iY9sy1=9(RvbG6E@^=W%# z3Tu&T;rNHC zO{>k`>*x5<^zymGJG-Nl{bS6<_21pQ-qO|kMr`_r>uv9)H>$L?L`|=+W$DbBScSZ# z>-}r~r`JZWzp|@KA6`H7Ch-x=uV+@23d?wI-Q!&8BR9I&>jq+PDSYzU;0{NvbnZOY zbmP(3#`O;){H8waJ-+SrK8>>(i$bm@Cw=_#tm|U$=4B`Eoy&ea3_LtPROh7!&_pbu zKWBg&Y0d!EpD_Tx{y@S2|8pb^M!`lw34@;_VbHlO&!pkwdk4yuLq4?Tlhcqe+tx$8GgRVX)aSk*YYw%SyfQ!`cr;#>fEN5lqH(H(z9-?aL{%b^f7}_^Jz9`ENOyx*0{_6i9)-?; zBRm<50C_Y?9_0ZxY7i|rfUZiV(Wt%@RWi*_cno~|g9N!ZotGj98(0&B_o{@UtA6~a zcgCoxsq*ROy|Wrd71j677&KB9D|k;h9*GxL&R_J-yk$aue?6lys%ri3OeCtJ`Wg-g zT9Sb5r)QXV)rNoT)6ga}ylDQQO9PIuwKA6A{Rda%RsB)~!jI(TJD|$>`v@%t$xVam zr}SNY5A7}aPxXxhRoTxA1Ku5}hErAJpZK$A2n`J#NCKJU3pj)nga`s(lpp~yr~u+ER8N0S3w_6Kp%gdI04+~n4T`@4Uv5H&BW9?Z^Pido=%#NvX<(Cp zrb6;n`CrsBUj7VU1jQdg3*e~?I)eT^YYFYm?`)I-mIqHjsS^1{0}dww)y0=4o-QVW zi+EW|H!QNKtBM_v($aoWYGI#QK~3lDuJ)?1Mklhk#JftBiM~^$Poh@0U7!|6(h6b zgQ)msuLtuK8m+1(P|H6+g%_{qe^4`c`B4YUx)*f_PmRpN528j5C6t80)O@4z2dD}0 za;MM+O2@!P3HiQFMrP{=Qh_7jhL`hi)cpVzexyMzBJfuN=mQDy{hpAK+4(_);DKYv z^Iw6I8Ym(I2>by;{3)S>Sj#_@KA5%qslzbW$SnIHYOuI|mv;~~->CcnYQD3H0YUDA ziSZbgnh{#~0mcM}Q5#l$;doU3u=;YN(R>Cqj+@VSjT10T+l+U6UT zKhQReAd)}bm&Bm_mhjsQN6jBM^f(ZhAcryZxNlVc05x>7C(V}>G>{f>XfU_YzgNmg zV9rM3?hh0kED^Z=!>NI9Wc~m--wBR~mp{p$JjiLGP=_Jsj~jk0o~VlHi&zHo+5j?t zfE+hp8kJ5V1(7`mHqbx??KT`af7}DWf_O+6$qyn2q$v87_YaWsUF&@B9aFzEHb}LR z8GkHDNeH9IfiVk6N2n46TI^2>^M~YC5cJ@H09p`3&@{nA2pO6E#{z-D3==|PK@Lcm zdHNHAFEA(s@m-UU$YffuKZB02rUZp}ktr)_R4;$601}<<6++Qq1O-zR1fdySa9%@D z6DS2T&7a}rA578UB|;XWwHKlcz&50wgvY?QAP1#DcGs}ARsiJ(Xi&d*$dPIzb2mV2 zDhPvkaS$(I(w93!VsNT_8RZ?v6NKvY2RL~MVTd73J~H28U^)#)5YhpMV{jn7(-&Ca zfa>hy??3g``NSXu?SWv>K*YU^kSNFUj9r zTbpVapzViLGYJS#^L2Aj3D;if>qRlO4AeH&!D*YjYE!6sMk-W2A4?mgcBr-v)zntO zKiE$LsX+IlYG@mJ*#$Df)CdvAfdn-#G{sfN#?6>+ZfNRijPY1W527l73ZwWlG{__s zL1nrMm_&i(9vtM$H;2H?26%;0d{IbXpeP}fAkbOEpa7qaSIfMEh#&+SL3YJrJa9O? zJC5W5ycIkNjYFa_C?XDrQzN2?Xbj#J_ykB48jHpt5uogaXg$8MMPbp}2m~cql@b;} z31UzvLA>4`(0qJTjsRr%2M4(NB1j%Udw7As#g!85N+2M71JsB^7<3L8`DG#BS zg#~eAUlJ0IMG{m&n*9e;V85SHsg`)cu#D=u67RbrR43Hb%aUeg=-_RPqG>zmA`Nx4 zbq%$RsYGJ1nYI^I&sMY`GBQ-ec|Y1)Rij1Uj3Hr`lA-_AYU4ZSLq z9FFyOLlOPm3~hrQP(((!w!RLEs_#oOvQi`K(Lz?DhQCgDd?gAS;%K-kkc`pR)h7Aq zy4hR$`T1L~VtC^L(;69Thj@7eY5UQ%Lyc(KcmiNnQxCwfRyr28dfM8C+F_P_K1B`S z)9?UCb2B|h3Fi$)`Mbkmdon2xNcV>Av2ihzJJ7m(Nc_ zSY>3+`5;z7ee(#gSbTpM2?j?HIy*mNbND@;zelG9hiaP+%PKgEKM_OLLF0k~RYF7f zIxW;(jij$_>YyDyNT=CgEbNVS{Pb2a+$p+vz(3j!hITj$j2@k;Z{>(K330dAiCF39 z9^!^_r#o6>z1>h~V{J<#lD73Kn!AxzsJRy*WccgU`i^UdxcL!%9PI)ksM^LlKz}*< z)3tT}oBl!%;ERYAf!gNUzAG#PEr}ta{vj5+o=Ap`1J2yl!SeU%FCJgG^CnZ#8D4(; zB=it=7+HveQ3D}PpI?i{eoF~pL0S`pIeZrc4eYm|U;Ias=f7dI=?HhPAT2t@SA*~I z0%eN9ffrH*|KspOh#OfPGKe?~=nm{76pQ*cSOBQ;Kf`{1-^q^96 zpyhx;6FQ6-BJhQI4F`fOV7G+&|3?IQ3wiJe8e9w3YF(Zpw&_I@iol*mbXrMvh)jyQrPw5Q#FT@C9%J2IUfIB{- zEFu^iAmA^+V8AKrXEr1n^x^kO7#Je)CnT)@7&)ksMJ*^SQrM|Bh#cVY2@@3X|0y{m zi&+MaPr-pPOnv=@@Iho^)r5JiKVK~fC5M5)q1D{+?kF{~n+FQzj>HTJ$512latD$2 zElmwbBleBS0SpOL`;R9`{~O~Wuvm8j5=%zoi4+orh$IaqZDd~AK+>>;ZKi|j zQFuHVNx&fS9v(yj5kIuiM&@1&A`SIzXbT#P?dL~cs^CwEy8bI^NIb!vjKKmgp5%e| zKo2EtWX{DP(t!CArt{HiNTJOI0cC$m^snScG?|RTkV$wHkwn1Y$-`)ok+~KFNyC8d z6rtaQ2AV^tEHMOPUk3Xx@OZy5B*-uzu_!W{LU8vWknzK`+Q=M@L8O5UZ@*)Y|7Mvn zAPfBCo-3WltvMgq!zC`0~nrvnWXq0rF)qpUzg%g<`SF+ipC4SD_R z7!oA1zt@Q9kvSYl;BW}KM}UJqfD|P7E%a^wXQYhK*$}4Pd9emyGGYHX7|i#L`G7h5 z%Plf!6+{4y?iHp&3!wN9XSUEI^fd-JxdQ@?K_g~B{!bW~{B``s?`Z%d$c0*CFr`CS zab#`>XfI*#3m-@&7$e(1*y*20Hw$Z?t^|>ZL(3XO}yS_03 zeL9kt1Lidv&{0SgTRKGrbkTaKdXN|-UllKZIs*(ER-t*Q2oI?6XB4O~XeuD|3}UD- zJXHfo46>&d)t#gfVNKMxvNzTSA8IHrkg&?p9ckiYqDIxW)ipD+qSHKyHa=?pDkcmE z3K8#Xr($g6g+)5Tu`$DXIWRnY0>~C_0jn^Z8{B)4EXMT>u0qp!c5hoU6tbypDfFN~nOeMpsz%soSbQQ^WI&!8$n zWBcX#FRc=xHu9iQ-0A;`hldb4GG`5iN2wwOofhzcgrbQ9j{jKO^QMY0XiEjnx?Iq| zF+g;O5HK>A3?x@nv3*0^QK0Wr=xri_RTTEppgk-=+$0bqhd{8>W0eV#c0mzYxAy+}H=Fu_bpED;MQU{KBj zWr?I~X`W)hF1& z!BPDMpa@{@t*`(P{PN>p{$(J@;>THn9SrDy>c0#JNB0+iCcweg_Xa>&^Yu0V9>5<$ z7BTk2s=>k5cNvxd2V36`4h0gu{W}DZpBL`nQE;&JU53ZN!6w|nfw74FI|Mjha1Uq> zu=UNo74RdE%bdUnRo=yL{&ZaM#cvqEm4bu(rhyaq<-rMjCWaIE1;PnDyJ-aiMZuS# z6e9nf;6y7}V!1=!N1e^o*`^pnA z58%7L_Y?3B*zYS(z(QcZuRH-4f&ISn1dIgs`^ppW5*!T15xj?hoxpxyc><0C`+emJ zm`;rd zQ~ZZ3fzc_hWu;@Y?Q*S`Ppn%l`exp`3*&#CcW2{;&ZZl`T)33Ip541;^1`XjQ}j=r ze3tPsjrd~j!wMCbxM1>BgchgToT=Vhs%54X-TjVfUT~{6B|75Nqx~7zQmk2DMaLY| zQm)j9IQr=MvxlYc5^@r1%?k3^^{=HLa*JAPUAnEVqd4vNU0tI;yx&$U@wR$frk{0$ zt@tx`mkC#9|Eh~?{oCTWGxOOkueF$=-OawXy^B(N4Yj&j^zU4vEt_9e@gl`E{wAWL zv-}W;^CrPnwbU;})BjT697Y7Py^VFYRJ?HIu$}z6( zY=e1Nc8$qN(=3=v6F#zdmJ z5|zHQ+mGeA&B@KUvE3iT$$c`Ro;EvfEFFf9&1f z^!k!q+p{N&^%k9T+xPs;p1iJ=_ZLenx0+wLH`V8))9Sa`OFF5argdYLjV~*CIj4zd zU6S|0pEX@pE=dX4yu>zF8o%$Xlv7vs*(0v+a>QM(o1K&jUchuoaNaWQq0~6rUV|Qc z;xm}C@-s_uvAJ_>1LQ9yOV#X3n>8x#w#wrw?6dr&_4gU*;AcDb)$a2DG?p>`2+@md zcJbPndc~ry+ZE~A@I(0%ioED@G1c4saZmhSFE=6CHqSlngTGU>eCZiyN^Zi@IaA(< zHotjFV)?F3sIT7cIQh$mtn_E=%(5MIUOBEXN_&O-Rp(2De$(mJTdR{SSGb;-efCRg z#)bTljUQr)sI!``l(hL7X0%|uo>?eIOvKNdPB~YVb1otM+)CA~GhmtcsO+P)8ZoqG-hL;I&%`*s*SuCZp0r`1OhxCOX9vtq`PqM! zeULRXi%~r4e8Pb|=aBaN36-ID+BGJ8?EbV1CpOU{N{VFqMc9ZwvmUnNok~s@4-np7tsa&%?;X`lDF42@0)b&bV%vA!$AeR4ozAksU4zyt$u%`Nsh0==GIv@r<8H&JG^SU zj>O>hYPZCk4fI%D@s@2NzP9ve(5GbG*S)<*{V#;_eVEc+lYP z5Zv9}-Q9x+g1ft0aJOK=-QC?Cg5|!DoS8Y_d~;>pb^l$~da3T}lJ4rNu4h;6XK$t| zJj>4Q&Sgl4GwLW;B-4aX4Qj})7RB?nxbeprSuTe2c-ZRjN!y@F{!91>)PXLtO4 z_)UbBVDyT7qZ&A|0bcDhb&w=^-h#|rB$A}OI;7Kvmz#OBpV?y6FWG_)XtrR2e&#tm z`gIVwTJ{y7x=+Liap=i+kA7UMt$1{lr)F+XU5*syj zt&r!AqQvtgom=SoBJ9P=xnfY!l1z9e;fF;YA*Oj_ITzCz9;Y=cDlIFGS}zXBy{sE) z^$vJ^_RHwYXN`-mUfW+H_cf~EN3X4HwT3|A8F>15f8CGqvU))sMPXkC1ggec^iucQ zDv}4UH=nY|6^*+`y!UGXcMZH(rQPh+ZF6wd8Eu%Va7zqz{9fK1Y;n~r_fRG|=e4!D zX)ALv7o18|j@k;6HkZ0Sh-Md0QP}5pmwI5Txvt+;Q)+2d(o1iaAtb(VamV$eJ^Ii%82Dw(_G5d1D2au?Dl7sBb^UP?@j=z%45nFb2s)CP(X! zEBeTUsR3d~sCej&4cdZJzg8u8LrTT((=9S~7=!}-DU{5S?gY4kHE1eBZ6yUH(f-4_ zKqw~9bw^3UPl?9#5c6)#cKOhfWkaWYJi z7EMZSfHN@}OI9epnOuCO&s|K}dc7A!gInp?BF4h{62M;bH*hEGx zFeuWcTL*LzQB++lh`D~~pn5J}{7i|9?KWc<(SM*vnL;FEg7kIHQi|9?UE9dQFW9cS zKh1vcofLzMv`4# z?bKtGXg2ejrEOZyLooIhLGP&5F18>3tsNxjlh#6?LCMV%zXOsfr20-%p?WN3NjI<` zY-zH#hSj=cxf8^VmqlqfIw~ytT0^}%6{9sx;iI_jLHULQ#(imKLn( zs0W_kyh$g|RhQ?FcbXvKq`QBCd4h_R_IrO{)Djd(a2qsBh2;*?bGf2}|-b1VW#KrbG zBnhZe=x7YO<|#>99m-%w4#*(s6{+pFk!zLd(4Lkn8~vq0w!oCAKvZa1&_V-y$vR*!X>RW z`AscMZRnl62`5+d0?x5^H)m~^%(4oZbj@?)!`NCcFGsF4`q7!e+B#Fc0Jyt8<}v8ZQfJr)5=ge)oBpndF6(%?e~zlH~$daJJIK&6SKAw`IdYEZb#e zCt$m>@s%(21s8e}uFObeKi=o#a;9!N_q6n40LE9TZxVF5FcI0!?s;~ajUL{F6~86V z*MTQt%T*vm>Pagx3TukfLBOC;3PYyjI{uYX!Wx9Q>=c0u;?BNUh&U(x~ne3deID zwwcS7|CVitb&AGL+dc@)Sz4~~r3e9WgDXuoO@6Ym*LQ$>4*{&ik!n=M%MKJBZ&UA6 zO&>z9OAG&@kjb^`l)DIZtRgOjlOrvJfxJ_RWk>R5MyHjZiqDlhYOBd57NErsE;g~a zz3!mNNEk-XDa1q#lWos&cu1hXh7~rZZr)=ptCTipVwUy9>)yw8N@+sqlkc5V_@_3a zQ1CRvnYFPm>*PR%#Y!_f=O+uKOI4NzY6C}R{|Tc{E^mdCb1$`Zv8Nq zo-o5T-NwXP|3f%%g3EEuVy6~kURY3&Gu=~4Xu<4KOcA0@SvM2zfyk|}bfs8Zs~Ekd zyX;|54v~ZMQVZx~^PPV?p=(Kypq3M!BuC5Oh8Q~rn3lEF7I(u5ja-F>vwg)0N5C0U zyTE;h?|slYZdXH}^l6>e>yZo8+RCC+8)(P3X_g+-J(pvcd@0y2;Pu(FO&|cg;o)DG zc4Eb6bqXU62nsgSajEfA2<6E$F~{ut1b8Dk9 zzwzT1k^h~+;5i{#&*8`hvC4Ls1EDf5Pxeplh&wm-2#t_bfVmG>720(HyvUiU6HXDmGci?v#4FA(v)!sTQ)oY>DTlVI|lkseD z_{!sSfYA~EIyweS?i)8rzX7JMcs7Gfz`s9NmtV(@NF+gL-#b=7H}af*m}8qu`KWzJ zBezjtjj#?8-$xZONNVQ*n2v}RM{#)eXtV@zD5b(Bu0ia|tXXxwI*MrqrJ`6X04DaC z)XlCq+gOSq>XoIlvXc^pU1?8YeT4GplWQHBr%orV3u|y7rMh}-6%>MuxSA`hM`VU3 z4^#cjzjc?B4IdS)(kaAt>ARIE2c?bc*+`sy=|_SVTb?VMj$~BZb;>kIkP6Rqo`SAj z*lui6VqP%1|X)lPF0uq+NlO30i8-}=z^zh@PY?d!tsO(V65tJmkBp@ zI<Lrzvtbb>|NdO~dnS6AGTZakVyfP3ds8W*onbZU%@ih(mb6ZK>UW znMBy!<6#w z%YYVmhtY z;$75Yw$UiHZLYNFEMV5|J}=%I6`tg)?civBj}WDk;WBfkWb$rrDaQ@UYHNO?UZr2pb^SUy%q-Dlaicr>eb+iyx9uDD zw}uiF-G$6zObX;vb{@X8xawYj#^V|Ch%J7# zu_fqlLvG))JtFlvN`VM`%<@tz9i|&Q7XJ(>vx?3Y6`NIKA5>FUMrvR?H1ha8%w}Dx zs(aC0<#lm>1vxBD)@%l~m(h#$0OSeW#%DxvRb@ZsJZE?D&K??TRd^&OT)|wXPm1v zN5_#%J2wQK#g<-`Qck#)=FQhZvCi*jE3(OCPqQyi zrRdd|3yX#ZjXY)I?0bD^>ucUXp&W;*r1`^%rE4C^HxmnBAUPtm#ux{?GIgJXZxh%! z97uCr#FN~OZGGHFp*B3Iro(uxr+Xnt;Dd%6o~jn#96kkAHWjpl=>d7AMq=M7FI82C zMrVZ&D%ft#F-h5(lyu2%4D>i1xxY#%4N_SvbvfTB5WYqKP-sB`IvG*Bn!mat!(T{*4M7TIw! znG#ZMmkl_1nsch~w#X}0`b1P(B5%lx&?Uj=>F74c6F0+ncfanH;i%7D5`|QsfMtT` zypx6PF(g1&#M4wA0U7X(EKU6!KR;{*Dt$PF+ZL9^6fDY9m6-hld2V5{4OqfGw{bMO zDdo;3P1@DFFPZY2D5i*;fbWVsqxmmA9Lb?Xe^4OHu|9FS$wqrE1&!tVbcqE{WagDwWr**}^`H4Dl1l2;! znGj0KSDAWMeP<>|1;ft?2?D1P%db6Y5S)i{G*_0$=W<7tu>yQcVu@zXLN zQ3xkCJyfZPbnEjANHzrq_eEH@V*6gf4P!)+&WxISeKBr>GCD9ksU05>=rwyS)~vse zJeWud=hi!_?5$BY$K4nQsD$Pt)a?juWGqhG=%E@=C`+9!-GC41T;D@G$%q=4RBfFY zM#EUN`@!aSrVD>|v!%-$^%~|9ZVw6z@Q{4C!B91|R$p|O_|~vsVyqsrrlYT}tfWpy z?fc;WtVoc#Q>M=DHF5)H&oj5QvtpCf;?EHBeiDN!+K>I}9ZO!~oYqDH$G(K{PA*C- zQANMFg0Wj8&{BO*)!||fA3JcBs<-eYNJEH&PMJ|YZZ!*ZCl+9gA}nkuB1*QQ0gIk@ zcq+PJ2M5#*sx?cI)+M=r9EBT7Js9`)El9+$@2q9bz2Eb*;0jjI-h^KXQn}^N0w0!wkC4@ub`QhMXCt4D(j+rIi^i7|8HeQozw${^N$ZQ#&0-3|4L zX8v_hXb`)I8)*}8NGIR{0wB=mp!T>iU7upiFcS6*!)yoSaxSM_8)R!E++XcA7W5R# zBQ;a?XLLAKauING-K0DDOh&xeL@Ppw@1DmtWBk&dZ18w9aFV~c^p9sv8~V7~fwn2s zw`6_Wg8Phbe-Ug(*p=RPn^!VE`u*3>9Tk4KXj`qBjQvO)QG|x_EdvkS^zjSrOCOiW z6TA7YnUjH4pGR>6_KM`oZuZ6R2{Qf0)VLaknjRavmItc-7c00BtwPY!?sN%PDHOa` z#iIM7eb!h~jMO93X}JDEOeCK1g$LWF?K@_1xn|bajLVlNJ9ADdki?0!eG*;W-*XJN zLemX{7>^2xHJEC+N}TlMAAO5AOj}NKg96Y|LxLfxlrhX{Cap1m&a8^1u5GzY97olF zX-oFc^|1EK_?SvOJ1izfbHF{BrnqVxBN2Y_pGiSyKG-ZKw{hBLk0{3YJo?0SM67Qc zB^ZRSCH2=NBszA%NCS{Nrt-2?7yFJR)i7@s`X+_8v&HNq+rcQS*-6QTM~mnlHrV2x z7G2+rs>|6n&r;p^DvVra8d(#j8U@Vq)an`MDJ z>zbByGs5LS$1F#S>ZGxhJZe0Izo9nwJd5mFwm6WNU|EBHgKCWn?HO)Fe$FOml(b6f zRw$_3fz@k9kUj~xA^Z>#I0jw};5R)kn-|c$> z1g^cxoKk%2tEM5@N0>@@JyU5GQu;Ni8}k5Z>Lh?J=Q=#C0tyr?kv-xQ({TdghHE_L z47W-I5hk+Pk@Vm_jh8V$O_}owSs>5!GuJ8 zPF=4%id&Nvx!lWzpUqghy*@nO$TO-4Shi?Efab*fFjZcqzSpKGJj)>%SBo+zhMHkv zRkEm3qTLeF#3ANoFLmQbtKTkWG=?tP80Xq{|NZQlGGu=TenE;1F9GZGdlmJeno@HL z{}NG>5am-R)=rk<5OozZ)iIpId%nP5r34jkJ2uw`*FS9xf38YH+^vrbXssk;6^wn$ z_E3D3wp zY&q!ZX6U}xUKuEaYw0n6=iOCvquea)IVYawd`m32Rmp-^N{^ntRXWsqdy7V631d<( z$+opLtx{Ugqt^DFf3wE$V?Bc~^kJ-1$q(>U#4fR-N9=e02p_X4N7rn4%`Ajon9)Byhu9@Ewvy{Q? zUFR(t@}0Et`XgH;we--yMr~U6ATJp&?&_$Mk$qf#L)kI%a%f5VveQi1&h~j;ngD5L zY$if-Yl$R^n)}co-j8_e#BLwSU0d~0!q~9^nIK8L_9N{tcC7I1hL;;=uJ`4D7=|WV zY(O+10YPj7H;3^~G)8P+WYG8(;s#D_qdyEQbvN{MGQ6iDC+2bZ7Zrv%&5j5ac?e#% zNb8+uJQDL67Z3!gzO9yxRyMCt7V(KS$M<7Gr6&FNX6_CRp5W6;6q&^%;{8Bc zmZR|VBnCDby*|_Owe}4T!$CqB3VV;jL0TWuX5wu(p7=Qc4W=pbSQv;D>ev1%_dqy@ zlh}V@sWs(0QTve!cGc54gguy8kaa9{A>kgXzU7gayS7aOE>m|7iJm_?r;mWZC- ziZ^zYx!%4dbD`MAxzyVs_@H;{tWOa&{dUqfCgYm~WJcUj*cwjcyc(>c80iSIF*z9X zB%`8t)7Yk%{A@n8=Ojf$hZJZnPG#HvM0cx(ms+hx6{N{m?EArqyFiV}061S>S!un% zFBK$!VoJ{o3g(O-{EL4u@wEIcIfL>3M}!^MF|NG(&fN7?WN~6wccaA8G>MO#0z!MX zzB*&6)>-41Oc2j~_AU)jtU3aIcc-{1=CXMNfk*ES{I=#XY}HOb17#iN6E=)g_kB#| zM##g%xhNX#M@d=cX0CJ&26{rcHiaH=?aaaWeAOB-gJYYoVY z+F?!-U<##ig&s{rC8g7kBzWzUCfX{W+K}e`2)BReL&{WpFZtq}rsrISkWwjedsws% zU1Vkx+S$!@%h~3Br-^*7NB)KL!%b7~*=edL0%PMiock{I=t_O#wY-4-JHjj&_JJE# zmad!7c{)>f(iR5B{N}Gt2rk3n0=5(3g13e-o^3@Gl|z*#L#_htcmfu%ek+xjxj4q; zWVn~b-$NhF!ekzx`9dXKH{9WE{aAo7&}+N!Djv>(uKb|*p!=$~Y+E?v+h9n_Ft=dq;uj`&0J!HtXsAKPc* z$o@+n4%3$`H)EmOz^l8vM--Q|#Iy1XM5eWNh?5An>qEC|FP2>!W=RVw!>Ls}C6TQW zl=Y0M)CIRXT$U@zfW)CGrKI#rH>P3VhU9PEwaF$64#nxo{065Fbex=~PkPP>HCNn5 z^eRWGkJX*sOxJeT{pK9F29??-TuOs`<5)5S6+xqozc9H@u5aJYBFh-@jKdm8F6};T zIh7AJALrnjVApbp=}8}w-YG=G*eGW|s`bH*9YyrLuNN{8)vW9Jv} z1+;kFaU)wt8~fji zWYT(801v-%3c>(Z041Nj8Gu*7Z)0gFr3koesb}H<(2V%T7+O9DgI7gAb~aEis4%%^{d(>J3SK}KrsuTb*E=5YGh_&`d<<&I2u_gzbY-!u(Qzttc?7* zF@V!xBL;wu&YR8-Kpl(VAMNrQ^LOPOdVsbVKnn|o_AgzXzclp#g}iwl{!h9(S}M?r z3M$y`zlJ>cG<|>weJly10)PNNTtdA>65?Y&%a9Nv<-le+qng=GgwvurrLjguVXJuk zZ?#iXRVUYuz3%FzTaKwEGsOZP(uEOGeNSg?S?Rm>SEt?%YtId5Is~7f?1;<)h?)aO zEYJgZpNf!N7NL{vEaeQIpL+e4Kk;k&+0r^ATQ?3ns(p0?pCk-Ts4wSfUlNLB${^!R zNgOGaSxU_z=yBqhtVx`$_#9F670c|@Q&!@6Qh2w#f^o9c4G*m^t&>lX95i}}#9o*v zklF@sVge0ipf0yiNNDL?+X^`RDeS)=&GKLU&88i~eqjXqCXc-$>l7zLEHbe1iPKMgHiNn#*pG1;+5=_Cyw%F}Jz7bC~ zT@l=!ufKev$w{b;oago1UL>*QzM~gim^vOyG|lG@!rt7Sr#@tA|0ck_B0FY!?LuA{ zr=nSg>?9wURWBZdff*DdPk)92jHn+k57{1b-{>}Sk-bhhVk9%BhDbf)@?CQht@q`y zd`5|C3f$Lwzd>iD*oXNDZ^bvDYx&AJ9&cV#15|CHZGxin@{^ja z&opmuRO)v-6$Mnqgk1cG@duM}Y_3H;luncJA)e(tT99XA*gD8+f23v<=8HZD8N06T zFWuwBmA2#Y$J{Q6PO4AGJ;X9tkeCH`!cKba>L-W7H%qC-K8z2h-n>pp1D+Z1dGVk& z{qNj!2g10-$JLAb1xEEYS%oKZXExcQis;0-$cfo_CXNN>_LI6uD2jE(t?Dta<d4Z63 z3s-|U7EJAsBgvy~$`abgK4nd>vI2CXF4(KbRa)7gx^1(rY?k_O)WmqKj8}{X#0teW zb&$pe{XrH}jI>n(8pBv_j9Xp>hLDsWDOtt_M&-ZU2SNN)d)K*+(T^AAa(5A592491 zfq;~W2aFjmtx@Jg7vZXXO5z=gv^&jMKaLsXP9k}jy8(GCGeZ|$2Hwjc*V&ibr){;* zFAC|LoXAjv6$>%eG7E5t$qh{HJbH)2`zz-MbD6k(OY}>VQ_09E9|=S&{eA35A+oFZ zWhLDFZ9!l7%=(n9g%a>91c~`;vvcHa9QDs0udh9AuL7N+5Ju)~Jmru<;5cXR^v6yd zij9nzA54M#?b6qtdw-74Iy-+BQfhM>QFp?0A7Q!RrWSbdP1>52g~;#5jS#ip%*X(7 z-lW@eXS1iGC4i)x*#5#7g=w$uNI%~E)T^_kOf<$ZjFY~Ssk7vY8G{n!v`8dTi%{Fl zUn;$qn#NYhMMy|rtS?uqO+2MeeN(|q3!%FFvXos#|I+vx4b3C0GRoplW+0s~uDqGx$T~Pqnf4dp#KT0Rq5ZQ)L-C6oO%L zKZu*EI6JB*k+v}yC1^}_tbcLdKlpiFYPIBY_v^8zI{!AexOf&M7kG11!qV=-QS8%K zarlIs3+MU9gPJoIt1ok79mexc8&AtA7m#gDZgiCSEF z^xnO}%f9N!R3L*CYX7d+K#Lf810KFmMp^0L=9CdhO@kgE&EWQ8k7#N?*c+kD{_8xj zUPQ5=G)9eqn1e-XLR>=N$4*G%a=pXav;eSTG|z~*Y}VXbqkNAd71c}|eSMH8rINg! zvyG33UzpQA4U_5@;>bS5jp)~VFm6f6{^IN>z55ZJw;kF^g(FBsR`10@Jv@m*z7Q zXd!0}%Qd3X!J{&&Y<&mfip8TK`rC5e)q$F9Y}SwIEzW+kHNJDbU2?F1>-F(znprZD zT`7bK=`d%vZ|w&O6ylE*xZ^5KkpFD2jKp0{CLez5KYVU*dv7pZhUrC;MVwTDBrJj) zE9-eLp<7)?55+NlbDUJ1V?UZ-ZoNN$zS?BXLiEu~OG}s|X#^H~iZN+}Obv8qBf7E$ zvA}0&R(rp2xi^zDeofwz(|N!gI5b`swW3;?t#j`*ng6zv0y9DYCK2R*5!oUDHI^CP z(|Gq?t+^w;9X;MDic0t|NfVRu(W(&x1Me!mFljq`T%%858K><$E2f~9(8-$vJc#QD zYo51ATzcWM(4AR6Fv^kBe76kD!dgZq-9jx3(%t0kZLpkBH`dTR!ojJ$gZium`$BR+J_HiV3;>HcJ1)H z(chyAl8%(n!yeK2Lt5Yipxs!ErGfLsabeJ6#N=+Go{i$0U zc`IjE>&gedBQXR% zy>#z@U+~mYAYDvJdG?v1Ylu#+xXQOiem`i)M54E*_a^n&KMNii$Sf;VK|!5-?D^W0 zEZ!liDdu>8+`ZLEJP=ff6jkJ*uC!b1%)Cu`n2S;S#^TovGN>Q`#ufQ#e4A zhq%$?9?iQDaHMSqV%Fi&YS;FaL#%v*TZ%jut;JVp8wBeIRZ&+JOnnFExsJFbb-}HI zPKdl>rASU=KyD0)r z7yxeL^c;-dI6$<2m)8KP6x;xGS}QSYV;cb5hXBBxGBE=Pi*5wu0K=;QgSG^;GOr%z z%&bia$i)l+(wLc}8z52vVD{Y7$m&%(qa*l>Vf0Ty5g=Q=@jw8AnV6uWjfj|_lpcU4 z^;ZEfv?{N}D-BivV~Z8Q_+SCBNZ0_x7iPfIzMiuJC^ZZK^33b`YxsKoujAJcKrnne ze?5Nv{Z$6bD^CZI_OIVtUO*fhfc^0r_nM9oK%#j&2GsFd&g=1C;11B?mDL7tZ2=(GalM)~;UVA>2K>EIl>WZ~=H?0DGbA ztN_a6|76|h%~&8{-HG|{>qc}m?2N1cYe9csH~QDazt@eJ*l1qw0btnR@9Rc?n3(^v zZuA!OyB+>oD58H|;Cfwf`p3G_8)FRc#Q%$Rqd+AONi-9r%!Q>TRA3{IW!xgn2!BrX zOk147cjPdpa?;T%N>F}2S(hk;JmgeU-(+tpsN7KNV|;`wRavo$Q?r zxk)#j2~pok7{xO+lU!_jtY)lP8@@|TUONT>@d4rY_5GT>P>P}P#gA5P7Nozz&?v9K zL^5m{szWH6nl2P>bPk6#x;@bGtSqfd3A!anUG!JlbmLY;LOwwHjW9^yQv)qyXy5Y*25>NTJrRJT(A8Gl)_4D+YT2vn|dPkP_?!Zn~D0yrw zKb6hX+=7Q5VKGMt#8unnV7pZkPHL43$LK^=&==g z=yrPCVMIydW@b=|9hm|Zhm8PN#8EWS-tCG}D8;4ixNIG}zxKgoCfyi0n?Kpu{kXpU znTloK$vbbZlCqAFK{7Vz9}@Z)%^RoghH~wt=vB^%rl=m~M`f;1cR5K^q;jM1iWBi@ zE2;V(Sd!+sDSnWc4@2hHbEb;Z*x{wZA4s|>*jlyRH~5vFh#6VR_J>3{Ga7H6cc)p( zv>R!;;I3eodCa9cp|?Ivc0VOJD)x>#;ZJU>@bJ#FdMYb^cG8bg+zD=P8K!T-R=h>M zA=NfvNE!Z^13xx#@G-)!>}x0`C8}+lE36C_DM=Ga&m7}XncpQ@>B)H{TbX458d=*} z%5nP>VVIl$@*0jQ4Bb97r_hW7_6ykRdj7g1PId#?x;V7sS?is-ca>2>=C8ugF`Q$qN8-5MDcUQa%#msW~+C%q|6w@BlGo2xE7_E*Q6Z$ zJk(ui{mHECnCgRZTkDKtk&Y3mCjH?{poofOsxtvM=<_qtoFbE+=2I`NLX6$jLY%*Y zfqpxZk_hq+dq!~gL^w2p*rRI>FY-K(4g+G>CYNdZ@w+Hh6<34WSyQ%}Q68mZF^pDe zydLTW=u6u(lZ51?{CH1CP4Ahag6YUKol@TJL)`u{8?M$oYd#bj$#TkX<__Hjpxzru zrSIBOp6R@Q9K`+{`Vb-Q%Njcx?#6iV^h=V1wU=dUEtf_L4g6!GH}5%m4ml}N$TkI( zWiWwgEFo$2M!;t@OrSX9x`|j;v8e*qJBK;LIAOs~GxqI#1NQjPiSG(i_L$U7w1Iy7 z%dJ1nkI;cvM1-wTGHdA(QjhA@s46siQWBaPi+0eJm3X`+D*Kx2?>^&~(PXs28{yqs znMt3j*)_!NP#m`5x6vM}r961Z3^Xqu^}bi*&AwG z?YNIJizPC=(TcSQ?*1UQp_X3AHzq+%u<0%#D93lDUftjAw!b8NE?R4UlLl_FhV=VxzzePFl0JJ6So zmc*ofH`(t^y{zN9#`NB^NP0T&Jq>$P{74Vtk97WM=C3ETsd z8nw5FUb!H?$wVYOz;5~%aNL=ueUfk)->lxJvqWU!)_5#TVfF9BG25I34(r10aFz&;ZTfG+-e3~)pZzz2T^^{<5WzaYz>xtR&D{q+Aq z{oiDO{{ZUg0butP)H48J?rZP|R{z21zp?foH2()I|H1u#K>Z)Y&in_>|AFzp5%gaW z|Bt-z2mb%Y+J9jDEAoD$(*Hj~*KZ~;{^}h6?eO_Gbp7{n^S_O*-w6Nz1zo?HQutSN z{eQF{3vg!f*M97O-iig7mtkh6V|@kI01quRtaPk&0Luq|wqgO>tZd8xX#78e)c==T zu>fBo3``94zajansPShjmigbdV&7u^E2IV(WM%mmNDUC}0rJTI2BcPlR7KmH&0wr) zfr9d*6av;$(><_y-*z{8THTQ|=}{#cpChVNrTtDSN7djf`Jp*cifOR04IKSyQce?g ztObgcwY|+{p=%)S3u8-Y($m=0TDpm|aeMO5_N(;Ej5|*OAU-4rK`=g)_8n%*p@cT~ zRy2)8sIJp*A(LG()$m^tz^drLmWbcY(}@^0<5#>tUo6h4&nD5a;tiNPe8{g zNa}%t?s_3y^{%V0G{VXzPJ!;q#;?FVgt3rV*qD{MxF*-GAP_aSWw8beWI*D|V2`vK zWi&yJ1q)4b%qp*h4*Ci;`|dccDE;A!m#sp8$jK~oW&7>J47FPol zqs_{&+F?~Cw}8&CN-q;}>}_NG`Mc3Ims7ZQDk`c)XU_!~8~n8F#_aaH^-Ck-gS)eO z1oDrr&rj(h6}V#~zD7f9SJ>j>!*MqiOZH~npDd}iX*<=3bDhw0oGhUV&BVsJc8xj6 zSTapIrXu0F+8SgfgxgZoS6wH+TR%5H;@{nLZZ`-wHMI#{*rl}O4GX5Mtd-01*WYAo z&Ll{6fNbF|HCX3nCND)&sl(|bAMbyqfQ%Zr;Su-B#nn2?edwQfC=@-)jNnM*8h8Cp zz=&&Qo>yOqCWeA-2$L|hP9Z{OrW;Zzr66-V3nA)y8t5ggA&ARBp40HSpU#GsDlaUIaeRZVzR@Sh&dCU-6$ZY&Ua+?PsPkHXi z_-gs+ysF9_)TASWNoyWj-P7sHB?CEC7uHRdMQbSI=BOZUgh`eNFf5cJK2&^gm(ou? zIXS}B_T@mT#OI;3biW9wjtPoZUGOb6kHUiak8z*zHp;rQ&GLsC$Adt0Q+YgV)i+}c znSS~GYArbI|AvTw2F2gK87od{N(;68aqK$s9h-o?xzhvmZBd|>_{I8ZsR#$>J8^vP zBXG;9uU;&$PX_OgB0X1D58IJMBKab9ZM)Ofk-_F9F`}BYvF6qp%ncysS_Fo(UtG@M zEur8oEVX}CdOrs)r@i1QA$*D`DdZ(f-1ZyVC7rJoy5bXX5ZvCC(&f;WS5|g@GQlrKPj= zc4m`#R+AF*JT*AW>2(axFtIZV#mCOi6^*ka^=6F`bAy(UPZ!xH+!~eXgav6bCuM@h zSXuYfc*ami3|c6?|NMsfX-eqer@T@ebr-A!Lg zFdjM{=>+XUjSAlFCDHJXhnDa8>jx-;ksaIAYO#&l?V_r%r<3p$?1X0 z`(}f+E9ltMR9VPEY?HeV;EjV-S!6IXKsf*}xlcUm^lRx8UPo+24&r7uvPO&vP9{&g z?3;`RBoUMu>+_d|%W4(yn|8Rcd-pU)0atOJ&M@Xw3%)$&24frKxX+ z`P{YG?3MUFMLTAQV-XFee^6~9M|PX4-|_bDZYVYau49!O5n`^qR~1i_QSGL-m55ld zIE%{~0}YJ|%e$}>@;(JtT9b zNtmY4Qd1$eH0aPgkp};xgtXJmN2)__hntkq85^6AAAy8~6crT(`RpVe6&*83X_*Ou zyQOH3junk5(DuJ3(f2bSM`A|y1b_0_SK>koiaGZ`(V3`fd-%TEML&Br2`zcexZYtLwZxT7RF|Qn)ZAuya z$SXR9i*xNm@kdVigCj)bpAv&(PGtzt6cxu0eZ3<<9&_C6RkhL|z*+e`H6LJ-sTgaV zloDb{SifCL0k54G?0(01d~m*7)n1#%!9x&15O|M+%c-u)^i$U^VY1soZgpJO+S!?= z8!T$722NHTSQvWDZ|@S)e!qw;h*94nRu{<4LS9^*eSlH>gS~Cl(%uT58tT{NQAYU zoS8_{(Ulm25OjK!%i*Kgw*%6K$>YEx-Ci)$LdGX#hP1qJu1ub<>gte3cL%x zd)a4jUEcv#ps&8-WK~7|^#iPln*;6~M#jJ`B(4`ZIb# zs#?0{XqQcm#V*p4v(MBLH2Ra5l-C!d1bTJsPf&1d8@%io^Vc;eNPIdIo}gc@&-{@j zbtHV=+xjD9ffhuDRe1X1N@dNOY=K`2_G0yfO%6ai85-4j+WutFxs5kLE}K0cr+bXG zGa>;W?)P#e2@P^JmTF{3x=Tx?FPM0UtM|**_Mz+b6Xiw(CnZt7R*91kL_%wI{8`f4 z2xjBZRMteH5!w&W-UQI08o5cfF1NeDP4^GtXwl!Apy{N$=F^i?8z4K2C!8rR(Ie&! zOK}wBWt^=NprTDK@rB$mFxd9)?PY=pKCXxd18IF}S#wd#}^O%JKcA`Uvi`+nfBnu0msptxaw&H-t{# zsw)2M*!;|jLct8R=CZ8uHAH9uHMPP62toVcU_~P+A)>DqmF98=25#W!wMaPAs*#L~ zpHyOIi?B%X3Ac<;NX(?>x_et(4#fS3Pk#MGvto1d8TBEsV*W9+LmhR<#wDo}?=2>J+AS#ZMRRPqfVH5_pItFeB|*TLwY=|W zJgyIlPjDJe?%^Uwvt9x}+k~p4b46MnTm=JbZElriU~IqJ+%_~K)g39Y=sRt>I^o7E zK1d;Nw{cC9mrTTG406*nNj+qDrcxP^2v09f894m<{zLRf6_+m)$O>yQz8stydY)D* zFn#sICcjX<>Y++|9!*VPAuzC#oNs^Coa7ldGYG5D(95d9&8-3-cmyGQtWhlKu4s2U zS|@DU?A?{hTwQ9VCoXHZJAzzti8|vO3EF~!C6j)6-Y7<%A@Z4w*+5M^Sc7os9%|{l zmDG`u-|QVBPbYk^L@|e9rrBo9F8LqrU3oZFUHcA|(jZMTrjpE#Gw(_w8AF5!uQF!H zJP%FY2E7WY6roHJ$=pYVlt_sTDGkW@8Y&@?>9^L|M?YupzVCYf`TqM{SJye+=UHn# z>)Cs)z0P^=weCdqTietW6*nc14ptqO?wwQ(Zr>8UId)dt#XV~zUnKsr)o4-W`BA68 zUyJT*NXovWdsis(fsc-McHB{uC@G%QbT`|Z!+yJKn-KrwFJi=kNnUl7m&Y2qkD6$> z-r8^68o7#7IF2V`V(+N*lF!T4D;`(XOKf)Fo<^Ev)~omhw6vUlXlMC+@tC;Lq@R}N zu#Nle!x}UF7Y5BNEK&p$tX|5TdE8X7AZ-yZ`C(SPNu_teYP~>P;~{p(N)J)v`)d;h zjT)!k>sv_F4Bcu!u$ZmkvP$-n$qgLb_fIF(W;bwc$l1luzc_GtIq)W=PDh^ zUi;#Ch8CObZFblayR9d}Fj`mL$G20^LpQCilT9wP%6e~8i2?7}<{$^&DV|rOq0!Yt zn)yNc`Y-!$4(>CFA=tEdfh7pS}M|jHy|8bWe$^#!QNoLWz3x=(=gE zrrJP-$9-(-7InG@%gY_Ss;;ICI`P_h?N>KcHJf^T=6s-{%OaPJH>PZ~cNLa#OO&Ro znJEj5`7OvDu~Kj#zP;6E61Gj%L?<#pBCI+r&3Wu^f{^^an8Qut1gV(B%8Wccs}xEd zxj&+=P%@1}+k+H4mLrj?@a`iKVQ!`L9RIf1tM65nBwSn!CD%S58>@KQrMCO? z`@d8Ki>KX(jqaCdHSXD?*`4|32zNUHxMFs_AB^xeD(<{#~X9rnk!wI{fX-+L!BDiZO%r?~0LyL`!Y!%e4dzV$87*6uQY zInZbRKGV}@&vd1Q^R4_h*Y8#385(%H(u}^cKOkrg-&x~%KzMZYxUbcK$;s{)u3hE} z%jMOyuJ;*VUdiQq)N~<7xW&S4&qnfduI*;al54mS=}8Un?C3rAt?&N+NaHmhZ?4J} zCJqRsvRy3T-C?fSm@M&pAS28zTekG};ZV=_(MGXX{_bXb)udde_G8b$(@;;B__edL zp_Xeh;|VT$FOw}XtHQ)$ zc74OB?FS40MEu!f{q#snQxsbp_kE}}DI00n>c45Mp4!M6rR(Z7VVEk{8qQM`%&A!6 zWz+k#c&+&TM}JN)3iNXG?Dc=$CPw~oJn2MS6XEiBN2r=ti|Py6dX=s!t2`k`g=0^s ze8RSIeO1r=ezMbEDP^$bCM>Cne`V-8!B%pgBmJco&?Ios)Hr7pxXfPsg;1NNqZJ3= zq8C9qwxLr30i!LmgbcMaKkO2x*dOmnKXc>E!EdvtF80<$E1%dJa8|?k=qKY)}k18wHR#x3^0LlGBhqKO^_4M)@+=y7YH00sE*8Azl zoVJ@?ztIxj)78s|$Zn3+@a6w1ARC<| z@$ydimFm%)jee`1#2njDkfNLSlUufNnRlqS$s()v-m-$pL{rCy$!u0Smk<-7jdIVo zIHu-RH~x6zZSxHL3{lp*Lo#T%#^&|r4Ex)u;h(m2HE|DCJ6d%ZfUxHkV3ToS2suQk#`5<`CcJfwxUS&ns_}gyDu1=ru z;@BN0zP~f^lGlINVEMhp@nBuNl%!K+^9blfl2SmV~OzVDCh4%>q~ zd#bl=cKCdGQ6_OBGwJ|oL)c-@DK1rkTz#9=S^e@WVhf(v53EJ}gD$Izezm@*y7p_u zGrn?Os$=K#aHVxz@iqjGVg4kGnj)`d4&r;xC(G$Ly|Uf8+}5aWB<}l!z}?E!$w-UH zEz!%xyg21I(7!Js#Rz_G59Td;$`!{JX7aPU51cinB|~TD3_Ve5@JxkYxM%yoHFfb9 ziBgtHY^q&u0@|BGzKgaTOXu@`Z_yTzof8zklCQ($OToRQlY=?OmMp3*^^whRJ7yDL z_p?X(`Cx8)N^M_&!79^HHY3rO5|kk48M7C=&VRfai5xmja(%)V+P>VDBrdf$v}46}_=V%h;%fIBGLv$v2tIUT+oqYxLq&^*3Lnp& zP!eMI@thrMGkV>&jZ^7`VOS>!2nFCn3)IOEr%a-d?--ut;K>X3_XgGt*!8ch%uCY|5G>UZSiLE%h?FM6O|fq5 zGYIMVoGkNtXqxJ<-p(}FRwI4WyB}H^=P{?z4g(@W7oBwx}_6WMQnLa z%*cOFT>mZKk^kq$Qma*}cX;Y;-)RNw<|~wpN4j0-We+)2>!`9ZJx=}ffQsT5bJ1qm z!2uP%f~}pkAO6}JwnpJ?0dJj^@xq8xYCXuVxN}yM$Ah&i0-XjZL|HX=mHXN#2?bzCqV-s+n0zg*+XvUF_@Azd(4=xO7+qXScMi z-I}w$C$?RZ*z31>NFjO5e5>2ZKHhkNr&gOhE_u8=^Eu#KA=TDyI(X>mkDuRKbv_to ztf}BCaMuhrGorkRGd|l{bEKzyCi>RUIM*2E^jATf*SZRi69q^vPCII!ot^%dQubaX{BrBri&k}I37cBGTz@q@~*@ z+u!N)Zfs16(sqeHe*4E(zWR#sgqi+2MJmr3pHnueWzDf1xhW}%+vInJj`m9L%x#YM z$od#@UWIB9lD~V!r2`kX+gIc&JH^rFpUQ75I}34qp~vU1UB>Qf$!(a%*SCJL~sB-q_o2FbACWuhCjeh2Hh2W4zW23 zE353<@m3p&k4OX|J%{uQq8QV-7x-2U&M;2t4hVQ#6ntWH`BozIbEQMM{G9nU1KQqgog zm6@Dp@?p_jJChwdN6KZgT$%ZMrX>ne&;k@@>+pX>iZa?B3FW*pS+yi);vS{NGHJMT z++4Iy5}MSfp(aeC0Hn+UE&+*224He*(aLCOLrlH^1+|+~belZz+nIrQu zdyD!>L<^9Zpo%(AM8Unx5TKt?m?1zbBZ02` zH@On?6mR|w)d>{pNn>L^UIzNy@P6;85GESU;5X;|$j6e!_=#h`2k zD+U#RaTpoOez4lnh)}Qvi{X8yGo(sb?Ese>=N}z`GA|fA1baOQ1cZ+F1p#VSn6iMn zj`IazxcJEfAzrL60K>%;2%F%10T@(mVeuKT;_<$afKoZu4xDCyjUNyz0S|OcePjgh z3s^AVe5TOwzEJ46Yc5ZvVtoPQg9@nmEbYRu(6HkJlm&|l7CVAGjexrz0K>r zW$7d+-va;U#wr+2p@IWca2VWNhqc3xUpiRZW3M?K z?76{SbHLd94MxL_RXPp9-D`9@cywZYp_8aMpXtA81DsHUizyv}GFz-MK;&`v8XbX~ z{jhcvsEvgwi=V>~V1XSo2!ROYt60i{rz(`P!eCS=YlXoOC`HAJ0aYwqSul}f?>_`i ziny}iKpY%~;O7w>#sI8oaBYBT2p2yvK5%hHsJLf00uE2Y z*n#ya0XvTa40rDWjDo!= count1); - test.ok(collectionInfo2['_id_'] != null); - test.equal('_id', collectionInfo2['_id_'][0][0]); - test.ok(collectionInfo2['a_1'] != null); - test.deepEqual([["a", 1]], collectionInfo2['a_1']); - test.ok((collectionInfo[indexName] != null)); - test.deepEqual([["a", 1]], collectionInfo[indexName]); - - // Let's close the db - test.done(); - }); - }); - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleMultipleColumnIndexes = function(test) { - client.createCollection('test_multiple_index_cols', function(err, collection) { - collection.insert({a:1}, function(err, ids) { - // Create an index on the collection - client.createIndex(collection.collectionName, [['a', -1], ['b', 1], ['c', -1]], function(err, indexName) { - test.equal("a_-1_b_1_c_-1", indexName); - // Let's fetch the index information - client.indexInformation(collection.collectionName, function(err, collectionInfo) { - var count1 = 0; - // Get count of indexes - for(var i in collectionInfo) { count1 += 1;} - - // Test - test.equal(2, count1); - test.ok(collectionInfo[indexName] != null); - test.deepEqual([['a', -1], ['b', 1], ['c', -1]], collectionInfo[indexName]); - - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleUniqueIndex = function(test) { - // Create a non-unique index and test inserts - client.createCollection('test_unique_index', function(err, collection) { - client.createIndex(collection.collectionName, 'hello', function(err, indexName) { - // Insert some docs - collection.insert([{'hello':'world'}, {'hello':'mike'}, {'hello':'world'}], {safe:true}, function(err, errors) { - // Assert that we have no erros - client.error(function(err, errors) { - test.equal(1, errors.length); - test.equal(null, errors[0].err); - - // Create a unique index and test that insert fails - client.createCollection('test_unique_index2', function(err, collection) { - client.createIndex(collection.collectionName, 'hello', {unique:true}, function(err, indexName) { - // Insert some docs - collection.insert([{'hello':'world'}, {'hello':'mike'}, {'hello':'world'}], {safe:true}, function(err, ids) { - test.ok(err != null); - test.equal(11000, err.code); - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyCreateSubfieldIndex = function(test) { - // Create a non-unique index and test inserts - client.createCollection('test_index_on_subfield', function(err, collection) { - collection.insert([{'hello': {'a':4, 'b':5}}, {'hello': {'a':7, 'b':2}}, {'hello': {'a':4, 'b':10}}], {safe:true}, function(err, ids) { - // Assert that we have no erros - client.error(function(err, errors) { - test.equal(1, errors.length); - test.ok(errors[0].err == null); - - // Create a unique subfield index and test that insert fails - client.createCollection('test_index_on_subfield2', function(err, collection) { - client.createIndex(collection.collectionName, 'hello.a', true, function(err, indexName) { - collection.insert([{'hello': {'a':4, 'b':5}}, {'hello': {'a':7, 'b':2}}, {'hello': {'a':4, 'b':10}}], {safe:true}, function(err, ids) { - // Assert that we have erros - test.ok(err != null); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyDropIndexes = function(test) { - client.createCollection('test_drop_indexes', function(err, collection) { - collection.insert({a:1}, {safe:true}, function(err, ids) { - // Create an index on the collection - client.createIndex(collection.collectionName, 'a', function(err, indexName) { - test.equal("a_1", indexName); - // Drop all the indexes - collection.dropAllIndexes(function(err, result) { - test.equal(true, result); - - collection.indexInformation(function(err, result) { - test.ok(result['a_1'] == null); - test.done(); - }) - }) - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleDistinctIndexes = function(test) { - client.createCollection('test_distinct_queries', function(err, collection) { - collection.insert([{'a':0, 'b':{'c':'a'}}, - {'a':1, 'b':{'c':'b'}}, - {'a':1, 'b':{'c':'c'}}, - {'a':2, 'b':{'c':'a'}}, {'a':3}, {'a':3}], {safe:true}, function(err, ids) { - collection.distinct('a', function(err, docs) { - test.deepEqual([0, 1, 2, 3], docs.sort()); - }); - - collection.distinct('b.c', function(err, docs) { - test.deepEqual(['a', 'b', 'c'], docs.sort()); - test.done(); - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteEnsureIndex = function(test) { - client.createCollection('test_ensure_index', function(err, collection) { - // Create an index on the collection - client.ensureIndex(collection.collectionName, 'a', function(err, indexName) { - test.equal("a_1", indexName); - // Let's fetch the index information - client.indexInformation(collection.collectionName, function(err, collectionInfo) { - test.ok(collectionInfo['_id_'] != null); - test.equal('_id', collectionInfo['_id_'][0][0]); - test.ok(collectionInfo['a_1'] != null); - test.deepEqual([["a", 1]], collectionInfo['a_1']); - - client.ensureIndex(collection.collectionName, 'a', function(err, indexName) { - test.equal("a_1", indexName); - // Let's fetch the index information - client.indexInformation(collection.collectionName, function(err, collectionInfo) { - test.ok(collectionInfo['_id_'] != null); - test.equal('_id', collectionInfo['_id_'][0][0]); - test.ok(collectionInfo['a_1'] != null); - test.deepEqual([["a", 1]], collectionInfo['a_1']); - // Let's close the db - test.done(); - }); - }); - }); - }); - }) -} - -/** - * @ignore - */ -exports.shouldCorrectlyCreateAndUseSparseIndex = function(test) { - client.createCollection('create_and_use_sparse_index_test', function(err, r) { - client.collection('create_and_use_sparse_index_test', function(err, collection) { - - collection.ensureIndex({title:1}, {sparse:true}, function(err, indexName) { - collection.insert([{name:"Jim"}, {name:"Sarah", title:"Princess"}], {safe:true}, function(err, result) { - collection.find({title:{$ne:null}}).sort({title:1}).toArray(function(err, items) { - test.equal(1, items.length); - test.equal("Sarah", items[0].name); - - // Fetch the info for the indexes - collection.indexInformation({full:true}, function(err, indexInfo) { - test.equal(null, err); - test.equal(2, indexInfo.length); - test.done(); - }) - }) - }); - }) - }) - }) -} - -/** - * @ignore - */ -exports["Should correctly execute insert with keepGoing option on mongod >= 1.9.1"] = function(test) { - client.admin().serverInfo(function(err, result){ - if(parseInt((result.version.replace(/\./g, ''))) >= 191) { - client.createCollection('shouldCorrectlyExecuteKeepGoingWithMongodb191OrHigher', function(err, collection) { - collection.ensureIndex({title:1}, {unique:true}, function(err, indexName) { - collection.insert([{name:"Jim"}, {name:"Sarah", title:"Princess"}], {safe:true}, function(err, result) { - // Force keep going flag, ignoring unique index issue - collection.insert([{name:"Jim"}, {name:"Sarah", title:"Princess"}, {name:'Gump', title:"Gump"}], {safe:true, keepGoing:true}, function(err, result) { - collection.count(function(err, count) { - test.equal(3, count); - test.done(); - }) - }); - }); - }); - }); - } else { - test.done(); - } - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleGeospatialIndexes = function(test) { - client.admin().serverInfo(function(err, result){ - if(parseInt((result.version.replace(/\./g, ''))) >= 191) { - client.createCollection('geospatial_index_test', function(err, r) { - client.collection('geospatial_index_test', function(err, collection) { - collection.ensureIndex({loc:'2d'}, function(err, indexName) { - collection.insert({'loc': [-100,100]}, {safe:true}, function(err, result) { - test.equal(err,null); - collection.insert({'loc': [200,200]}, {safe:true}, function(err, result) { - err = err ? err : {}; - test.equal(err.err,"point not in interval of [ -180, 180 )"); - test.done(); - }); - }); - }); - }); - }); - } else { - test.done(); - } - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleGeospatialIndexesAlteredRange = function(test) { - client.admin().serverInfo(function(err, result){ - if(parseInt((result.version.replace(/\./g, ''))) >= 191) { - client.createCollection('geospatial_index_altered_test', function(err, r) { - client.collection('geospatial_index_altered_test', function(err, collection) { - collection.ensureIndex({loc:'2d'},{min:0,max:1024}, function(err, indexName) { - collection.insert({'loc': [100,100]}, {safe:true}, function(err, result) { - test.equal(err,null); - collection.insert({'loc': [200,200]}, {safe:true}, function(err, result) { - test.equal(err,null); - collection.insert({'loc': [-200,-200]}, {safe:true}, function(err, result) { - err = err ? err : {}; - test.equal(err.err,"point not in interval of [ 0, 1024 )"); - test.done(); - }); - }); - }); - }); - }); - }); - } else { - test.done(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/insert_test.js b/test/insert_test.js deleted file mode 100644 index 9bfe0f53b25..00000000000 --- a/test/insert_test.js +++ /dev/null @@ -1,1149 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Script = require('vm'), - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - Binary = require('../lib/mongodb/bson/binary').Binary, - Code = require('../lib/mongodb/bson/code').Code, - DBRef = require('../lib/mongodb/bson/db_ref').DBRef, - Timestamp = require('../lib/mongodb/bson/timestamp').Timestamp, - Long = require('../lib/mongodb/bson/long').Long, - Collection = mongodb.Collection, - Step = require('step'), - Server = mongodb.Server, - ServerManager = require('./tools/server_manager').ServerManager; - -var MONGODB = 'integration_tests'; -var client = null; -var useSSL = process.env['USE_SSL'] != null ? true : false; -var native_parser = (process.env['TEST_NATIVE'] != null); - -/** - * Module for parsing an ISO 8601 formatted string into a Date object. - * @ignore - */ -var ISODate = function (string) { - var match; - - if (typeof string.getTime === "function") - return string; - else if (match = string.match(/^(\d{4})(-(\d{2})(-(\d{2})(T(\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|((\+|-)(\d{2}):(\d{2}))))?)?)?$/)) { - var date = new Date(); - date.setUTCFullYear(Number(match[1])); - date.setUTCMonth(Number(match[3]) - 1 || 0); - date.setUTCDate(Number(match[5]) || 0); - date.setUTCHours(Number(match[7]) || 0); - date.setUTCMinutes(Number(match[8]) || 0); - date.setUTCSeconds(Number(match[10]) || 0); - date.setUTCMilliseconds(Number("." + match[12]) * 1000 || 0); - - if (match[13] && match[13] !== "Z") { - var h = Number(match[16]) || 0, - m = Number(match[17]) || 0; - - h *= 3600000; - m *= 60000; - - var offset = h + m; - if (match[15] == "+") - offset = -offset; - - new Date(date.valueOf() + offset); - } - - return date; - } else - throw new Error("Invalid ISO 8601 date given.", __filename); -}; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * A simple document insert example, not using safe mode to ensure document persistance on MongoDB - * - * @_class collection - * @_function insert - * @ignore - */ -exports.shouldCorrectlyPerformASimpleSingleDocumentInsertNoCallbackNoSafe = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch a collection to insert document into - db.collection("simple_document_insert_collection_no_safe", function(err, collection) { - - // Insert a single document - collection.insert({hello:'world_no_safe'}); - - // Wait for a second before finishing up, to ensure we have written the item to disk - setTimeout(function() { - - // Fetch the document - collection.findOne({hello:'world_no_safe'}, function(err, item) { - test.equal(null, err); - test.equal('world_no_safe', item.hello); - test.done(); - db.close(); - }) - }, 1000); - }); - }); -} - -/** - * A batch document insert example, using safe mode to ensure document persistance on MongoDB - * - * @_class collection - * @_function insert - * @ignore - */ -exports.shouldCorrectlyPerformABatchDocumentInsertSafe = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch a collection to insert document into - db.collection("batch_document_insert_collection_safe", function(err, collection) { - - // Insert a single document - collection.insert([{hello:'world_safe1'} - , {hello:'world_safe2'}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Fetch the document - collection.findOne({hello:'world_safe2'}, function(err, item) { - test.equal(null, err); - test.equal('world_safe2', item.hello); - test.done(); - db.close(); - }) - }); - }); - }); -} - -/** - * Example of inserting a document containing functions - * - * @_class collection - * @_function insert - * @ignore - */ -exports.shouldCorrectlyPerformASimpleDocumentInsertWithFunctionSafe = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch a collection to insert document into - db.collection("simple_document_insert_with_function_safe", function(err, collection) { - - // Insert a single document - collection.insert({hello:'world' - , func:function() {}}, {safe:true, serializeFunctions:true}, function(err, result) { - test.equal(null, err); - - // Fetch the document - collection.findOne({hello:'world'}, function(err, item) { - test.equal(null, err); - test.ok("function() {}", item.code); - test.done(); - db.close(); - }) - }); - }); - }); -} - -/** - * Example of using keepGoing to allow batch insert to complete even when there are illegal documents in the batch - * - * @_class collection - * @_function insert - * @ignore - */ -exports["Should correctly execute insert with keepGoing option on mongod >= 1.9.1"] = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Only run the rest of the code if we have a mongodb server with version >= 1.9.1 - db.admin().serverInfo(function(err, result){ - - // Ensure we are running at least MongoDB v1.9.1 - if(parseInt((result.version.replace(/\./g, ''))) >= 191) { - - // Create a collection - client.createCollection('keepGoingExample', function(err, collection) { - - // Add an unique index to title to force errors in the batch insert - collection.ensureIndex({title:1}, {unique:true}, function(err, indexName) { - - // Insert some intial data into the collection - collection.insert([{name:"Jim"} - , {name:"Sarah", title:"Princess"}], {safe:true}, function(err, result) { - - // Force keep going flag, ignoring unique index issue - collection.insert([{name:"Jim"} - , {name:"Sarah", title:"Princess"} - , {name:'Gump', title:"Gump"}], {safe:true, keepGoing:true}, function(err, result) { - - // Count the number of documents left (should not include the duplicates) - collection.count(function(err, count) { - test.equal(3, count); - db.close(); - test.done(); - }) - }); - }); - }); - }); - } else { - db.close(); - test.done(); - } - }); - }); -} - -/** - * @ignore - */ -exports.shouldForceMongoDbServerToAssignId = function(test) { - /// Set up server with custom pk factory - var db = new Db(MONGODB, new Server('localhost', 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null), 'forceServerObjectId':true}); - db.open(function(err, client) { - client.createCollection('test_insert2', function(err, r) { - client.collection('test_insert2', function(err, collection) { - - Step( - function inserts() { - var group = this.group(); - - for(var i = 1; i < 1000; i++) { - collection.insert({c:i}, {safe:true}, group()); - } - }, - - function done(err, result) { - collection.insert({a:2}, {safe:true}, function(err, r) { - collection.insert({a:3}, {safe:true}, function(err, r) { - collection.count(function(err, count) { - test.equal(1001, count); - // Locate all the entries using find - collection.find(function(err, cursor) { - cursor.toArray(function(err, results) { - test.equal(1001, results.length); - test.ok(results[0] != null); - - client.close(); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - } - ) - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformSingleInsert = function(test) { - client.createCollection('shouldCorrectlyPerformSingleInsert', function(err, collection) { - collection.insert({a:1}, {safe:true}, function(err, result) { - collection.findOne(function(err, item) { - test.equal(1, item.a); - test.done(); - }) - }) - }) -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformBasicInsert = function(test) { - client.createCollection('test_insert', function(err, r) { - client.collection('test_insert', function(err, collection) { - - Step( - function inserts() { - var group = this.group(); - - for(var i = 1; i < 1000; i++) { - collection.insert({c:i}, {safe:true}, group()); - } - }, - - function done(err, result) { - collection.insert({a:2}, {safe:true}, function(err, r) { - collection.insert({a:3}, {safe:true}, function(err, r) { - collection.count(function(err, count) { - test.equal(1001, count); - // Locate all the entries using find - collection.find(function(err, cursor) { - cursor.toArray(function(err, results) { - test.equal(1001, results.length); - test.ok(results[0] != null); - - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - } - ) - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleMultipleDocumentInsert = function(test) { - client.createCollection('test_multiple_insert', function(err, r) { - var collection = client.collection('test_multiple_insert', function(err, collection) { - var docs = [{a:1}, {a:2}]; - - collection.insert(docs, {safe:true}, function(err, ids) { - ids.forEach(function(doc) { - test.ok(((doc['_id']) instanceof ObjectID || Object.prototype.toString.call(doc['_id']) === '[object ObjectID]')); - }); - - // Let's ensure we have both documents - collection.find(function(err, cursor) { - cursor.toArray(function(err, docs) { - test.equal(2, docs.length); - var results = []; - // Check that we have all the results we want - docs.forEach(function(doc) { - if(doc.a == 1 || doc.a == 2) results.push(1); - }); - test.equal(2, results.length); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteSaveInsertUpdate= function(test) { - client.createCollection('shouldCorrectlyExecuteSaveInsertUpdate', function(err, collection) { - collection.save({ email : 'save' }, {safe:true}, function() { - collection.insert({ email : 'insert' }, {safe:true}, function() { - collection.update( - { email : 'update' }, - { email : 'update' }, - { upsert: true, safe:true}, - - function() { - collection.find(function(e, c) { - c.toArray(function(e, a) { - test.equal(3, a.length) - test.done(); - }); - }); - } - ); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertAndRetrieveLargeIntegratedArrayDocument = function(test) { - client.createCollection('test_should_deserialize_large_integrated_array', function(err, collection) { - var doc = {'a':0, - 'b':['tmp1', 'tmp2', 'tmp3', 'tmp4', 'tmp5', 'tmp6', 'tmp7', 'tmp8', 'tmp9', 'tmp10', 'tmp11', 'tmp12', 'tmp13', 'tmp14', 'tmp15', 'tmp16'] - }; - // Insert the collection - collection.insert(doc, {safe:true}, function(err, r) { - // Fetch and check the collection - collection.findOne({'a': 0}, function(err, result) { - test.deepEqual(doc.a, result.a); - test.deepEqual(doc.b, result.b); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertAndRetrieveDocumentWithAllTypes = function(test) { - client.createCollection('test_all_serialization_types', function(err, collection) { - var date = new Date(); - var oid = new ObjectID(); - var string = 'binstring' - var bin = new Binary() - for(var index = 0; index < string.length; index++) { - bin.put(string.charAt(index)) - } - - var motherOfAllDocuments = { - 'string': 'hello', - 'array': [1,2,3], - 'hash': {'a':1, 'b':2}, - 'date': date, - 'oid': oid, - 'binary': bin, - 'int': 42, - 'float': 33.3333, - 'regexp': /regexp/, - 'boolean': true, - 'long': date.getTime(), - 'where': new Code('this.a > i', {i:1}), - 'dbref': new DBRef('namespace', oid, 'integration_tests_') - } - - collection.insert(motherOfAllDocuments, {safe:true}, function(err, docs) { - collection.findOne(function(err, doc) { - // Assert correct deserialization of the values - test.equal(motherOfAllDocuments.string, doc.string); - test.deepEqual(motherOfAllDocuments.array, doc.array); - test.equal(motherOfAllDocuments.hash.a, doc.hash.a); - test.equal(motherOfAllDocuments.hash.b, doc.hash.b); - test.equal(date.getTime(), doc.long); - test.equal(date.toString(), doc.date.toString()); - test.equal(date.getTime(), doc.date.getTime()); - test.equal(motherOfAllDocuments.oid.toHexString(), doc.oid.toHexString()); - test.equal(motherOfAllDocuments.binary.value(), doc.binary.value()); - - test.equal(motherOfAllDocuments.int, doc.int); - test.equal(motherOfAllDocuments.long, doc.long); - test.equal(motherOfAllDocuments.float, doc.float); - test.equal(motherOfAllDocuments.regexp.toString(), doc.regexp.toString()); - test.equal(motherOfAllDocuments.boolean, doc.boolean); - test.equal(motherOfAllDocuments.where.code, doc.where.code); - test.equal(motherOfAllDocuments.where.scope['i'], doc.where.scope.i); - - test.equal(motherOfAllDocuments.dbref.namespace, doc.dbref.namespace); - test.equal(motherOfAllDocuments.dbref.oid.toHexString(), doc.dbref.oid.toHexString()); - test.equal(motherOfAllDocuments.dbref.db, doc.dbref.db); - test.done(); - }) - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertAndUpdateDocumentWithNewScriptContext= function(test) { - var db = new Db(MONGODB, new Server('localhost', 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, db) { - //convience curried handler for functions of type 'a -> (err, result) - function getResult(callback){ - return function(error, result) { - test.ok(error == null); - return callback(result); - } - }; - - db.collection('users', getResult(function(user_collection){ - user_collection.remove({}, {safe:true}, function(err, result) { - //first, create a user object - var newUser = { name : 'Test Account', settings : {} }; - user_collection.insert([newUser], {safe:true}, getResult(function(users){ - var user = users[0]; - - var scriptCode = "settings.block = []; settings.block.push('test');"; - var context = { settings : { thisOneWorks : "somestring" } }; - - Script.runInNewContext(scriptCode, context, "testScript"); - - //now create update command and issue it - var updateCommand = { $set : context }; - - user_collection.update({_id : user._id}, updateCommand, {safe:true}, - getResult(function(updateCommand) { - // Fetch the object and check that the changes are persisted - user_collection.findOne({_id : user._id}, function(err, doc) { - test.ok(err == null); - test.equal("Test Account", doc.name); - test.equal("somestring", doc.settings.thisOneWorks); - test.equal("test", doc.settings.block[0]); - - // Let's close the db - db.close(); - test.done(); - }); - }) - ); - })); - }); - })); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlySerializeDocumentWithAllTypesInNewContext = function(test) { - client.createCollection('test_all_serialization_types_new_context', function(err, collection) { - var date = new Date(); - var scriptCode = - "var string = 'binstring'\n" + - "var bin = new mongo.Binary()\n" + - "for(var index = 0; index < string.length; index++) {\n" + - " bin.put(string.charAt(index))\n" + - "}\n" + - "motherOfAllDocuments['string'] = 'hello';" + - "motherOfAllDocuments['array'] = [1,2,3];" + - "motherOfAllDocuments['hash'] = {'a':1, 'b':2};" + - "motherOfAllDocuments['date'] = date;" + - "motherOfAllDocuments['oid'] = new mongo.ObjectID();" + - "motherOfAllDocuments['binary'] = bin;" + - "motherOfAllDocuments['int'] = 42;" + - "motherOfAllDocuments['float'] = 33.3333;" + - "motherOfAllDocuments['regexp'] = /regexp/;" + - "motherOfAllDocuments['boolean'] = true;" + - "motherOfAllDocuments['long'] = motherOfAllDocuments['date'].getTime();" + - "motherOfAllDocuments['where'] = new mongo.Code('this.a > i', {i:1});" + - "motherOfAllDocuments['dbref'] = new mongo.DBRef('namespace', motherOfAllDocuments['oid'], 'integration_tests_');"; - - var context = { - motherOfAllDocuments : {}, - mongo:{ - ObjectID:ObjectID, - Binary:Binary, - Code:Code, - DBRef:DBRef - }, - date:date}; - - // Execute function in context - Script.runInNewContext(scriptCode, context, "testScript"); - // sys.puts(sys.inspect(context.motherOfAllDocuments)) - var motherOfAllDocuments = context.motherOfAllDocuments; - - collection.insert(context.motherOfAllDocuments, {safe:true}, function(err, docs) { - collection.findOne(function(err, doc) { - // Assert correct deserialization of the values - test.equal(motherOfAllDocuments.string, doc.string); - test.deepEqual(motherOfAllDocuments.array, doc.array); - test.equal(motherOfAllDocuments.hash.a, doc.hash.a); - test.equal(motherOfAllDocuments.hash.b, doc.hash.b); - test.equal(date.getTime(), doc.long); - test.equal(date.toString(), doc.date.toString()); - test.equal(date.getTime(), doc.date.getTime()); - test.equal(motherOfAllDocuments.oid.toHexString(), doc.oid.toHexString()); - test.equal(motherOfAllDocuments.binary.value(), doc.binary.value()); - - test.equal(motherOfAllDocuments.int, doc.int); - test.equal(motherOfAllDocuments.long, doc.long); - test.equal(motherOfAllDocuments.float, doc.float); - test.equal(motherOfAllDocuments.regexp.toString(), doc.regexp.toString()); - test.equal(motherOfAllDocuments.boolean, doc.boolean); - test.equal(motherOfAllDocuments.where.code, doc.where.code); - test.equal(motherOfAllDocuments.where.scope['i'], doc.where.scope.i); - test.equal(motherOfAllDocuments.dbref.namespace, doc.dbref.namespace); - test.equal(motherOfAllDocuments.dbref.oid.toHexString(), doc.dbref.oid.toHexString()); - test.equal(motherOfAllDocuments.dbref.db, doc.dbref.db); - - test.done(); - }) - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyDoToJsonForLongValue = function(test) { - client.createCollection('test_to_json_for_long', function(err, collection) { - test.ok(collection instanceof Collection); - - collection.insert([{value: Long.fromNumber(32222432)}], {safe:true}, function(err, ids) { - collection.findOne({}, function(err, item) { - test.equal(32222432, item.value); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertAndUpdateWithNoCallback = function(test) { - var db = new Db(MONGODB, new Server('localhost', 27017, {auto_reconnect: true, poolSize: 1, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, client) { - client.createCollection('test_insert_and_update_no_callback', function(err, collection) { - // Insert the update - collection.insert({i:1}, {safe:true}) - // Update the record - collection.update({i:1}, {"$set":{i:2}}, {safe:true}) - - // Make sure we leave enough time for mongodb to record the data - setTimeout(function() { - // Locate document - collection.findOne({}, function(err, item) { - test.equal(2, item.i) - - client.close(); - test.done(); - }); - }, 100) - }) - }); -} - -/** - * @ignore - */ -exports.shouldInsertAndQueryTimestamp = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - db.createCollection('test_insert_and_query_timestamp', function(err, collection) { - // Insert the update - collection.insert({i:Timestamp.fromNumber(100), j:Long.fromNumber(200)}, {safe:true}, function(err, r) { - // Locate document - collection.findOne({}, function(err, item) { - test.ok(item.i instanceof Timestamp); - test.equal(100, item.i); - test.ok(typeof item.j == "number"); - test.equal(200, item.j); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertAndQueryUndefined = function(test) { - client.createCollection('test_insert_and_query_undefined', function(err, collection) { - // Insert the update - collection.insert({i:undefined}, {safe:true}, function(err, r) { - // Locate document - collection.findOne({}, function(err, item) { - test.equal(null, item.i) - - test.done(); - }); - }) - }) -} - -/** - * @ignore - */ -exports.shouldCorrectlySerializeDBRefToJSON = function(test) { - var dbref = new DBRef("foo", ObjectID.createFromHexString("fc24a04d4560531f00000000"), null); - JSON.stringify(dbref); - test.done(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyPerformSafeInsert = function(test) { - var fixtures = [{ - name: "empty", array: [], bool: false, dict: {}, float: 0.0, string: "" - }, { - name: "not empty", array: [1], bool: true, dict: {x: "y"}, float: 1.0, string: "something" - }, { - name: "simple nested", array: [1, [2, [3]]], bool: true, dict: {x: "y", array: [1,2,3,4], dict: {x: "y", array: [1,2,3,4]}}, float: 1.5, string: "something simply nested" - }]; - - - client.createCollection('test_safe_insert', function(err, collection) { - Step( - function inserts() { - var group = this.group(); - - for(var i = 0; i < fixtures.length; i++) { - collection.insert(fixtures[i], {safe:true}, group()); - } - }, - - function done() { - collection.count(function(err, count) { - test.equal(3, count); - - collection.find().toArray(function(err, docs) { - test.equal(3, docs.length) - }); - }); - - - collection.find({}, {}, function(err, cursor) { - var counter = 0; - - cursor.each(function(err, doc) { - if(doc == null) { - test.equal(3, counter); - test.done(); - } else { - counter = counter + 1; - } - }); - }); - } - ) - }) -} - -/** - * @ignore - */ -exports.shouldThrowErrorIfSerializingFunction = function(test) { - client.createCollection('test_should_throw_error_if_serializing_function', function(err, collection) { - var func = function() { return 1}; - // Insert the update - collection.insert({i:1, z:func }, {safe:true, serializeFunctions:true}, function(err, result) { - collection.findOne({_id:result[0]._id}, function(err, object) { - test.equal(func.toString(), object.z.code); - test.equal(1, object.i); - test.done(); - }) - }) - }) -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertDocumentWithUUID = function(test) { - client.collection("insert_doc_with_uuid", function(err, collection) { - collection.insert({_id : "12345678123456781234567812345678", field: '1'}, {safe:true}, function(err, result) { - test.equal(null, err); - - collection.find({_id : "12345678123456781234567812345678"}).toArray(function(err, items) { - test.equal(null, err); - test.equal(items[0]._id, "12345678123456781234567812345678") - test.equal(items[0].field, '1') - - // Generate a binary id - var binaryUUID = new Binary('00000078123456781234567812345678', Binary.SUBTYPE_UUID); - - collection.insert({_id : binaryUUID, field: '2'}, {safe:true}, function(err, result) { - collection.find({_id : binaryUUID}).toArray(function(err, items) { - test.equal(null, err); - test.equal(items[0].field, '2') - test.done(); - }); - }); - }) - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyCallCallbackWithDbDriverInStrictMode = function(test) { - var db = new Db(MONGODB, new Server('localhost', 27017, {auto_reconnect: true, poolSize: 1, ssl:useSSL}), {strict:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, client) { - client.createCollection('test_insert_and_update_no_callback_strict', function(err, collection) { - collection.insert({_id : "12345678123456781234567812345678", field: '1'}, {safe:true}, function(err, result) { - test.equal(null, err); - - collection.update({ '_id': "12345678123456781234567812345678" }, { '$set': { 'field': 0 }}, function(err, numberOfUpdates) { - test.equal(null, err); - test.equal(1, numberOfUpdates); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertDBRefWithDbNotDefined = function(test) { - client.createCollection('shouldCorrectlyInsertDBRefWithDbNotDefined', function(err, collection) { - var doc = {_id: new ObjectID()}; - var doc2 = {_id: new ObjectID()}; - var doc3 = {_id: new ObjectID()}; - collection.insert(doc, {safe:true}, function(err, result) { - // Create object with dbref - doc2.ref = new DBRef('shouldCorrectlyInsertDBRefWithDbNotDefined', doc._id); - doc3.ref = new DBRef('shouldCorrectlyInsertDBRefWithDbNotDefined', doc._id, MONGODB); - - collection.insert([doc2, doc3], {safe:true}, function(err, result) { - // Get all items - collection.find().toArray(function(err, items) { - test.equal("shouldCorrectlyInsertDBRefWithDbNotDefined", items[1].ref.namespace); - test.equal(doc._id.toString(), items[1].ref.oid.toString()); - test.equal(null, items[1].ref.db); - - test.equal("shouldCorrectlyInsertDBRefWithDbNotDefined", items[2].ref.namespace); - test.equal(doc._id.toString(), items[2].ref.oid.toString()); - test.equal(MONGODB, items[2].ref.db); - - test.done(); - }) - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertUpdateRemoveWithNoOptions = function(test) { - var db = new Db(MONGODB, new Server('localhost', 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, db) { - db.collection('shouldCorrectlyInsertUpdateRemoveWithNoOptions', function(err, collection) { - collection.insert({a:1}); - collection.update({a:1}, {a:2}); - collection.remove({a:2}); - - collection.count(function(err, count) { - test.equal(0, count); - - db.close(); - test.done(); - }) - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyExecuteMultipleFetches = function(test) { - var db = new Db(MONGODB, new Server('localhost', 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Search parameter - var to = 'ralph' - // Execute query - db.open(function(err, db) { - db.collection('shouldCorrectlyExecuteMultipleFetches', function(err, collection) { - collection.insert({addresses:{localPart:'ralph'}}, {safe:true}, function(err, result) { - // Let's find our user - collection.findOne({"addresses.localPart" : to}, function( err, doc ) { - test.equal(null, err); - test.equal(to, doc.addresses.localPart); - - db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyFailWhenNoObjectToUpdate= function(test) { - client.createCollection('shouldCorrectlyExecuteSaveInsertUpdate', function(err, collection) { - collection.update({_id : new ObjectID()}, { email : 'update' }, {safe:true}, - function(err, result) { - test.equal(0, result); - test.done(); - } - ); - }); -} - -/** - * @ignore - */ -exports['Should correctly insert object and retrieve it when containing array and IsoDate'] = function(test) { - var doc = { - "_id" : new ObjectID("4e886e687ff7ef5e00000162"), - "str" : "foreign", - "type" : 2, - "timestamp" : ISODate("2011-10-02T14:00:08.383Z"), - "links" : [ - "http://www.reddit.com/r/worldnews/comments/kybm0/uk_home_secretary_calls_for_the_scrapping_of_the/" - ] - } - - client.createCollection('Should_correctly_insert_object_and_retrieve_it_when_containing_array_and_IsoDate', function(err, collection) { - collection.insert(doc, {safe:true}, function(err, result) { - test.ok(err == null); - - collection.findOne(function(err, item) { - test.ok(err == null); - test.deepEqual(doc, item); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should correctly insert object with timestamps'] = function(test) { - var doc = { - "_id" : new ObjectID("4e886e687ff7ef5e00000162"), - "str" : "foreign", - "type" : 2, - "timestamp" : new Timestamp(10000), - "links" : [ - "http://www.reddit.com/r/worldnews/comments/kybm0/uk_home_secretary_calls_for_the_scrapping_of_the/" - ], - "timestamp2" : new Timestamp(33333), - } - - client.createCollection('Should_correctly_insert_object_with_timestamps', function(err, collection) { - collection.insert(doc, {safe:true}, function(err, result) { - test.ok(err == null); - - collection.findOne(function(err, item) { - test.ok(err == null); - test.deepEqual(doc, item); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should fail on insert due to key starting with $'] = function(test) { - var doc = { - "_id" : new ObjectID("4e886e687ff7ef5e00000162"), - "$key" : "foreign", - } - - client.createCollection('Should_fail_on_insert_due_to_key_starting_with', function(err, collection) { - collection.insert(doc, {safe:true}, function(err, result) { - test.ok(err != null); - test.done(); - }); - }); -} - -/** - * @ignore - */ -exports['Should Correctly allow for control of serialization of functions on command level'] = function(test) { - var doc = { - str : "String", - func : function() {} - } - - client.createCollection("Should_Correctly_allow_for_control_of_serialization_of_functions_on_command_level", function(err, collection) { - test.ok(err == null); - - collection.insert(doc, {safe:true}, function(err, result) { - - collection.update({str:"String"}, {$set:{c:1, d:function(){}}}, {safe:true, serializeFunctions:false}, function(err, result) { - test.equal(1, result); - - collection.findOne({str:"String"}, function(err, item) { - test.equal(null, item.d); - - // Execute a safe insert with replication to two servers - collection.findAndModify({str:"String"}, [['a', 1]], {'$set':{'f':function() {}}}, {new:true, safe: true, serializeFunctions:true}, function(err, result) { - test.ok(result.f instanceof Code) - test.done(); - }) - }) - }) - }); - }); -} - -/** - * @ignore - */ -exports['Should Correctly allow for control of serialization of functions on collection level'] = function(test) { - var doc = { - str : "String", - func : function() {} - } - - client.createCollection("Should_Correctly_allow_for_control_of_serialization_of_functions_on_collection_level", {serializeFunctions:true}, function(err, collection) { - test.ok(err == null); - - collection.insert(doc, {safe:true}, function(err, result) { - test.equal(null, err); - - collection.findOne({str : "String"}, function(err, item) { - test.ok(item.func instanceof Code); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should Correctly allow for using a Date object as _id'] = function(test) { - var doc = { - _id : new Date(), - str : 'hello' - } - - client.createCollection("Should_Correctly_allow_for_using_a_Date_object_as__id", {serializeFunctions:true}, function(err, collection) { - test.ok(err == null); - - collection.insert(doc, {safe:true}, function(err, result) { - test.equal(null, err); - - collection.findOne({str : "hello"}, function(err, item) { - test.ok(item._id instanceof Date); - test.done(); - }); - }); - }); -} - -/** - * @ignore - */ -exports['Should Correctly fail to update returning 0 results'] = function(test) { - client.createCollection("Should_Correctly_fail_to_update_returning_0_results", {serializeFunctions:true}, function(err, collection) { - test.ok(err == null); - - collection.update({a:1}, {$set: {a:1}}, {safe:true}, function(err, numberOfUpdated) { - test.equal(0, numberOfUpdated); - test.done(); - }); - }); -} - -/** - * @ignore - */ -exports['Should Correctly update two fields including a sub field'] = function(test) { - var doc = { - _id: new ObjectID(), - Prop1: 'p1', - Prop2: 'p2', - More: { - Sub1: 's1', - Sub2: 's2', - Sub3: 's3' - } - } - - client.createCollection("Should_Correctly_update_two_fields_including_a_sub_field", {}, function(err, collection) { - collection.insert(doc, {safe:true}, function(err, result) { - test.equal(null, err); - - // Update two fields - collection.update({_id:doc._id}, {$set:{Prop1:'p1_2', 'More.Sub2':'s2_2'}}, {safe:true}, function(err, numberOfUpdatedDocs) { - test.equal(null, err); - test.equal(1, numberOfUpdatedDocs); - - collection.findOne({_id:doc._id}, function(err, item) { - test.equal(null, err); - test.equal('p1_2', item.Prop1); - test.equal('s2_2', item.More.Sub2); - test.done(); - }) - }); - }) - }); -} - -/** - * @ignore - */ -exports['Should correctly fail due to duplicate key for _id'] = function(test) { - client.createCollection("Should_Correctly_update_two_fields_including_a_sub_field_2", {}, function(err, collection) { - collection.insert({_id:1}, {safe:true}, function(err, result) { - test.equal(null, err); - - // Update two fields - collection.insert({_id:1}, {safe:true}, function(err, result) { - test.ok(err != null); - test.done(); - }); - }) - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/logging_test.js b/test/logging_test.js deleted file mode 100644 index 8e277b6bc51..00000000000 --- a/test/logging_test.js +++ /dev/null @@ -1,93 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldCorrectlyLogContent = function(test) { - var loggedOutput = false; - var logger = { - doDebug:true, - doError:true, - doLog:true, - - error:function(message, object) {}, - log:function(message, object) {}, - - debug:function(message, object) { - loggedOutput = true; - } - } - - var automatic_connect_client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null), retryMiliSeconds:50, logger:logger}); - automatic_connect_client.open(function(err, automatic_connect_client) { - automatic_connect_client.close(); - test.equal(true, loggedOutput); - test.done(); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/manual_tests/grids_fs_compatibility_test.js b/test/manual_tests/grids_fs_compatibility_test.js deleted file mode 100644 index 4f1f738a336..00000000000 --- a/test/manual_tests/grids_fs_compatibility_test.js +++ /dev/null @@ -1,20 +0,0 @@ -var Server = require("../../lib/mongodb").Server, - Db = require("../../lib/mongodb").Db, - ObjectID = require("../../lib/mongodb").ObjectID, - GridStore = require("../../lib/mongodb").GridStore; - -var options = { - auto_reconnect: true, - poolSize: 1, - socketOptions: { timeout:8000 } -}; - -var db = new Db("data", new Server( 'localhost', 27017, options)); -db.open(function(err, client){ - var id = new ObjectID(); - // Write a file into gridfs and then verify that it's readable - var gridStore = new GridStore(client, 'manual_test.jpg', "w"); - gridStore.writeFile('/Users/christiankvalheim/coding/projects/node-mongodb-native/test/gridstore/iya_logo_final_bw.jpg', function(err, result) { - db.close(); - }) -}); \ No newline at end of file diff --git a/test/manual_tests/hanging_queries_test.js b/test/manual_tests/hanging_queries_test.js deleted file mode 100644 index 09ac425852f..00000000000 --- a/test/manual_tests/hanging_queries_test.js +++ /dev/null @@ -1,182 +0,0 @@ -var ReplicaSetManager = require('../../test/tools/replica_set_manager').ReplicaSetManager; - -var mongo = require('../../lib/mongodb'), - // website = new mongo.Db('simplereach_website_production', new mongo.Server('localhost', 27017, {auto_reconnect:true, poolSize:5})), - // adserver = new mongo.Db('adserver', new mongo.Server('localhost', 27017, {auto_reconnect:true, poolSize:5})), - accounts = [], accountsCollection, contentCollection, count = 0; - -RS = new ReplicaSetManager({retries:120, secondary_count:1, passive_count:0, arbiter_count:1}); -RS.startSet(true, function(err, result) { - // Replica configuration - var replSet = new mongo.ReplSetServers( [ - new mongo.Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new mongo.Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new mongo.Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, read_secondary:true, readPreference:mongo.Server.READ_SECONDARY_ONLY} - ); - - // Replica configuration - var replSet2 = new mongo.ReplSetServers( [ - new mongo.Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new mongo.Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new mongo.Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, read_secondary:true, readPreference:mongo.Server.READ_SECONDARY_ONLY} - ); - - var adserver = new mongo.Db('adserver', replSet); - var website = new mongo.Db('simplereach_website_production', replSet2); - - website.on('error', function(err){ - console.log(err); process.exit(1); - }); - - adserver.on('error', function(err){ - console.log(err); process.exit(1); - }); - - /** - * loads content for accounts in the array - */ - function loadContent(){ - var account = accounts.shift(); - fields = ['account_id','avg_ctr','cat','channels','ckw','ctr','published','topics','url', 'updated_at', 'disabled'], - sort = [['published','desc']], - criteria = { account_id:account, $or:[ { end_date: null }, { end_date:{ $gte:new Date() }} ]}; - - if(account === undefined){ - process.exit(1); - // no more accounts to process - // the return here goes into limbo - return; - } - console.log('GETTING CONTENT'); - contentCollection.find(criteria, {fields:fields, limit:100000, sort:sort}, function(err, cursor){ - - cursor.each(function(err, doc) { - if(err){ console.log(err); process.exit(1); } - if(doc === null){ - //once this account is done, load the next - console.log('FINISHED ACCOUNT', account, 'WITH', count, 'ITEMS'); - count = 0; - process.nextTick(function() { - loadContent(); - }) - } else { - count += 1; - } - }); - }); - } - - /** - * loads content for accounts in the array - */ - function loadContentParallel(account, callback){ - var fields = ['account_id','avg_ctr','cat','channels','ckw','ctr','published','topics','url', 'updated_at', 'disabled'], - sort = [['published','desc']], - criteria = { account_id:account, $or:[ { end_date: null }, { end_date:{ $gte:new Date() }} ]}; - - if(account === undefined){ - process.exit(1); - - // no more accounts to process - // the return here goes into limbo - return; - } - console.log('GETTING CONTENT'); - contentCollection.find(criteria, {fields:fields, limit:100000, sort:sort}, function(err, cursor){ - cursor.each(function(err, doc) { - if(err){ - return callback(err, account); - } - - if(doc === null){ - //once this account is done, load the next - console.log('FINISHED ACCOUNT', account, 'WITH', count, 'ITEMS'); - count = 0; - callback(null, account); - } else { - count += 1; - } - }); - }); - } - - /** - * Loads account ids and pushes them onto an array - **/ - function loadAccountsParallel(){ - accountsCollection.find({active:{$ne:null}}, { fields:{'_id':1, 'a':1}}).toArray(function(err, accounts) { - // keep track of the number of accounts - var numberOfFinishedAccount = accounts.length; - - for(var i = 0; i < accounts.length; i++) { - loadContentParallel(accounts[i].a, function(err, result) { - numberOfFinishedAccount = numberOfFinishedAccount - 1; - - if(numberOfFinishedAccount == 0) process.exit(0); - }); - } - }); - } - - /** - * Loads account ids and pushes them onto an array - **/ - function loadAccounts(){ - accountsCollection.find({active:{$ne:null}}, { fields:{'_id':1, 'a':1}}, function(err, cursor) { - if(err){ console.log(err); process.exit(1); } - console.log('GETTING ACCOUNTS'); - cursor.each(function(err, doc){ - if(err){ console.log(err); process.exit(1); } - if(doc !== null){ - accounts.push(doc.a); - } else { - console.log('FOUND', accounts.length, 'ACCOUNTS'); - loadContent(); - } - }); - }); - } - - console.log('OPENING CONNECTION TO WEBSITE'); - website.open(function(err, wsClient){ - if(err){console.log(err); process.exit(1); } - console.log('OPENING CONNECTION TO ADSERVER'); - adserver.open(function(err, asClient){ - if(err){ console.log(err); process.exit(1); } - - // Get collections and remove the content - accountsCollection = asClient.collection('accounts'); - accountsCollection.remove(); - - contentCollection = asClient.collection('content'); - contentCollection.remove(); - - // insert a bunch of account docs to trigger flows - var accountDocs = []; - for(var i = 0; i < 1000; i++) { - accountDocs.push({a:i, active:true}); - } - - // insert a bunch of account docs to trigger flows - var contentDocs = []; - for(var i = 0; i < 1000; i++) { - var a_id = Math.floor(Math.random()*1000); - contentDocs.push({a:1, end_date:null, account_id:a_id}); - } - - // Just insert some test data - accountsCollection.insert(accountDocs, {safe:{w:2, wtimout:1000}}, function(err, r) { - contentCollection.insert(contentDocs, {safe:{w:2, wtimout:1000}}, function(err, r) { - // process.exit(0); - loadAccounts(); - // loadAccountsParallel(); - }); - }); - }); - }); -}); - diff --git a/test/manual_tests/issue_replicaset_test.js b/test/manual_tests/issue_replicaset_test.js deleted file mode 100644 index ed5692b24ac..00000000000 --- a/test/manual_tests/issue_replicaset_test.js +++ /dev/null @@ -1,43 +0,0 @@ -var mongodb = require("../../lib/mongodb"), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager; - -var options = { - auto_reconnect: true, - poolSize: 4, - socketOptions: { keepAlive: 100, timeout:6000 } -}; - -var userObjects = []; - -// Build user array -for(var i = 0; i < 122; i++) { - userObjects.push({'user_id':i}); -} - -// Manual config -// mongod --rest --replSet mlocal --oplogSize 8 --dbpath=./d1 -// mongod --port 27018 --rest --replSet mlocal --dbpath=./d2 -// mongod --port=27019 --rest --replSet mlocal --dbpath=./d3 -// {"_id" : "mlocal", "members" : [{"_id" : 0,"host" : "localhost:27017"},{"_id" : 1,"host" : "localhost:27018"},{"_id" : 2,"host" : "localhost:27019","arbiterOnly" : true}]} - -// Replica configuration -var replSet = new mongodb.ReplSetServers( [ - new mongodb.Server( 'localhost', 27017, { auto_reconnect: true } ), - new mongodb.Server( 'localhost', 27018, { auto_reconnect: true } ), - new mongodb.Server( 'localhost', 27019, { auto_reconnect: true } ) - ], - {rs_name:'mlocal'} -); - -var queryCount = 0; -var users; -var db = new mongodb.Db("data", replSet); -db.on("error", function(err) { - console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") - console.dir(err) -}) - -db.open(function(err, client){ - // Just close the connection - db.close(); -}); diff --git a/test/manual_tests/manual_larger_queries.js b/test/manual_tests/manual_larger_queries.js deleted file mode 100644 index 09aceeb8dbe..00000000000 --- a/test/manual_tests/manual_larger_queries.js +++ /dev/null @@ -1,137 +0,0 @@ -var mongodb = require("../../lib/mongodb"), - ReplicaSetManager = require('../../test/tools/replica_set_manager').ReplicaSetManager; - -var options = { - auto_reconnect: true, - poolSize: 4, - socketOptions: { keepAlive: 100, timeout:30000 } -}; - -var userObjects = []; -var counter = 0; -var counter2 = 0; -var maxUserId = 10000; - -// Build user array -for(var i = 0; i < 122; i++) { - userObjects.push({a:true, b:true}); -} - -RS = new ReplicaSetManager({retries:120, secondary_count:1, passive_count:0, arbiter_count:1}); -RS.startSet(true, function(err, result) { - // Replica configuration - var replSet = new mongodb.ReplSetServers( [ - new mongodb.Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new mongodb.Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new mongodb.Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, read_secondary:true, readPreference:mongodb.Server.READ_SECONDARY} - ); - - var collA; - var collB; - - var db = new mongodb.Db("data", replSet); - db.open(function(err, client){ - console.log("Connected"); - if(err != null) { - console.dir(err); - return; - } - - var userCollection = client.collection('users'); - var accountCollection = client.collection('accounts'); - - // Generate a bunch of fake accounts - var accountDocs = []; - for(var i = 0; i < 10000; i++) { - accountDocs.push({ - account_id:i, - 'somedata': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata2': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata3': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata4': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata5': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata6': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata7': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata8': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata9': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad' - }) - } - - // Generate a bunch of false users - var userDocs = []; - for(var i = 0; i < maxUserId; i++) { - // Generate a random number of account ids - var numberOfAccounts = Math.floor(Math.random(10000)); - // Generate an array of random numbers - var accountIds = []; - for(var j = 0; j < numberOfAccounts; j++) { - numberOfAccounts.push(Math.floor(Math.random(10000))); - } - - // Generate a user - userDocs.push({ - user_id:i, - ids:accountIds, - 'somedata': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata2': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata3': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata4': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata5': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata6': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata7': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata8': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad', - 'somedata9': 'dfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaaddfdfdsaaad' - }) - } - - // Insert all the docs - userCollection.insert(userDocs, {safe:true}, function(err, result) { - console.dir(err); - - accountCollection.insert(accountDocs, {safe:true}, function(err, result) { - console.dir(err); - - var timeoutFunc = function() { - lookup(function(err, result) { - console.log("-------------------------------------------- lookedup :: " + counter); - counter = counter + 1; - process.nextTick(timeoutFunc, 1); - }); - } - - process.nextTick(timeoutFunc, 1); - }); - }); - }); - - function lookup(cb){ - // Locate a random user - db.collection('users', function(err, userCollection) { - - userCollection.findOne({user_id:Math.floor(Math.random(maxUserId))}, function(err, user) { - if(err == null && user != null) { - console.log("-------------------------------------------- findOne"); - - // Fetch all the accounts - db.collection('accounts', function(err, accountCollection) { - - accountCollection.find({account_id:{$in:user.ids}}).toArray(function(err, accounts) { - if(err == null && accounts != null) { - console.log("-------------------------------------------- findAccounts :: " + accounts.length); - cb(null, null); - } else { - console.log("-------------------------------------------- findAccounts ERROR"); - cb(err, null); - } - }); - }); - } else { - console.log("-------------------------------------------- findOne ERROR"); - cb(err, null); - } - }); - }); - } -}); \ No newline at end of file diff --git a/test/manual_tests/manual_lock.js b/test/manual_tests/manual_lock.js deleted file mode 100644 index 33da8bec3f0..00000000000 --- a/test/manual_tests/manual_lock.js +++ /dev/null @@ -1,84 +0,0 @@ -var mongodb = require("../../lib/mongodb"), - ReplicaSetManager = require('../../test/tools/replica_set_manager').ReplicaSetManager; - -var options = { - auto_reconnect: true, - poolSize: 4, - socketOptions: { keepAlive: 100, timeout:30000 } -}; - -var userObjects = []; -var counter = 0; -var counter2 = 0; - -// Build user array -for(var i = 0; i < 122; i++) { - userObjects.push({a:true, b:true}); -} - -RS = new ReplicaSetManager({retries:120, secondary_count:1, passive_count:0, arbiter_count:1}); -RS.startSet(true, function(err, result) { - // Replica configuration - var replSet = new mongodb.ReplSetServers( [ - new mongodb.Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new mongodb.Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new mongodb.Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - var collA; - var collB; - - var db = new mongodb.Db("data", replSet); - db.open(function(err, client){ - console.log("Connected"); - client.collection("collA", function(err, coll){ - collA = coll; - - coll.insert(userObjects, {safe:true}, function(err, result) { - - client.collection("collB", function(err, coll){ - collB = coll; - - coll.insert(userObjects, {safe:true}, function(err, result) { - - var timeoutFunc = function() { - lookup(function(err, result) { - console.log("-------------------------------------------- lookedup") - process.nextTick(timeoutFunc, 1); - }) - } - - process.nextTick(timeoutFunc, 1); - }); - }); - }); - }); - }); - - function lookup(cb){ - var a, b; - var waiting = 2; - - collA.findOne({ a: true }, function(err, result){ - a = result; - waiting--; - if(waiting === 0){ - console.log("---------------------------------------------------------------------- collA :: " + counter); - counter = counter + 1; - cb(null, [a, b]); - } - }); - - collB.findOne({ b: true }, function(err, result){ - b = result; - waiting--; - if(waiting === 0){ - console.log("---------------------------------------------------------------------- collB :: " + counter); - counter = counter + 1; - cb(null, [a, b]); - } - }); - } -}); \ No newline at end of file diff --git a/test/manual_tests/replicaset_test.js b/test/manual_tests/replicaset_test.js deleted file mode 100644 index fc61965a0d9..00000000000 --- a/test/manual_tests/replicaset_test.js +++ /dev/null @@ -1,70 +0,0 @@ -var mongodb = require("../../lib/mongodb"), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager; - -var options = { - auto_reconnect: true, - poolSize: 4, - socketOptions: { keepAlive: 100, timeout:6000 } -}; - -var userObjects = []; - -// Build user array -for(var i = 0; i < 122; i++) { - userObjects.push({'user_id':i}); -} - -RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); -RS.startSet(true, function(err, result) { - // Replica configuration - var replSet = new mongodb.ReplSetServers( [ - new mongodb.Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new mongodb.Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new mongodb.Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - var queryCount = 0; - var users; - var db = new mongodb.Db("data", replSet); - db.on("error", function(err) { - console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") - console.dir(err) - }) - - db.open(function(err, client){ - if(err){ - console.log("[%s] %s", new Date, err.stack || err); - return; - } - - if(users){ - console.log("[%s] Reconnected?!", new Date); - return; - } - - client.collection("users", function(err, coll){ - coll.insert(userObjects, {safe:true}, function(err, result) { - users = coll; - query(); - }) - }); - }); - - function query(){ - var current = queryCount++; - console.log("[%s] #%s querying all users", new Date, current); - // setTimeout(query, 32 * 1000); - setTimeout(query, 7 * 1000); - users.find().count(function(err, all){ - if(err){ - console.log("[%s] #%s %s", new Date, current, err.stack || err); - }else{ - console.log("[%s] #%s found %s users", new Date, current, all); - } - }); - } -}); - - diff --git a/test/manual_tests/server_load.js b/test/manual_tests/server_load.js deleted file mode 100644 index 5640234f0b2..00000000000 --- a/test/manual_tests/server_load.js +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env node -var mongo = require("../../lib/mongodb"); -var express = require("express"); -var ObjectID = mongo.ObjectID; -var DBRef = mongo.DBRef; -var util = require("util"); - -var app = express.createServer(); - -app.configure(function() { - app.set('dbconnection', { - "port": 27017, - "host": "localhost" - }); -}); - -app.renderResponse = function(res, err, data, allCount) { - res.header('Content-Type', 'application/json'); - - if(err == null) { - if(typeof allCount == "undefined") { - res.send({data: data, success: true}); - } else { - res.send({allCount: allCount, data: data, success: true}); - } - } else { - util.log(util.inspect(err)); - console.log(err.stack); - res.send({success: false, error:err.message}); - } -}; - -app.use(express.bodyParser()); -app.use(app.router); -app.use(express.logger()); -app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); - -var isISO8601 = function(dString) { - var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))?/; - if (dString.toString().match(new RegExp(regexp))) { - return true; - } - else - { - return false; - } -}; - - -var decodeField = function(value) { - if(value == null) - return null; - - if(typeof value == "object" && value['namespace'] && value['oid']) { - if(/^[0-9a-fA-F]{24}$/.test(value['oid'])) - return new DBRef(value['namespace'], new ObjectID(value['oid'])); - else - return new DBRef(value['namespace'], value['oid']); - } - - if(isISO8601(value)) - return new Date(value); - - return value; -}; - -var deepDecode = function(obj) { - for(var i in obj) - { - if(obj[i] == null) { - // do nothing - } - else if(i == "_id" && /^[0-9a-fA-F]{24}$/.test(obj[i])) { - obj[i] = new ObjectID(obj[i]); - } - else if(typeof obj[i] == "object" && typeof obj[i]['namespace'] == "undefined" && typeof obj[i]['oid'] == "undefined") { - deepDecode(obj[i]); - } - else { - obj[i] = decodeField(obj[i]); - } - } -}; - -db = null; -var openConnection = function(dbname, config, callback) { - if(db) { - callback(null, db); - } - else { - var target; - target = new mongo.Server(config.host, config.port, {'auto_reconnect':true, 'poolSize':4}); - db = new mongo.Db(dbname, target, {native_parser:false}); - db.open(callback); - } -} - -var listCommand = function (target, spec, options, next){ - deepDecode(spec); - openConnection(target.db, target.connection, function(err,db) { - if(err) { next(err); return; } - // open collection - db.collection(target.collection, function(err, collection) { - - if(spec._id) { - collection.findOne(spec, options, function(err, doc){ - next(err, doc); - }); - } - else - { - // console.dir(options) - options['limit'] = 10; - - collection.find(spec, options, function(err, cursor) - { - - cursor.toArray(function(err, docs) - { - next(err, docs); - //db.close(); - }); - }); - } - }); - }); -} - -app.get('/:db/:collection/:id?', function(req, res, next) -{ - var spec = req.query.query? JSON.parse(req.query.query) : {}; - spec = req.query.spec? JSON.parse(req.query.spec) : spec; - - if(req.params.id) - spec._id = req.params.id; - - // JSON decode options - var options = req.query.options?JSON.parse(req.query.options) : {}; - - listCommand({ - connection: app.set("dbconnection"), - db: req.params.db, - collection: req.params.collection - }, - spec, - options, - function(err, docs, allCount) { - app.renderResponse(res, err, docs, allCount); - }); -}); - -app.listen(9999, '127.0.0.1'); \ No newline at end of file diff --git a/test/manual_tests/simple_test.js b/test/manual_tests/simple_test.js deleted file mode 100644 index 55b561e5f0e..00000000000 --- a/test/manual_tests/simple_test.js +++ /dev/null @@ -1,23 +0,0 @@ -var Db = require('../../lib/mongodb').Db, - Server = require('../../lib/mongodb').Server; - -var _db = new Db('mydb', new Server('localhost', 27017, {auto_reconnect: true, poolSize: 2})); -_db.open(function(err, db) { - - db.collection('coll1', function(err, coll) { - var expireDate = new Date(); - expireDate.setHours(expireDate.getHours() + 24); - coll.remove({valid_to: {$lt: expireDate}}, {safe: true}, function(err) { - console.log('Deleted the items'); - }); - }); - - db.collection('coll2', function(err, coll) { - coll.find({}, {}, function(err, cursor) { - console.log('Turning the cursor into an array'); - cursor.toArray(function(err, docs) { - console.log('Got the array'); - }); - }); - }); -}); \ No newline at end of file diff --git a/test/manual_tests/single_test.js b/test/manual_tests/single_test.js deleted file mode 100644 index 662b921e92b..00000000000 --- a/test/manual_tests/single_test.js +++ /dev/null @@ -1,61 +0,0 @@ -var mongodb = require("../../lib/mongodb"), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager; - -var options = { - auto_reconnect: true, - poolSize: 1, - // socketOptions: { keepAlive: 100, timeout:8000 } - socketOptions: { timeout:8000 } -}; - -var userObjects = []; - -// Build user array -for(var i = 0; i < 122; i++) { - userObjects.push({'user_id':i}); -} - -var queryCount = 0; -var replSet = new mongodb.Server( 'localhost', 27017, options); - -var users; -var db = new mongodb.Db("data", replSet); -db.on("error", function(err) { - console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") - console.dir(err) -}) - -db.open(function(err, client){ - if(err){ - console.log("[%s] %s", new Date, err.stack || err); - return; - } - - if(users){ - console.log("[%s] Reconnected?!", new Date); - return; - } - - client.collection("users", function(err, coll){ - coll.remove({}, {safe:true}, function(err) { - coll.insert(userObjects, {safe:true}, function(err, result) { - users = coll; - query(); - }) - }); - }); -}); - -function query(){ - var current = queryCount++; - console.log("[%s] #%s querying all users", new Date, current); - // setTimeout(query, 32 * 1000); - setTimeout(query, 7 * 1000); - users.find().count(function(err, all){ - if(err){ - console.log("[%s] #%s %s", new Date, current, err.stack || err); - }else{ - console.log("[%s] #%s found %s users", new Date, current, all); - } - }); -} \ No newline at end of file diff --git a/test/manual_tests/test.js b/test/manual_tests/test.js deleted file mode 100644 index 006668b3d09..00000000000 --- a/test/manual_tests/test.js +++ /dev/null @@ -1,83 +0,0 @@ -var mongodb = require("./lib/mongodb"), - ReplicaSetManager = require('./test/tools/replica_set_manager').ReplicaSetManager; - -var options = { - auto_reconnect: true, - poolSize: 4, - socketOptions: { keepAlive: 100, timeout:30000 } -}; - -var userObjects = []; - -// Build user array -for(var i = 0; i < 122; i++) { - userObjects.push({'user_id':i}); -} - -// var replSet = new mongodb.ReplSetServers([ -// new mongodb.Server("mongo-1", 27017, options), -// new mongodb.Server("mongo-2", 27017, options), -// new mongodb.Server("mongo-3", 27017, options) -// ]); - -RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); -RS.startSet(true, function(err, result) { - // Replica configuration - var replSet = new mongodb.ReplSetServers( [ - new mongodb.Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new mongodb.Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new mongodb.Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - // {rs_name:RS.name, strategy:'ping'} - // {rs_name:RS.name, strategy:'statistical'} - ); - - var users; - var db = new mongodb.Db("data", replSet); - db.open(function(err, client){ - if(err){ - console.log("[%s] %s", new Date, err.stack || err); - return; - } - - if(users){ - console.log("[%s] Reconnected?!", new Date); - return; - } - - client.collection("users", function(err, coll){ - console.log("Connected"); - coll.insert(userObjects, {safe:true}, function(err, result) { - users = coll; - query(); - }) - }); - // client.collection("users", function(err, users){ - // console.log("Connected"); - // db.users = users; - // query(); - // }); - }); - - function query(){ - console.log("[%s] querying all users", new Date); - // setTimeout(query, 70 * 60 * 1000); - setTimeout(query, 32 * 1000); - db.collection('users', function(err, coll) { - if(err){ - console.log("[0] :: [%s] %s", new Date, err.stack || err); - } - - coll.find().count(function(err, all){ - if(err){ - console.log("[1] :: [%s] %s", new Date, err.stack || err); - }else{ - console.log("[2] :: [%s] found %s users", new Date, all); - } - }); - }) - } -}); - - diff --git a/test/map_reduce_test.js b/test/map_reduce_test.js deleted file mode 100644 index c6ea7906bcd..00000000000 --- a/test/map_reduce_test.js +++ /dev/null @@ -1,520 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - Code = require('../lib/mongodb/bson/code').Code, - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * A whole lot of different wayt to execute the group command - * - * @_class collection - * @_function group - */ -exports.shouldCorrectlyExecuteGroupFunction = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a test collection - db.createCollection('test_group', function(err, collection) { - - // Peform a simple group by on an empty collection - collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }", function(err, results) { - test.deepEqual([], results); - - // Trigger some inserts on the collection - collection.insert([{'a':2}, {'b':5}, {'a':1}], {safe:true}, function(err, ids) { - - // Perform a group count - collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }" - , function(err, results) { - test.equal(3, results[0].count); - - // Pefrom a group count using the eval method - collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }" - , false, function(err, results) { - test.equal(3, results[0].count); - - // Group with a conditional - collection.group([], {'a':{'$gt':1}}, {"count":0}, "function (obj, prev) { prev.count++; }" - , function(err, results) { - // Results - test.equal(1, results[0].count); - - // Group with a conditional using the EVAL method - collection.group([], {'a':{'$gt':1}}, {"count":0}, "function (obj, prev) { prev.count++; }" - , false, function(err, results) { - // Results - test.equal(1, results[0].count); - - // Insert some more test data - collection.insert([{'a':2}, {'b':3}], {safe:true}, function(err, ids) { - - // Do a Group by field a - collection.group(['a'], {}, {"count":0}, "function (obj, prev) { prev.count++; }" - , function(err, results) { - // Results - test.equal(2, results[0].a); - test.equal(2, results[0].count); - test.equal(null, results[1].a); - test.equal(2, results[1].count); - test.equal(1, results[2].a); - test.equal(1, results[2].count); - - // Do a Group by field a - collection.group({'a':true}, {}, {"count":0}, function (obj, prev) { prev.count++; } - , true, function(err, results) { - // Results - test.equal(2, results[0].a); - test.equal(2, results[0].count); - test.equal(null, results[1].a); - test.equal(2, results[1].count); - test.equal(1, results[2].a); - test.equal(1, results[2].count); - - // Correctly handle illegal function - collection.group([], {}, {}, "5 ++ 5", function(err, results) { - test.ok(err instanceof Error); - test.ok(err.message != null); - - // Use a function to select the keys used to group by - var keyf = function(doc) { return {a: doc.a}; }; - collection.group(keyf, {a: {$gt: 0}}, {"count": 0, "value": 0} - , function(obj, prev) { prev.count++; prev.value += obj.a; }, true, function(err, results) { - // Results - results.sort(function(a, b) { return b.count - a.count; }); - test.equal(2, results[0].count); - test.equal(2, results[0].a); - test.equal(4, results[0].value); - test.equal(1, results[1].count); - test.equal(1, results[1].a); - test.equal(1, results[1].value); - - // Correctly handle illegal function when using the EVAL method - collection.group([], {}, {}, "5 ++ 5", false, function(err, results) { - test.ok(err instanceof Error); - test.ok(err.message != null); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** -* @ignore -*/ -exports.shouldCorrectlyExecuteGroupFunctionWithFinalizeFunction = function(test) { - client.createCollection('test_group2', function(err, collection) { - collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }", true, function(err, results) { - test.deepEqual([], results); - - // Trigger some inserts - collection.insert([{'a':2}, {'b':5, 'a':0}, {'a':1}, {'c':2, 'a':0}], {safe:true}, function(err, ids) { - collection.group([], {}, {count: 0, running_average: 0} - , function (doc, out) { - out.count++; - out.running_average += doc.a; - } - , function(out) { - out.average = out.running_average / out.count; - }, true, function(err, results) { - test.equal(3, results[0].running_average) - test.equal(0.75, results[0].average) - test.done(); - }); - }); - }); - }); -} - -/** - * A simple map reduce example - * - * @_class collection - * @_function mapReduce - */ -exports.shouldPerformSimpleMapReduceFunctions = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a test collection - db.createCollection('test_map_reduce_functions', function(err, collection) { - - // Insert some documents to perform map reduce over - collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { - - // Map function - var map = function() { emit(this.user_id, 1); }; - // Reduce function - var reduce = function(k,vals) { return 1; }; - - // Peform the map reduce - collection.mapReduce(map, reduce, {out: {replace : 'tempCollection'}}, function(err, collection) { - // Mapreduce returns the temporary collection with the results - collection.findOne({'_id':1}, function(err, result) { - test.equal(1, result.value); - - collection.findOne({'_id':2}, function(err, result) { - test.equal(1, result.value); - - db.close(); - test.done(); - }); - }); - }); - }); - }); - }); -} - -/** - * A simple map reduce example using the inline output type on MongoDB > 1.7.6 - * - * @_class collection - * @_function mapReduce - */ -exports.shouldPerformMapReduceFunctionInline = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Parse version of server if available - db.admin().serverInfo(function(err, result){ - - // Only run if the MongoDB version is higher than 1.7.6 - if(parseInt((result.version.replace(/\./g, ''))) >= 176) { - - // Create a test collection - db.createCollection('test_map_reduce_functions_inline', function(err, collection) { - - // Insert some test documents - collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { - - // Map function - var map = function() { emit(this.user_id, 1); }; - // Reduce function - var reduce = function(k,vals) { return 1; }; - - // Execute map reduce and return results inline - collection.mapReduce(map, reduce, {out : {inline: 1}}, function(err, results) { - test.equal(2, results.length); - - db.close(); - test.done(); - }); - }); - }); - } else { - test.done(); - } - }); - }); -} - -/** -* Mapreduce different test with a provided scope containing a javascript function. -* -* @_class collection -* @_function mapReduce -*/ -exports.shouldPerformMapReduceInContext = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Create a test collection - client.createCollection('test_map_reduce_functions_scope', function(err, collection) { - - // Insert some test documents - collection.insert([{'user_id':1, 'timestamp':new Date()} - , {'user_id':2, 'timestamp':new Date()}], {safe:true}, function(err, r) { - - // Map function - var map = function(){ - emit(test(this.timestamp.getYear()), 1); - } - - // Reduce function - var reduce = function(k, v){ - count = 0; - for(i = 0; i < v.length; i++) { - count += v[i]; - } - return count; - } - - // Javascript function available in the map reduce scope - var t = function(val){ return val+1; } - - // Execute the map reduce with the custom scope - collection.mapReduce(map, reduce, {scope:{test:new Code(t.toString())} - , out: {replace:'replacethiscollection'}}, function(err, collection) { - - // Find all entries in the map-reduce collection - collection.find().toArray(function(err, results) { - test.equal(2, results[0].value) - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** -* Mapreduce tests -* @ignore -*/ -exports.shouldPerformMapReduceWithStringFunctions = function(test) { - client.createCollection('test_map_reduce', function(err, collection) { - collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { - // String functions - var map = "function() { emit(this.user_id, 1); }"; - var reduce = "function(k,vals) { return 1; }"; - - collection.mapReduce(map, reduce, {out: {replace : 'tempCollection'}}, function(err, collection) { - collection.findOne({'_id':1}, function(err, result) { - test.equal(1, result.value); - }); - - collection.findOne({'_id':2}, function(err, result) { - test.equal(1, result.value); - test.done(); - }); - }); - }); - }); -} - -/** -* @ignore -*/ -exports.shouldPerformMapReduceWithParametersBeingFunctions = function(test) { - client.createCollection('test_map_reduce_with_functions_as_arguments', function(err, collection) { - collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { - // String functions - var map = function() { emit(this.user_id, 1); }; - var reduce = function(k,vals) { return 1; }; - - collection.mapReduce(map, reduce, {out: {replace : 'tempCollection'}}, function(err, collection) { - collection.findOne({'_id':1}, function(err, result) { - test.equal(1, result.value); - }); - - collection.findOne({'_id':2}, function(err, result) { - test.equal(1, result.value); - test.done(); - }); - }); - }); - }); -} - -/** -* @ignore -*/ -exports.shouldPerformMapReduceWithCodeObjects = function(test) { - client.createCollection('test_map_reduce_with_code_objects', function(err, collection) { - collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { - // String functions - var map = new Code("function() { emit(this.user_id, 1); }"); - var reduce = new Code("function(k,vals) { return 1; }"); - - collection.mapReduce(map, reduce, {out: {replace : 'tempCollection'}}, function(err, collection) { - collection.findOne({'_id':1}, function(err, result) { - test.equal(1, result.value); - }); - - collection.findOne({'_id':2}, function(err, result) { - test.equal(1, result.value); - test.done(); - }); - }); - }); - }); -} - -/** -* @ignore -*/ -exports.shouldPerformMapReduceWithOptions = function(test) { - client.createCollection('test_map_reduce_with_options', function(err, collection) { - collection.insert([{'user_id':1}, {'user_id':2}, {'user_id':3}], {safe:true}, function(err, r) { - // String functions - var map = new Code("function() { emit(this.user_id, 1); }"); - var reduce = new Code("function(k,vals) { return 1; }"); - - collection.mapReduce(map, reduce, {out: {replace : 'tempCollection'}, 'query': {'user_id':{'$gt':1}}}, function(err, collection) { - collection.count(function(err, count) { - test.equal(2, count); - - collection.findOne({'_id':2}, function(err, result) { - test.equal(1, result.value); - }); - - collection.findOne({'_id':3}, function(err, result) { - test.equal(1, result.value); - test.done(); - }); - }); - }); - }); - }); -} - -/** -* @ignore -*/ -exports.shouldHandleMapReduceErrors = function(test) { - client.createCollection('test_map_reduce_error', function(err, collection) { - collection.insert([{'user_id':1}, {'user_id':2}, {'user_id':3}], {safe:true}, function(err, r) { - // String functions - var map = new Code("function() { throw 'error'; }"); - var reduce = new Code("function(k,vals) { throw 'error'; }"); - - collection.mapReduce(map, reduce, {out : {inline: 1}, 'query': {'user_id':{'$gt':1}}}, function(err, r) { - test.ok(err != null); - test.done(); - }); - }); - }); -} - -/** -* @ignore -*/ -exports.shouldCorrectlyReturnNestedKeys = function(test) { - var start = new Date().setTime(new Date().getTime() - 10000); - var end = new Date().setTime(new Date().getTime() + 10000); - - var keys = { - "data.lastname": true - }; - - var condition = { - "data.date": { - $gte: start, - $lte: end - } - }; - - condition = {} - - var initial = { - count : 0 - }; - - var reduce = function(doc, output) { - output.count++; - } - - // Execute the group - client.createCollection('data', function(err, collection) { - collection.insert({ - data: { - lastname:'smith', - date:new Date() - } - }, {safe:true}, function(err, result) { - - // Execute the group - collection.group(keys, condition, initial, reduce, true, function(err, r) { - test.equal(1, r[0].count) - test.equal('smith', r[0]['data.lastname']); - test.done(); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/multiple_dbs_on_connection_pool_test.js b/test/multiple_dbs_on_connection_pool_test.js deleted file mode 100644 index b8d364aa6ca..00000000000 --- a/test/multiple_dbs_on_connection_pool_test.js +++ /dev/null @@ -1,256 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - ServerManager = require('../test/tools/server_manager').ServerManager, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyEmitErrorOnAllDbsOnPoolClose = function(test) { - if(process.platform !== 'linux') { - var db = new Db('tests', new Server("127.0.0.1", 27027, {auto_reconnect: true}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - // All inserted docs - var docs = []; - var errs = []; - var insertDocs = []; - var numberOfCloses = 0; - - // Start server - var serverManager = new ServerManager({auth:false, purgedirectories:true, journal:false, start_port:27027}) - serverManager.start(false, function() { - db.on("close", function(err) { - numberOfCloses = numberOfCloses + 1; - }) - - db.open(function(err, db) { - db.createCollection('shouldCorrectlyErrorOnAllDbs', function(err, collection) { - test.equal(null, err); - - collection.insert({a:1}, {safe:true}, function(err, result) { - test.equal(null, err); - - // Open a second db - var db2 = db.db('tests_2'); - // Add a close handler - db2.on("close", function(err) { - numberOfCloses = numberOfCloses + 1; - }); - - db.serverConfig.connectionPool.openConnections[0].connection.destroy(); - - // Kill server and end test - serverManager.stop(9, function() { - test.equal(2, numberOfCloses) - test.done(); - }); - }); - }); - }); - }); - } else { - test.done(); - } -} - -/** - * Test the auto connect functionality of the db - * - * @ignore - */ -exports.shouldCorrectlyUseSameConnectionsForTwoDifferentDbs = function(test) { - var second_test_database = new Db(MONGODB + "_2", new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null), retryMiliSeconds:50}); - // Just create second database - second_test_database.open(function(err, second_test_database) { - // Close second database - second_test_database.close(); - // Let's grab a connection to the different db resusing our connection pools - var secondDb = client.db(MONGODB + "_2"); - secondDb.createCollection('shouldCorrectlyUseSameConnectionsForTwoDifferentDbs', function(err, collection) { - // Insert a dummy document - collection.insert({a:20}, {safe: true}, function(err, r) { - test.equal(null, err); - - // Query it - collection.findOne({}, function(err, item) { - test.equal(20, item.a); - - // Use the other db - client.createCollection('shouldCorrectlyUseSameConnectionsForTwoDifferentDbs', function(err, collection) { - // Insert a dummy document - collection.insert({b:20}, {safe: true}, function(err, r) { - test.equal(null, err); - - // Query it - collection.findOne({}, function(err, item) { - test.equal(20, item.b); - - // Drop the second db - secondDb.dropDatabase(function(err, item) { - test.equal(null, err); - test.done(); - }) - }) - }); - }); - }) - }); - }); - }); -} - -/** - * Test the auto connect functionality of the db - * - * @ignore - */ -exports.shouldCorrectlyUseSameConnectionsForTwoDifferentDbs = function(test) { - var second_test_database = new Db(MONGODB + "_2", new Server("127.0.0.1", 27017, {auto_reconnect: true, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null), retryMiliSeconds:50}); - // Just create second database - second_test_database.open(function(err, second_test_database) { - // Close second database - second_test_database.close(); - // Let's grab a connection to the different db resusing our connection pools - var secondDb = client.db(MONGODB + "_2"); - secondDb.createCollection('shouldCorrectlyUseSameConnectionsForTwoDifferentDbs', function(err, collection) { - // Insert a dummy document - collection.insert({a:20}, {safe: true}, function(err, r) { - test.equal(null, err); - - // Query it - collection.findOne({}, function(err, item) { - test.equal(20, item.a); - - // Use the other db - client.createCollection('shouldCorrectlyUseSameConnectionsForTwoDifferentDbs', function(err, collection) { - // Insert a dummy document - collection.insert({b:20}, {safe: true}, function(err, r) { - test.equal(null, err); - - // Query it - collection.findOne({}, function(err, item) { - test.equal(20, item.b); - - // Drop the second db - secondDb.dropDatabase(function(err, item) { - test.equal(null, err); - test.done(); - }) - }) - }); - }); - }) - }); - }); - }); -} - -/** - * Simple example connecting to two different databases sharing the socket connections below. - * - * @_class db - * @_function db - */ -exports.shouldCorrectlyShareConnectionPoolsAcrossMultipleDbInstances = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - test.equal(null, err); - - // Reference a different database sharing the same connections - // for the data transfer - var secondDb = db.db("integration_tests_2"); - - // Fetch the collections - var multipleColl1 = db.collection("multiple_db_instances"); - var multipleColl2 = secondDb.collection("multiple_db_instances"); - - // Write a record into each and then count the records stored - multipleColl1.insert({a:1}, {safe:true}, function(err, result) { - multipleColl2.insert({a:1}, {safe:true}, function(err, result) { - - // Count over the results ensuring only on record in each collection - multipleColl1.count(function(err, count) { - test.equal(1, count); - - multipleColl2.count(function(err, count) { - test.equal(1, count); - - db.close(); - test.done(); - }); - }); - }); - }); - }); -} - - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/objectid_test.js b/test/objectid_test.js deleted file mode 100644 index f001df8b16e..00000000000 --- a/test/objectid_test.js +++ /dev/null @@ -1,351 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyGenerateObjectID = function(test) { - var number_of_tests_done = 0; - - client.collection('test_object_id_generation.data', function(err, collection) { - // Insert test documents (creates collections and test fetch by query) - collection.insert({name:"Fred", age:42}, {safe:true}, function(err, ids) { - test.equal(1, ids.length); - test.ok(ids[0]['_id'].toHexString().length == 24); - // Locate the first document inserted - collection.findOne({name:"Fred"}, function(err, document) { - test.equal(ids[0]['_id'].toHexString(), document._id.toHexString()); - number_of_tests_done++; - }); - }); - - // Insert another test document and collect using ObjectId - collection.insert({name:"Pat", age:21}, {safe:true}, function(err, ids) { - test.equal(1, ids.length); - test.ok(ids[0]['_id'].toHexString().length == 24); - // Locate the first document inserted - collection.findOne(ids[0]['_id'], function(err, document) { - test.equal(ids[0]['_id'].toHexString(), document._id.toHexString()); - number_of_tests_done++; - }); - }); - - // Manually created id - var objectId = new ObjectID(null); - // Insert a manually created document with generated oid - collection.insert({"_id":objectId, name:"Donald", age:95}, {safe:true}, function(err, ids) { - test.equal(1, ids.length); - test.ok(ids[0]['_id'].toHexString().length == 24); - test.equal(objectId.toHexString(), ids[0]['_id'].toHexString()); - // Locate the first document inserted - collection.findOne(ids[0]['_id'], function(err, document) { - test.equal(ids[0]['_id'].toHexString(), document._id.toHexString()); - test.equal(objectId.toHexString(), document._id.toHexString()); - number_of_tests_done++; - }); - }); - }); - - var intervalId = setInterval(function() { - if(number_of_tests_done == 3) { - clearInterval(intervalId); - test.done(); - } - }, 100); -} - -/** - * Generate 12 byte binary string representation using a second based timestamp or - * default value - * - * @_class objectid - * @_function getTimestamp - * @ignore - */ -exports.shouldCorrectlyGenerate12ByteStringFromTimestamp = function(test) { - // Get a timestamp in seconds - var timestamp = Math.floor(new Date().getTime()/1000); - // Create a date with the timestamp - var timestampDate = new Date(timestamp*1000); - - // Create a new ObjectID with a specific timestamp - var objectId = new ObjectID(timestamp); - - // Get the timestamp and validate correctness - test.equal(timestampDate.toString(), objectId.getTimestamp().toString()); - test.done(); -} - -/** - * Generate a 24 character hex string representation of the ObjectID - * - * @_class objectid - * @_function toHexString - * @ignore - */ -exports.shouldCorrectlyRetrieve24CharacterHexStringFromToString = function(test) { - // Create a new ObjectID - var objectId = new ObjectID(); - // Verify that the hex string is 24 characters long - test.equal(24, objectId.toHexString().length); - test.done(); -} - -/** - * Get and set the generation time for an ObjectID - * - * @_class objectid - * @_function generationTime - * @ignore - */ -exports.shouldCorrectlyGetAndSetObjectIDUsingGenerationTimeProperty = function(test) { - // Create a new ObjectID - var objectId = new ObjectID(); - // Get the generation time - var generationTime = objectId.generationTime; - // Add 1000 miliseconds to the generation time - objectId.generationTime = generationTime + 1000; - - // Create a timestamp - var timestampDate = new Date(); - timestampDate.setTime((generationTime + 1000) * 1000); - - // Get the timestamp and validate correctness - test.equal(timestampDate.toString(), objectId.getTimestamp().toString()); - test.done(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyRetrieve24CharacterHexStringFromToString = function(test) { - // Create a new ObjectID - var objectId = new ObjectID(); - // Verify that the hex string is 24 characters long - test.equal(24, objectId.toString().length); - test.done(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyRetrieve24CharacterHexStringFromToString = function(test) { - // Create a new ObjectID - var objectId = new ObjectID(); - // Verify that the hex string is 24 characters long - test.equal(24, objectId.toJSON().length); - test.done(); -} - -/** - * Convert a ObjectID into a hex string representation and then back to an ObjectID - * - * @_class objectid - * @_function ObjectID.createFromHexString - * @ignore - */ -exports.shouldCorrectlyTransformObjectIDToAndFromHexString = function(test) { - // Create a new ObjectID - var objectId = new ObjectID(); - // Convert the object id to a hex string - var originalHex = objectId.toHexString(); - // Create a new ObjectID using the createFromHexString function - var newObjectId = new ObjectID.createFromHexString(originalHex) - // Convert the new ObjectID back into a hex string using the toHexString function - var newHex = newObjectId.toHexString(); - // Compare the two hex strings - test.equal(originalHex, newHex); - test.done(); -} - -/** - * Compare two different ObjectID's using the equals method - * - * @_class objectid - * @_function equals - * @ignore - */ -exports.shouldCorrectlyTransformObjectIDToAndFromHexString = function(test) { - // Create a new ObjectID - var objectId = new ObjectID(); - // Create a new ObjectID Based on the first ObjectID - var objectId2 = new ObjectID(objectId.id); - // Create another ObjectID - var objectId3 = new ObjectID(); - // objectId and objectId2 should be the same - test.ok(objectId.equals(objectId2)); - // objectId and objectId2 should be different - test.ok(!objectId.equals(objectId3)); - test.done(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyCreateOIDNotUsingObjectID = function(test) { - client.createCollection('test_non_oid_id', function(err, collection) { - var date = new Date(); - date.setUTCDate(12); - date.setUTCFullYear(2009); - date.setUTCMonth(11 - 1); - date.setUTCHours(12); - date.setUTCMinutes(0); - date.setUTCSeconds(30); - - collection.insert({'_id':date}, {safe:true}, function(err, ids) { - collection.find({'_id':date}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(("" + date), ("" + items[0]._id)); - - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyGenerateObjectIDFromTimestamp = function(test) { - var timestamp = Math.floor(new Date().getTime()/1000); - var objectID = new ObjectID(timestamp); - var time2 = objectID.generationTime; - test.equal(timestamp, time2); - test.done(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyCreateAnObjectIDAndOverrideTheTimestamp = function(test) { - var timestamp = 1000; - var objectID = new ObjectID(); - var id1 = objectID.id; - // Override the timestamp - objectID.generationTime = timestamp - var id2 = objectID.id; - // Check the strings - test.equal(id1.substr(4), id2.substr(4)); - test.done(); -} - -/** - * @ignore - */ -exports.shouldCorrectlyInsertWithObjectId = function(test) { - client.createCollection('shouldCorrectlyInsertWithObjectId', function(err, collection) { - collection.insert({}, {safe:true}, function(err, ids) { - setTimeout(function() { - collection.insert({}, {safe:true}, function(err, ids) { - collection.find().toArray(function(err, items) { - var compareDate = new Date(); - - // Date 1 - var date1 = new Date(); - date1.setTime(items[0]._id.generationTime * 1000); - // Date 2 - var date2 = new Date(); - date2.setTime(items[1]._id.generationTime * 1000); - - // Compare - test.equal(compareDate.getFullYear(), date1.getFullYear()); - test.equal(compareDate.getDate(), date1.getDate()); - test.equal(compareDate.getMonth(), date1.getMonth()); - test.equal(compareDate.getHours(), date1.getHours()); - - test.equal(compareDate.getFullYear(), date2.getFullYear()); - test.equal(compareDate.getDate(), date2.getDate()); - test.equal(compareDate.getMonth(), date2.getMonth()); - test.equal(compareDate.getHours(), date2.getHours()); - // Let's close the db - test.done(); - }); - }); - }, 2000); - }); - }); -} - -/** - * Show the usage of the Objectid createFromTime function - * - * @_class objectid - * @_function ObjectID.createFromTime - * @ignore - */ -exports.shouldCorrectlyTransformObjectIDToAndFromHexString = function(test) { - var objectId = ObjectID.createFromTime(1); - test.equal("000000010000000000000000", objectId.toHexString()); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/raw_test.js b/test/raw_test.js deleted file mode 100644 index 30164a18a98..00000000000 --- a/test/raw_test.js +++ /dev/null @@ -1,397 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - ObjectID = require('../lib/mongodb/bson/objectid').ObjectID, - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldCorrectlySaveDocumentsAndReturnAsRaw = function(test) { - client.createCollection('shouldCorrectlySaveDocumentsAndReturnAsRaw', function(err, collection) { - // Insert some documents - collection.insert([{a:1}, {b:2000}, {c:2.3}], {safe:true}, function(err, result) { - // You have to pass at least query + fields before passing options - collection.find({}, null, {raw:true}).toArray(function(err, items) { - var objects = []; - for(var i = 0; i < items.length; i++) { - test.ok(items[i] instanceof Buffer); - objects.push(client.bson.deserialize(items[i])); - } - - test.equal(1, objects[0].a); - test.equal(2000, objects[1].b); - test.equal(2.3, objects[2].c); - - // Execute findOne - collection.findOne({a:1}, {raw:true}, function(err, item) { - test.ok(item instanceof Buffer); - var object = client.bson.deserialize(item); - test.equal(1, object.a) - test.done(); - }) - }) - }) - }); -} - -exports.shouldCorrectlyRemoveDocumentAndReturnRaw = function(test) { - client.createCollection('shouldCorrectlyRemoveDocumentAndReturnRaw', function(err, collection) { - // Insert some documents - collection.insert([{a:1}, {b:2000}, {c:2.3}], {safe:true}, function(err, result) { - // Let's create a raw delete command - var queryObject = {b:2000}; - // Create raw bson buffer - var rawQueryObject = new Buffer(client.bson.calculateObjectSize(queryObject)); - client.bson.serializeWithBufferAndIndex(queryObject, false, rawQueryObject, 0); - - // Update the document and return the raw new document - collection.remove(rawQueryObject, {safe:true}, function(err, numberOfDeleted) { - test.equal(1, numberOfDeleted); - - collection.findOne({b:2000}, function(err, item) { - test.equal(null, item) - test.done(); - }); - }); - }); - }); -} - -exports.shouldCorrectlyUpdateDocumentAndReturnRaw = function(test) { - client.createCollection('shouldCorrectlyUpdateDocumentAndReturnRaw', function(err, collection) { - // Insert some documents - collection.insert([{a:1}, {b:2000}, {c:2.3}], {safe:true}, function(err, result) { - // Let's create a raw delete command - var selectorObject = {b:2000}; - // Create raw bson buffer - var rawSelectorObject = new Buffer(client.bson.calculateObjectSize(selectorObject)); - client.bson.serializeWithBufferAndIndex(selectorObject, false, rawSelectorObject, 0); - // Let's create a raw delete command - var updateObject = {"$set":{c:2}}; - // Create raw bson buffer - var rawUpdateObject = new Buffer(client.bson.calculateObjectSize(updateObject)); - client.bson.serializeWithBufferAndIndex(updateObject, false, rawUpdateObject, 0); - // Update the document and return the raw new document - collection.update(rawSelectorObject, rawUpdateObject, {safe:true}, function(err, numberOfUpdated) { - test.equal(1, numberOfUpdated); - - // Query the document - collection.find({}, {}, {raw:true}).toArray(function(err, items) { - var objects = []; - for(var i = 0; i < items.length; i++) { - test.ok(items[i] instanceof Buffer); - objects.push(client.bson.deserialize(items[i])); - } - - test.equal(1, objects[0].a); - test.equal(2.3, objects[1].c); - test.equal(2000, objects[2].b); - test.equal(2, objects[2].c); - test.done(); - }) - }); - }); - }); -} - -exports.shouldCorreclyInsertRawDocumentAndRetrieveThem = function(test) { - client.createCollection('shouldCorreclyInsertRawDocumentAndRetrieveThem', function(err, collection) { - // Create serialized insert objects - var id = new ObjectID(); - var inputObjects = [{_id:id}, {a:1}, {b:2}, {c:4}] - var serializedObjects = []; - - // Serialize all object - for(var i = 0; i < inputObjects.length; i++) { - // Create raw bson buffer - var rawObject = new Buffer(client.bson.calculateObjectSize(inputObjects[i])); - client.bson.serializeWithBufferAndIndex(inputObjects[i], false, rawObject, 0); - serializedObjects.push(rawObject); - } - - // Insert all raw objects - collection.insert(serializedObjects, {safe:true}, function(err, result) { - test.equal(null, err); - - // Query the document - collection.find({}, {}, {raw:true}).toArray(function(err, items) { - var objects = []; - for(var i = 0; i < items.length; i++) { - test.ok(items[i] instanceof Buffer); - objects.push(client.bson.deserialize(items[i])); - } - - test.equal(id.toHexString(), objects[0]._id.toHexString()); - test.equal(1, objects[1].a); - test.equal(2, objects[2].b); - test.equal(4, objects[3].c); - test.done(); - }) - }); - }); -} - -exports.shouldCorrectlyPeformQueryUsingRaw = function(test) { - client.createCollection('shouldCorrectlyPeformQueryUsingRaw', function(err, collection) { - collection.insert([{a:1}, {b:2}, {b:3}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Let's create a raw query object - var queryObject = {b:3}; - // Create raw bson buffer - var rawQueryObject = new Buffer(client.bson.calculateObjectSize(queryObject)); - client.bson.serializeWithBufferAndIndex(queryObject, false, rawQueryObject, 0); - - // Let's create a raw fields object - var fieldsObject = {}; - // Create raw bson buffer - var rawFieldsObject = new Buffer(client.bson.calculateObjectSize(fieldsObject)); - client.bson.serializeWithBufferAndIndex(fieldsObject, false, rawFieldsObject, 0); - - collection.find(rawQueryObject, rawFieldsObject, {raw:true}).toArray(function(err, items) { - test.equal(1, items.length); - test.ok(items[0] instanceof Buffer); - if(items[0] == null) console.dir(items) - var object = client.bson.deserialize(items[0]); - test.equal(3, object.b) - - collection.findOne(rawQueryObject, rawFieldsObject, {raw:true}, function(err, item) { - test.equal(null, err); - test.ok(item != null); - var object = client.bson.deserialize(item); - test.equal(3, object.b) - test.done(); - }); - }); - }) - }); -} - -exports.shouldCorrectlyThrowErrorsWhenIllegalySizedMessages = function(test) { - client.createCollection('shouldCorrectlyThrowErrorsWhenIllegalySizedMessages', function(err, collection) { - var illegalBuffer = new Buffer(20); - try { - collection.insert(illegalBuffer, {safe:true}, function(err, result) {}); - } catch (err) { - test.ok(err.toString().indexOf("insert") != -1); - } - - try { - collection.update(illegalBuffer, {}, function(){}) - } catch(err) { - test.ok(err.toString().indexOf("update spec") != -1); - } - - try { - collection.update({}, illegalBuffer, function(){}) - } catch(err) { - test.ok(err.toString().indexOf("update document") != -1); - } - - try { - collection.remove(illegalBuffer, function(){}) - } catch(err) { - test.ok(err.toString().indexOf("delete") != -1); - } - - try { - collection.find(illegalBuffer).toArray(function() {}) - } catch(err) { - test.ok(err.toString().indexOf("query selector") != -1); - } - - try { - collection.find({}, illegalBuffer).toArray(function() {}) - } catch(err) { - test.ok(err.toString().indexOf("query fields") != -1); - } - - try { - collection.findOne(illegalBuffer, function() {}) - } catch(err) { - test.ok(err.toString().indexOf("query selector") != -1); - } - - try { - collection.findOne({}, illegalBuffer, function() {}) - } catch(err) { - test.ok(err.toString().indexOf("query fields") != -1); - test.done(); - } - }); -} - -exports.shouldCorrectlyPeformQueryUsingRawSettingRawAtCollectionLevel = function(test) { - client.createCollection('shouldCorrectlyPeformQueryUsingRawSettingRawAtCollectionLevel', function(err, collection) { - collection.insert([{a:1}, {b:2}, {b:3}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Let's create a raw query object - var queryObject = {b:3}; - // Create raw bson buffer - var rawQueryObject = new Buffer(client.bson.calculateObjectSize(queryObject)); - client.bson.serializeWithBufferAndIndex(queryObject, false, rawQueryObject, 0); - - // Let's create a raw fields object - var fieldsObject = {}; - // Create raw bson buffer - var rawFieldsObject = new Buffer(client.bson.calculateObjectSize(fieldsObject)); - client.bson.serializeWithBufferAndIndex(fieldsObject, false, rawFieldsObject, 0); - - client.collection('shouldCorrectlyPeformQueryUsingRaw', {raw:true}, function(err, collection) { - collection.find(rawQueryObject, rawFieldsObject).toArray(function(err, items) { - test.equal(1, items.length); - test.ok(items[0] instanceof Buffer); - var object = client.bson.deserialize(items[0]); - test.equal(3, object.b) - - collection.findOne(rawQueryObject, rawFieldsObject, {raw:true}, function(err, item) { - test.equal(null, err); - test.ok(item != null); - var object = client.bson.deserialize(item); - test.equal(3, object.b) - test.done(); - }); - }); - }); - }) - }); -} - -exports.shouldCorreclyInsertRawDocumentAndRetrieveThemSettingRawAtCollectionLevel = function(test) { - client.createCollection('shouldCorreclyInsertRawDocumentAndRetrieveThemSettingRawAtCollectionLevel', {raw:true}, function(err, collection) { - // Create serialized insert objects - var id = new ObjectID(); - var inputObjects = [{_id:id}, {a:1}, {b:2}, {c:4}] - var serializedObjects = []; - - // Serialize all object - for(var i = 0; i < inputObjects.length; i++) { - // Create raw bson buffer - var rawObject = new Buffer(client.bson.calculateObjectSize(inputObjects[i])); - client.bson.serializeWithBufferAndIndex(inputObjects[i], false, rawObject, 0); - serializedObjects.push(rawObject); - } - - // Insert all raw objects - collection.insert(serializedObjects, {safe:true}, function(err, result) { - test.equal(null, err); - - // Query the document - collection.find({}, {}).toArray(function(err, items) { - var objects = []; - for(var i = 0; i < items.length; i++) { - test.ok(items[i] instanceof Buffer); - objects.push(client.bson.deserialize(items[i])); - } - - test.equal(id.toHexString(), objects[0]._id.toHexString()); - test.equal(1, objects[1].a); - test.equal(2, objects[2].b); - test.equal(4, objects[3].c); - test.done(); - }) - }); - }); -} - -exports.shouldCorrectlyUpdateDocumentAndReturnRawSettingRawAtCollectionLevel = function(test) { - client.createCollection('shouldCorrectlyUpdateDocumentAndReturnRawSettingRawAtCollectionLevel', {raw:true}, function(err, collection) { - // Insert some documents - collection.insert([{a:1}, {b:2000}, {c:2.3}], {safe:true}, function(err, result) { - // Let's create a raw delete command - var selectorObject = {b:2000}; - // Create raw bson buffer - var rawSelectorObject = new Buffer(client.bson.calculateObjectSize(selectorObject)); - client.bson.serializeWithBufferAndIndex(selectorObject, false, rawSelectorObject, 0); - // Let's create a raw delete command - var updateObject = {"$set":{c:2}}; - // Create raw bson buffer - var rawUpdateObject = new Buffer(client.bson.calculateObjectSize(updateObject)); - client.bson.serializeWithBufferAndIndex(updateObject, false, rawUpdateObject, 0); - // Update the document and return the raw new document - collection.update(rawSelectorObject, rawUpdateObject, {safe:true}, function(err, numberOfUpdated) { - test.equal(1, numberOfUpdated); - - // Query the document - collection.find({}, {}).toArray(function(err, items) { - var objects = []; - for(var i = 0; i < items.length; i++) { - test.ok(items[i] instanceof Buffer); - objects.push(client.bson.deserialize(items[i])); - } - - test.equal(1, objects[0].a); - test.equal(2.3, objects[1].c); - test.equal(2000, objects[2].b); - test.equal(2, objects[2].c); - test.done(); - }) - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/reaper_test.js b/test/reaper_test.js deleted file mode 100644 index 3bf407476f5..00000000000 --- a/test/reaper_test.js +++ /dev/null @@ -1,88 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldCorrectlySaveUnicodeContainingDocument = function(test) { - var reaperClient = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: false, ssl:useSSL}), {reaper:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - reaperClient.open(function(err, reaperClient) { - reaperClient._lastReaperTimestamp = (new Date().getTime() - 1000000); - var con = reaperClient.serverConfig.checkoutReader(); - // Prime the reaper with a bogus call - reaperClient._callBackStore._notReplied["3"] = {start: (new Date().getTime() - 50000), 'raw': false, chained:null, connection:con}; - reaperClient._callBackStore.once("3", function(err, result) { - reaperClient.close(); - test.done(); - }) - - reaperClient.collection("test", {safe:true}, function(err, col) { - // Does not matter - }); - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/regexp_test.js b/test/regexp_test.js deleted file mode 100644 index a3303c4d3d5..00000000000 --- a/test/regexp_test.js +++ /dev/null @@ -1,126 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldCorrectlyInsertSimpleRegExpDocument = function(test) { - var regexp = /foobar/i; - - client.createCollection('test_regex', function(err, collection) { - collection.insert({'b':regexp}, {safe:true}, function(err, ids) { - collection.find({}, {'fields': ['b']}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(("" + regexp), ("" + items[0].b)); - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -exports.shouldCorrectlyInsertSimpleUTF8Regexp = function(test) { - var regexp = /foobaré/; - - client.createCollection('test_utf8_regex', function(err, collection) { - collection.insert({'b':regexp}, {safe:true}, function(err, ids) { - collection.find({}, {'fields': ['b']}, function(err, cursor) { - cursor.toArray(function(err, items) { - test.equal(("" + regexp), ("" + items[0].b)); - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -exports.shouldCorrectlyFindDocumentsByRegExp = function(test) { - // Serialized regexes contain extra trailing chars. Sometimes these trailing chars contain / which makes - // the original regex invalid, and leads to segmentation fault. - client.createCollection('test_regex_serialization', function(err, collection) { - collection.insert({keywords: ["test", "segmentation", "fault", "regex", "serialization", "native"]}, {safe:true}, function(err, r) { - - var count = 20, - run = function(i) { - // search by regex - collection.findOne({keywords: {$all: [/ser/, /test/, /seg/, /fault/, /nat/]}}, function(err, item) { - test.equal(6, item.keywords.length); - if (i === 0) { - test.done() - } - }); - }; - // loop a few times to catch the / in trailing chars case - while (count--) { - run(count); - } - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/remove_test.js b/test/remove_test.js deleted file mode 100644 index bc5d9f853d7..00000000000 --- a/test/remove_test.js +++ /dev/null @@ -1,171 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -/** - * An example removing all documents in a collection not using safe mode - * - * @_class collection - * @_function remove - * @ignore - */ -exports.shouldRemoveAllDocumentsNoSafe = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch a collection to insert document into - db.collection("remove_all_documents_no_safe", function(err, collection) { - - // Insert a bunch of documents - collection.insert([{a:1}, {b:2}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Remove all the document - collection.remove(); - - // Wait for a second to ensure command went through - setTimeout(function() { - - // Fetch all results - collection.find().toArray(function(err, items) { - test.equal(null, err); - test.equal(0, items.length); - db.close(); - test.done(); - }); - }, 1000); - }); - }) - }); -} - -/** - * An example removing a subset of documents using safe mode to ensure removal of documents - * - * @_class collection - * @_function remove - * @ignore - */ -exports.shouldRemoveSubsetOfDocumentsSafeMode = function(test) { - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {native_parser: native_parser}); - - // Establish connection to db - db.open(function(err, db) { - - // Fetch a collection to insert document into - db.collection("remove_subset_of_documents_safe", function(err, collection) { - - // Insert a bunch of documents - collection.insert([{a:1}, {b:2}], {safe:true}, function(err, result) { - test.equal(null, err); - - // Remove all the document - collection.remove({a:1}, {safe:true}, function(err, numberOfRemovedDocs) { - test.equal(null, err); - test.equal(1, numberOfRemovedDocs); - db.close(); - test.done(); - }); - }); - }) - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyClearOutCollection = function(test) { - client.createCollection('test_clear', function(err, r) { - client.collection('test_clear', function(err, collection) { - collection.insert({i:1}, {safe:true}, function(err, ids) { - collection.insert({i:2}, {safe:true}, function(err, ids) { - collection.count(function(err, count) { - test.equal(2, count); - // Clear the collection - collection.remove({}, {safe:true}, function(err, result) { - test.equal(2, result); - - collection.count(function(err, count) { - test.equal(0, count); - // Let's close the db - test.done(); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/replicaset/connect_test.js b/test/replicaset/connect_test.js deleted file mode 100644 index e19d0a7c12f..00000000000 --- a/test/replicaset/connect_test.js +++ /dev/null @@ -1,518 +0,0 @@ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - Server = require('../../lib/mongodb').Server; - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - // Print any errors - db.on("error", function(err) { - console.log("============================= ensureConnection caught error") - console.dir(err) - if(err != null && err.stack != null) console.log(err.stack) - db.close(); - }) - - // Open the db - db.open(function(err, p_db) { - db.close(); - - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 3000); - } else { - return callback(null); - } - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -/** - * @ignore - */ -exports.shouldThrowErrorDueToSharedConnectionUsage = function(test) { - var replSet = new ReplSetServers([ - new Server('localhost', 28390, { auto_reconnect: true } ), - new Server('localhost', 28391, { auto_reconnect: true } ), - new Server('localhost', 28392, { auto_reconnect: true } ) - ] - ); - - try { - var db = new Db(MONGODB, replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - var db1 = new Db(MONGODB, replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - } catch(err) { - test.done(); - } -} - -/** - * @ignore - */ -exports.shouldCorrectlyHandleErrorWhenNoServerUpInReplicaset = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server('localhost', 28390, { auto_reconnect: true } ), - new Server('localhost', 28391, { auto_reconnect: true } ), - new Server('localhost', 28392, { auto_reconnect: true } ) - ] - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - test.ok(err != null); - test.done(); - }); -} - -/** - * Simple replicaset connection setup, requires a running replicaset on the correct ports - * - * @_class db - * @_function open - */ -exports.shouldCorrectlyConnectWithDefaultReplicasetNoOption = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server('localhost', 30000, { auto_reconnect: true } ), - new Server('localhost', 30001, { auto_reconnect: true } ), - new Server('localhost', 30002, { auto_reconnect: true } ) - ] - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - test.equal(null, err); - test.done(); - p_db.close(); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyConnectWithDefaultReplicasetNoOption = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ] - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - test.equal(null, err); - test.done(); - p_db.close(); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyConnectWithDefaultReplicaset = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {} - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - test.equal(null, err); - test.done(); - p_db.close(); - }) -} - -/** - * @ignore - */ -exports.shouldCorrectlyConnectWithDefaultReplicasetAndSocketOptionsSet = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {socketOptions:{keepAlive:100}} - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - test.equal(null, err); - test.equal(100, db.serverConfig.checkoutWriter().socketOptions.keepAlive) - test.done(); - p_db.close(); - }) -} - -/** - * @ignore - */ -exports.shouldEmitCloseNoCallback = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], {} - ); - - new Db('integration_test_', replSet).open(function(err, db) { - test.equal(null, err); - var dbCloseCount = 0, serverCloseCount = 0; - db.on('close', function() { ++dbCloseCount; }); - db.close(); - - setTimeout(function() { - test.equal(dbCloseCount, 1); - test.done(); - }, 2000); - }) -} - -/** - * @ignore - */ -exports.shouldEmitCloseWithCallback = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], {} - ); - - new Db('integration_test_', replSet).open(function(err, db) { - test.equal(null, err); - var dbCloseCount = 0; - db.on('close', function() { ++dbCloseCount; }); - - db.close(function() { - // Let all events fire. - process.nextTick(function() { - test.equal(dbCloseCount, 0); - test.done(); - }); - }); - }) -} - -/** - * @ignore - */ -exports.shouldCorrectlyPassErrorWhenWrongReplicaSet = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name + "-wrong"} - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - test.notEqual(null, err); - test.done(); - }) -} - -/** - * @ignore - */ -exports.shouldConnectWithPrimarySteppedDown = function(test) { - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Step down primary server - RS.stepDownPrimary(function(err, result) { - // Wait for new primary to pop up - ensureConnection(test, retries, function(err, p_db) { - - new Db('integration_test_', replSet).open(function(err, p_db) { - test.ok(err == null); - test.equal(true, p_db.serverConfig.isConnected()); - - p_db.close(); - test.done(); - }) - }); - }); -} - -/** - * @ignore - */ -exports.shouldConnectWithThirdNodeKilled = function(test) { - RS.getNodeFromPort(RS.ports[2], function(err, node) { - if(err != null) debug("shouldConnectWithThirdNodeKilled :: " + inspect(err)); - - RS.kill(node, function(err, result) { - if(err != null) debug("shouldConnectWithThirdNodeKilled :: " + inspect(err)); - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Wait for new primary to pop up - ensureConnection(test, retries, function(err, p_db) { - new Db('integration_test_', replSet).open(function(err, p_db) { - test.ok(err == null); - test.equal(true, p_db.serverConfig.isConnected()); - - p_db.close(); - test.done(); - }) - }); - }); - }); -} - -/** - * @ignore - */ -exports.shouldConnectWithSecondaryNodeKilled = function(test) { - RS.killSecondary(function(node) { - - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - var db = new Db('integration_test_', replSet); - // Print any errors - db.on("error", function(err) { - console.log("============================= caught error") - console.dir(err) - if(err.stack != null) console.log(err.stack) - test.done(); - }) - - db.open(function(err, p_db) { - test.ok(err == null); - test.equal(true, p_db.serverConfig.isConnected()); - - // Close and cleanup - p_db.close(); - test.done(); - }) - }); -} - -/** - * @ignore - */ -exports.shouldConnectWithPrimaryNodeKilled = function(test) { - RS.killPrimary(function(node) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - var db = new Db('integration_test_', replSet); - ensureConnection(test, retries, function(err, p_db) { - if(err != null && err.stack != null) console.log(err.stack) - test.done(); - }); - }); -} - -/** - * @ignore - */ -exports.shouldCorrectlyBeAbleToUsePortAccessors = function(test) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - if(err != null) debug("shouldCorrectlyBeAbleToUsePortAccessors :: " + inspect(err)); - test.equal(replSet.host, p_db.serverConfig.primary.host); - test.equal(replSet.port, p_db.serverConfig.primary.port); - - p_db.close(); - test.done(); - }) -} - -/** - * @ignore - */ -exports.shouldCorrectlyConnect = function(test) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Replica configuration - var replSet2 = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - var db = new Db('integration_test_', replSet ); - db.open(function(err, p_db) { - if(err != null) debug("shouldCorrectlyConnect :: " + inspect(err)); - test.equal(true, p_db.serverConfig.isConnected()); - - // Test primary - RS.primary(function(err, primary) { - if(err != null) debug("shouldCorrectlyConnect :: " + inspect(err)); - - test.notEqual(null, primary); - test.equal(primary, p_db.serverConfig.primary.host + ":" + p_db.serverConfig.primary.port); - - // Perform tests - RS.secondaries(function(err, items) { - if(err != null) debug("shouldCorrectlyConnect :: " + inspect(err)); - - // Test if we have the right secondaries - test.deepEqual(items.sort(), p_db.serverConfig.allSecondaries.map(function(item) { - return item.host + ":" + item.port; - }).sort()); - - // Test if we have the right arbiters - RS.arbiters(function(err, items) { - if(err != null) debug("shouldCorrectlyConnect :: " + inspect(err)); - - test.deepEqual(items.sort(), p_db.serverConfig.arbiters.map(function(item) { - return item.host + ":" + item.port; - }).sort()); - // Force new instance - var db2 = new Db('integration_test_', replSet2 ); - db2.open(function(err, p_db2) { - if(err != null) debug("shouldCorrectlyConnect :: " + inspect(err)); - - test.equal(true, p_db2.serverConfig.isConnected()); - // Close top instance - db.close(); - db2.close(); - test.done(); - }); - }); - }); - }) - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; diff --git a/test/replicaset/count_test.js b/test/replicaset/count_test.js deleted file mode 100644 index 5e9221e8a98..00000000000 --- a/test/replicaset/count_test.js +++ /dev/null @@ -1,208 +0,0 @@ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - Server = require('../../lib/mongodb').Server; - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - // Print any errors - db.on("error", function(err) { - console.log("============================= ensureConnection caught error") - console.dir(err) - if(err != null && err.stack != null) console.log(err.stack) - db.close(); - }) - - // Open the db - db.open(function(err, p_db) { - db.close(); - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 1000); - } else { - return callback(null, p_db); - } - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -exports.shouldRetrieveCorrectCountAfterInsertionReconnect = function(test) { - // debug("=========================================== shouldRetrieveCorrectCountAfterInsertionReconnect") - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Insert some data - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - // if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - // Drop collection on replicaset - p_db.dropCollection('testsets', function(err, r) { - if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - - // Recreate collection on replicaset - p_db.createCollection('testsets', function(err, collection) { - if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - - // Insert a dummy document - collection.insert({a:20}, {safe: {w:2, wtimeout: 10000}}, function(err, r) { - if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - - // Execute a count - collection.count(function(err, c) { - if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - - test.equal(1, c); - // Close starting connection - p_db.close(); - - // Ensure replication happened in time - setTimeout(function() { - // Kill the primary - RS.killPrimary(function(node) { - - // debug("=========================================== shouldRetrieveCorrectCountAfterInsertionReconnect :: 0") - // Ensure valid connection - // Do inserts - // ensureConnection(test, retries, function(err, p_db) { - // // debug("=========================================== shouldRetrieveCorrectCountAfterInsertionReconnect :: 1") - // if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - // test.ok(err == null); - - p_db.collection('testsets', function(err, collection) { - if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - - collection.insert({a:30}, {safe:true}, function(err, r) { - if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - - collection.insert({a:40}, {safe:true}, function(err, r) { - if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - - // Execute count - collection.count(function(err, c) { - if(err != null) debug("shouldRetrieveCorrectCountAfterInsertionReconnect :: " + inspect(err)); - - test.equal(3, c); - - p_db.close(); - test.done(); - }); - }); - }); - }); - // }); - }); - }, 2000); - }) - }) - }); - }); - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; - - - - - - - - - - - - - - - - diff --git a/test/replicaset/insert_test.js b/test/replicaset/insert_test.js deleted file mode 100644 index 268c04a0a42..00000000000 --- a/test/replicaset/insert_test.js +++ /dev/null @@ -1,484 +0,0 @@ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - Server = require('../../lib/mongodb').Server, - Step = require("step"); - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - // // Print any errors - // db.on("error", function(err) { - // console.log("============================= ensureConnection caught error") - // console.dir(err) - // if(err != null && err.stack != null) console.log(err.stack) - // db.close(); - // }) - - // Open the db - db.open(function(err, p_db) { - // Close connections - db.close(); - // Process result - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 1000); - } else { - return callback(null, p_db); - } - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -exports.shouldCorrectlyWaitForReplicationToServersOnInserts = function(test) { - // debug("=========================================== shouldWorkCorrectlyWithInserts") - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Insert some data - var db = new Db('integration_test_', replSet, {numberOfRetries:20, retryMiliSeconds:5000}); - db.open(function(err, p_db) { - // Check if we got an error - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - - // Drop collection on replicaset - p_db.dropCollection('shouldCorrectlyWaitForReplicationToServersOnInserts', function(err, r) { - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - // Recreate collection on replicaset - p_db.createCollection('shouldCorrectlyWaitForReplicationToServersOnInserts', function(err, collection) { - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - // Insert a dummy document - collection.insert({a:20}, {safe: {w:2, wtimeout: 10000}}, function(err, r) { - test.equal(null, err); - test.done(); - p_db.close(); - }); - }); - }); - }); -} - -exports.shouldCorrectlyThrowTimeoutForReplicationToServersOnInserts = function(test) { - // debug("=========================================== shouldWorkCorrectlyWithInserts") - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Insert some data - var db = new Db('integration_test_', replSet, {numberOfRetries:20, retryMiliSeconds:5000}); - db.open(function(err, p_db) { - // Check if we got an error - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - - // Drop collection on replicaset - p_db.dropCollection('shouldCorrectlyThrowTimeoutForReplicationToServersOnInserts', function(err, r) { - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - // Recreate collection on replicaset - p_db.createCollection('shouldCorrectlyThrowTimeoutForReplicationToServersOnInserts', function(err, collection) { - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - // Insert a dummy document - collection.insert({a:20}, {safe: {w:7, wtimeout: 10000}}, function(err, r) { - test.equal('timeout', err.err); - test.equal(true, err.wtimeout); - test.done(); - p_db.close(); - }); - }); - }); - }); -} - -exports.shouldCorrectlyExecuteSafeFindAndModify = function(test) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Insert some data - var db = new Db('integration_test_', replSet, {numberOfRetries:20, retryMiliSeconds:5000}); - db.open(function(err, p_db) { - // Check if we got an error - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - // Drop collection on replicaset - p_db.dropCollection('shouldCorrectlyExecuteSafeFindAndModify', function(err, r) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Recreate collection on replicaset - p_db.createCollection('shouldCorrectlyExecuteSafeFindAndModify', function(err, collection) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Insert a dummy document - collection.insert({a:20}, {safe: {w:2, wtimeout: 10000}}, function(err, r) { - // Execute a safe insert with replication to two servers - collection.findAndModify({'a':20}, [['a', 1]], {'$set':{'b':3}}, {new:true, safe: {w:2, wtimeout: 10000}}, function(err, result) { - test.equal(20, result.a); - test.equal(3, result.b); - test.done(); - p_db.close(); - }) - }); - }); - }); - }); -} - -exports.shouldCorrectlyInsertAfterPrimaryComesBackUp = function(test) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - // {rs_name:RS.name, socketOptions:{timeout:30000}} - {rs_name:RS.name} - ); - - - // Insert some data - var db = new Db('integration_test_', replSet, {numberOfRetries:20, retryMiliSeconds:5000}); - // Open db - db.open(function(err, p_db) { - // Check if we got an error - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - // Drop collection on replicaset - p_db.dropCollection('shouldCorrectlyInsertAfterPrimaryComesBackUp', function(err, r) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Recreate collection on replicaset - p_db.createCollection('shouldCorrectlyInsertAfterPrimaryComesBackUp', function(err, collection) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Insert a dummy document - collection.insert({a:20}, {safe: {w:'majority', wtimeout: 10000}}, function(err, r) { - // Kill the primary - RS.killPrimary(2, {killNodeWaitTime:0}, function(node) { - // Attempt insert (should fail) - collection.insert({a:30}, {safe: {w:2, wtimeout: 10000}}, function(err, r) { - test.ok(err != null) - - if(err != null) { - collection.insert({a:40}, {safe: {w:2, wtimeout: 10000}}, function(err, r) { - - // Peform a count - collection.count(function(err, count) { - - test.equal(2, count); - p_db.close(); - test.done(); - }); - }); - } else { - p_db.close(); - test.ok(false) - test.done(); - } - }); - }); - }); - }); - }); - }); -} - -exports.shouldCorrectlyQueryAfterPrimaryComesBackUp = function(test) { - // debug("=========================================== shouldWorkCorrectlyWithInserts") - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Insert some data - var db = new Db('integration_test_', replSet, {numberOfRetries:20, retryMiliSeconds:5000}); - // Print any errors - db.on("error", function(err) { - console.log("============================= ensureConnection caught error") - console.dir(err) - if(err != null && err.stack != null) console.log(err.stack) - db.close(); - }) - // Open db - db.open(function(err, p_db) { - // Check if we got an error - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - // Drop collection on replicaset - p_db.dropCollection('shouldCorrectlyQueryAfterPrimaryComesBackUp', function(err, r) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Recreate collection on replicaset - p_db.createCollection('shouldCorrectlyQueryAfterPrimaryComesBackUp', function(err, collection) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Insert a dummy document - collection.insert({a:20}, {safe: {w:'majority', wtimeout: 10000}}, function(err, r) { - // Kill the primary - RS.killPrimary(2, {killNodeWaitTime:0}, function(node) { - // Ok let's execute same query a couple of times - collection.find({}).toArray(function(err, items) { - // console.log("============================================ CALLED :: 0") - test.ok(err != null); - // console.dir(err) - - collection.find({}).toArray(function(err, items) { - // console.log("============================================ CALLED :: 1") - // console.dir(err) - // console.dir(items) - - test.ok(err == null); - test.equal(1, items.length); - - collection.find({}).toArray(function(err, items) { - test.ok(err == null); - test.equal(1, items.length); - p_db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); -} - -exports.shouldWorkCorrectlyWithInserts = function(test) { - // debug("=========================================== shouldWorkCorrectlyWithInserts") - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - // Insert some data - var db = new Db('integration_test_', replSet, {numberOfRetries:20, retryMiliSeconds:5000}); - db.open(function(err, p_db) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Drop collection on replicaset - p_db.dropCollection('shouldWorkCorrectlyWithInserts', function(err, r) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Recreate collection on replicaset - p_db.createCollection('shouldWorkCorrectlyWithInserts', function(err, collection) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - // Insert a dummy document - collection.insert({a:20}, {safe: {w:'majority', wtimeout: 10000}}, function(err, r) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - // Execute a count - collection.count(function(err, c) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - test.equal(1, c); - - // Kill the primary - RS.killPrimary(function(node) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - test.ok(err == null); - - // p_db.collection('shouldWorkCorrectlyWithInserts', {safe:true}, function(err, collection) { - p_db.collection('shouldWorkCorrectlyWithInserts', function(err, collection) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Execute a set of inserts - Step( - function inserts() { - var group = this.group(); - collection.save({a:30}, {safe:{w:2, wtimeout: 10000}}, group()); - collection.save({a:40}, {safe:{w:2, wtimeout: 10000}}, group()); - collection.save({a:50}, {safe:{w:2, wtimeout: 10000}}, group()); - collection.save({a:60}, {safe:{w:2, wtimeout: 10000}}, group()); - collection.save({a:70}, {safe:{w:2, wtimeout: 10000}}, group()); - }, - - function finishUp(err, values) { - if(err != null) console.log(err.stack) - // Restart the old master and wait for the sync to happen - RS.restartKilledNodes(function(err, result) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Contains the results - var results = []; - - // Just wait for the results - // setTimeout(function() { - // Ensure the connection - // ensureConnection(test, retries, function(err, p_db) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - // Get the collection - p_db.collection('shouldWorkCorrectlyWithInserts', function(err, collection) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - collection.find().each(function(err, item) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - if(item == null) { - // Ensure we have the correct values - test.equal(6, results.length); - [20, 30, 40, 50, 60, 70].forEach(function(a) { - test.equal(1, results.filter(function(element) { - return element.a == a; - }).length); - }); - - // Run second check - collection.save({a:80}, {safe:true}, function(err, r) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - collection.find().toArray(function(err, items) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - // Ensure we have the correct values - test.equal(7, items.length); - - // Sort items by a - items = items.sort(function(a,b) { return a.a > b.a}); - // Test all items - test.equal(20, items[0].a); - test.equal(30, items[1].a); - test.equal(40, items[2].a); - test.equal(50, items[3].a); - test.equal(60, items[4].a); - test.equal(70, items[5].a); - test.equal(80, items[6].a); - - p_db.close(); - test.done(); - }); - }); - } else { - results.push(item); - } - }); - }); - // }); - // }, 5000); - }) - } - ); - }); - }); - }) - }) - }); - }); - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; - - - - - - - - - - - - - - - diff --git a/test/replicaset/map_reduce_test.js b/test/replicaset/map_reduce_test.js deleted file mode 100644 index f7b04c3e966..00000000000 --- a/test/replicaset/map_reduce_test.js +++ /dev/null @@ -1,251 +0,0 @@ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - Server = require('../../lib/mongodb').Server, - Step = require("step"); - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - // Open the db - db.open(function(err, p_db) { - // Close connections - db.close(); - // Process result - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 1000); - } else { - return callback(null, p_db); - } - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:0, arbiter_count:1}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -exports['Should Correctly group using replicaset'] = function(test) { - var self = this; - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:true} - ); - - // Insert some data - var db = new Db('integration_test_', replSet, {slave_ok:true}); - db.open(function(err, p_db) { - if(err != null) debug("shouldGroup :: " + inspect(err)); - - p_db.createCollection("testgroup_replicaset", {safe:{w:2, wtimeout:10000}}, function(err, collection) { - if(err != null) debug("shoulGroup :: " + inspect(err)); - - collection.insert([{key:1,x:10}, {key:2,x:30}, {key:1,x:20}, {key:3,x:20}], {safe:{w:2, wtimeout:10000}}, function(err, result) { - // Ensure replication happened in time - setTimeout(function() { - // Kill the primary - RS.killPrimary(function(node) { - // Do a collection find - collection.group(['key'], {}, {sum:0}, function reduce(record, memo){ - memo.sum += record.x; - }, true, function(err, items){ - if(err != null) debug("shouldGroup :: " + inspect(err)); - test.equal(null, err); - test.equal(3, items.length); - - p_db.close(); - test.done(); - }) - }); - }, 2000); - }) - }); - }) -} - -exports.shouldPerformMapReduceFunctionInline = function(test) { - var self = this; - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:true} - ); - - // Establish connection to db - var db = new Db('integration_test_', replSet, {slave_ok:true}); - db.open(function(err, db) { - - // Parse version of server if available - db.admin().serverInfo(function(err, result){ - - // Only run if the MongoDB version is higher than 1.7.6 - if(parseInt((result.version.replace(/\./g, ''))) >= 176) { - - // Create a test collection - db.createCollection('test_map_reduce_functions_inline_map_reduce', {safe:{w:2, wtimeout:10000}}, function(err, collection) { - // Insert some test documents - collection.insert([{'user_id':1}, {'user_id':2}], {safe:{w:2, wtimeout:10000}}, function(err, r) { - - // Ensure replication happened in time - setTimeout(function() { - // Map function - var map = function() { emit(this.user_id, 1); }; - // Reduce function - var reduce = function(k,vals) { return 1; }; - - // Execute map reduce and return results inline - collection.mapReduce(map, reduce, {out : {inline: 1}}, function(err, results) { - test.equal(2, results.length); - - db.close(); - test.done(); - }); - }, 2000); - }); - }); - } else { - test.done(); - } - }); - }); -} - -exports.shouldFailToDoMapReduceToOutCollection = function(test) { - var self = this; - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:true} - ); - - // Establish connection to db - var db = new Db('integration_test_', replSet, {slave_ok:true}); - db.open(function(err, db) { - - // Parse version of server if available - db.admin().serverInfo(function(err, result){ - - // Only run if the MongoDB version is higher than 1.7.6 - if(parseInt((result.version.replace(/\./g, ''))) >= 176) { - - // Create a test collection - db.createCollection('test_map_reduce_functions_notInline_map_reduce', {safe:{w:2, wtimeout:10000}}, function(err, collection) { - - // Insert some test documents - collection.insert([{'user_id':1}, {'user_id':2}], {safe:{w:2, wtimeout:10000}}, function(err, r) { - - // Ensure replication happened in time - setTimeout(function() { - // Map function - var map = function() { emit(this.user_id, 1); }; - // Reduce function - var reduce = function(k,vals) { return 1; }; - - // Execute map reduce and return results inline - collection.mapReduce(map, reduce, {out : {replace:'replacethiscollection'}}, function(err, results) { - test.ok(err != null); - - db.close(); - test.done(); - }); - }, 2000); - }); - }); - } else { - test.done(); - } - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; diff --git a/test/replicaset/query_secondaries_test.js b/test/replicaset/query_secondaries_test.js deleted file mode 100644 index 1f4bd91b08a..00000000000 --- a/test/replicaset/query_secondaries_test.js +++ /dev/null @@ -1,283 +0,0 @@ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - Server = require('../../lib/mongodb').Server, - Step = require("step"); - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - // Print any errors - db.on("error", function(err) { - console.log("============================= ensureConnection caught error") - console.dir(err) - if(err != null && err.stack != null) console.log(err.stack) - db.close(); - }) - - // Open the db - db.open(function(err, p_db) { - db.close(); - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 1000); - } else { - return callback(null, p_db); - } - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -exports.shouldReadPrimary = function(test) { - // debug("=========================================== shouldReadPrimary") - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:true} - ); - - // Insert some data - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - if(err != null) debug("shouldReadPrimary :: " + inspect(err)); - // Drop collection on replicaset - p_db.dropCollection('testsets', function(err, r) { - if(err != null) debug("shouldReadPrimary :: " + inspect(err)); - test.equal(false, p_db.serverConfig.isReadPrimary()); - test.equal(false, p_db.serverConfig.isPrimary()); - p_db.close(); - test.done(); - }); - }) -} - -exports.shouldCorrectlyTestConnection = function(test) { - // debug("=========================================== shouldCorrectlyTestConnection") - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:true} - ); - - // Insert some data - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - if(err != null) debug("shouldReadPrimary :: " + inspect(err)); - - // Drop collection on replicaset - p_db.dropCollection('testsets', function(err, r) { - if(err != null) debug("shouldReadPrimary :: " + inspect(err)); - - test.ok(p_db.serverConfig.primary != null); - test.ok(p_db.serverConfig.read != null); - test.ok(p_db.serverConfig.primary.port != p_db.serverConfig.read.port); - p_db.close(); - test.done(); - }); - }) -} - -exports.shouldCorrectlyQuerySecondaries = function(test) { - // debug("=========================================== shouldCorrectlyQuerySecondaries") - var self = this; - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:true} - ); - - // Insert some data - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - if(err != null) debug("shouldReadPrimary :: " + inspect(err)); - - p_db.createCollection("testsets", {safe:{w:2, wtimeout:10000}}, function(err, collection) { - if(err != null) debug("shouldReadPrimary :: " + inspect(err)); - - collection.insert([{a:20}, {a:30}, {a:40}], {safe:{w:2, wtimeout:10000}}, function(err, result) { - // Ensure replication happened in time - setTimeout(function() { - // Kill the primary - RS.killPrimary(function(node) { - // Do a collection find - collection.find().toArray(function(err, items) { - test.equal(null, err); - test.equal(3, items.length); - p_db.close(); - test.done(); - }); - }); - }, 2000); - }) - }); - }) -} - -exports.shouldCorrectlyQuerySecondaries = function(test) { - // debug("=========================================== shouldCorrectlyQuerySecondaries") - var self = this; - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:false} - ); - - // Insert some data - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - if(err != null) debug("shouldReadPrimary :: " + inspect(err)); - - // Ensure the checkoutReader gives us the actual writer object - var reader = replSet.checkoutReader(); - var writer = replSet.checkoutWriter(); - // Ensure the connections are the same - test.equal(reader.socketOptions.host, writer.socketOptions.host); - test.equal(reader.socketOptions.port, writer.socketOptions.port); - // Close connection to Spain - db.close(); - test.done(); - }); -} - -exports.shouldAllowToForceReadWithPrimary = function(test) { - // debug("=========================================== shouldAllowToForceReadWithPrimary") - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - ], - {rs_name:RS.name, read_secondary:true} - ); - - // Insert some data - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - if(err != null) debug("shouldReadPrimary :: " + inspect(err)); - // Create a collection - p_db.createCollection('shouldAllowToForceReadWithPrimary', function(err, collection) { - test.equal(null, err); - // Insert a document - collection.insert({a:1}, {safe:{w:2, wtimeout:10000}}, function(err, result) { - test.equal(null, err); - - // Force read using primary - var cursor = collection.find({}, {read:'primary'}) - // Get documents - cursor.toArray(function(err, items) { - test.equal(1, items.length); - test.equal(1, items[0].a); - p_db.close(); - test.done(); - }) - }); - }) - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; - - - - - - - - - - - - - - - - diff --git a/test/replicaset/read_preference_replicaset_test.js b/test/replicaset/read_preference_replicaset_test.js deleted file mode 100644 index bdf6970b955..00000000000 --- a/test/replicaset/read_preference_replicaset_test.js +++ /dev/null @@ -1,424 +0,0 @@ -// Read Preference behaviour based on Python driver by A. Jesse Jiryu Davis -// https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/__init__.py -// +----------------------+--------------------------------------------------+ -// | Connection type | Read Preference | -// +======================+================+================+================+ -// | |`PRIMARY` |`SECONDARY` |`SECONDARY_ONLY`| -// +----------------------+----------------+----------------+----------------+ -// |Connection to a single|Queries are |Queries are |Same as | -// |host. |allowed if the |allowed if the |`SECONDARY` | -// | |connection is to|connection is to| | -// | |the replica set |the replica set | | -// | |primary. |primary or a | | -// | | |secondary. | | -// +----------------------+----------------+----------------+----------------+ -// |Connection to a |Queries are sent|Queries are |Same as | -// |mongos. |to the primary |distributed |`SECONDARY` | -// | |of a shard. |among shard | | -// | | |secondaries. | | -// | | |Queries are sent| | -// | | |to the primary | | -// | | |if no | | -// | | |secondaries are | | -// | | |available. | | -// | | | | | -// +----------------------+----------------+----------------+----------------+ -// |ReplicaSetConnection |Queries are sent|Queries are |Queries are | -// | |to the primary |distributed |never sent to | -// | |of the replica |among replica |the replica set | -// | |set. |set secondaries.|primary. An | -// | | |Queries are sent|exception is | -// | | |to the primary |raised if no | -// | | |if no |secondary is | -// | | |secondaries are |available. | -// | | |available. | | -// | | | | | -// +----------------------+----------------+----------------+----------------+ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - Server = require('../../lib/mongodb').Server, - Step = require("step"); - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - // Print any errors - db.on("error", function(err) { - console.log("============================= ensureConnection caught error") - console.dir(err) - if(err != null && err.stack != null) console.log(err.stack) - db.close(); - }) - - // Open the db - db.open(function(err, p_db) { - db.close(); - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 1000); - } else { - return callback(null, p_db); - } - }) -} - -var identifyServers = function(rs, dbname, callback) { - // Total number of servers to query - var numberOfServersToCheck = Object.keys(rs.mongods).length; - - // Arbiters - var arbiters = []; - var secondaries = []; - var primary = null; - - // Let's establish what all servers so we can pick targets for our queries - var keys = Object.keys(rs.mongods); - for(var i = 0; i < keys.length; i++) { - var host = rs.mongods[keys[i]].host; - var port = rs.mongods[keys[i]].port; - - // Connect to the db and query the state - var server = new Server(host, port,{auto_reconnect: true}); - // Create db instance - var db = new Db(dbname, server, {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Connect to the db - db.open(function(err, db) { - numberOfServersToCheck = numberOfServersToCheck - 1; - if(db.serverConfig.isMasterDoc.ismaster) { - primary = {host:db.serverConfig.host, port:db.serverConfig.port}; - } else if(db.serverConfig.isMasterDoc.secondary) { - secondaries.push({host:db.serverConfig.host, port:db.serverConfig.port}); - } else if(db.serverConfig.isMasterDoc.arbiterOnly) { - arbiters.push({host:db.serverConfig.host, port:db.serverConfig.port}); - } - - // Close the db - db.close(); - // If we are done perform the callback - if(numberOfServersToCheck <= 0) { - callback(null, {primary:primary, secondaries:secondaries, arbiters:arbiters}); - } - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -// +----------------------+--------------------------------------------------+ -// | Connection type | Read Preference | -// +======================+================+================+================+ -// | |`PRIMARY` |`SECONDARY` |`SECONDARY_ONLY`| -// +----------------------+----------------+----------------+----------------+ -// |ReplicaSetConnection |Queries are sent|Queries are |Queries are | -// | |to the primary |distributed |never sent to | -// | |of the replica |among replica |the replica set | -// | |set. |set secondaries.|primary. An | -// | | |Queries are sent|exception is | -// | | |to the primary |raised if no | -// | | |if no |secondary is | -// | | |secondaries are |available. | -// | | |available. | | -// | | | | | -// +----------------------+----------------+----------------+----------------+ -exports['Connection to replicaset with primary read preference'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, readPreference:Server.READ_PRIMARY} - ); - - // Execute flag - var executedCorrectly = false; - - // Create db instance - var db = new Db('integration_test_', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Connect to the db - db.open(function(err, p_db) { - // Let's get the primary server and wrap the checkout Method to ensure it's the one called for read - var checkoutWriterMethod = p_db.serverConfig._state.master.checkoutWriter; - // Set up checkoutWriter to catch correct write request - p_db.serverConfig._state.master.checkoutWriter = function() { - executedCorrectly = true; - return checkoutWriterMethod.apply(this); - } - - // Grab the collection - db.collection("read_preference_replicaset_test_0", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - // Does not get called or we don't care - test.ok(executedCorrectly); - p_db.close(); - test.done(); - }); - }); - }); -} - -exports['Connection to replicaset with secondary read preference with no secondaries should return primary'] = function(test) { - // Fetch all the identity servers - identifyServers(RS, 'integration_test_', function(err, servers) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, readPreference:Server.READ_SECONDARY} - ); - - // Create db instance - var db = new Db('integration_test_', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Connect to the db - db.open(function(err, p_db) { - // Rip out secondaries forcing an attempt to read from the primary - p_db.serverConfig._state.secondaries = {}; - - // Let's get the primary server and wrap the checkout Method to ensure it's the one called for read - var checkoutWriterMethod = p_db.serverConfig._state.master.checkoutWriter; - // Set up checkoutWriter to catch correct write request - p_db.serverConfig._state.master.checkoutWriter = function() { - var r = checkoutWriterMethod.apply(p_db.serverConfig._state.master); - test.equal(servers.primary.host, r.socketOptions.host); - test.equal(servers.primary.port, r.socketOptions.port); - return r; - } - - // Grab the collection - p_db.collection("read_preference_replicaset_test_0", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - // Does not get called or we don't care - p_db.close(); - test.done(); - }); - }); - }); - }); -} - -exports['Connection to replicaset with secondary only read preference no secondaries should not return a connection'] = function(test) { - // Fetch all the identity servers - identifyServers(RS, 'integration_test_', function(err, servers) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, readPreference:Server.READ_SECONDARY_ONLY} - ); - - // Create db instance - var db = new Db('integration_test_', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Connect to the db - db.open(function(err, p_db) { - // Rip out secondaries forcing an attempt to read from the primary - p_db.serverConfig._state.secondaries = {}; - - // Grab the collection - p_db.collection("read_preference_replicaset_test_0", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - test.ok(err != null); - test.equal("no open connections", err.message); - // Does not get called or we don't care - p_db.close(); - test.done(); - }); - }); - }); - }); -} - -exports['Connection to replicaset with secondary only read preference should return secondary server'] = function(test) { - // Fetch all the identity servers - identifyServers(RS, 'integration_test_', function(err, servers) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, readPreference:Server.READ_SECONDARY_ONLY} - ); - - // Execute flag - var executedCorrectly = false; - - // Create db instance - var db = new Db('integration_test_', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Connect to the db - db.open(function(err, p_db) { - // Let's set up all the secondaries - var keys = Object.keys(p_db.serverConfig._state.secondaries); - - // Set up checkoutReaders - for(var i = 0; i < keys.length; i++) { - var checkoutReader = p_db.serverConfig._state.secondaries[keys[i]].checkoutReader; - p_db.serverConfig._state.secondaries[keys[i]].checkoutReader = function() { - executedCorrectly = true; - } - } - - // Grab the collection - p_db.collection("read_preference_replicaset_test_0", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - // Does not get called or we don't care - test.ok(executedCorrectly); - p_db.close(); - test.done(); - }); - }); - }); - }); -} - -exports['Connection to replicaset with secondary read preference should return secondary server'] = function(test) { - // Fetch all the identity servers - identifyServers(RS, 'integration_test_', function(err, servers) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, readPreference:Server.READ_SECONDARY_ONLY} - ); - - // Execute flag - var executedCorrectly = false; - - // Create db instance - var db = new Db('integration_test_', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Connect to the db - db.open(function(err, p_db) { - // Let's set up all the secondaries - var keys = Object.keys(p_db.serverConfig._state.secondaries); - - // Set up checkoutReaders - for(var i = 0; i < keys.length; i++) { - var checkoutReader = p_db.serverConfig._state.secondaries[keys[i]].checkoutReader; - p_db.serverConfig._state.secondaries[keys[i]].checkoutReader = function() { - executedCorrectly = true; - return checkoutReader.apply(this); - } - } - - // Grab the collection - p_db.collection("read_preference_replicaset_test_0", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - // Does not get called or we don't care - test.ok(executedCorrectly); - p_db.close(); - test.done(); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; - - - - - - - - - - - - - - - diff --git a/test/replicaset/read_preferences_single_test.js b/test/replicaset/read_preferences_single_test.js deleted file mode 100644 index 09f3b7defd4..00000000000 --- a/test/replicaset/read_preferences_single_test.js +++ /dev/null @@ -1,362 +0,0 @@ -// Read Preference behaviour based on Python driver by A. Jesse Jiryu Davis -// https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/__init__.py -// +----------------------+--------------------------------------------------+ -// | Connection type | Read Preference | -// +======================+================+================+================+ -// | |`PRIMARY` |`SECONDARY` |`SECONDARY_ONLY`| -// +----------------------+----------------+----------------+----------------+ -// |Connection to a single|Queries are |Queries are |Same as | -// |host. |allowed if the |allowed if the |`SECONDARY` | -// | |connection is to|connection is to| | -// | |the replica set |the replica set | | -// | |primary. |primary or a | | -// | | |secondary. | | -// +----------------------+----------------+----------------+----------------+ -// |Connection to a |Queries are sent|Queries are |Same as | -// |mongos. |to the primary |distributed |`SECONDARY` | -// | |of a shard. |among shard | | -// | | |secondaries. | | -// | | |Queries are sent| | -// | | |to the primary | | -// | | |if no | | -// | | |secondaries are | | -// | | |available. | | -// | | | | | -// +----------------------+----------------+----------------+----------------+ -// |ReplicaSetConnection |Queries are sent|Queries are |Queries are | -// | |to the primary |distributed |never sent to | -// | |of the replica |among replica |the replica set | -// | |set. |set secondaries.|primary. An | -// | | |Queries are sent|exception is | -// | | |to the primary |raised if no | -// | | |if no |secondary is | -// | | |secondaries are |available. | -// | | |available. | | -// | | | | | -// +----------------------+----------------+----------------+----------------+ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - Server = require('../../lib/mongodb').Server, - Step = require("step"); - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - // Print any errors - db.on("error", function(err) { - console.log("============================= ensureConnection caught error") - console.dir(err) - if(err != null && err.stack != null) console.log(err.stack) - db.close(); - }) - - // Open the db - db.open(function(err, p_db) { - db.close(); - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 1000); - } else { - return callback(null, p_db); - } - }) -} - -var identifyServers = function(rs, dbname, callback) { - // Total number of servers to query - var numberOfServersToCheck = Object.keys(rs.mongods).length; - - // Arbiters - var arbiters = []; - var secondaries = []; - var primary = null; - - // Let's establish what all servers so we can pick targets for our queries - var keys = Object.keys(rs.mongods); - for(var i = 0; i < keys.length; i++) { - var host = rs.mongods[keys[i]].host; - var port = rs.mongods[keys[i]].port; - - // Connect to the db and query the state - var server = new Server(host, port,{auto_reconnect: true}); - // Create db instance - var db = new Db(dbname, server, {native_parser: (process.env['TEST_NATIVE'] != null)}); - // Connect to the db - db.open(function(err, db) { - numberOfServersToCheck = numberOfServersToCheck - 1; - if(db.serverConfig.isMasterDoc.ismaster) { - primary = {host:db.serverConfig.host, port:db.serverConfig.port}; - } else if(db.serverConfig.isMasterDoc.secondary) { - secondaries.push({host:db.serverConfig.host, port:db.serverConfig.port}); - } else if(db.serverConfig.isMasterDoc.arbiterOnly) { - arbiters.push({host:db.serverConfig.host, port:db.serverConfig.port}); - } - - // Close the db - db.close(); - // If we are done perform the callback - if(numberOfServersToCheck <= 0) { - callback(null, {primary:primary, secondaries:secondaries, arbiters:arbiters}); - } - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -// +----------------------+--------------------------------------------------+ -// | Connection type | Read Preference | -// +======================+================+================+================+ -// | |`PRIMARY` |`SECONDARY` |`SECONDARY_ONLY`| -// +----------------------+----------------+----------------+----------------+ -// |Connection to a single|Queries are |Queries are |Same as | -// |host. |allowed if the |allowed if the |`SECONDARY` | -// | |connection is to|connection is to| | -// | |the replica set |the replica set | | -// | |primary. |primary or a | | -// | | |secondary. | | -// +----------------------+----------------+----------------+----------------+ -exports['Connection to a arbiter host with primary preference should give error'] = function(test) { - // Fetch all the identity servers - identifyServers(RS, 'integration_test_', function(err, servers) { - // Let's grab an arbiter, connect and attempt a query - var host = servers.arbiters[0].host; - var port = servers.arbiters[0].port; - - // Connect to the db - var server = new Server(host, port,{auto_reconnect: true}); - // Create db instance - var db = new Db('integration_test_', server, {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - // Grab a collection - p_db.createCollection('read_preference_single_test_0', function(err, collection) { - test.ok(err instanceof Error); - test.equal('Cannot write to an arbiter', err.message); - p_db.close(); - test.done(); - }); - }); - }); -} - -exports['Connection to a single primary host with different read preferences'] = function(test) { - // Fetch all the identity servers - identifyServers(RS, 'integration_test_', function(err, servers) { - // Select a secondary server, but specify read_primary (should fail) - // Let's grab a secondary server - var host = servers.primary.host; - var port = servers.primary.port; - - // Connect to the db - var server = new Server(host, port,{auto_reconnect: true, readPreference:Server.READ_PRIMARY}); - // Create db instance - var db = new Db('integration_test_', server, {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - // Grab the collection - p_db.collection("read_preference_single_test_0", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - test.equal(null, err); - p_db.close(); - - // Connect to the db - var server = new Server(host, port,{auto_reconnect: true, readPreference:Server.READ_SECONDARY}); - // Create db instance - var db = new Db('integration_test_', server, {slave_ok:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - // Grab the collection - db.collection("read_preference_single_test_0", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - test.equal(null, err); - test.equal(0, items.length); - p_db.close(); - - // test.done(); - - // Connect to the db - var server = new Server(host, port,{auto_reconnect: true, readPreference:Server.READ_SECONDARY_ONLY}); - // Create db instance - var db = new Db('integration_test_', server, {slave_ok:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - // Grab the collection - db.collection("read_preference_single_test_0", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - test.ok(err instanceof Error); - test.equal("Cannot read from primary when secondary only specified", err.message); - - p_db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -exports['Connection to a single secondary host with different read preferences'] = function(test) { - // Fetch all the identity servers - identifyServers(RS, 'integration_test_', function(err, servers) { - // Select a secondary server, but specify read_primary (should fail) - // Let's grab a secondary server - var host = servers.secondaries[0].host; - var port = servers.secondaries[0].port; - - // Connect to the db - var server = new Server(host, port,{auto_reconnect: true, readPreference:Server.READ_PRIMARY}); - // Create db instance - var db = new Db('integration_test_', server, {native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - // Grab the collection - p_db.collection("read_preference_single_test_1", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - test.ok(err instanceof Error); - test.equal("Read preference is primary and server is not master", err.message); - p_db.close(); - - // Connect to the db - var server = new Server(host, port,{auto_reconnect: true, readPreference:Server.READ_SECONDARY}); - // Create db instance - var db = new Db('integration_test_', server, {slave_ok:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - // Grab the collection - db.collection("read_preference_single_test_1", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - test.equal(null, err); - test.equal(0, items.length); - p_db.close(); - - // Connect to the db - var server = new Server(host, port,{auto_reconnect: true, readPreference:Server.READ_SECONDARY_ONLY}); - // Create db instance - var db = new Db('integration_test_', server, {slave_ok:true, native_parser: (process.env['TEST_NATIVE'] != null)}); - db.open(function(err, p_db) { - // Grab the collection - db.collection("read_preference_single_test_1", function(err, collection) { - // Attempt to read (should fail due to the server not being a primary); - collection.find().toArray(function(err, items) { - test.equal(null, err); - test.equal(0, items.length); - - p_db.close(); - test.done(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; - - - - - - - - - - - - - - - - diff --git a/test/replicaset/tags_test.js b/test/replicaset/tags_test.js deleted file mode 100644 index 053073febad..00000000000 --- a/test/replicaset/tags_test.js +++ /dev/null @@ -1,382 +0,0 @@ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - PingStrategy = require('../../lib/mongodb/connection/strategies/ping_strategy').PingStrategy, - StatisticsStrategy = require('../../lib/mongodb/connection/strategies/statistics_strategy').StatisticsStrategy, - Server = require('../../lib/mongodb').Server; - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - // Print any errors - db.on("error", function(err) { - console.log("============================= ensureConnection caught error") - console.dir(err) - if(err != null && err.stack != null) console.log(err.stack) - db.close(); - }) - - // Open the db - db.open(function(err, p_db) { - db.close(); - - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 3000); - } else { - return callback(null); - } - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, passive_count:0, secondary_count:2, tags:[{"dc1":"ny"}, {"dc1":"ny"}, {"dc2":"sf"}]}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -exports['Should Correctly Connect With Default Replicaset And Insert Document For Tag Dc:NY'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {} - ); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - // Recreate collection on replicaset - p_db.createCollection('testsets', function(err, collection) { - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - - // Insert a dummy document - collection.insert({a:20}, {safe: {w:'majority'}}, function(err, r) { - // Should have no error - test.equal(null, err); - - // Do a read for the value - collection.findOne({a:20}, function(err, item) { - p_db.close(); - test.equal(20, item.a); - test.done(); - }) - }); - }); - }) -} - -exports['Should Honor setReadPreference primary'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {} - ); - - // Set read preference - replSet.setReadPreference(Server.READ_PRIMARY); - // Open the database - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - // Checkout a reader and make sure it's the primary - var reader = replSet.checkoutReader(); - var readerAddress = reader.socketOptions['host'] + ":" + reader.socketOptions['port']; - // Locate server instance associated with this id - var serverInstance = replSet._state.addresses[readerAddress]; - // Check that it's the primary instance - test.equal(true, serverInstance.master); - // Check that it's in the list of primary servers - var primaryAddress = replSet._state.master.host + ":" + replSet._state.master.port; - test.equal(primaryAddress, readerAddress); - // End test and close db - p_db.close(); - test.done(); - }) -} - -exports['Should Honor setReadPreference secondary'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {} - ); - - // Set read preference - replSet.setReadPreference(Server.READ_SECONDARY); - // Open the database - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - // Checkout a reader and make sure it's the primary - var reader = replSet.checkoutReader(); - var readerAddress = reader.socketOptions['host'] + ":" + reader.socketOptions['port']; - // Locate server instance associated with this id - var serverInstance = replSet._state.addresses[readerAddress]; - // Check that it's the primary instance - test.equal(false, serverInstance.master); - // Check that it's in the list of primary servers - test.ok(replSet._state.secondaries[readerAddress] != null); - // End test and close db - p_db.close(); - test.done(); - }) -} - -exports['Should correctly cleanup connection with tags'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {} - ); - - // Set read preference - replSet.setReadPreference({'dc3':'pa', 'dc2':'sf', 'dc1':'ny'}); - // Open the database - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - // Checkout a reader and make sure it's the primary - var reader = replSet.checkoutWriter(); - var readerAddress = reader.socketOptions['host'] + ":" + reader.socketOptions['port']; - // Locate server instance associated with this id - var serverInstance = replSet._state.addresses[readerAddress]; - // Force cleanup of byTags - ReplSetServers._cleanupTags(serverInstance, replSet._state.byTags); - // Check cleanup successful - test.equal(1, replSet._state.byTags['dc1']['ny'].length); - test.equal(1, replSet._state.byTags['dc2']['sf'].length); - // End test and close db - p_db.close(); - test.done(); - }) -} - -exports['Should Honor setReadPreference tag'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {} - ); - - // Set read preference - replSet.setReadPreference({'dc3':'pa', 'dc2':'sf', 'dc1':'ny'}); - // Open the database - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - // Checkout a reader and make sure it's the primary - var reader = replSet.checkoutReader(); - var readerAddress = reader.socketOptions['host'] + ":" + reader.socketOptions['port']; - // Locate server instance associated with this id - var serverInstance = replSet._state.addresses[readerAddress]; - test.deepEqual({ dc2: 'sf' }, serverInstance.tags) - p_db.close(); - test.done(); - }) -}, - -exports['Should Correctly Collect ping information from servers'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {} - ); - - // Set read preference - replSet.setReadPreference({'dc3':'pa', 'dc2':'sf', 'dc1':'ny'}); - // Open the database - var db = new Db('integration_test_', replSet, {recordQueryStats:true}); - db.open(function(err, p_db) { - setTimeout(function() { - var keys = Object.keys(replSet._state.addresses); - for(var i = 0; i < keys.length; i++) { - var server = replSet._state.addresses[keys[i]]; - test.ok(server.queryStats.numDataValues >= 0); - test.ok(server.queryStats.mean >= 0); - test.ok(server.queryStats.variance >= 0); - test.ok(server.queryStats.standardDeviation >= 0); - } - - p_db.close(); - test.done(); - }, 5000) - }) -} - -exports['Should correctly pick a ping strategy for secondary'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {} - ); - - // Set read preference - replSet.setReadPreference(Server.READ_SECONDARY); - // Open the database - var db = new Db('integration_test_', replSet, {recordQueryStats:true}); - db.open(function(err, p_db) { - p_db.createCollection('testsets3', function(err, collection) { - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - - // Insert a bunch of documents - collection.insert([{a:20}, {b:30}, {c:40}, {d:50}], {safe: {w:'majority'}}, function(err, r) { - - // Select all documents - collection.find().toArray(function(err, items) { - test.equal(null, err); - test.equal(4, items.length); - p_db.close(); - test.done(); - }); - }); - }); - }) -} - -exports['Should correctly pick a statistics strategy for secondary'] = function(test) { - // Replica configuration - var replSet = new ReplSetServers([ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {strategy:'statistical'} - ); - - // Ensure we have the right strategy - test.ok(replSet.strategyInstance instanceof StatisticsStrategy); - - // Set read preference - replSet.setReadPreference(Server.READ_SECONDARY); - // Open the database - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - p_db.createCollection('testsets2', function(err, collection) { - if(err != null) debug("shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect(err)); - - // Insert a bunch of documents - collection.insert([{a:20}, {b:30}, {c:40}, {d:50}], {safe: {w:'majority'}}, function(err, r) { - - // Select all documents - collection.find().toArray(function(err, items) { - collection.find().toArray(function(err, items) { - collection.find().toArray(function(err, items) { - test.equal(null, err); - test.equal(4, items.length); - - // Total number of entries done - var totalNumberOfStrategyEntries = 0; - - // Check that we have correct strategy objects - var keys = Object.keys(replSet._state.secondaries); - for(var i = 0; i < keys.length; i++) { - var server = replSet._state.secondaries[keys[i]]; - totalNumberOfStrategyEntries += server.queryStats.numDataValues; - } - - p_db.close(); - test.equal(4, totalNumberOfStrategyEntries); - test.done(); - }); - }); - }); - }); - }); - }) -}, - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; diff --git a/test/replicaset/two_server_tests.js b/test/replicaset/two_server_tests.js deleted file mode 100644 index 34e253db571..00000000000 --- a/test/replicaset/two_server_tests.js +++ /dev/null @@ -1,162 +0,0 @@ -var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - gleak = require('../../dev/tools/gleak'), - ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager, - Db = require('../../lib/mongodb').Db, - ReplSetServers = require('../../lib/mongodb').ReplSetServers, - Server = require('../../lib/mongodb').Server, - Step = require("step"); - -// Keep instance of ReplicaSetManager -var serversUp = false; -var retries = 120; -var RS = RS == null ? null : RS; - -var ensureConnection = function(test, numberOfTries, callback) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} - ); - - if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null); - - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - db.close(); - if(err != null) { - // Wait for a sec and retry - setTimeout(function() { - numberOfTries = numberOfTries - 1; - ensureConnection(test, numberOfTries, callback); - }, 1000); - } else { - return callback(null, p_db); - } - }) -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - // Create instance of replicaset manager but only for the first call - if(!serversUp && !noReplicasetStart) { - serversUp = true; - RS = new ReplicaSetManager({retries:120, - arbiter_count:0, - secondary_count:1, - passive_count:0, - kill_node_wait_time:50000}); - RS.startSet(true, function(err, result) { - if(err != null) throw err; - // Finish setup - callback(); - }); - } else { - RS.restartKilledNodes(function(err, result) { - if(err != null) throw err; - callback(); - }) - } -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - numberOfTestsRun = numberOfTestsRun - 1; - if(numberOfTestsRun == 0) { - // Finished kill all instances - RS.killAll(function() { - callback(); - }) - } else { - callback(); - } -} - -exports.shouldCorrectlyExecuteSafeFindAndModify = function(test) { - // Replica configuration - var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - // new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name, read_secondary:false} - ); - - // Insert some data - var db = new Db('integration_test_', replSet); - db.open(function(err, p_db) { - // Check if we got an error - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - - // Drop collection on replicaset - p_db.dropCollection('testsets', function(err, r) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Recreate collection on replicaset - p_db.createCollection('testsets', function(err, collection) { - if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err)); - // Insert a dummy document - collection.insert({a:20}, {safe: {w:1, wtimeout: 10000}}, function(err, r) { - // Execute a findAndModify - collection.findAndModify({'a':20}, [['a', 1]], {'$set':{'b':3}}, {'new':true, safe: {w:7, wtimeout: 10000}}, function(err, updated_doc) { - test.equal('timeout', err.err) - test.equal(true, err.wtimeout) - p_db.close(); - test.done(); - }); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; - - - - - - - - - - - - - - - - diff --git a/test/streaming_test.js b/test/streaming_test.js deleted file mode 100644 index 567867b8005..00000000000 --- a/test/streaming_test.js +++ /dev/null @@ -1,143 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var native_parser = (process.env['TEST_NATIVE'] != null); -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldStreamRecordsCallsDataTheRightNumberOfTimes = function(test) { - client.createCollection('test_stream_records', function(err, collection) { - test.ok(collection instanceof Collection); - collection.insert([{'a':1}, {'b' : 2}, {'c' : 3}, {'d' : 4}, {'e' : 5}], {safe:true}, function(err, ids) { - var stream = collection.find({}, {'limit' : 3}).streamRecords(); - var callsToEnd = 0; - stream.on('end', function() { - test.done(); - }); - - var callsToData = 0; - stream.on('data',function(data){ - callsToData += 1; - test.ok(callsToData <= 3); - }); - }); - }); -} - -exports.shouldStreamRecordsCallsEndTheRightNumberOfTimes = function(test) { - client.createCollection('test_stream_records', function(err, collection) { - test.ok(collection instanceof Collection); - collection.insert([{'a':1}, {'b' : 2}, {'c' : 3}, {'d' : 4}, {'e' : 5}], {safe:true}, function(err, ids) { - collection.find({}, {'limit' : 3}, function(err, cursor) { - var stream = cursor.streamRecords(function(er,item) {}); - var callsToEnd = 0; - stream.on('end', function() { - callsToEnd += 1; - test.equal(1, callsToEnd); - setTimeout(function() { - // Let's close the db - if (callsToEnd == 1) { - test.done(); - } - }.bind(this), 1000); - }); - - stream.on('data',function(data){ /* nothing here */ }); - }); - }); - }); -} - -exports.shouldStreamDocumentsWithLimitForFetching = function(test) { - var docs = [] - - for(var i = 0; i < 3000; i++) { - docs.push({'a':i}) - } - - client.createCollection('test_streaming_function_with_limit_for_fetching', function(err, collection) { - test.ok(collection instanceof Collection); - - collection.insert(docs, {safe:true}, function(err, ids) { - collection.find({}, function(err, cursor) { - // Execute find on all the documents - var stream = cursor.streamRecords({fetchSize:1000}); - var callsToEnd = 0; - stream.on('end', function() { - test.done(); - }); - - var callsToData = 0; - stream.on('data',function(data){ - callsToData += 1; - test.ok(callsToData <= 3000); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/test/tools/keyfile.txt b/test/tools/keyfile.txt deleted file mode 100644 index f15d6805bea..00000000000 --- a/test/tools/keyfile.txt +++ /dev/null @@ -1 +0,0 @@ -THIS IS A SECRET KEYFILE FOR REPLICA SETS BWAHAHAHAH diff --git a/test/tools/replica_set_manager.js b/test/tools/replica_set_manager.js deleted file mode 100644 index 15cd9cb5aa0..00000000000 --- a/test/tools/replica_set_manager.js +++ /dev/null @@ -1,591 +0,0 @@ -var debug = require('util').debug, - inspect = require('util').inspect, - path = require('path'), - fs = require('fs'), - exec = require('child_process').exec, - spawn = require('child_process').spawn, - Connection = require('../../lib/mongodb').Connection, - Db = require('../../lib/mongodb').Db, - Server = require('../../lib/mongodb').Server, - Step = require("step"); - -var ReplicaSetManager = exports.ReplicaSetManager = function(options) { - options = options == null ? {} : options; - - this.startPort = options["start_port"] || 30000; - this.ports = []; - this.name = options["name"] != null ? options["name"] : "replica-set-foo"; - this.host = options["host"] != null ? options["host"] : "127.0.0.1"; - this.retries = options["retries"] != null ? options["retries"] : 60; - this.config = {"_id": this.name, "version": 1, "members": []}; - this.durable = options["durable"] != null ? options["durable"] : false; - this.auth = options['auth'] != null ? options['auth'] : false; - this.path = path.resolve("data"); - this.killNodeWaitTime = options['kill_node_wait_time'] != null ? options['kill_node_wait_time'] : 20000; - this.tags = options['tags'] != null ? options['tags'] : []; - this.ssl = options['ssl'] != null ? options['ssl'] : false; - - this.arbiterCount = options["arbiter_count"] != null ? options["arbiter_count"] : 2; - this.secondaryCount = options["secondary_count"] != null ? options["secondary_count"] : 1; - this.passiveCount = options["passive_count"] != null ? options["passive_count"] : 1; - this.primaryCount = options["primary_count"] != null ? options["primary_count"] : 1; - this.keyPath = [process.cwd(), "test", "tools", "keyfile.txt"].join("/"); - try { - fs.chmodSync(this.keyPath, 0600); - } catch(err) { - console.dir(err); - } - - this.count = this.primaryCount + this.passiveCount + this.arbiterCount + this.secondaryCount; - if(this.count > 7) { - throw new Error("Cannot create a replica set with #{node_count} nodes. 7 is the max."); - } - - // Keeps all the mongod instances - this.mongods = {}; -} - -ReplicaSetManager.prototype.secondaries = function(callback) { - return this.allHostPairsWithState(2, callback); -} - -ReplicaSetManager.prototype.arbiters = function(callback) { - return this.allHostPairsWithState(7, callback); -} - -ReplicaSetManager.prototype.primary = function(callback) { - return this.allHostPairsWithState(1, function(err, items) { - if(items.length == 0) { - return callback(null, null); - } else { - return callback(null, items[0]); - } - }); -} - -ReplicaSetManager.prototype.allHostPairsWithState = function(state, callback) { - this.ensureUp(function(err, status) { - if(err != null) return callback(err, null); - - var members = status["members"]; - - // Get the correct state memebers - var nodes = members.filter(function(value) { - return value["state"] == state; - }); - - // Filter out address of the server - var servers = nodes.map(function(item) { - return item["name"]; - }); - - // Map nodes - return callback(null, servers); - }) -} - -ReplicaSetManager.prototype.startSet = function(killall, callback) { - var self = this; - // Unpack callback and variables - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - killall = args.length ? args.shift() : true; - debug("** Starting a replica set with " + this.count + " nodes"); - - // Kill all existing mongod instances - exec(killall ? 'killall -9 mongod' : '', function(err, stdout, stderr) { - var n = 0; - var tagsIndex = 0; - - Step( - function startAllServers() { - var group = this.group(); - // Start primary instances - for(n = 0; n < (self.primaryCount + self.secondaryCount); n++) { - self.initNode(n, {tags:self.tags[tagsIndex] != null ? self.tags[tagsIndex++] : null}, group()); - } - - // Start passive instances - for(var i = 0; i < self.passiveCount; i++) { - self.initNode(n, {passive:true, priority:0, tags:self.tags[tagsIndex] != null ? self.tags[tagsIndex++] : null}, group()) - n = n + 1; - } - - // Start arbiter instances - for(var i = 0; i < self.arbiterCount; i++) { - self.initNode(n, {arbiterOnly:true, tags:self.tags[tagsIndex] != null ? self.tags[tagsIndex++] : null}, group()); - n = n + 1; - } - }, - - function finishUp(err, values) { - self.numberOfInitiateRetries = 0; - // Initiate - self.initiate(function(err, result) { - if(err != null) return callback(err, null); - self.ensureUpRetries = 0; - - // Ensure all the members are up - debug("** Ensuring members are up..."); - // Let's ensure everything is up - self.ensureUp(function(err, result) { - if(err != null) return callback(err, null); - // Return a correct result - callback(null, result); - }) - }); - } - ); - }) -} - -ReplicaSetManager.prototype.initiate = function(callback) { - var self = this; - var done = false; - // Get master connection - self.getConnection(function(err, connection) { - if(err != null) return callback(err, null); - // Set replica configuration - connection.admin().command({replSetInitiate:self.config}, function(err, result) { - // Close connection - connection.close(); - // If we have an error let's - if(err != null) { - // Retry a number of times - if(self.numberOfInitiateRetries < self.retries) { - setTimeout(function() { - self.numberOfInitiateRetries = self.numberOfInitiateRetries + 1; - self.initiate(callback); - }, 1000); - } - } else { - // Make sure we only do this once, even if some messages are late - if(!done) { - done = true; - self.numberOfInitiateRetries = 0; - callback(null, null); - } - } - }); - }); -} - -// Get absolute path -var getPath = function(self, name) { - return path.join(self.path, name); -} - -ReplicaSetManager.prototype.initNode = function(n, fields, callback) { - var self = this; - this.mongods[n] = this.mongods[n] == null ? {} : this.mongods[n]; - var port = this.startPort + n; - this.ports.push(port); - this.mongods[n]["ssl"] = this.ssl; - this.mongods[n]["host"] = this.host; - this.mongods[n]["port"] = port; - this.mongods[n]["db_path"] = getPath(this, "rs-" + port); - this.mongods[n]["log_path"] = getPath(this, "log-" + port); - this.up = false; - - // Set priority off server in config - var priority = typeof fields === 'object' ? fields.priority : null; - - // Add extra fields provided - for(var name in fields) { - this.mongods[n][name] = fields[name]; - } - - // Perform cleanup of directories - exec("rm -rf " + self.mongods[n]["db_path"], function(err, stdout, stderr) { - if(err != null) return callback(err, null); - - // Create directory - exec("mkdir -p " + self.mongods[n]["db_path"], function(err, stdout, stderr) { - if(err != null) return callback(err, null); - self.mongods[n]["start"] = self.startCmd(n); - - // console.log("----------------------------------------------------- node start command") - // console.log(self.mongods[n]["start"]) - - self.start(n, function() { - // Add instance to list of members - var member = {"_id": n, "host": self.host + ":" + self.mongods[n]["port"]}; - // Set it to arbiter if it's been passed - if(self.mongods[n]['arbiterOnly']) { - member['arbiterOnly'] = true; - } - // Set priority level if it's defined - if(priority != null) { - member['priority'] = priority; - } - - // Check if we have tags - if(self.mongods[n]['tags'] != null) { - member["tags"] = self.mongods[n]['tags']; - } - - // Push member to config - self.config["members"].push(member); - // Return - return callback(); - }); - }); - }); -} - -ReplicaSetManager.prototype.killAll = function(callback) { - exec('killall -9 mongod', function(err, stdout, stderr) { - return callback(); - }); -} - -ReplicaSetManager.prototype.kill = function(node, signal, options, callback) { - var self = this; - // Unpack callback and variables - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - signal = args.length ? args.shift() : 2; - options = args.length ? args.shift() : {}; - // kill node wait time - var killNodeWaitTime = options.killNodeWaitTime == null ? self.killNodeWaitTime : options.killNodeWaitTime; - - debug("** Killing node with pid " + this.mongods[node]["pid"] + " at port " + this.mongods[node]['port']); - var command = "kill -" + signal + " " + this.mongods[node]["pid"]; - // Kill process - exec(command, - function (error, stdout, stderr) { - debug('stdout: ' + stdout); - debug('stderr: ' + stderr); - if (error != null) { - debug('exec error: ' + error); - } - - self.mongods[node]["up"] = false; - // Wait for 5 seconds to give the server time to die a proper death - setTimeout(callback, killNodeWaitTime); - }); -} - -ReplicaSetManager.prototype.killPrimary = function(signal, options, callback) { - var self = this; - // Unpack callback and variables - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - signal = args.length ? args.shift() : 2; - options = args.length ? args.shift() : {}; - var done = false; - - this.getNodeWithState(1, function(err, node) { - if(!done) { - // Ensure no double callbacks due to later scheduled connections returning - done = true; - if(err != null) return callback(err, null); - - // Kill process and return node reference - self.kill(node, signal, options, function() { - // Wait for a while before passing back - callback(null, node); - }) - } - }); -} - -ReplicaSetManager.prototype.killSecondary = function(callback) { - var self = this; - var done = false; - - this.getNodeWithState(2, function(err, node) { - if(!done) { - // Ensure no double callbacks due to later scheduled connections returning - done = true; - if(err != null) return callback(err, null); - // Kill process and return node reference - self.kill(node, function() { - callback(null, node); - }) - } - }); -} - -ReplicaSetManager.prototype.stepDownPrimary = function(callback) { - var self = this; - // Get the primary node - this.getNodeWithState(1, function(err, primary) { - // Return error - if(err) return callback(err, null); - if(primary == null) return callback(new Error("No primary found"), null); - // Get the connection for the primary - self.getConnection(primary, function(err, connection) { - // Return any errors - if(err) return callback(err, null); - // Execute stepdown process - connection.admin().command({"replSetStepDown": 90}); - // Return the callback - return callback(null, connection); - }); - }); -} - -ReplicaSetManager.prototype.getNodeFromPort = function(port, callback) { - var self = this; - var nodes = Object.keys(this.mongods).filter(function(key, index, array) { - return self.mongods[key]["port"] == port; - }); - // Return first node - callback(null, nodes.length > 0 ? nodes.shift() : null); -} - -ReplicaSetManager.prototype.getNodeWithState = function(state, callback) { - var self = this; - self.ensureUpRetries = 0; - self.ensureUp(function(err, status) { - if(err != null) return callback(err, null); - - var node = status["members"].filter(function(element, index, array) { - return element["state"] == state; - }).shift(); - - if(node != null) { - var hostPort = node["name"].split(":"); - var port = hostPort[1] != null ? parseInt(hostPort[1]) : 27017; - var key = Object.keys(self.mongods).filter(function(element, index, array) { - return self.mongods[element]["port"] == port; - }).shift(); - return callback(null, key); - } else { - return callback(null, false); - } - }); -} - -ReplicaSetManager.prototype.ensureUp = function(callback) { - var self = this; - var numberOfInitiateRetries = this.retries; - var done = false; - - // Actual function doing testing - var ensureUpFunction = function() { - if(!done) { - if(!self.up) process.stdout.write("."); - // Attemp to retrieve a connection - self.getConnection(function(err, connection) { - // Adjust the number of retries - numberOfInitiateRetries = numberOfInitiateRetries - 1 - // If have no more retries stop - if(numberOfInitiateRetries == 0) { - // Set that we are done - done = true; - // perform callback - return callback(new Error("Servers did not come up again"), null); - } - - // We have a connection, execute command and update server object - if(err == null && connection != null) { - // Check repl set get status - connection.admin().command({"replSetGetStatus": 1}, function(err, object) { - // Close connection - if(connection != null) connection.close(); - // Get documents - var documents = object.documents; - // Get status object - var status = documents[0]; - - // If no members set - if(status["members"] == null || err != null) { - // if we have a connection force close it - if(connection != null) connection.close(); - // Ensure we perform enough retries - if(self.ensureUpRetries >= self.retries) { - // Set that we are done - done = true; - // Return error - return callback(new Error("Operation Failure"), null); - } else { - // Execute function again - setTimeout(ensureUpFunction, 1000); - } - } else { - // Establish all health member - var healthyMembers = status.members.filter(function(element) { - return element["health"] == 1 && [1, 2, 7].indexOf(element["state"]) != -1 - }); - - var stateCheck = status["members"].filter(function(element, indexOf, array) { - return element["state"] == 1; - }); - - if(healthyMembers.length == status.members.length && stateCheck.length > 0) { - // Set that we are done - done = true; - // if we have a connection force close it - if(connection != null) connection.close(); - // process.stdout.write("all members up! \n\n"); - if(!self.up) process.stdout.write("all members up!\n\n") - self.up = true; - return callback(null, status); - } else { - // if we have a connection force close it - if(connection != null) connection.close(); - // Ensure we perform enough retries - if(self.ensureUpRetries >= self.retries) { - // Set that we are done - done = true; - // Return error - return callback(new Error("Operation Failure"), null); - } else { - // Execute function again - setTimeout(ensureUpFunction, 1000); - } - } - } - }); - } else if(err != null && connection != null) { - if(connection != null) connection.close(); - } - }); - } - } - - // Execute the first function call - ensureUpFunction(); -} - -// Restart -ReplicaSetManager.prototype.restartKilledNodes = function(callback) { - var self = this; - - var nodes = Object.keys(self.mongods).filter(function(key) { - return self.mongods[key]["up"] == false; - }); - - var numberOfNodes = nodes.length; - if(numberOfNodes == 0) return self.ensureUp(callback); - - // Restart all the number of nodes - for(var i = 0; i < numberOfNodes; i++) { - // Start the process - self.start(nodes[i], function(err, result) { - // Adjust the number of nodes we are starting - numberOfNodes = numberOfNodes - 1; - - if(numberOfNodes === 0) { - self.ensureUp(callback); - } - }); - } -} - -ReplicaSetManager.prototype.getConnection = function(node, callback) { - var self = this; - // Function done - var done = false; - // Number of retries - var numberOfRetries = self.retries; - // Unpack callback and variables - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - node = args.length ? args.shift() : null; - - if(node == null) { - var keys = Object.keys(this.mongods); - for(var i = 0; i < keys.length; i++) { - var key = keys[i]; - // Locate first db that's runing and is not an arbiter - if(this.mongods[keys[i]]["arbiterOnly"] == null && this.mongods[key]["up"]) { - node = keys[i]; - break; - } - } - } - - // Get the node - if(self.mongods[node] != null) { - var intervalId = setInterval(function() { - var connection = new Db("replicaset_test", new Server(self.host, self.mongods[node]["port"], {ssl:self.ssl})); - connection.open(function(err, db) { - if(err == null && !done) { - // Set done - done = true; - // Clear interval - clearInterval(intervalId); - // Callback as done - return callback(null, connection); - } else { - // Close the connection - if(connection != null) connection.close(); - // Adjust the number of retries - numberOfRetries = numberOfRetries - 1; - // If we have no more retries fail - if(numberOfRetries == 0) { - // Set done - done = true; - // Clear interval - clearInterval(intervalId); - // Callback as done - return callback(new Error("Timed out connecting to primary"), null); - } - } - }); - }, 1000); - } else { - callback(new Error("no primary node found to do stepDownPrimary"), null); - } -} - -// Fire up the mongodb instance -var start = ReplicaSetManager.prototype.start = function(node, callback) { - var self = this; - - // Start up mongod process - var mongodb = exec(self.mongods[node]["start"], - function (error, stdout, stderr) { - debug('stdout: ' + stdout); - debug('stderr: ' + stderr); - if (error != null) { - debug('exec error: ' + error); - } - }); - - // Wait for a half a second then save the pids - setTimeout(function() { - // Mark server as running - self.mongods[node]["up"] = true; - self.mongods[node]["pid"]= fs.readFileSync(path.join(self.mongods[node]["db_path"], "mongod.lock"), 'ascii').trim(); - // Callback - callback(); - }, 5000); -} - -ReplicaSetManager.prototype.restart = start; - -ReplicaSetManager.prototype.startCmd = function(n) { - // Create boot command - this.mongods[n]["start"] = "mongod --rest --noprealloc --smallfiles --replSet " + this.name + " --logpath '" + this.mongods[n]['log_path'] + "' " + - " --dbpath " + this.mongods[n]['db_path'] + " --port " + this.mongods[n]['port'] + " --fork"; - this.mongods[n]["start"] = this.durable ? this.mongods[n]["start"] + " --dur" : this.mongods[n]["start"]; - - if(this.auth) { - this.mongods[n]["start"] = this.auth ? this.mongods[n]["start"] + " --keyFile " + this.keyPath : this.mongods[n]["start"]; - } - - // If we have ssl defined set up with test certificate - if(this.ssl) { - var path = getPath(this, '../test/certificates'); - this.mongods[n]["start"] = this.mongods[n]["start"] + " --sslOnNormalPorts --sslPEMKeyFile=" + path + "/mycert.pem --sslPEMKeyPassword=10gen"; - } - - return this.mongods[n]["start"]; -} - - - - - - - - - - - - - diff --git a/test/tools/server_manager.js b/test/tools/server_manager.js deleted file mode 100644 index 23c6a6103a8..00000000000 --- a/test/tools/server_manager.js +++ /dev/null @@ -1,142 +0,0 @@ -var debug = require('util').debug, - inspect = require('util').inspect, - path = require('path'), - fs = require('fs'), - exec = require('child_process').exec, - spawn = require('child_process').spawn, - Connection = require('../../lib/mongodb').Connection, - Db = require('../../lib/mongodb').Db, - Server = require('../../lib/mongodb').Server; - -var ServerManager = exports.ServerManager = function(options) { - options = options == null ? {} : options; - // Basic unpack values - this.path = path.resolve("data"); - this.port = options["start_port"] != null ? options["start_port"] : 27017; - this.db_path = getPath(this, "data-" + this.port); - this.log_path = getPath(this, "log-" + this.port); - this.journal = options["journal"] != null ? options["journal"] : false; - this.auth = options['auth'] != null ? options['auth'] : false; - this.ssl = options['ssl'] != null ? options['ssl'] : false; - this.purgedirectories = options['purgedirectories'] != null ? options['purgedirectories'] : true; - - // Server status values - this.up = false; - this.pid = null; -} - -// Start up the server instance -ServerManager.prototype.start = function(killall, callback) { - var self = this; - // Unpack callback and variables - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - killall = args.length ? args.shift() : true; - // Create start command - var startCmd = generateStartCmd(this, {log_path: self.log_path, - db_path: self.db_path, port: self.port, journal: self.journal, auth:self.auth, ssl:self.ssl}); - - // console.log("----------------------------------------------------------------------- start") - // console.log(startCmd) - - exec(killall ? 'killall mongod' : '', function(err, stdout, stderr) { - if(self.purgedirectories) { - // Remove directory - exec("rm -rf " + self.db_path, function(err, stdout, stderr) { - if(err != null) return callback(err, null); - // Create directory - exec("mkdir -p " + self.db_path, function(err, stdout, stderr) { - if(err != null) return callback(err, null); - // Start up mongod process - var mongodb = exec(startCmd, - function (error, stdout, stderr) { - // console.log('stdout: ' + stdout); - // console.log('stderr: ' + stderr); - if (error != null) { - console.log('exec error: ' + error); - } - }); - - // Wait for a half a second then save the pids - setTimeout(function() { - // Mark server as running - self.up = true; - self.pid = fs.readFileSync(path.join(self.db_path, "mongod.lock"), 'ascii').trim(); - // Callback - callback(); - }, 500); - }); - }); - } else { - // Ensure we remove the lock file as we are not purging the directory - fs.unlinkSync(path.join(self.db_path, "mongod.lock")); - - // Start up mongod process - var mongodb = exec(startCmd, - function (error, stdout, stderr) { - if (error != null) { - console.log('exec error: ' + error); - } - }); - - // Wait for a half a second then save the pids - setTimeout(function() { - // Mark server as running - self.up = true; - self.pid = fs.readFileSync(path.join(self.db_path, "mongod.lock"), 'ascii').trim(); - // Callback - callback(); - }, 5000); - } - }); -} - -ServerManager.prototype.stop = function(signal, callback) { - var self = this; - // Unpack callback and variables - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - signal = args.length ? args.shift() : 2; - // Stop the server - var command = "kill -" + signal + " " + self.pid; - // Kill process - exec(command, - function (error, stdout, stderr) { - // console.log('stdout: ' + stdout); - // console.log('stderr: ' + stderr); - if (error !== null) { - console.log('exec error: ' + error); - } - - self.up = false; - // Wait for a second - setTimeout(callback, 1000); - }); -} - -ServerManager.prototype.killAll = function(callback) { - exec('killall mongod', function(err, stdout, stderr) { - callback(null, null); - }); -} - -// Get absolute path -var getPath = function(self, name) { - return path.join(self.path, name); -} - -// Generate start command -var generateStartCmd = function(self, options) { - // Create boot command - var startCmd = "mongod --noprealloc --logpath '" + options['log_path'] + "' " + - " --dbpath " + options['db_path'] + " --port " + options['port'] + " --fork"; - startCmd = options['journal'] ? startCmd + " --journal" : startCmd; - startCmd = options['auth'] ? startCmd + " --auth" : startCmd; - // If we have ssl defined set up with test certificate - if(options['ssl']) { - var path = getPath(self, '../test/certificates'); - startCmd = startCmd + " --sslOnNormalPorts --sslPEMKeyFile=" + path + "/mycert.pem --sslPEMKeyPassword=10gen"; - } - // Return start command - return startCmd; -} diff --git a/test/tools/sharding_manager.js b/test/tools/sharding_manager.js deleted file mode 100644 index 9d58a7a2cab..00000000000 --- a/test/tools/sharding_manager.js +++ /dev/null @@ -1,155 +0,0 @@ -var debug = require('util').debug, - inspect = require('util').inspect, - path = require('path'), - fs = require('fs'), - exec = require('child_process').exec, - spawn = require('child_process').spawn, - Connection = require('../../lib/mongodb').Connection, - Db = require('../../lib/mongodb').Db, - Server = require('../../lib/mongodb').Server; - -var ShardingManager = exports.ShardingManager = function(options) { - options = options == null ? {} : options; - // Basic unpack values - this.path = path.resolve("data"); - this.port = options["start_port"] != null ? options["start_port"] : 27017; - this.number_of_sharding_servers = options["number_of_sharding_servers"] != null ? options["number_of_sharding_servers"] : 2; - this.number_of_config_servers = options["number_of_config_servers"] != null ? options["number_of_config_servers"] : 1; - this.db_path = getPath(this, "data-" + this.port); - this.log_path = getPath(this, "log-" + this.port); - this.journal = options["journal"] != null ? options["journal"] : false; - this.auth = options['auth'] != null ? options['auth'] : false; - this.ssl = options['ssl'] != null ? options['ssl'] : false; - this.purgedirectories = options['purgedirectories'] != null ? options['purgedirectories'] : true; - - // Server status values - this.up = false; - this.pid = null; -} - -// Start up the server instance -ShardingManager.prototype.start = function(killall, callback) { - var self = this; - // Unpack callback and variables - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - killall = args.length ? args.shift() : true; - // Create start command - var startCmd = generateStartCmd(this, {log_path: self.log_path, - db_path: self.db_path, port: self.port, journal: self.journal, auth:self.auth, ssl:self.ssl}); - - // Purge function for the data directory - var purgeFunction = function() { - if(self.purgedirectories) { - // Remove directory - exec("rm -rf " + self.db_path, function(err, stdout, stderr) { - if(err != null) return callback(err, null); - // Create directory - exec("mkdir -p " + self.db_path, function(err, stdout, stderr) { - if(err != null) return callback(err, null); - // Start up mongod process - var mongodb = exec(startCmd, - function (error, stdout, stderr) { - // console.log('stdout: ' + stdout); - // console.log('stderr: ' + stderr); - if (error != null) { - console.log('exec error: ' + error); - } - }); - - // Wait for a half a second then save the pids - setTimeout(function() { - // Mark server as running - self.up = true; - self.pid = fs.readFileSync(path.join(self.db_path, "mongod.lock"), 'ascii').trim(); - // Callback - callback(); - }, 500); - }); - }); - } else { - // Ensure we remove the lock file as we are not purging the directory - fs.unlinkSync(path.join(self.db_path, "mongod.lock")); - - // Start up mongod process - var mongodb = exec(startCmd, - function (error, stdout, stderr) { - if (error != null) { - console.log('exec error: ' + error); - } - }); - - // Wait for a half a second then save the pids - setTimeout(function() { - // Mark server as running - self.up = true; - self.pid = fs.readFileSync(path.join(self.db_path, "mongod.lock"), 'ascii').trim(); - // Callback - callback(); - }, 5000); - } - } - - // If we specified kill all the instances do that then purge the directories - if(killall) { - this.killAll(function() { - purgeFunction(); - }); - } else { - purgeFunction(); - } -} - -ShardingManager.prototype.stop = function(signal, callback) { - var self = this; - // Unpack callback and variables - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - signal = args.length ? args.shift() : 2; - // Stop the server - var command = "kill -" + signal + " " + self.pid; - // Kill process - exec(command, - function (error, stdout, stderr) { - // console.log('stdout: ' + stdout); - // console.log('stderr: ' + stderr); - if (error != null) { - console.log('exec error: ' + error); - } - - self.up = false; - // Wait for a second - setTimeout(callback, 1000); - }); -} - -ShardingManager.prototype.killAll = function(callback) { - // Kill all mongos instances - exec('killall mongos', function(err, stdout, stderr) { - // Kill all mongod instances - exec('killall mongod', function(err, stdout, stderr) { - callback(null, null); - }); - }); -} - -// Get absolute path -var getPath = function(self, name) { - return path.join(self.path, name); -} - -// Generate start command -var generateStartCmd = function(self, options) { - // Create boot command - var startCmd = "mongod --noprealloc --logpath '" + options['log_path'] + "' " + - " --dbpath " + options['db_path'] + " --port " + options['port'] + " --fork"; - startCmd = options['journal'] ? startCmd + " --journal" : startCmd; - startCmd = options['auth'] ? startCmd + " --auth" : startCmd; - // If we have ssl defined set up with test certificate - if(options['ssl']) { - var path = getPath(self, '../test/certificates'); - startCmd = startCmd + " --sslOnNormalPorts --sslPEMKeyFile=" + path + "/mycert.pem --sslPEMKeyPassword=10gen"; - } - // Return start command - return startCmd; -} diff --git a/test/unicode_test.js b/test/unicode_test.js deleted file mode 100644 index 903a5941a4b..00000000000 --- a/test/unicode_test.js +++ /dev/null @@ -1,185 +0,0 @@ -var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure(); -var useSSL = process.env['USE_SSL'] != null ? true : false; - -var testCase = require('nodeunit').testCase, - debug = require('util').debug, - inspect = require('util').inspect, - nodeunit = require('nodeunit'), - gleak = require('../dev/tools/gleak'), - Db = mongodb.Db, - Cursor = mongodb.Cursor, - Collection = mongodb.Collection, - Server = mongodb.Server; - -var MONGODB = 'integration_tests'; -var client = null; - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.setUp = function(callback) { - var self = exports; - client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)}); - client.open(function(err, db_p) { - if(numberOfTestsRun == (Object.keys(self).length)) { - // If first test drop the db - client.dropDatabase(function(err, done) { - callback(); - }); - } else { - return callback(); - } - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.tearDown = function(callback) { - var self = this; - numberOfTestsRun = numberOfTestsRun - 1; - // Close connection - client.close(); - callback(); -} - -exports.shouldCorrectlySaveUnicodeContainingDocument = function(test) { - var doc = {statuses_count: 1687 - , created_at: 'Mon Oct 22 14:55:08 +0000 2007' - , description: 'NodeJS hacker, Cofounder of Debuggable, CakePHP core alumnus' - , favourites_count: 6 - , profile_sidebar_fill_color: 'EADEAA' - , screen_name: 'felixge' - , status: - { created_at: 'Fri Mar 12 08:59:44 +0000 2010' - , in_reply_to_screen_name: null - , truncated: false - , in_reply_to_user_id: null - , source: 'Tweetie' - , favorited: false - , in_reply_to_status_id: null - , id: 10364119169 - , text: '#berlin #snow = #fail : (' - } - , contributors_enabled: false - , following: null - , geo_enabled: false - , time_zone: 'Eastern Time (US & Canada)' - , profile_sidebar_border_color: 'D9B17E' - , url: 'http://debuggable.com' - , verified: false - , location: 'Berlin' - , profile_text_color: '333333' - , notifications: null - , profile_background_image_url: 'http://s.twimg.com/a/1268354287/images/themes/theme8/bg.gif' - , protected: false - , profile_link_color: '9D582E' - , followers_count: 840 - , name: 'Felix Geisend\u00f6rfer' - , profile_background_tile: false - , id: 9599342 - , lang: 'en' - , utc_offset: -18000 - , friends_count: 450 - , profile_background_color: '8B542B' - , profile_image_url: 'http://a3.twimg.com/profile_images/107142257/passbild-square_normal.jpg' - }; - - client.createCollection('test_should_correctly_save_unicode_containing_document', function(err, collection) { - doc['_id'] = 'felixge'; - - collection.save(doc, {safe:true}, function(err, doc) { - collection.findOne(function(err, doc) { - test.equal('felixge', doc._id); - test.done(); - }); - }); - }); -} - -// Test unicode characters -exports.shouldCorrectlyInsertUnicodeCharacters = function(test) { - client.createCollection('unicode_test_collection', function(err, collection) { - var test_strings = ["ouooueauiOUOOUEAUI", "öüóőúéáűíÖÜÓŐÚÉÁŰÍ", "本荘由利地域に洪水警報"]; - collection.insert({id: 0, text: test_strings[0]}, {safe:true}, function(err, ids) { - collection.insert({id: 1, text: test_strings[1]}, {safe:true}, function(err, ids) { - collection.insert({id: 2, text: test_strings[2]}, {safe:true}, function(err, ids) { - collection.find(function(err, cursor) { - cursor.each(function(err, item) { - if(item != null) { - test.equal(test_strings[item.id], item.text); - } else { - test.done(); - } - }); - }); - }); - }); - }); - }); -} - -exports.shouldCreateObjectWithChineseObjectName = function(test) { - var object = {'客家话' : 'Hello'}; - - client.createCollection('create_object_with_chinese_object_name', function(err, r) { - client.collection('create_object_with_chinese_object_name', function(err, collection) { - - collection.insert(object, {safe:true}, function(err, result) { - collection.findOne(function(err, item) { - test.equal(object['客家话'], item['客家话']) - - collection.find().toArray(function(err, items) { - test.equal(object['客家话'], items[0]['客家话']) - test.done(); - }) - }) - }); - }) - }) -} - -exports.shouldCorrectlyHandleUT8KeyNames = function(test) { - client.createCollection('test_utf8_key_name', function(err, collection) { - collection.insert({'šđžčćŠĐŽČĆ':1}, {safe:true}, function(err, ids) { - // finished_test({test_utf8_key_name:'ok'}); - collection.find({}, {'fields': ['šđžčćŠĐŽČĆ']}, function(err, cursor) { - cursor.toArray(function(err, items) { - // console.log("---------------------------------------------------------------") - // console.dir(err) - // console.dir(items) - // - test.equal(1, items[0]['šđžčćŠĐŽČĆ']); - // Let's close the db - test.done(); - }); - }); - }); - }); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -exports.noGlobalsLeaked = function(test) { - var leaks = gleak.detectNew(); - test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', ')); - test.done(); -} - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @ignore - */ -var numberOfTestsRun = Object.keys(this).length - 2; \ No newline at end of file diff --git a/video.html b/video.html deleted file mode 100644 index 409e25055c0..00000000000 --- a/video.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - Presentations — MongoDB Node.JS Driver 0.9.9.1 documentation - - - - - - - - - - -
        -
        -
        -
        - -
        -

        Presentations

        -
        -

        NYC MongoDB User Group - Schemas for Real Time Analytics with Node.js

        -

        Schemas for Real Time Analytics with Node.js - Eric Lubow and Russell Bradberry, SimpleReach

        -

        SimpleReach powers the Slide, a recommendation powered content discovery technology for websites. Eric Lublow will discuss how SimpleReach builds schemas in MongoDB and Node.js for powerful, real-time data delivery. Topics will include:

        -
          -
        • Dynamic collection creation
        • -
        • Updating (Increments over sets)
        • -
        • Schema
        • -
        • Next gen schemas for dynamic filters
        • -
        -
        -
        - - -
        -
        -
        -
        -
        - -

        Page Contents

        - - - -

        Core Documentation

        - - - - -

        This Page

        - -
        -
        -
        -
        - - - - - - - \ No newline at end of file From e2128d458a16349066d389f3c14af89008050796 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Fri, 17 Feb 2012 09:57:55 +0100 Subject: [PATCH 13/56] updated docs --- api-articles/index.html | 30 +++++++++++++------ api-articles/nodekoarticle1.html | 30 +++++++++++++------ api-articles/nodekoarticle2.html | 30 +++++++++++++------ api-bson-generated/binary.html | 30 +++++++++++++------ api-bson-generated/bson.html | 30 +++++++++++++------ api-bson-generated/code.html | 30 +++++++++++++------ api-bson-generated/double.html | 30 +++++++++++++------ api-bson-generated/index.html | 30 +++++++++++++------ api-bson-generated/long.html | 30 +++++++++++++------ api-bson-generated/maxkey.html | 30 +++++++++++++------ api-bson-generated/minkey.html | 30 +++++++++++++------ api-bson-generated/objectid.html | 30 +++++++++++++------ api-bson-generated/symbol.html | 30 +++++++++++++------ api-bson-generated/timestamp.html | 30 +++++++++++++------ api-generated/admin.html | 30 +++++++++++++------ api-generated/collection.html | 30 +++++++++++++------ api-generated/cursor.html | 30 +++++++++++++------ api-generated/cursorstream.html | 30 +++++++++++++------ api-generated/db.html | 30 +++++++++++++------ api-generated/grid.html | 30 +++++++++++++------ api-generated/gridstore.html | 30 +++++++++++++------ api-generated/index.html | 30 +++++++++++++------ api-generated/readstream.html | 30 +++++++++++++------ changelog/changelog.html | 30 +++++++++++++------ content/awesomeappsvideo.html | 30 +++++++++++++------ content/nodejsvideo.html | 30 +++++++++++++------ content/tutorials.html | 30 +++++++++++++------ contents.html | 30 +++++++++++++------ genindex.html | 46 +++++++++++++++++++----------- github/github.html | 30 +++++++++++++------ index.html | 30 +++++++++++++------ markdown-docs/collections.html | 30 +++++++++++++------ markdown-docs/database.html | 30 +++++++++++++------ markdown-docs/gridfs.html | 30 +++++++++++++------ markdown-docs/index.html | 30 +++++++++++++------ markdown-docs/indexes.html | 30 +++++++++++++------ markdown-docs/insert.html | 30 +++++++++++++------ markdown-docs/queries.html | 30 +++++++++++++------ markdown-docs/replicaset.html | 30 +++++++++++++------ objects.inv | Bin 1217 -> 1218 bytes search.html | 31 ++++++++++++++------ searchindex.js | 2 +- 42 files changed, 850 insertions(+), 369 deletions(-) diff --git a/api-articles/index.html b/api-articles/index.html index de560a31c91..95cc4c49e19 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -13,16 +13,17 @@ + + + @@ -143,5 +144,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-articles/nodekoarticle1.html b/api-articles/nodekoarticle1.html index b4b948e473f..eebe6764451 100644 --- a/api-articles/nodekoarticle1.html +++ b/api-articles/nodekoarticle1.html @@ -13,16 +13,17 @@ + + + @@ -434,5 +435,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-articles/nodekoarticle2.html b/api-articles/nodekoarticle2.html index 9449ba43c20..b4c2bbfbdf0 100644 --- a/api-articles/nodekoarticle2.html +++ b/api-articles/nodekoarticle2.html @@ -13,16 +13,17 @@ + + + @@ -362,5 +363,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/binary.html b/api-bson-generated/binary.html index 543314cdecc..eb198058077 100644 --- a/api-bson-generated/binary.html +++ b/api-bson-generated/binary.html @@ -13,16 +13,17 @@ + + + @@ -454,5 +455,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/bson.html b/api-bson-generated/bson.html index 1fece4ca5b0..3182f7f395b 100644 --- a/api-bson-generated/bson.html +++ b/api-bson-generated/bson.html @@ -13,16 +13,17 @@ + + + @@ -942,5 +943,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/code.html b/api-bson-generated/code.html index de920e71524..ed8eb852f14 100644 --- a/api-bson-generated/code.html +++ b/api-bson-generated/code.html @@ -13,16 +13,17 @@ + + + @@ -174,5 +175,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/double.html b/api-bson-generated/double.html index 29228650ce1..2f48d0a359f 100644 --- a/api-bson-generated/double.html +++ b/api-bson-generated/double.html @@ -13,16 +13,17 @@ + + + @@ -191,5 +192,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/index.html b/api-bson-generated/index.html index be4c194bc26..fc2e6ac1fac 100644 --- a/api-bson-generated/index.html +++ b/api-bson-generated/index.html @@ -13,16 +13,17 @@ + + + @@ -262,5 +263,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/long.html b/api-bson-generated/long.html index 2dec16bbce0..a8edd9973cd 100644 --- a/api-bson-generated/long.html +++ b/api-bson-generated/long.html @@ -13,16 +13,17 @@ + + + @@ -992,5 +993,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/maxkey.html b/api-bson-generated/maxkey.html index d72d1b68ae0..ceb12e9510f 100644 --- a/api-bson-generated/maxkey.html +++ b/api-bson-generated/maxkey.html @@ -13,16 +13,17 @@ + + + @@ -166,5 +167,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/minkey.html b/api-bson-generated/minkey.html index ee03ae8a90c..86a7f7ad456 100644 --- a/api-bson-generated/minkey.html +++ b/api-bson-generated/minkey.html @@ -13,16 +13,17 @@ + + + @@ -143,5 +144,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/objectid.html b/api-bson-generated/objectid.html index 8c9949b4d8e..a2a1afaaecc 100644 --- a/api-bson-generated/objectid.html +++ b/api-bson-generated/objectid.html @@ -13,16 +13,17 @@ + + + @@ -442,5 +443,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/symbol.html b/api-bson-generated/symbol.html index f6db6547c92..27b07374ca6 100644 --- a/api-bson-generated/symbol.html +++ b/api-bson-generated/symbol.html @@ -13,16 +13,17 @@ + + + @@ -181,5 +182,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-bson-generated/timestamp.html b/api-bson-generated/timestamp.html index b2d6317360f..962f0fa8536 100644 --- a/api-bson-generated/timestamp.html +++ b/api-bson-generated/timestamp.html @@ -13,16 +13,17 @@ + + + @@ -992,5 +993,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/admin.html b/api-generated/admin.html index 4a87fe61be3..e45fadd39fe 100644 --- a/api-generated/admin.html +++ b/api-generated/admin.html @@ -13,16 +13,17 @@ + + + @@ -1133,5 +1134,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/collection.html b/api-generated/collection.html index 66551f7d202..2d5d60d05dc 100644 --- a/api-generated/collection.html +++ b/api-generated/collection.html @@ -13,16 +13,17 @@ + + + @@ -2971,5 +2972,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/cursor.html b/api-generated/cursor.html index 824f7394a4a..0fbc3aafb8f 100644 --- a/api-generated/cursor.html +++ b/api-generated/cursor.html @@ -13,16 +13,17 @@ + + + @@ -1212,5 +1213,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/cursorstream.html b/api-generated/cursorstream.html index 5e8f3a57572..5cac54b96b9 100644 --- a/api-generated/cursorstream.html +++ b/api-generated/cursorstream.html @@ -13,16 +13,17 @@ + + + @@ -391,5 +392,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/db.html b/api-generated/db.html index b88c1beb201..e26eff0e665 100644 --- a/api-generated/db.html +++ b/api-generated/db.html @@ -13,16 +13,17 @@ + + + @@ -2447,5 +2448,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/grid.html b/api-generated/grid.html index 652da2ed35a..7cb14dd5438 100644 --- a/api-generated/grid.html +++ b/api-generated/grid.html @@ -13,16 +13,17 @@ + + + @@ -367,5 +368,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/gridstore.html b/api-generated/gridstore.html index 303106d756f..099cacec6f2 100644 --- a/api-generated/gridstore.html +++ b/api-generated/gridstore.html @@ -13,16 +13,17 @@ + + + @@ -2091,5 +2092,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/index.html b/api-generated/index.html index 692a53881b7..47df3581e8a 100644 --- a/api-generated/index.html +++ b/api-generated/index.html @@ -13,16 +13,17 @@ + + + @@ -275,5 +276,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/api-generated/readstream.html b/api-generated/readstream.html index 0baf4b7ca20..f6a292b9382 100644 --- a/api-generated/readstream.html +++ b/api-generated/readstream.html @@ -13,16 +13,17 @@ + + + @@ -399,5 +400,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/changelog/changelog.html b/changelog/changelog.html index f9c0498e10f..c4184aaa10f 100644 --- a/changelog/changelog.html +++ b/changelog/changelog.html @@ -13,16 +13,17 @@ + + + @@ -809,5 +810,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/content/awesomeappsvideo.html b/content/awesomeappsvideo.html index b6c0b698729..f8995d829e6 100644 --- a/content/awesomeappsvideo.html +++ b/content/awesomeappsvideo.html @@ -13,16 +13,17 @@ + + + @@ -131,5 +132,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/content/nodejsvideo.html b/content/nodejsvideo.html index 1a29d9e3e4e..da6de587811 100644 --- a/content/nodejsvideo.html +++ b/content/nodejsvideo.html @@ -13,16 +13,17 @@ + + + @@ -251,5 +252,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/content/tutorials.html b/content/tutorials.html index 143e55afce2..49ae9ca7382 100644 --- a/content/tutorials.html +++ b/content/tutorials.html @@ -13,16 +13,17 @@ + + + @@ -150,5 +151,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/contents.html b/contents.html index ec24013e7db..de035bbd0b5 100644 --- a/contents.html +++ b/contents.html @@ -13,16 +13,17 @@ + + + @@ -419,5 +420,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/genindex.html b/genindex.html index 287fae5caf3..9c841c5dd8f 100644 --- a/genindex.html +++ b/genindex.html @@ -15,16 +15,17 @@ + + + @@ -161,7 +162,7 @@

        C

        -
        close() (built-in function), [1], [2] +
        close() (built-in function), [1], [2]
        @@ -203,7 +204,7 @@

        C

        -
        createIndex() (built-in function), [1] +
        createIndex() (built-in function), [1]
        @@ -291,7 +292,7 @@

        D

        -
        dropIndex() (built-in function), [1] +
        dropIndex() (built-in function), [1]
        @@ -305,7 +306,7 @@

        E

        -
        ensureIndex() (built-in function), [1] +
        ensureIndex() (built-in function), [1]
        @@ -315,7 +316,7 @@

        E

        -
        equals() (built-in function), [1], [2] +
        equals() (built-in function), [1], [2]
        @@ -453,7 +454,7 @@

        I

        -
        indexInformation() (built-in function), [1] +
        indexInformation() (built-in function), [1]
        @@ -681,7 +682,7 @@

        R

        -
        reIndex() (built-in function), [1] +
        reIndex() (built-in function), [1]
        @@ -871,7 +872,7 @@

        V

        -
        valueOf() (built-in function), [1] +
        valueOf() (built-in function), [1]
        @@ -975,5 +976,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/github/github.html b/github/github.html index 090d620ec43..6eb6171b35d 100644 --- a/github/github.html +++ b/github/github.html @@ -13,16 +13,17 @@ + + + @@ -1775,5 +1776,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/index.html b/index.html index 8ae702a6cad..799569548b0 100644 --- a/index.html +++ b/index.html @@ -13,16 +13,17 @@ + + + @@ -300,5 +301,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/markdown-docs/collections.html b/markdown-docs/collections.html index f329d8418a4..4160407aad6 100644 --- a/markdown-docs/collections.html +++ b/markdown-docs/collections.html @@ -13,16 +13,17 @@ + + + @@ -299,5 +300,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/markdown-docs/database.html b/markdown-docs/database.html index ef89c4e8b66..3d628beed5a 100644 --- a/markdown-docs/database.html +++ b/markdown-docs/database.html @@ -13,16 +13,17 @@ + + + @@ -289,5 +290,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/markdown-docs/gridfs.html b/markdown-docs/gridfs.html index 9986b2b7aec..c52aead57db 100644 --- a/markdown-docs/gridfs.html +++ b/markdown-docs/gridfs.html @@ -13,16 +13,17 @@ + + + @@ -321,5 +322,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/markdown-docs/index.html b/markdown-docs/index.html index eddfec7e175..9548075411e 100644 --- a/markdown-docs/index.html +++ b/markdown-docs/index.html @@ -13,16 +13,17 @@ + + + @@ -128,5 +129,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/markdown-docs/indexes.html b/markdown-docs/indexes.html index 8ab967207fa..63624b64c94 100644 --- a/markdown-docs/indexes.html +++ b/markdown-docs/indexes.html @@ -13,16 +13,17 @@ + + + @@ -231,5 +232,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/markdown-docs/insert.html b/markdown-docs/insert.html index 8875adbaa5f..a31ed05882c 100644 --- a/markdown-docs/insert.html +++ b/markdown-docs/insert.html @@ -13,16 +13,17 @@ + + + @@ -280,5 +281,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/markdown-docs/queries.html b/markdown-docs/queries.html index 85af05f90f3..a68b4414685 100644 --- a/markdown-docs/queries.html +++ b/markdown-docs/queries.html @@ -13,16 +13,17 @@ + + + @@ -448,5 +449,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/markdown-docs/replicaset.html b/markdown-docs/replicaset.html index 5cccf1bb92e..1e141798fd3 100644 --- a/markdown-docs/replicaset.html +++ b/markdown-docs/replicaset.html @@ -13,16 +13,17 @@ + + + @@ -203,5 +204,16 @@

        Navigation

        document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); + \ No newline at end of file diff --git a/objects.inv b/objects.inv index 618933a6002042927c36283f17f3d49109316ba1..95313f0aa5ffb6bb3a4ad1703340a80ef4e77503 100644 GIT binary patch delta 1095 zcmV-N1i1Ub3Bn1GihqvVHW0n=z$VPGP4w^l9Xc? z{rC3??_Ct4?O6H>8Bs->9V z+MtL5`fDaBG^THo$=$OQ#WYv4oHL`XWnPQSFe!$Oxt)G8R#3_veAS=^EL$U*wkDO5 zIpa(ePa>CBtq3idXblT6%i4K4OFbMltORXHS+y&q#AMqI`xmZmo7GB7)mmlSTD&+b zQI{#6^sf(K41cKqHtx^gb}?d%VrgyQht&$js5VlaMf?*Jzr$f9NqF=ZIJ8E3%W|`3 z#nwa}{kviY-ZOsv=mXAT)W5tgH@>q>zX1-@*51eshDH=oUN6#VCWXKyz2S9o)?s?t zWGrTHSBMs)swB=Z&Vwfrm#|8~j>%d-C?%El-u&Ky7k@(zr0gTC4{_~gwYE7Pc_t|G z6w43SOGI)GZs?o}1S#SEG~(^@2L#>5fsQk6Lh)(jBkX-4_9Hx9mLK-Gu?{{lmd3OE z?nj#g8E(SAhD<7|gBWS$j`6e@p^$;o>LnD2<{dN#B#I0va4~3GSF>?X)KJ>Bp*RG)l2f0D$Xh%Qa zumHJ4;S#)+rHjkVW^-_sd#vjPF(f5=1UWse!SssKs8nTyXEn#srbsWSjov!;XE%AT zUVDeL)dydNW`%$__nZDP);Z3!4B2~V8M5zanSYby^li^waG%V*dTU>>YG~--k=a^3 zM6{_|pnQD^Z&Wj-$RUX6=bP1X`V$b<){zdX(Jp=6AmmOd^IfBxwE{aO@~`bZEA{YC zO?Z?SE}Rq*pcvs8##SbU1ar;=QDcx#-J~J(z&=9dymtI)<|6SPBYBhT*%4mDDjzr1 zhkr7aykp2Hj(F<49<81t{|7VMd7bB=u;*NAR9Camxs+TQ*4-y zw}_h>cc0rr>j~x9BRSxr*~{@gDOhM9Z+{23Fmy|k7*&dGc0{%fP^FN@?XPch;JU=@ z?PiobsX$}S@U?V`iMu2 ze5|^RnZXCpXV?J`X`d~GmZSv#N1-*=(%6%bt+)Pz5K86G(az57&&&JuW-nx&azGgA z$<$3cyQq_D4Yba}3y_M(Sgdb8uCNjJ3%yG4O6_CSdvnGHp1Ny@bs z`|%x7ie;&?MbbG17C9tm=FOW&CYO{63j0VK`ks>*crBrQ2a zkJYD}48(xZ%h$%Do~nVUWZRuse`}^~>It7o1~-fO8q(;8et(~EqIL8(A_beoT8as- z4T>0`eu93Z09cGX(ENd6`av@Je!5^ zvQAJ)fNb4WkW@LbhG8do6k+)(6zrHR^_@~uY3I#vEq_)wMghssN4Z9{wzFE>6kVPP zinPSi!{v&QoP!-Yt$aapxIK!ZG7QqoTmt11t+*7==PCPC~_+r3Uy@U+0yn~?ga?twAmWZ%w(zm22fO-d+Dp|}p zx1A6CbAN>KF}8%9!<*B0uf^+KCI|*f)sRP$-EG2E%xu7%oo-5hZM(O3kZU>_ZQrLG zW+0cSQoOe^(zVuy5R7HMAcn+5k3gxXG?-pd8dl_lCnd+xx@ym8jov!d&u%tfPVJ6j zQmlcNiGMQd4l>p|PQ(k@JBSyu?}(S9#&m7aU4MWd&7HbyU!iKKDdB-t^?C?sRHZ<@ z`t0ATW=fHRm)2C^SIBKfwO2iMsp^UvJEq2Ujc#@_lqATtRi9a@yMIf)X znO2N&thrVY`BdJV38KcJ9otDmD1m)|o_Xo+)5J#N9wT{`z}XRA!YUm%)rUNmykp2H zj(<2Rx*lU5Bma$=?YvA=P}pD2VfkVfI=77ri5P&v#`-j3*LQp%1Jw~if?rX0fFkai zoT1^t=6KD0M}G$;gG^BfKj1|)Sm4-deT7bGuf$J~hTXX8bO)sCgtJ1!*W4q%3e7SB z^i?>|H+m?^9>@U~O`e+vByX|Z+z_r|?thj(F{%{X?1)kupim)=-CtjKfXj~*y*(=d zy%PRv3xqCxd%R6_aGLGwl_Sar9PMs?J-Z9oo4Vq?bWt;cQ!O{UU)V-D+sKdTVi0r| z@p;S)zIZ;t4!BoawK`@EiBwd31#FGgH1;f1Rb2m32*vW};N#A!pXc}M&0fed=07mf zt*Mh&~kWa#tZ)!Mhq!@ew0_fkJvi%Z6- M@BaXP0iWCeq$pV->i_@% diff --git a/search.html b/search.html index 15f1c7710cf..a7f4686de59 100644 --- a/search.html +++ b/search.html @@ -13,16 +13,18 @@ + + + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js index 76be5853a60..9cb6b62d3e1 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{notEquals:[32,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[32,1,1,""],DBRef:[3,0,1,""],ensureIndex:[10,1,1,""],Binary:[29,0,1,""],streamRecords:[20,1,1,""],deserializeStream:[1,1,1,""],findOne:[21,1,1,""],valueOf:[16,1,1,""],chunkCollection:[4,1,1,""],Long:[15,0,1,""],nextObject:[20,1,1,""],validateCollection:[23,1,1,""],removeUser:[10,1,1,""],profilingInfo:[23,1,1,""],dropIndex:[10,1,1,""],findAndRemove:[21,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[32,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[23,1,1,""],getNumBitsAbs:[32,1,1,""],cursorInfo:[10,1,1,""],"generationTime number [Getter|Setter]":[8,2,1,""],Timestamp:[32,0,1,""],batchSize:[20,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[10,0,1,""],dropCollection:[10,1,1,""],Collection:[21,0,1,""],MinKey:[5,0,1,""],shiftRight:[32,1,1,""],writeFile:[4,1,1,""],Grid:[30,0,1,""],Double:[17,0,1,""],getTimestamp:[8,1,1,""],toString:[32,1,1,""],profilingLevel:[23,1,1,""],collectionNames:[10,1,1,""],toNumber:[32,1,1,""],indexInformation:[10,1,1,""],isOdd:[32,1,1,""],getHighBits:[32,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[23,0,1,""],dropDatabase:[10,1,1,""],Symbol:[16,0,1,""],previousErrors:[10,1,1,""],mapReduce:[21,1,1,""],shiftLeft:[32,1,1,""],shiftRightUnsigned:[32,1,1,""],Cursor:[20,0,1,""],MaxKey:[11,0,1,""],CursorStream:[34,0,1,""],findAndModify:[21,1,1,""],greaterThan:[32,1,1,""],renameCollection:[10,1,1,""],buildInfo:[23,1,1,""],resetErrorHistory:[10,1,1,""],isClosed:[20,1,1,""],getLowBitsUnsigned:[32,1,1,""],toHexString:[8,1,1,""],indexExists:[21,1,1,""],getLowBits:[32,1,1,""],toArray:[20,1,1,""],reIndex:[10,1,1,""],listDatabases:[23,1,1,""],ObjectID:[8,0,1,""],isNegative:[32,1,1,""],geoHaystackSearch:[21,1,1,""],addUser:[10,1,1,""],lessThanOrEqual:[32,1,1,""],isZero:[32,1,1,""],collectionsInfo:[10,1,1,""],lessThan:[32,1,1,""],isCapped:[21,1,1,""],ReadStream:[7,0,1,""],createCollection:[10,1,1,""],createIndex:[10,1,1,""],dropAllIndexes:[21,1,1,""],lastError:[10,1,1,""],geoNear:[21,1,1,""],greaterThanOrEqual:[32,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[8,1,1,""],createFromHexString:[8,1,1,""]},Timestamp:{fromBits:[32,1,1,""],fromNumber:[32,1,1,""],fromInt:[32,1,1,""],fromString:[32,1,1,""]},Db:{connect:[10,1,1,""]},Long:{fromBits:[15,1,1,""],fromNumber:[15,1,1,""],fromInt:[15,1,1,""],fromString:[15,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:14,returnkei:[19,20,21],maxscan:[19,20,21],readfilesync:4,prefix:[19,35],crete:21,createindex:[10,21,19,6,25,9],world_safe2:21,world_safe1:21,pedro:12,test_map_reduce_functions_inlin:21,deviat:19,under:19,everi:[0,20,28,22],test_gs_seek_with_buff:4,simple_next_object_collect:20,upload:22,correct:[1,10,8,19,4,36],gotik:18,"10k":19,erhangundogan:14,seper:4,direct:[6,20,36],second:[20,13,2,19,21,4,37,35,8,28,10],street:14,aggreg:21,even:[0,33,21],attemp:[10,21],neg:[32,15],"256k":37,"new":[0,1,2,19,4,6,7,8,10,13,15,23,35,20,21,22,28,29,30,32,34,36,37],net:14,metadata:[22,37,4],"_event":19,rootcollect:4,never:[19,10],here:[36,37,4],epce4qkoh5:33,io_seek_set:4,integration_tests_to_drop:10,anymor:19,robin:36,getlowbit:[24,15,32,9],findandmodifi:[19,21,25,9,13],vincentcr:19,pvorb:14,schemaless:36,sessionstorag:14,middlewar:[14,33],sarah:21,describ:33,would:[0,10,21,19,15,6,37,32],init:20,concret:14,overhead:36,recommend:[36,33,21],type:[11,12,1,21,22,3,33,4,5,31,17,37,36,29,16,19,23],tell:[10,21,4,25,36,37,9],relat:6,notic:[36,37],warn:[21,10,13],exce:4,hold:[36,1,4,20],must:[0,32,15,21],join:33,err:[0,23,7,20,13,2,22,19,21,4,34,35,30,36,37,28,10],aheckmann:19,setup:[2,37,10],work:[0,10,19,33,4,36,26,37,20],test_gs_tel:4,rework:19,root:[37,4,30],overrid:[10,19,20,21],give:33,simple_geo_haystack_command:21,indic:[0,13,12,35,6,22,36,28],want:[0,10,21,35,4,6,17,36,37,28],keep:[22,19,10,36,21],unsign:[32,15],end:[7,20,21,22,35,33,4,34,36,37],replicaset:[12,10,2,19,36,27],quot:20,playerid:33,how:[12,23,10,21,33,4,31,36,26,37,20],"_id_":[10,21],recoveri:2,rewind:[0,20,19,4,25,9],milisecond:[19,10,8],config:[2,19,10],updat:[29,12,23,10,21,13,19,33,25,36,37,27,9],maxdist:21,recogn:4,after:[7,20,13,14,22,19,33,4,34,1,37],listdatabas:[25,19,23,10,9],befor:[0,10,21,2,19,6,36,37,28],wrong:19,simple_document_insert_with_function_saf:21,beauti:[12,33],descriptior:22,parallel:36,demonstr:33,attempt:[36,23,28],third:4,zzdhidden:14,exclud:[20,21],receiv:37,maintain:33,errorobject:19,order:[0,20,13,21,6,28],oper:[0,23,20,13,19,15,35,32,6,21,36,37,28,10],cursorinfo:[25,10,9],over:[20,21,14,19,33,28,10],becaus:[14,32,15],readbuff:[19,37],flexibl:14,vari:19,digest:[19,37],uuid:[29,1],fit:[36,20],fix:[19,37],mongolia:14,better:[36,19,28],complex:[36,10,21],loggerinst:19,persist:[36,18,21],split:[32,15,4],them:36,thei:[36,19,15,37,32],safe:[13,10,21,19,23,34,36,35,20],update_a_simple_docu:21,yourself:33,bread:14,"instanceof":[10,21,19,23,4,20],choic:19,guileen:14,changelog:[12,19],bonu:36,timeout:[2,19,20,28,21],each:[0,7,20,21,2,19,15,4,32,34,25,37,28,9,10],debug:19,went:21,a_simple_collect:10,mean:[20,2,19,33,36,37,28],resum:[34,7,25,9],overflow:[32,15],reset_error_histori:10,eventstor:14,extract:19,newli:[6,35,23],content:[29,0,7,30,13,14,22,33,4,36,37,9],daniel:[0,28,22],reader:19,got:[36,10,21],more_index_information_test:[10,21],validatecollect:[19,23,25,9],navig:37,worthwhil:37,hang:19,findandremov:[19,25,9,21],situat:19,standard:14,md5:[29,19,1,4],filter:[33,10,21],mvc:14,pagin:21,regress:19,onto:19,rang:[0,19,21],instruct:2,alreadi:[20,13,22,35,4,6,36,28],messag:[13,10,21,19,23,4],unlin:4,getnumbitsab:[24,15,32,9],mojo:14,hexstr:8,rewritten:19,top:[14,32,15,21],startindex:1,tonumb:[24,15,32,9],ton:[36,37],tom:33,kamikazepanda:18,listen:[19,20],consol:[0,1,13,22,35,36,37,28],namespac:3,eventlisten:19,took:20,incur:36,removeus:[25,19,23,10,9],silli:36,target:[37,21],provid:[10,21,14,32,15,4,36,37],zero:[19,15,32,8],project:[14,12,26,33],matter:36,iron:36,myexperience620186085001:33,beginn:12,websocket:[14,36],abov:[36,37,13],mind:36,raw:[0,10,21,19,13,35,37,28,20],manner:[19,37],increment:[36,33],seek:[25,22,37,4,9],dbref:[12,10,3,24,36,19,9],ensureindex:[10,21,19,6,25,9],simple_limit_collect:20,data2:4,simplifi:[14,19,37],evangelist:33,insur:19,plenti:37,usernam:[6,23,10],object:[0,1,2,19,4,6,7,8,10,12,13,14,23,35,20,21,22,28,29,30,31,33,34,36,37],what:[12,20,35,33,36,37],regular:[0,22],tradit:36,simplic:37,don:[19,28,21],doc:[0,23,1,20,13,14,19,21,4,34,36,10],flow:19,doe:[13,15,10,21,19,33,4,35,36,37,32],masylum:14,bson_data_d:1,radix:[32,15],random:4,speedup:19,syntax:19,test_stream_funct:20,identifi:[36,35,37],absolut:[32,15,37,4],acquir:20,field2:0,explain:[0,10,21,25,9,20],field1:0,theme:36,busi:36,rich:36,ppf_qxbkwm4g:33,io_seek_cur:4,cachefunct:1,nasti:19,test_cursorstream_destroi:34,stop:19,collectionsinfo:[25,10,9],bson_data_numb:1,report:36,youtub:[26,33,18],databank:14,bar:4,emb:[26,33,18],patch:19,previouli:20,fileidobject:4,steam:20,fieldnam:0,fair:37,indexnam:[10,21],num:21,tocollect:10,previouserror:[25,10,9],respons:[0,33,20],fail:[30,21,19,23,36,10],hash:[0,19,37,10,28],said:37,databas:[0,30,23,20,13,14,12,19,21,4,31,35,22,36,37,27,28,10],test_gs_empty_file_eof:4,discoveri:33,gridstor:[29,12,23,7,20,21,22,19,8,4,34,31,1,25,30,37,27,9,10],simplest:[14,0,37],awai:37,lotsofdoc:36,side:14,accord:2,newnam:21,simple_key_based_distinct:21,getlasterror:[23,10,21],howev:20,against:[0,23,20,21,19,15,4,8,32,10],logic:[0,19],browser:14,com:[12,14,19,33,18,36,26],con:33,assur:20,asced:20,simple_explain_collect:20,height:[26,33,18],getmorecommand:[20,21],path:[22,19,4],guid:12,assum:[32,15],duplic:[10,6,19,20,21],three:[36,37,4],been:[19,37,20,10],much:[36,37,33,13],basic:[12,10,31,21,36,37],quickli:33,life:37,regul:20,nodeeventstor:14,isodd:[24,15,32,9],ani:[0,10,13,14,36,37,20],child:10,"catch":21,laurie71:19,another_root:4,dissect:37,properti:[0,8,22,19,4,24,25,9],calcul:1,marriag:[12,33],"typeof":[19,1,4],succes:21,toolkit:14,sever:[13,2,35,6,36,28],grown:36,usessl:10,test_is_close_function_on_cursor:20,perform:[0,23,10,21,19,15,32,20],make:[0,20,13,19,21,6,36,37,28],transpar:33,meetup:[12,33],drawback:37,descend:[6,20],isneg:[24,15,32,9],complet:21,nin:0,rail:14,hand:28,fairli:19,tune:37,scenario:28,geohaystack:21,test_close_function_on_cursor:20,client:[23,10,13,14,21,4,30,36,20],thi:[29,0,23,7,20,13,14,22,19,15,4,28,32,6,33,37,21,36,8,26,10],everyth:13,settimeout:[34,19,7,21],left:[32,15,10,28,21],protocol:[36,19],just:[0,37,36,21],laptop:19,ordin:[10,21],farther:7,yet:28,languag:[14,36,33],previous:19,doc1:36,wmode:33,easi:14,collectionn:28,had:20,board:33,els:[21,23,28,13],ffffff:33,save:[10,21,22,13,4,25,28,9],dynamicstream:33,applic:[12,10,14,33,18,36,37],milli:23,preserv:20,background:[10,21],test_ev:10,apart:[36,37],measur:19,specif:[0,20,12,19,33,4,21,36,8,35,10],arbitrari:4,negat:[24,15,32,9],collection2:[10,21],collection1:21,underli:34,www:[12,10,14,33,18,26],right:[33,32,15,37,36],old:4,creek:33,deal:36,manual:[12,9],interv:19,deserializestream:[24,1,9],dead:19,intern:[0,32,15,22,21],successfulli:20,thu:13,m_tddbw6qnuu4iuxlyo:33,nwtj:14,timestampd:8,multipli:[24,15,32,9,21],fog:33,christkv:[36,19],condit:[0,19,21],localhost:[14,36,35,37,10],a_simple_create_drop_collect:10,collection_stats_test:21,promot:36,repositori:[14,36],post:[0,32,15,35],ryanke:14,plug:36,obj:21,slightli:36,simul:[32,15,37],commit:10,simple_previous_error_col:10,bson_data_symbol:1,"float":[36,32,15],simple_skip_collect:20,bound:[10,20,21],down:[19,10],wrap:[0,7,16,19,34,17],storag:[14,36,37],git:14,wai:[0,13,21,14,19,15,36,37,32],support:[0,19,37,36,22],happi:[14,12,33],avail:[23,7,20,21,2,19,33,4,34,36,37,10],width:[26,33,18],test_rename_collection3:21,call:[0,10,14,19,4,37,28,20],constantli:36,bulqmxg0vdc:33,fork:14,head:[37,4],medium:23,form:[19,33,4],forc:[10,19,23,20,21],"true":[0,23,1,20,13,2,22,19,33,4,34,6,35,7,21,30,36,37,28,10],reset:[0,10,4,20],new_nam:35,highbit:[32,15],maximum:[36,19,20,10],until:[36,23,10],deprect:20,fundament:36,sampl:36,emit:[36,19,34,10,21],shouldcorrectlyfailonretryduetoappcloseofdb:10,featur:37,"abstract":14,fromstr:[32,19,15,24,9],exist:[0,23,10,13,22,19,21,4,6,35,25,36,37,28,9],videoplay:33,check:[0,23,7,20,21,22,19,15,4,34,6,1,36,32,10],test_collection_opt:21,bson_binary_subtype_md5:[29,1],test_to_a_after_each:20,floor:8,tip:12,refactor:19,simple_limit_skip_find_one_queri:21,test:[23,20,13,14,22,19,21,4,18,36,37,35,10],forceclos:10,miliscecond:[34,7],node:[12,20,2,19,33,14,18,36,26,9],insensit:20,consid:21,sql:36,cachefunctionscrc32:1,errormessag:19,teixeira:12,faster:[6,19],ignor:[36,1,21],time:[12,20,21,2,19,33,14,31,36,8,28,10],push:[20,14,19,34,36,10],backward:[19,20],daili:33,concept:[36,19],skip:[25,0,20,9,21],global:19,primer:[12,37,33,31],row:21,millisecond:28,middl:21,depend:19,originalhex:8,dropindex:[25,6,10,9,21],sourc:[33,18,20],string:[29,0,23,1,20,21,22,3,15,4,16,32,6,37,35,30,36,8,19,10],feasibl:37,test_cursorstream_resum:34,logmeup:14,contenttyp:22,level:[10,21,14,19,23,4],did:[19,10],dig:36,eventemitt:20,iter:[20,21],item:[7,10,21,19,23,4,34,36,20],team:33,quick:[36,37,33],div:[33,24,15,32,9],round:36,databasenam:[10,28],wtimeout:[19,23,10,21],addtoset:36,sign:[32,15,35],slow_onli:23,cost:19,port:[19,10,28],comparis:4,checkoutwrit:10,repli:[36,23,21],muq2w2u5x9m:26,current:[15,10,22,3,33,4,36,37,32,23],subtype_uuid:29,boost:14,deriv:[32,15],gener:[12,10,8,14,19,21,37,28],wait:[10,21],box:36,bson_data_regexp:1,shift:[19,15,32],queue:[14,36],behav:19,examp:14,more_complex_ensure_index_test:[10,21],extrem:19,weird:19,werehamst:14,checkkei:1,extra:0,modul:[14,19],prefer:[0,19,36],toarrai:[0,20,21,14,19,23,25,36,9,10],bxhflrwemeg:18,instal:[36,19],includeloc:21,aaaaipotmrk:33,perf:19,memori:[0,20,31,12,19,36,37],regep:36,connector:[12,33],live:[36,19,37],handler:37,value2:0,value1:0,criteria:13,scope:[36,19,1,10,21],prev:21,maxkei:[11,12,1,19,24,9],multiplecoll1:10,share:[14,19,33,10,28],finit:[32,15],visual:14,examin:36,content_typ:[22,37],fly:14,cap:[36,19,10,21],uniqu:[0,21,10,28,6],test_correctly_access_collect:10,whatev:28,bson_binary_subtype_funct:[29,1],mongo:[12,10,13,14,19,33,36,37,31],stream:[7,20,22,19,34,4,1,25,36,37,9],predict:19,bson_data_long:1,createcollect:[10,21,19,34,25,36,35,9,20],topic:[12,33],nocr:14,kaflr8pi5nk:26,occur:[0,20,13,22,19,4,6,35,28],alwai:[36,32,15,20,21],multipl:[21,2,32,15,28,19],ping:[25,19,23,10,9],fieldvalu:0,write:[29,1,10,2,22,19,4,24,7,25,36,37,9,30],foreach:[4,21],pure:[29,23,7,20,21,34,19,8,4,1,30,10],nyc:[12,33],map:[36,21],product:[33,32,15],max:[10,19,20,21],dive:[36,37],date:[1,20,8,19,21,23,6,36],docstartindex:1,data:[29,12,7,20,21,22,19,33,4,34,31,1,18,30,36,37,10],grow:36,sbrekken:19,inform:[20,21,2,22,23,4,6,14,36,28,10],"switch":19,reaper:[19,10,28],combin:[33,4,10],anoth:[0,4,36,8],filedata:4,talk:33,gettimestamp:[19,24,9,8],still:[0,19,13],pointer:[0,35,4,28,22],dynam:33,test_map_reduce_funct:21,group:[12,21,19,33,25,26,37,9],gte:0,indexexist:[19,25,9,21],jim:21,nodelai:[2,19,28],platform:36,mbostock:19,requir:[29,23,7,20,13,34,19,21,4,1,37,35,30,36,8,28,10],main:[12,37,33,36],non:[14,19,21],"6pjmp23z0lw":26,encod:[2,36,19,28],col2:10,col3:10,initi:[10,21,19,4,36,37,20],col1:10,verifi:[10,8,23,4,21],now:[36,19,37,10],discuss:[12,33],nor:35,introduct:[2,12,33,36,31],mapreduc:[19,25,9,21],name:[29,0,23,1,20,13,2,22,3,33,4,28,6,35,21,37,19,10],drop:[10,21,19,23,6,25,35,9],revert:0,crypto:19,separ:[0,19,4],recreat:28,jprichardson:14,failov:[2,19],replai:19,dialect:14,replac:[0,21,19,13,4,36],individu:[0,19],firej:14,a_1_b_1:[10,21],ensur:[10,21,19,6,36,37],poolreadi:19,serverclust:19,happen:[34,7,4,20],shown:[36,37],accomplish:37,space:[1,10],streetsaheadllc:14,profil:[23,20,21],tohexstr:[0,19,24,9,8],factori:[0,28,21],resultset:36,million:33,orm:[14,33],mime:4,sethml:19,replacethiscollect:21,org:[14,12,10],"byte":[29,0,1,10,8,22,19,36,37,28],care:[2,0,36],question:[33,32,15],bradberri:33,synchron:36,thing:[36,37,28],place:[12,32,15],year2013:19,frequent:[32,15],first:[0,23,20,13,22,35,33,4,37,21,36,8,28,10],origin:[21,13],bson_binary_:19,directli:[0,20,36],onc:[6,36],arrai:[29,0,23,1,20,13,2,22,19,21,4,36,35,10],"0x7f":1,reopen:[4,28],"long":[12,1,20,8,19,15,24,36,9],serverinfo:21,open:[23,7,20,13,2,22,19,33,4,25,35,34,21,30,36,37,28,9,10],predefin:1,size:[0,1,20,21,22,19,15,4,37,32,10],given:[29,10,21,32,15,4,37,20],breviti:[36,37],workaround:19,paramt:20,collectionnam:[10,21,35,23,6,25,37,9],conveni:[0,32,15],subtype_md5:29,especi:36,copi:2,specifi:[29,0,10,21,22,19,4,36,37,28,20],test_rename_collection2:21,test_arrai:20,keepgo:[19,21],than:[0,20,13,21,2,22,19,15,32,37,28],png:[22,4],serv:33,firebas:14,tedeh:19,were:[20,13],posit:[29,22,32,15,4,37],seri:14,pre:[23,1,10,21],lowest:19,sai:37,pro:33,argument:[29,32,23,7,20,21,34,3,15,4,16,1,17,37,30,8,19,10],simple_rename_collection_2:10,deliv:33,bitwis:[36,32,15],squar:14,alias:0,destroi:[34,7,25,9],note:[32,15,20,10],take:[0,1,2,19,33,36,37],createfromhexstr:[0,19,24,9,8],begin:[0,4],sure:[37,20],normal:20,buffer:[29,0,1,20,13,22,19,21,4,35,30,37,28,10],clearer:19,getyear:21,homepag:14,deepequ:[30,10,21,4,20],renam:[10,21,35,25,36,9],byte_valu:29,later:[37,10,21],indexbound:[10,21],test_gs_read_stream:4,runtim:19,parseint:21,axi:21,show:[29,7,10,21,34,8,4,1,30,36,20],simple_count_exampl:21,objectid3:8,objectid2:8,concurr:19,corner:19,onli:[0,23,20,13,2,19,21,4,6,36,37,28,10],slow:[19,23,10,21],dice:36,setprofilinginfo:23,activ:[14,19],state:[36,20,28],analyt:[14,12,33,36],overwritten:37,min_valu:[32,15],variou:[14,23,21],get:[7,19,4,6,8,9,10,12,13,14,23,35,20,21,22,25,28,30,31,33,34,36,37],secondari:[2,19,10,20,21],ssl:[19,10],cannot:[10,21,32,15,36,20],shiftrightunsign:[24,15,32,9],geo:21,gen:33,nolock:[19,10],doabl:0,seldom:19,yield:[19,21,10,35,13],isarrai:1,caboos:14,nettl:14,where:[29,0,1,10,13,2,22,19,21,4,6,36,37,35],geospati:[10,21],desced:20,wiki:36,khwang:14,testcas:19,infinit:[19,15,32],detect:2,heckmann:19,fs_chunk:37,integration_tests_2:10,wayt:21,enough:20,between:[36,19,33,10,28],"import":[36,37],across:[19,28,21],spars:[6,10,21],august:[12,33],subtype_user_defin:29,tut:12,test_group:21,come:[22,32,15,21],simple_find_and_modify_operations_:21,region:21,gwt:[32,15],tutori:[12,26,37],mani:[36,20],fromnumb:[24,15,32,9],reindex:[25,19,10,9,21],iscap:[19,25,9,21],dir:13,dispatch:36,createcreateindexcommand:19,fs_file:37,lessthan:[24,15,32,9],reaperinterv:[19,10,28],cursor_information_collect:10,cursorinst:20,coupl:[29,36,21],aciev:0,rebuilt:[10,21],addit:[0,1,10,21,32,15,23,37,20],derefer:[25,19,10,9],lowbit:[32,15],geonear:[19,25,9,21],"1mb":37,those:[32,15],"case":[20,21,32,15,6,36,37,19],myself:36,bson_seri:19,tostr:[29,30,8,32,15,4,24,21,37,9],trick:[12,37],invok:37,isconnect:19,firstext:23,simple_sort_collect:20,trello:[12,33],advantag:36,createexperi:33,eras:[22,35],dynamicgui:14,ascii:[2,29,19,28],acess:10,develop:[14,12,33,36],author:[0,22,13],media:14,same:[0,20,21,19,15,4,6,8,32,10],binari:[29,0,23,7,20,12,22,19,13,4,34,24,1,21,30,36,8,35,9,10],html:12,document:[0,23,1,20,12,2,22,19,13,4,33,34,6,35,7,21,14,36,37,28,10],howtonod:12,createpk:28,exhaust:20,ifram:[26,33,18],finish:[37,21],closest:[32,15,21],utf8:[2,36,19,4,28],nest:[0,6],oid:3,driver:[0,13,2,12,19,33,35,14,25,36,37,28,9,31],gotend:4,capabl:33,newobjectid:8,improv:19,extern:12,defo:0,bson_data_boolean:1,appropri:33,moder:33,distancemultipli:21,brightcov:33,without:[1,10,32,15,28,35,19],model:[14,33,21],dereferenc:10,upsert:[21,13],ourexamplefiletowrit:4,execut:[23,10,13,19,21,4,36,20],when:[0,1,20,13,2,22,19,33,4,34,35,7,21,36,37,28],rest:[14,19,8,21],hint:[20,21],db_connector:[35,28],except:[36,19,4,13],littl:36,desktop:12,blog:[14,0,35,12],framebord:[26,33,18],default_chunk_s:4,haystack:21,real:[14,12,33],around:[14,12,19,36],read:[29,7,20,21,2,22,19,4,24,25,36,37,9,10],period:[0,35],grid:[29,12,30,14,19,25,37,9],pop:36,world:[7,10,21,13,4,1,37,30],lasterror:[25,19,10,9],reap:19,mod:[0,32,15],saniti:19,poolsiz:[7,10,21,19,23,4,34,30,36,28,20],realtim:[12,33],integ:[0,1,8,32,15,36,19],server:[29,23,1,20,13,2,34,19,33,4,14,35,7,37,21,30,36,8,28,10],firebaseco:14,either:[22,19,37,36],output:[0,21],greaterthanorequ:[24,15,32,9],manag:[14,22,19,36],kvalheim:33,bson_binary_subtype_byte_arrai:[29,1],eventloop:37,"_bsontyp":19,intact:13,generationtim:8,setnodelai:19,slice:36,writedata:37,node_ev:19,confirm:36,definit:12,legal:21,evolv:36,profilinginfo:[23,25,9],bson_data_binari:1,power:[14,33],broken:19,aquir:10,bson_binary_subtype_default:[29,19,1],regexp:[36,19,1],"throw":[36,19,37,13],comparison:8,pointer_to_collect:0,firstnam:[0,6],nocooki:[26,33,18],numbit:[32,15],bson_data_code_w_scop:1,gump:21,act:37,luck:37,other:[0,15,12,2,19,33,4,36,37,32,31],readstream:[25,12,7,20,9],addus:[25,19,23,10,9],test_collections_info:10,your:[21,2,33,4,14,36,37],loc:21,log:[0,1,20,21,14,22,19,13,23,35,36,37,28],hex:[0,30,4,8],overwrit:[23,4],dropdup:[19,10,21],strict:[19,35,10,28,21],interfac:[7,20,14,19,34,36,30],low:[36,32,15,37],lot:[12,20,21,19,6,34,36,37],isvid:33,tupl:6,shamelessli:36,replsetsrv:2,longer:[19,4],pull:[36,19,23],dirti:36,possibl:[0,10,13,14,19,21,6,36],"default":[29,0,23,1,20,13,2,22,19,21,4,6,37,35,36,8,28,10],remove_subset_of_documents_saf:21,auto_reconnect:[7,10,21,2,23,4,34,30,36,37,28,20],connect:[12,7,20,21,2,19,23,4,14,31,34,37,25,30,36,26,28,9,10],gone:[30,10,4,21],creat:[29,0,23,1,20,21,2,22,19,33,4,34,6,7,37,35,30,36,8,28,10],certain:[6,36],watcher:14,intro:36,file:[7,10,14,22,19,4,37,30],russel:33,calculateobjects:[24,1,9],again:[4,20],kaba:14,compel:33,event:[7,10,22,19,4,34,36,37,28,20],field:[0,20,13,19,33,6,21,36,10],valid:[29,1,20,8,35,23,10],longlib:15,you:[0,1,20,13,2,22,19,33,35,6,21,36,37,28,10],scttnlsn:14,pefrom:21,sequenc:19,symbol:[12,1,16,19,24,36,9],briefli:33,opt_radix:[32,15],pool:[19,10,28],reduc:[19,15,32,21],lessthanorequ:[24,15,32,9],coreh:14,directori:19,descript:[29,10,1,4,20],tricki:36,potenti:19,alright:36,cpu:[19,37],unset:36,represent:[11,29,15,30,8,3,33,4,5,17,16,32],all:[0,23,1,20,12,2,22,19,13,4,6,35,21,36,37,28,10],forget:36,numberupd:21,dollar:35,month:33,simple_rename_collect:10,cceac:14,follow:[0,20,13,2,4,6,36,37],fetchsiz:20,disk:[37,7,4,21,20],nodej:[14,33,18],subtype_default:29,nextobject:[25,0,20,9,10],aaron:19,introduc:33,setprofilinglevel:[23,25,9],evaul:10,util:[14,19],test_rename_collect:21,failur:[36,19],veri:[12,19,37,36],base698:14,list:[10,21,19,23,4,25,36,37,35,9],resav:21,adjust:[19,37],default_port:28,small:[19,37,26],retun:1,cursorstream:[25,12,34,20,9],design:[12,33],pass:[1,20,21,2,19,8,4,35,37,28,10],excit:33,deleg:28,abc:[0,4,13],xor:[24,15,32,9],sub:[29,33,21],sum:[32,15],brief:26,delet:[10,21,22,19,4,25,36,37,28,9,30],version:[19,37,10,28,21],cruso:0,method:[29,0,20,21,12,19,8,4,31,35,36,37,28,30],full:[19,10,21],christian:33,variat:36,behaviour:14,foobar2:4,foobar3:4,strong:26,modifi:[36,21,13],valu:[0,1,19,4,6,8,9,10,13,15,23,17,35,20,21,22,24,28,29,16,32,33,36,37],search:[14,12,36,21],ahead:[14,36,37,21],showdiskloc:[19,20,21],amount:[36,32,15,10],base:[8,14,22,21,4,36,37],pick:[36,19,37,10],action:12,mongoos:[14,12,26,33],narrow:21,evalfunct:1,via:36,shorthand:13,lazybum:14,c_1:21,deprec:10,default_root_collect:4,establish:[7,10,21,19,23,4,34,30,20],select:[19,21,28,35,13],test_collection_is_cap:21,distinct:[19,25,9,21],regist:4,two:[0,33,10,13,2,12,32,15,4,22,6,37,14,36,8,35],coverag:19,bson_binary_subtype_user_defin:[29,1],taken:36,minor:19,more:[0,7,20,13,2,34,19,15,4,33,21,36,37,32,10],flag:21,stick:36,particular:36,cach:1,none:[2,33],outlin:[36,37],dev:14,histori:10,remain:[37,4],learn:[14,12,33],scan:[20,21],qard:14,shard:22,accept:[19,21],simple_document_insert_collection_no_saf:21,default_url:10,learnboost:[14,33],robinson:0,cours:36,newlin:4,divid:[32,15,21],rather:21,keepgoingexampl:21,hugh:33,simpl:[29,0,7,20,12,14,34,19,21,4,6,31,1,30,36,37,35,10],resourc:[14,28],brett:33,reflect:19,unlink:[25,22,37,4,9],associ:[37,4],keyorlist:20,github:[14,12,19,18,36],defineproperti:19,save_a_simple_document_modify_it_and_resave_it:21,caus:[36,19],callback:[0,23,20,13,22,19,21,4,6,35,36,37,28,10],spheric:21,doc_id:0,bson_data_oid:1,trade:37,through:[36,19,33,10,21],reconnect:[19,28],paramet:[0,20,13,2,22,19,23,4,6,35,36,37,28,10],style:[14,36,33],mongorepli:19,world_no_saf:21,batchsizevalu:20,asbuff:1,relev:36,stylu:18,rapidli:36,bypass:36,simple_limit_skip_queri:21,might:[6,37,10,36],alter:[0,35],good:[12,37,36],"return":[0,7,3,4,5,1,8,10,11,13,15,23,17,19,20,21,22,28,29,30,16,32,34,35,36,37],timestamp:[12,1,8,19,21,24,32,9],more_complex_index_test:[10,21],framework:14,compound:[10,21],karaco:14,readlen:4,emerleit:14,uploadd:22,unlik:20,authent:[25,19,23,10,9],easili:[19,15,32],achiev:0,skipvalu:20,found:[0,10,21,4,13],truncat:[35,37,4],hard:36,weren:0,realli:36,expect:[0,28],barrier:19,orient:12,primari:[0,10,21,2,19,36,28,20],b4ajeu13u6u:26,read_primari:19,pullal:36,foreground:[10,21],core2duo:19,advanc:[12,31,35,4,36,37],asc:[0,20,13],reason:4,croucher:33,connectionopt:10,put:[29,20,21,19,4,24,25,37,9,30],seconddb:10,gethighbit:[24,15,32,9],tailabl:[19,20,21],omit:[36,3,37,19],perman:10,assign:[2,19],notifi:[36,37,21],articl:[12,37,31],lastnam:[0,6],number:[29,0,23,1,20,21,19,15,4,32,6,17,37,36,8,28,10],done:[0,7,10,21,22,19,13,23,34,36,37,28],construct:[32,15],autoclos:[22,37,7,4],create_and_drop_an_index:[10,21],miss:19,differ:[12,10,21,19,15,4,6,37,36,8,32,30],chunk_typ:4,script:[22,33],interact:[36,37,4,30],least:[0,21],custompkfactori:28,settim:8,statement:[36,37,10],illeg:[30,19,23,10,21],master:2,store:[1,10,14,22,4,36,37,20],schema:[12,33],otherid:8,option:[29,0,23,1,20,13,2,22,3,21,4,28,6,35,25,30,36,37,19,9,10],reseterrorhistori:[25,10,9],similarli:36,native_pars:[7,10,21,23,4,34,30,28,20],getter:[4,8],pars:[19,1,21],literarili:36,std:19,kind:37,bson_data_nul:1,whenev:[10,21],remov:[23,10,21,19,13,4,6,25,36,35,9],reus:[19,1,10],str:[32,15],consumpt:37,toward:33,cleaner:14,comput:12,luckili:[36,37],"null":[0,1,20,21,2,19,23,4,14,34,35,30,28,10],built:[14,36],equival:[36,21],valueof:[24,17,9,16],fromcollect:10,also:[0,20,13,12,19,4,6,36,37,35],build:[23,10,19,33,36,37],tool:[14,33],lubow:33,blackboard:[12,18],choos:[36,21],reach:[37,7],most:[0,37,33,36],plai:33,plan:37,selector:[10,19,20,21],"16mb":22,cover:10,part:[36,19,26,8],clean:[14,19,10],frombit:[24,15,32,9],ridicul:14,brightcoveexperi:33,session:[14,33],find:[0,7,20,13,14,22,19,21,23,6,34,25,36,9,10],firewal:19,nosql:[14,12],pretti:36,manipul:21,test_gs_weird_bug:4,numberofdocu:1,queu:14,batch_document_insert_collection_saf:21,hit:[10,21],unus:19,express:[0,12,21,14,22,18,36],fieldtoupd:36,test_map_reduce_functions_scop:21,nativ:[14,36,19,28],ferret:14,restart:[34,7],statist:[19,23,10,21],wrote:36,set:[0,23,1,20,13,2,22,19,33,4,6,35,37,21,36,8,28,10],jade:18,see:[0,13,22,32,15,6,35,36,37,28],easymongo:14,close:[7,20,21,14,22,19,23,4,34,25,30,36,37,28,9,10],my_f:4,lee:19,misalign:19,someth:[4,28],altern:[14,21],signatur:[4,20],complement:[32,15],javascript:[1,10,21,14,32,15,33,36],salzman:19,succeed:6,both:[19,21],last:[14,22,10,36],create_and_drop_all_index:[10,21],context:[33,28],let:[7,10,21,19,4,36,37,20],corrupt:23,whole:[36,10,4,21],createdat:20,load:[0,19],episod:12,jsmode:21,point:[20,21,32,15,36,37],instanti:[36,19],param:33,shutdown:19,suppli:[19,37],backend:36,faithfulli:[32,15],user_id:21,due:[36,19,30],empti:[29,0,21,4,20],otherwis:[1,20,32,15,4,36,37],bgcolor:33,txt:4,strategi:[36,19],test_streamingrecords_funct:20,wish:[29,1,10,21,23,4,37],fire:[7,10,13,14,22,4,36,37,28],admindb:[23,10],imag:[22,37],understand:36,func:[1,21],look:[20,21,22,19,33,4,6,36,37],mdoq:14,straight:[36,37],batch:[36,19,20,21],"while":[0,19,4,22,20],getownpropertynam:19,behavior:[0,13,19,15,36,32],error:[0,23,7,20,13,14,22,19,21,4,6,34,35,36,28,10],fun:37,fixtur:14,loos:[14,36],loop:19,found2:4,test_gs_unlink:4,readi:[34,7,4,36,20],key2:0,key1:0,jpg:4,itself:[12,20],test_deref_exampl:10,rid:19,simple_key_based_distinct_sub_query_filt:21,chase:19,decor:19,gs2:4,geohaystacksearch:[19,25,9,21],coffeescript:[14,12,26],p_db:[2,10],higher:[2,19,37,28,21],"10gen":12,optim:[19,21],operaion:22,numberofretri:[19,10,28],piec:[36,32,15,37],temporari:[4,21],user:[29,0,1,10,13,14,12,19,33,4,6,23],hello2:21,keyf:21,recent:33,travers:20,entri:[10,37,4,21],joyent:33,explan:[10,21],getlowbitsunsign:[24,15,32,9],a_1:21,collabor:33,shape:19,tempcollect:21,update_a_simple_document_multi:21,password:[19,23,10],cur:37,colladow:14,tdegrunt:14,keeptemp:21,appli:[0,19,20,36],input:[32,15,21],subsequ:[10,21],format:[0,10,21,13,23,20],big:[36,19,37],checksum:4,shiftright:[24,15,32,9],rs_name:[2,19],replsetserv:[29,23,1,20,21,2,34,19,8,4,7,30,10],like:[0,15,20,21,14,32,33,6,37,10],fsync:[23,10,21],resolv:10,collect:[0,2,3,4,6,9,10,12,13,14,23,19,20,21,22,25,27,28,30,31,33,34,35,36,37],bson_data_cod:1,popular:[12,33,36],bamboo:19,variant:36,serverpair:19,often:[32,15],creation:[23,10,21,19,33,36],some:[29,0,7,20,12,22,19,33,4,6,21,30,36,37,10],back:[0,23,8,14,32,15,4,21,36],understood:36,dropallindex:[25,9,21],scale:[12,37,33,36,21],slaveok:[19,10,21],chunksiz:[22,37,4],bson_data_min_kei:1,retri:[36,19,10,28],larg:[0,10,21,22,36,37],intial:21,previou:[37,28],run:[12,10,21,2,19,13,36,37,31],lublow:33,simple_reset_error_history_col:10,step:37,simple_explain_queri:21,from:[29,0,23,1,20,12,2,15,19,13,4,32,35,33,37,21,22,36,8,30,10],subtract:[24,15,32,9],k1mnspb8wvq:26,allowfullscreen:[26,33,18],recordquerystat:10,block:[37,10,21],cygwin:19,within:[32,15],simple_index_test:21,contributor:33,test_collection_index_exist:21,bson_deseri:19,fast:14,custom:[0,19,37,28,21],plain:19,includ:[0,20,12,19,33,4,6,35,21,36,28,10],forward:4,files:4,properli:[19,4],uniquedoc:21,ascend:[0,20,6],link:[12,37,36,31],translat:14,atom:[36,19,21],line:[14,37,4],info:[19,23,37,10,21],concaten:[32,15,4],consist:19,caller:20,forceserverobjectid:[19,10,28],gridf:[12,30,31,22,19,4,37],readlin:[25,4,9],similar:22,constant:[29,1,10,4,24,25,9,20],multiplecoll2:10,parser:[19,1,10,28],doesn:[0,28,13],repres:[20,8,32,15,4,16,17,36],idhex:0,titl:[0,21,27,13],unidirect:20,wakup:10,nice:[36,33],deseri:[1,20,19,24,36,9],bcoe:14,jannehietamaki:19,mongodb:[0,1,2,19,4,6,7,8,9,10,12,13,14,23,18,35,20,21,22,26,28,29,30,33,34,36,37],eval:[1,10,21,19,25,9,20],profilinglevel:[23,25,9],algorithm:[2,32,19,15,28],cursorinform:10,tradeoff:37,awesom:[12,26,18],leak:19,far:4,hello:[29,7,10,21,13,4,1,36,37,30],code:[29,23,7,20,21,34,19,8,4,1,30,36,37,10],partial:[20,21],worldbuff:4,queri:[0,23,20,13,12,19,33,4,35,6,31,21,36,27,28,10],idvalu:0,mongoskin:14,octet:4,replicasetcheckinterv:19,base64:[2,19,28,30],update_a_simple_document_upsert:21,send:[2,36,19,10,28],lower:[10,21],io_seek_end:4,sens:13,reapertimeout:[19,10,28],passiv:19,result2:30,account:21,writebuff:19,untouch:28,dbname:[19,10],magic:14,gettim:[20,8],roll:12,fieldorspec:[10,21],fewer:21,"try":[36,19,21,37,13],race:19,marri:33,refer:[10,3,4,36,19,20],smaller:22,fortun:36,natur:[36,33],jump:[36,37,33],video:[12,37],odm:[14,12,26],download:36,odd:[32,15],append:[22,4,36],compat:19,index:[12,1,20,21,19,6,25,27,35,9,10],compar:[8,32,15,4,6,24,9],descriptor:37,access:[10,21,22,23,4,16,17,20],experiment:19,can:[0,20,13,2,22,19,15,35,32,6,37,21,36,8,28,10],chose:33,bson_data_int:1,simplereach:33,cursor_count_collect:20,calipso:14,logout:[25,23,10,9],filedescriptor:37,becom:36,sinc:[36,32,15,37,13],subtype_byte_arrai:29,nexttick:19,convert:[0,36,8],convers:[36,21],larger:[22,19,37],technolog:33,chang:[21,19,15,36,37,32],configur:[2,36,19,10,35],read_secondari:[2,19],app:[2,12,19,33],mattinsl:14,api:[12,10,14,33,24,25,37],redi:33,cloud:12,chrisgibson:14,zir:14,batchsiz:[25,10,20,9,21],doubl:[12,19,24,17,36,9],next:[0,1,20,33,37,28],websit:[14,33],chr:4,simpler:[14,36,19,20,21],sort:[0,20,13,19,21,6,25,8,9],src:[26,33,18],benchmark:19,name2:0,socketopt:[2,19,28],sollect:35,degrunt:14,retriev:[0,23,20,13,22,19,21,4,36,37,10],scalabl:22,multiple_db_inst:10,annot:37,tag:[19,21],thin:14,fetch:[0,10,20,21,6,36,30],queryfailur:19,control:[36,19,37,28],objectid:[29,0,23,7,20,12,34,3,21,4,28,24,1,37,30,36,8,19,9,10],process:[12,20,14,19,15,32],lock:[19,37,10],username_:6,high:[10,21,32,15,36,19],unopen:19,serial:[1,10,21,19,24,9],pingresult:23,integration_test_:[2,10],instead:[0,20,21,2,19,6,37,28,10],npm:[36,19],pois:33,await:10,formattedorderclaus:19,originaldata:30,alloc:[19,1,10],bind:14,remove_all_documents_no_saf:21,correspond:[6,32,15,35],element:[0,4,36,20],issu:[36,19,21],chief:33,writ:4,allow:[10,21,19,23,35,36,37,28,20],subtyp:29,deoptim:19,doc2:36,doc3:36,move:[22,19,4,36],alexeypetrushin:14,doc4:36,spank:19,own:[19,4],server_opt:28,effici:[36,37,21],bunch:[19,10,21],perfect:36,total:[0,21],crash:19,greater:[0,32,15,20],python:12,databs:[22,35,28],dai:[12,33],auth:[19,10],renamecollect:[25,10,9],precess:36,numberofremoveddoc:21,writefil:[25,22,37,4,9],convin:0,anyth:19,edit:[37,4],npmj:14,slide:[12,33],deserializeddoc:1,exampledb:[36,37],subset:[20,21],opensync:4,chunk:[22,19,37,4],bson_binary_subtype_uuid:[29,1],"static":14,pushal:[36,19],our:[36,37,33,4,20],special:[36,32,15,37,20],out:[12,10,8,2,19,21,36,37,28,31],variabl:[36,19,21],trickier:[0,36],categori:37,suitabl:37,merg:[19,21],ref:19,clone:14,math:8,jessica:[0,13],insid:[0,37,22,6],dropcollect:[25,35,10,9],unpars:19,releas:19,princess:21,unwant:0,could:[36,19],shiftleft:[24,15,32,9],david:13,length:[29,23,1,10,21,22,8,4,24,37,9,20],lte:0,transfer:10,minkei:[12,19,1,24,5],evanp:14,debugmessag:19,iszero:[24,15,32,9],should_correctly_rewind_and_restart_cursor:20,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:10,prioriti:19,start:[29,0,1,20,12,2,35,21,4,36,37],system:[14,35,37,4],wrapper:14,createfromtim:[19,24,9,8],bson_data_max_kei:1,termin:4,"final":[36,19,33,21],idottv:14,deconstruct:37,test_gs_getc_fil:4,exactli:35,gridstorew:4,bson_data_object:1,replset:[2,10],bother:33,mongoserv:[35,28],structur:[0,37,36],charact:[29,19,8,4,21],test_gs_puts_and_readlin:4,seriou:19,result:[0,23,7,20,13,22,19,15,4,32,37,21,30,36,8,28,10],"function":[0,1,2,19,4,7,8,10,13,14,15,23,35,20,21,22,28,29,30,32,34,36,37],counter:[28,21],terribl:19,peform:[34,10,7,20,21],have:[0,10,21,2,35,33,4,6,36,37],tabl:[36,26,35],need:[0,1,10,13,22,32,15,6,35,36,37,28],turn:[0,23,10],border:26,buildinfo:[23,25,9],min:[10,19,20,21],rout:14,mix:[0,6],andrewjston:19,which:[0,33,2,22,19,15,4,32,35,37,28],test_other_drop:21,orgiin:4,singl:[29,0,10,21,13,22,19,33,4],fileid:[37,7,4],statsync:4,whi:0,serverconfig:[19,10,28],why:[14,36,33],overwriten:4,url:[14,10],timestamplib:32,request:[19,33,20],face:36,test_collect:13,snapshot:[20,21],"400m":33,determin:[36,20],"_id":[0,10,13,19,21,4,6,37,28,30],fact:[36,13],text:[33,32,15,37,4],serializefunct:[19,1,10,21],verbos:21,nagl:[2,19,28],anywai:[10,21],setter:[4,8],textual:[32,15],locat:[36,10,21,4,20],playerkei:33,should:[0,23,10,8,32,15,21,30,37,35,20],noid:14,test_cursorstream_paus:34,local:[3,10],devnul:14,cube:14,ritch:[14,19],kiefer:33,increas:19,donewithwrit:37,enabl:[19,10,28],organ:33,simple_batch_size_collect:20,stuff:[2,12,37,36,31],integr:[14,36,37],contain:[29,1,10,21,2,35,4,36,37,20],grab:[23,20,10],mon4mongo:14,view:14,modulo:[0,24,15,32,9],packet:19,meritt:14,statu:[14,36,19],wire:[36,19],correctli:[36,19,21],pattern:12,written:[29,21,14,32,15,4,37],crude:36,world2:21,streamrecord:[25,36,19,20,9],kei:[0,1,20,21,19,4,6,36,37,28,10],buckets:21,simple_queri:21,isol:19,job:[14,21],entir:[37,4,20],db_option:28,crc32:1,monitor:14,mongod:14,plugin:33,admin:[12,23,10,21,19,33,25,9],mongoj:[14,12],equal:[29,0,23,7,20,21,34,32,15,4,24,1,30,36,8,9,10],etc:[0,28,21],instanc:[23,1,20,21,2,19,8,4,30,36,37,28,10],greaterthan:[24,15,32,9],mongoq:14,subtype_funct:29,comment:[19,20,21],toint:[24,15,32,9],walk:33,removealllisten:19,save_a_simple_docu:21,attende:33,addition:35,compon:19,json:[12,33,32,15,24,36],treat:[0,19,20],pkfactori:[10,21],immedi:13,bit:[0,1,22,32,15,36,37,19],assert:[29,23,7,10,21,34,8,4,1,30,20],ador:14,present:[6,35,33,12],replic:[2,10],multi:[21,13],vimeo:12,cursor:[0,7,20,21,12,19,23,34,25,36,9,10],defin:[29,0,1,10,21,13,19,15,4,32,36,28],setreadprefer:19,bson_data_arrai:1,observ:14,layer:[14,36,33],helper:[14,19],site:2,lightweight:14,tojson:[32,19,15,24,9],nodetut:12,getc:[25,4,9],cross:19,member:[2,19],handl:[15,20,21,19,33,4,36,37,32],speaker:33,inc:[36,19],gett:14,difficult:37,incorrect:19,slave:2,hostnam:28,keepal:[2,19,28],upon:20,proxlet:33,retriv:23,student:26,serializewithbufferandindex:[24,1,9],php:12,chunk_siz:[22,4],off:[10,2,19,23,4,35,36,28,20],center:21,nevertheless:28,builder:33,well:[0,19,37,36],exampl:[29,0,23,7,20,12,22,35,13,4,34,6,31,1,37,21,30,36,8,28,10],command:[20,21,14,19,23,4,25,36,28,9,10],simple_geo_near_command:21,filesystem:22,latest:36,distanc:21,paus:[34,7,25,9],less:[36,32,15],"boolean":[7,20,21,22,32,15,4,6,1,37,10],additon:6,tcp:36,detail:[6,20,22],indexinform:[10,21,19,6,25,9,20],simpli:0,web:[14,12,36],rapid:[12,33],seekloc:[37,4],add:[23,10,8,32,15,6,24,21,36,9],cleanup:[19,37],tjanczuk:14,logger:19,match:[0,23,21,13,32,15,36,35],branch:19,crud:[12,36,31],iya_logo_final_bw:4,know:35,bson_data_timestamp:1,recurs:[15,32,1,4],isclos:[25,20,9],desc:[0,20],bson_data_str:1,insert:[0,23,1,20,12,19,13,4,25,35,34,21,36,27,28,9,10],resid:36,backbon:33,success:[22,4,20],isui:33,chunkcollect:[25,4,9],necessari:0,"0xff":1,async:[14,36],page:[0,33,36,12],milewis:14,linux:19,contin:14,flush:[37,7,4],proper:19,fileinfo:37,newhex:8,librari:[14,12,19,33,37],leaf:14,lead:[19,15,32],dropdatabas:[25,23,10,9,28],avoid:[6,19,23,36],fromint:[24,15,32,9],thank:19,leav:[19,13],kcbanner:14,speak:33,mode:[10,21,22,19,4,35,37,28,20],slight:36,journal:10,usag:[29,12,1,30,8,2,22,19,4,35,36,37,28],collection_nam:35,host:28,although:37,offset:[29,37,4],java:[32,15],cliftonc:14,panel:[12,33],about:[12,10,13,33,6,36,37,28,20],actual:[0,37,10,36,28],socket:[12,10,2,19,33,18,36,28],http:[12,14,19,33,18,36,26],dbinstanc:37,notequ:[24,15,32,9],constructor:[1,2,3,4,5,7,8,9,10,11,15,23,17,19,20,21,24,25,28,29,30,16,32,34],fals:[0,23,7,20,13,22,19,21,4,34,1,35,30,37,28,10],disabl:[2,19,28],autoindexid:10,automat:[7,20,2,22,19,36,37,28,10],dataset:[0,36],bson:[0,7,3,4,5,1,8,9,10,11,12,13,23,17,19,20,21,24,28,29,30,16,34,35],leverag:[36,33],val:21,pictur:37,primarki:0,mykei:36,trigger:[7,20,21,19,4,34],concat:0,"var":[29,0,23,1,20,13,2,22,35,21,4,34,7,37,30,36,8,28,10],fsname:30,deliveri:33,brand:19,continu:14,waitforconnect:19,eas:14,inlin:21,bug:[19,37],count:[0,20,13,19,21,4,25,35,9,10],made:[37,33],wise:0,whether:[32,15],ecosystem:33,displai:[33,10],asynchron:[2,36],record:[0,20,13,22,35,21,4,6,36,28,10],below:[12,10,13,32,15,36],limit:[0,20,21,22,25,36,9],default_content_typ:4,problem:[19,23],myexperience1123429378001:33,evalu:[1,10],"int":[32,15],dure:[36,19,23,10,21],year:0,filenam:[22,19,37,4],replica:[2,19,10],implement:[14,36,19,15,32],ing:[12,33],eric:33,retrymilisecond:[19,10,28],probabl:0,tick:19,arrj:14,bartt:14,book:[0,12],bool:8,futur:[14,36,19,10],karait:14,stat:[19,25,9,21],findon:[0,10,21,19,25,36,9],"class":[7,3,4,5,1,8,10,11,15,23,17,19,20,21,29,30,16,32,33,34,36,37],geck:14,stai:21,experienc:33,eof:[25,22,37,4,9],integration_test:[7,10,21,23,4,34,30,20],kaij:19,"0_gnhwzhc":26},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","ObjectID()","Node.JS MongoDB Driver Manual Contents","Db()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Symbol()","Double()","Awesome Node.js + MongoDB Applications","Changelog","Cursor()","Collection()","GridStore","Admin()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Binary()","Grid()","Articles","Timestamp()","Node.JS Specific Presentations","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/db","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/symbol","api-bson-generated/double","content/awesomeappsvideo","changelog/changelog","api-generated/cursor","api-generated/collection","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-articles/index","api-bson-generated/timestamp","content/nodejsvideo","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file +Search.setIndex({objects:{"":{notEquals:[32,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],GridStore:[4,0,1,""],toInt:[32,1,1,""],DBRef:[3,0,1,""],ensureIndex:[20,1,1,""],reIndex:[20,1,1,""],Binary:[29,0,1,""],deserializeStream:[1,1,1,""],findOne:[17,1,1,""],valueOf:[31,1,1,""],chunkCollection:[4,1,1,""],collectionNames:[20,1,1,""],Long:[14,0,1,""],nextObject:[9,1,1,""],validateCollection:[23,1,1,""],removeUser:[20,1,1,""],profilingInfo:[23,1,1,""],dropIndex:[20,1,1,""],findAndRemove:[17,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],toJSON:[32,1,1,""],BSON:[1,0,1,""],setProfilingLevel:[23,1,1,""],getNumBitsAbs:[32,1,1,""],cursorInfo:[20,1,1,""],"generationTime number [Getter|Setter]":[21,2,1,""],Timestamp:[32,0,1,""],batchSize:[9,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],Db:[20,0,1,""],dropCollection:[20,1,1,""],Collection:[17,0,1,""],MinKey:[5,0,1,""],shiftRight:[32,1,1,""],writeFile:[4,1,1,""],toString:[32,1,1,""],Double:[16,0,1,""],getTimestamp:[21,1,1,""],Grid:[30,0,1,""],profilingLevel:[23,1,1,""],streamRecords:[9,1,1,""],indexInformation:[20,1,1,""],isOdd:[32,1,1,""],getHighBits:[32,1,1,""],calculateObjectSize:[1,1,1,""],Admin:[23,0,1,""],dropDatabase:[20,1,1,""],Symbol:[31,0,1,""],previousErrors:[20,1,1,""],shiftRightUnsigned:[32,1,1,""],shiftLeft:[32,1,1,""],mapReduce:[17,1,1,""],Cursor:[9,0,1,""],MaxKey:[10,0,1,""],CursorStream:[34,0,1,""],findAndModify:[17,1,1,""],greaterThan:[32,1,1,""],renameCollection:[20,1,1,""],buildInfo:[23,1,1,""],resetErrorHistory:[20,1,1,""],isClosed:[9,1,1,""],getLowBitsUnsigned:[32,1,1,""],toHexString:[21,1,1,""],indexExists:[17,1,1,""],getLowBits:[32,1,1,""],toArray:[9,1,1,""],toNumber:[32,1,1,""],listDatabases:[23,1,1,""],ObjectID:[21,0,1,""],isNegative:[32,1,1,""],geoHaystackSearch:[17,1,1,""],addUser:[20,1,1,""],lessThanOrEqual:[32,1,1,""],isZero:[32,1,1,""],collectionsInfo:[20,1,1,""],lessThan:[32,1,1,""],isCapped:[17,1,1,""],ReadStream:[7,0,1,""],createCollection:[20,1,1,""],createIndex:[20,1,1,""],dropAllIndexes:[17,1,1,""],lastError:[20,1,1,""],geoNear:[17,1,1,""],greaterThanOrEqual:[32,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[21,1,1,""],createFromHexString:[21,1,1,""]},Timestamp:{fromBits:[32,1,1,""],fromNumber:[32,1,1,""],fromInt:[32,1,1,""],fromString:[32,1,1,""]},Db:{connect:[20,1,1,""]},Long:{fromBits:[14,1,1,""],fromNumber:[14,1,1,""],fromInt:[14,1,1,""],fromString:[14,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:13,returnkei:[19,9,17],maxscan:[19,9,17],readfilesync:4,prefix:[19,35],crete:17,createindex:[20,17,19,6,25,8],world_safe2:17,world_safe1:17,pedro:11,test_map_reduce_functions_inlin:17,deviat:19,under:19,everi:[0,9,28,22],test_gs_seek_with_buff:4,simple_next_object_collect:9,upload:22,correct:[1,20,21,19,4,36],gotik:18,"10k":19,cceac:13,seper:4,direct:[6,9,36],second:[20,12,2,19,21,4,35,17,37,28,9],street:13,aggreg:17,even:[0,15,17],attemp:[20,17],neg:[32,14],"while":[0,19,4,22,9],"new":[0,1,2,19,4,6,7,9,12,14,23,17,35,20,21,22,28,29,30,32,34,36,37],net:13,metadata:[22,37,4],"_event":19,rootcollect:4,never:[19,20],here:[36,37,4],epce4qkoh5:15,io_seek_set:4,anymor:19,loos:[13,36],getlowbit:[24,14,32,8],findandmodifi:[19,17,25,8,12],vincentcr:19,pvorb:13,schemaless:36,sessionstorag:13,middlewar:[13,15],sarah:17,describ:15,would:[0,20,17,19,14,6,37,32],aaron:19,concret:13,overhead:36,recommend:[36,15,17],type:[10,11,1,31,22,3,17,4,5,33,15,16,36,29,37,19,23],tell:[20,17,4,25,36,37,8],relat:6,notic:[36,37],warn:[17,20,12],exce:4,hold:[36,1,4,9],must:[0,32,14,17],join:15,err:[0,23,7,20,12,2,22,19,17,4,34,35,30,36,37,28,9],aheckmann:19,setup:[2,37,20],work:[0,9,19,15,4,36,26,37,20],test_gs_tel:4,rework:19,root:[37,4,30],overrid:[19,17,20,9],give:15,simple_geo_haystack_command:17,indic:[0,12,11,35,6,22,36,28],want:[0,20,17,35,4,6,16,36,37,28],david:12,unsign:[32,14],end:[7,9,17,22,35,15,4,34,36,37],replicaset:[11,20,2,19,36,27],quot:9,playerid:15,how:[11,15,9,17,23,4,33,36,26,37,20],"_id_":[20,17],recoveri:2,rewind:[0,9,19,4,25,8],milisecond:[19,20,21],config:[2,19,20],updat:[29,11,23,20,17,19,12,15,25,36,37,27,8],maxdist:17,recogn:4,after:[7,9,12,13,22,19,15,4,34,1,37],listdatabas:[25,19,23,20,8],befor:[0,20,17,2,19,6,36,37,28],wrong:19,gs2:4,beauti:[11,15],descriptior:22,parallel:36,demonstr:15,handl:[15,9,17,32,14,4,36,37,19],attempt:[36,23,28],third:4,zzdhidden:13,exclud:[9,17],perform:[0,23,20,17,19,14,32,9],maintain:15,errorobject:19,order:[0,9,12,17,6,28],oper:[0,23,20,12,19,14,35,32,6,17,36,37,28,9],cursorinfo:[25,20,8],over:[20,17,13,19,15,28,9],becaus:[13,32,14],readbuff:[19,37],flexibl:13,vari:19,digest:[19,37],uuid:[29,1],fit:[36,9],fix:[19,37],mongolia:13,better:[36,19,28],complex:[36,20,17],loggerinst:19,persist:[36,18,17],split:[32,14,4],them:36,thei:[36,19,14,37,32],safe:[12,20,17,19,23,34,36,35,9],update_a_simple_docu:17,yourself:15,bread:13,"instanceof":[9,17,19,23,4,20],choic:19,guileen:13,changelog:[11,19],bonu:36,timeout:[2,19,9,28,17],each:[0,7,20,17,2,19,14,4,32,34,25,37,28,8,9],debug:19,went:17,a_simple_collect:20,mean:[9,2,19,15,36,37,28],resum:[34,7,25,8],reset_error_histori:20,eventstor:13,extract:19,newli:[6,35,23],monitor:13,content:[29,0,7,30,12,13,22,15,4,36,37,8],daniel:[0,28,22],reader:19,got:[36,20,17],more_index_information_test:[20,17],navig:37,worthwhil:37,rail:13,default_port:28,situat:19,standard:13,md5:[29,19,1,4],filter:[15,20,17],mvc:13,pagin:17,regress:19,onto:19,rang:[0,19,17],instruct:2,alreadi:[9,12,22,35,4,6,36,28],wrapper:13,unlin:4,getnumbitsab:[24,14,32,8],primari:[0,20,17,2,19,36,28,9],hexstr:21,rewritten:19,top:[13,32,14,17],startindex:1,tonumb:[24,14,32,8],ton:[36,37],tom:15,kamikazepanda:18,listen:[19,9],consol:[0,1,12,22,35,36,37,28],namespac:3,eventlisten:19,took:9,incur:36,removeus:[25,19,23,20,8],silli:36,target:[37,17],provid:[20,17,13,32,14,4,36,37],cursorstream:[25,11,34,9,8],project:[13,11,26,15],matter:36,iron:36,myexperience620186085001:15,beginn:11,websocket:[13,36],abov:[36,37,12],mind:36,raw:[0,20,17,19,12,35,37,28,9],manner:[19,37],increment:[36,15],seek:[25,22,37,4,8],dbref:[11,20,3,24,36,19,8],ensureindex:[20,17,19,6,25,8],simple_limit_collect:9,data2:4,simplifi:[13,19,37],evangelist:15,insur:19,plenti:37,usernam:[6,23,20],object:[0,1,2,19,4,6,7,9,11,12,13,23,17,35,20,21,22,28,29,30,33,15,34,36,37],deleg:28,regular:[0,22],tradit:36,simplic:37,don:[19,28,17],doc:[0,23,1,20,12,13,19,17,4,34,36,9],flow:19,doe:[15,20,12,19,14,4,35,17,36,37,32],masylum:13,bson_data_d:1,radix:[32,14],random:4,speedup:19,syntax:19,test_stream_funct:9,identifi:[36,35,37],absolut:[32,14,37,4],acquir:9,field2:0,explain:[0,20,17,25,8,9],field1:0,theme:36,busi:36,rich:36,ppf_qxbkwm4g:15,io_seek_cur:4,cachefunct:1,nasti:19,test_cursorstream_destroi:34,stop:19,collectionsinfo:[25,20,8],bson_data_numb:1,report:36,youtub:[26,15,18],databank:13,bar:4,emb:[26,15,18],patch:19,previouli:9,fileidobject:4,steam:9,fieldnam:0,fair:37,indexnam:[20,17],num:17,structur:[0,37,36],previouserror:[25,20,8],respons:[0,15,9],fail:[30,17,19,23,36,20],christian:15,said:37,databas:[0,30,23,20,12,13,11,19,17,4,33,35,22,36,37,27,28,9],test_gs_empty_file_eof:4,discoveri:15,gridstor:[29,11,23,7,20,21,22,19,17,4,34,33,1,25,30,37,27,8,9],simplest:[13,0,37],awai:37,lotsofdoc:36,side:13,accord:2,newnam:17,getlasterror:[23,20,17],howev:9,against:[0,23,20,21,19,14,4,17,32,9],logic:[0,19],seri:13,com:[11,13,19,15,18,36,26],con:15,assur:9,can:[0,14,20,21,2,22,19,12,35,32,6,17,36,37,28,9],simple_explain_collect:9,height:[26,15,18],foobar2:4,path:[22,19,4],guid:11,assum:[32,14],duplic:[6,19,17,20,9],three:[36,37,4],been:[19,37,20,9],much:[36,37,15,12],basic:[11,20,33,17,36,37],quickli:15,life:37,regul:9,nodeeventstor:13,search:[13,11,36,17],argument:[29,32,23,7,20,21,34,3,14,4,31,1,16,17,30,37,19,9],child:20,"catch":17,laurie71:19,another_root:4,subsequ:[20,17],peform:[34,7,20,17,9],dissect:37,properti:[0,21,22,19,4,24,25,8],calcul:1,marriag:[11,15],"typeof":[19,1,4],succes:17,toolkit:13,sever:[12,2,35,6,36,28],grown:36,usessl:20,test_is_close_function_on_cursor:9,receiv:37,make:[0,9,12,19,17,6,36,37,28],transpar:15,meetup:[11,15],drawback:37,descend:[6,9],isneg:[24,14,32,8],complet:17,nin:0,hang:19,hand:28,fairli:19,tune:37,scenario:28,geohaystack:17,test_close_function_on_cursor:9,client:[23,9,17,13,12,4,30,36,20],thi:[29,0,23,7,20,21,13,14,19,12,4,32,6,15,37,17,22,36,26,28,9],everyth:12,settimeout:[34,19,7,17],left:[32,14,20,28,17],protocol:[36,19],just:[0,37,36,17],laptop:19,ordin:[20,17],farther:7,yet:28,languag:[13,36,15],previous:19,wmode:15,easi:13,collectionn:28,had:9,board:15,els:[17,23,28,12],ffffff:15,save:[20,17,22,12,4,25,28,8],dynamicstream:15,applic:[11,20,13,15,18,36,37],which:[0,15,2,22,19,14,4,32,35,37,28],preserv:9,background:[20,17],test_ev:20,apart:[36,37],measur:19,specif:[0,15,20,11,19,21,4,17,36,35,9],arbitrari:4,negat:[24,14,32,8],collection2:[20,17],collection1:17,underli:34,www:[11,20,13,15,18,26],right:[15,32,14,37,36],old:4,creek:15,deal:36,manual:[11,8],interv:19,deserializestream:[24,1,8],dead:19,intern:[0,32,14,22,17],successfulli:9,thu:12,txt:4,nwtj:13,timestampd:21,multipli:[24,14,32,8,17],originalhex:21,christkv:[36,19],condit:[0,19,17],localhost:[13,36,35,37,20],a_simple_create_drop_collect:20,collection_stats_test:17,promot:36,repositori:[13,36],post:[0,32,14,35],ryanke:13,plug:36,obj:17,unpars:19,bson_deseri:19,slightli:36,simul:[32,14,37],commit:20,book:[0,11],simple_previous_error_col:20,bson_data_symbol:1,"float":[36,32,14],encod:[2,36,19,28],bound:[17,20,9],down:[19,20],wrap:[0,7,31,19,34,16],storag:[13,36,37],git:13,wai:[0,12,17,13,19,14,36,37,32],support:[0,19,37,36,22],serverinfo:17,avail:[7,9,17,2,34,19,23,4,15,36,37,20],width:[26,15,18],test_rename_collection3:17,test_rename_collection2:17,constantli:36,bulqmxg0vdc:15,lowest:19,head:[37,4],medium:23,form:[19,15,4],forc:[19,17,23,20,9],"true":[0,23,1,20,12,2,22,19,17,4,15,34,6,7,35,30,36,37,28,9],reset:[0,4,9,20],new_nam:35,geospati:[20,17],maximum:[36,19,20,9],until:[36,23,20],deprect:9,fundament:36,sampl:36,emit:[36,19,34,20,17],shouldcorrectlyfailonretryduetoappcloseofdb:20,featur:37,"abstract":13,fromstr:[32,19,14,24,8],exist:[0,23,20,12,22,19,17,4,6,35,25,36,37,28,8],videoplay:15,check:[0,23,7,20,17,22,19,14,4,34,6,1,36,32,9],test_collection_opt:17,bson_binary_subtype_md5:[29,1],test_to_a_after_each:9,floor:21,when:[0,1,9,12,2,22,19,17,4,15,34,7,35,36,37,28],refactor:19,simple_limit_skip_find_one_queri:17,test:[23,20,12,13,22,19,17,4,18,36,37,35,9],forceclos:20,miliscecond:[34,7],node:[11,9,2,19,15,13,18,36,26,8],insensit:9,consid:17,sql:36,cachefunctionscrc32:1,dropdup:[19,20,17],teixeira:11,longer:[19,4],ignor:[36,1,17],time:[11,15,20,21,2,19,17,13,33,36,28,9],push:[20,13,19,34,36,9],backward:[19,9],daili:15,concept:[36,19],skip:[25,0,9,8,17],global:19,primer:[11,37,15,33],row:17,millisecond:28,middl:17,depend:19,fog:15,dropindex:[25,6,20,8,17],sourc:[15,18,9],string:[29,0,23,1,20,21,22,3,14,4,31,32,6,35,17,30,36,37,19,9],feasibl:37,test_cursorstream_resum:34,logmeup:13,contenttyp:22,level:[20,17,13,19,23,4],did:[19,20],dig:36,eventemitt:9,iter:[9,17],item:[7,9,17,19,23,4,34,36,20],team:15,quick:[36,37,15],div:[15,24,14,32,8],round:36,databasenam:[20,28],wtimeout:[19,23,20,17],addtoset:36,sign:[32,14,35],slow_onli:23,cost:19,port:[19,20,28],comparis:4,checkoutwrit:20,repli:[36,23,17],muq2w2u5x9m:26,current:[23,20,22,3,14,4,15,36,37,32],subtype_uuid:29,boost:13,deriv:[32,14],gener:[11,20,17,13,19,21,37,28],wait:[20,17],box:36,bson_data_regexp:1,shift:[19,14,32],queue:[13,36],behav:19,examp:13,more_complex_ensure_index_test:[20,17],extrem:19,weird:19,werehamst:13,checkkei:1,extra:0,modul:[13,19],prefer:[0,19,36],toarrai:[0,20,17,13,19,23,25,36,8,9],bxhflrwemeg:18,instal:[36,19],includeloc:17,aaaaipotmrk:15,perf:19,memori:[0,9,33,11,19,36,37],regep:36,connector:[11,15],live:[36,19,37],handler:37,value2:0,value1:0,criteria:12,scope:[36,19,1,20,17],prev:17,maxkei:[10,11,1,19,24,8],multiplecoll1:20,qard:13,finit:[32,14],visual:13,examin:36,content_typ:[22,37],fly:13,cap:[36,19,20,17],uniqu:[0,17,20,28,6],test_correctly_access_collect:20,whatev:28,bson_binary_subtype_funct:[29,1],mongo:[11,15,20,33,13,19,12,36,37],stream:[7,9,22,19,34,4,1,25,36,37,8],predict:19,bson_data_long:1,createcollect:[20,17,19,34,25,36,35,8,9],topic:[11,15],nocr:13,cube:13,kaflr8pi5nk:26,occur:[0,9,12,22,19,4,6,35,28],alwai:[36,32,14,9,17],multipl:[17,2,32,14,28,19],ping:[25,19,23,20,8],fieldvalu:0,write:[29,1,20,2,22,19,4,24,7,25,36,37,8,30],foreach:[4,17],pure:[29,23,7,20,21,34,19,17,4,1,30,9],nyc:[11,15],map:[36,17],product:[15,32,14],max:[19,17,20,9],dive:[36,37],date:[1,9,17,19,21,23,6,36],docstartindex:1,data:[29,11,7,20,17,22,19,33,4,15,34,1,18,30,36,37,9],grow:36,sbrekken:19,inform:[9,17,2,22,23,4,6,13,36,28,20],"switch":19,reaper:[19,20,28],combin:[15,4,20],keepgoingexampl:17,filedata:4,talk:15,increas:19,still:[0,19,12],pointer:[0,35,4,28,22],dynam:15,test_map_reduce_funct:17,group:[11,17,19,15,25,26,37,8],gte:0,indexexist:[19,25,8,17],jim:17,nodelai:[2,19,28],platform:36,mbostock:19,requir:[29,23,7,20,12,34,19,21,4,35,1,17,30,36,37,28,9],m_tddbw6qnuu4iuxlyo:15,main:[11,37,15,36],non:[13,19,17],"6pjmp23z0lw":26,simple_skip_collect:9,col2:20,col3:20,initi:[9,17,19,4,36,37,20],col1:20,verifi:[20,17,23,4,21],now:[36,19,37,20],discuss:[11,15],nor:35,introduct:[2,11,15,36,33],mapreduc:[19,25,8,17],name:[29,0,23,1,20,12,2,22,3,17,4,28,6,15,35,37,19,9],drop:[20,17,19,23,6,25,35,8],revert:0,crypto:19,separ:[0,19,4],recreat:28,jprichardson:13,failov:[2,19],replai:19,dialect:13,replac:[0,17,19,12,4,36],individu:[0,19],firej:13,a_1_b_1:[20,17],contributor:15,poolreadi:19,serverclust:19,happen:[34,7,4,9],shown:[36,37],accomplish:37,space:[1,20],streetsaheadllc:13,profil:[23,9,17],stuff:[2,11,37,36,33],factori:[0,28,17],brett:15,million:15,orm:[13,15],mime:4,sethml:19,replacethiscollect:17,org:[13,11,20],"byte":[29,0,1,20,21,22,19,36,37,28],care:[2,0,36],bradberri:15,synchron:36,thing:[36,37,28],place:[11,32,14],year2013:19,frequent:[32,14],first:[0,23,20,12,22,35,21,4,15,17,36,37,28,9],origin:[17,12],bson_binary_:19,directli:[0,9,36],onc:[6,36],arrai:[29,0,23,1,20,12,2,22,19,17,4,36,35,9],"0x7f":1,reopen:[4,28],fast:13,happi:[13,11,15],open:[23,7,20,12,2,22,19,17,4,34,35,15,25,30,36,37,28,8,9],predefin:1,size:[0,1,20,17,22,19,14,4,37,32,9],given:[29,9,17,32,14,4,37,20],breviti:[36,37],workaround:19,paramt:9,collectionnam:[20,17,35,23,6,25,37,8],conveni:[0,32,14],subtype_md5:29,especi:36,copi:2,specifi:[29,0,9,17,22,19,4,36,37,28,20],test_arrai:9,keepgo:[19,17],than:[0,9,12,2,22,19,14,32,17,37,28],png:[22,4],serv:15,firebas:13,tedeh:19,were:[9,12],posit:[29,22,32,14,4,37],browser:13,pre:[23,1,20,17],fork:13,sai:37,pro:15,ani:[0,20,12,13,36,37,9],simple_rename_collection_2:20,deliv:15,bitwis:[36,32,14],squar:13,alias:0,destroi:[34,7,25,8],note:[32,14,20,9],take:[0,1,2,19,15,36,37],createfromhexstr:[0,19,24,8,21],begin:[0,4],sure:[37,9],normal:9,buffer:[29,0,1,20,12,22,19,17,4,35,30,37,28,9],clearer:19,getyear:17,homepag:13,renam:[20,17,35,25,36,8],byte_valu:29,later:[37,20,17],indexbound:[20,17],test_gs_read_stream:4,runtim:19,parseint:17,axi:17,show:[29,7,20,21,34,17,4,1,30,36,9],atom:[36,19,17],objectid3:21,objectid2:21,concurr:19,corner:19,onli:[0,23,20,12,2,19,17,4,6,36,37,28,9],slow:[19,23,20,17],dice:36,setprofilinginfo:23,activ:[13,19],written:[29,17,13,32,14,4,37],analyt:[13,11,15,36],overwritten:37,min_valu:[32,14],variou:[13,23,17],get:[7,19,4,6,8,9,11,12,13,23,17,35,20,21,22,25,28,30,33,15,34,36,37],secondari:[2,19,17,20,9],ssl:[19,20],cannot:[20,17,32,14,36,9],shiftrightunsign:[24,14,32,8],geo:17,gen:15,nolock:[19,20],doabl:0,seldom:19,yield:[19,17,20,35,12],isarrai:1,caboos:13,nettl:13,where:[29,0,1,20,12,2,22,19,17,4,6,36,37,35],highbit:[32,14],desced:9,wiki:36,khwang:13,testcas:19,infinit:[19,14,32],detect:2,heckmann:19,fs_chunk:37,integration_tests_2:20,timestamplib:32,wayt:17,enough:9,between:[36,19,15,20,28],"import":[36,37],across:[19,28,17],spars:[6,20,17],august:[11,15],tut:11,test_group:17,come:[22,32,14,17],simple_find_and_modify_operations_:17,region:17,gwt:[32,14],tutori:[11,26,37],mani:[36,9],fromnumb:[24,14,32,8],reindex:[25,19,20,8,17],iscap:[19,25,8,17],db_option:28,period:[0,35],dispatch:36,createcreateindexcommand:19,fs_file:37,lessthan:[24,14,32,8],reaperinterv:[19,20,28],cursor_information_collect:20,cursorinst:9,coupl:[29,36,17],aciev:0,simplereach:15,rebuilt:[20,17],derefer:[25,19,20,8],lowbit:[32,14],geonear:[19,25,8,17],"1mb":37,those:[32,14],"case":[9,17,32,14,6,36,37,19],myself:36,bson_seri:19,tostr:[29,30,17,32,14,4,24,21,37,8],trick:[11,37],invok:37,idhex:0,firstext:23,simple_sort_collect:9,trello:[11,15],advantag:36,createexperi:15,eras:[22,35],dynamicgui:13,ascii:[2,29,19,28],acess:20,develop:[13,11,15,36],author:[0,22,12],media:13,same:[0,20,21,19,14,4,6,17,32,9],binari:[29,0,23,7,20,21,11,19,12,4,35,34,24,1,17,22,36,30,8,9],html:11,document:[0,23,1,20,11,2,22,19,12,4,15,34,6,35,7,17,13,36,37,28,9],howtonod:11,createpk:28,exhaust:9,ifram:[26,15,18],finish:[37,17],closest:[32,14,17],utf8:[2,36,19,4,28],nest:[0,6],oid:3,driver:[0,15,12,2,11,19,33,35,13,25,36,37,28,8],gotend:4,capabl:15,newobjectid:21,improv:19,extern:11,defo:0,bson_data_boolean:1,crud:[11,36,33],appropri:15,moder:15,framework:13,brightcov:15,without:[1,20,32,14,28,35,19],model:[13,15,17],dereferenc:20,upsert:[17,12],ourexamplefiletowrit:4,execut:[23,9,17,19,12,4,36,20],tip:11,rest:[13,19,17,21],hint:[9,17],db_connector:[35,28],except:[36,19,4,12],littl:36,desktop:11,blog:[13,0,35,11],framebord:[26,15,18],default_chunk_s:4,haystack:17,vimeo:11,found2:4,around:[13,11,19,36],read:[29,7,20,17,2,22,19,4,24,25,36,37,8,9],streamrecord:[25,36,19,9,8],grid:[29,11,30,13,19,25,37,8],pop:36,world:[7,20,12,17,4,1,37,30],lasterror:[25,19,20,8],reap:19,subtype_user_defin:29,saniti:19,poolsiz:[7,9,17,19,23,4,34,30,36,28,20],realtim:[11,15],integ:[0,1,21,32,14,36,19],server:[29,15,23,1,20,21,2,34,19,12,4,13,35,7,17,30,36,37,28,9],firebaseco:13,either:[22,19,37,36],output:[0,17],greaterthanorequ:[24,14,32,8],manag:[13,22,19,36],kvalheim:15,bson_binary_subtype_byte_arrai:[29,1],eventloop:37,"_bsontyp":19,intact:12,generationtim:21,setnodelai:19,slice:36,writedata:37,node_ev:19,confirm:36,definit:11,legal:17,evolv:36,profilinginfo:[23,25,8],bson_data_binari:1,power:[13,15],broken:19,aquir:20,bson_binary_subtype_default:[29,19,1],regexp:[36,19,1],"throw":[36,19,37,12],comparison:21,pointer_to_collect:0,firstnam:[0,6],nocooki:[26,15,18],numbit:[32,14],bson_data_code_w_scop:1,gump:17,act:37,luck:37,readstream:[25,11,7,9,8],addus:[25,19,23,20,8],test_collections_info:20,your:[17,2,15,4,13,36,37],loc:17,log:[0,1,9,12,13,22,19,17,23,35,36,37,28],hex:[0,30,4,21],overwrit:[23,4],errormessag:19,strict:[19,35,20,28,17],interfac:[7,9,13,19,34,36,30],low:[36,32,14,37],lot:[11,9,17,19,6,34,36,37],isvid:15,tupl:6,shamelessli:36,replsetsrv:2,faster:[6,19],pull:[36,19,23],dirti:36,possibl:[0,20,12,13,19,17,6,36],"default":[29,0,23,1,20,21,2,22,19,12,4,6,35,17,36,37,28,9],remove_subset_of_documents_saf:17,dropdatabas:[25,23,20,8,28],bson_data_min_kei:1,expect:[0,28],gone:[30,17,4,20],creat:[29,0,23,1,20,21,2,22,19,17,4,15,34,6,7,35,30,36,37,28,9],certain:[6,36],watcher:13,intro:36,file:[7,20,13,22,19,4,37,30],russel:15,calculateobjects:[24,1,8],again:[4,9],kaba:13,compel:15,orient:11,field:[0,15,20,12,19,17,6,36,9],valid:[29,1,20,21,35,23,9],longlib:14,you:[0,1,20,12,2,22,19,17,6,15,35,36,37,28,9],scttnlsn:13,pefrom:17,sequenc:19,symbol:[11,1,31,19,24,36,8],briefli:15,opt_radix:[32,14],pool:[19,20,28],reduc:[19,14,32,17],lessthanorequ:[24,14,32,8],coreh:13,directori:19,descript:[29,1,4,9,20],tricki:36,potenti:19,alright:36,cpu:[19,37],unset:36,represent:[10,29,15,30,21,3,14,4,5,16,31,32],all:[0,23,1,20,11,2,22,19,12,4,6,35,17,36,37,28,9],forget:36,numberupd:17,dollar:35,month:15,simple_rename_collect:20,erhangundogan:13,follow:[0,9,12,2,4,6,36,37],fetchsiz:9,disk:[37,7,4,17,9],nodej:[13,15,18],subtype_default:29,nextobject:[25,0,20,8,9],init:9,introduc:15,setprofilinglevel:[23,25,8],evaul:20,util:[13,19],test_rename_collect:17,failur:[36,19],veri:[11,19,37,36],base698:13,list:[20,17,19,23,4,25,36,37,35,8],resav:17,adjust:[19,37],findandremov:[19,25,8,17],small:[19,37,26],retun:1,eas:13,zero:[19,14,32,21],design:[11,15],pass:[1,20,21,2,19,17,4,35,37,28,9],excit:15,what:[11,9,35,15,36,37],abc:[0,4,12],xor:[24,14,32,8],sub:[29,15,17],sum:[32,14],brief:26,delet:[20,17,22,19,4,25,36,37,28,8,30],version:[19,37,20,28,17],cruso:0,method:[29,0,35,9,11,19,21,4,33,17,36,37,28,30],full:[19,20,17],hash:[0,19,37,20,28],variat:36,behaviour:13,getmorecommand:[9,17],foobar3:4,strong:26,modifi:[36,17,12],valu:[0,1,19,4,6,8,9,12,14,23,16,17,35,20,21,22,24,28,29,31,32,15,36,37],bartt:13,isodd:[24,14,32,8],ahead:[13,36,37,17],showdiskloc:[19,9,17],amount:[36,32,14,20],croucher:15,pick:[36,19,37,20],action:11,mongoos:[13,11,26,15],narrow:17,evalfunct:1,via:36,shorthand:12,lazybum:13,c_1:17,deprec:20,default_root_collect:4,establish:[7,9,17,19,23,4,34,30,20],select:[19,17,28,35,12],test_collection_is_cap:17,distinct:[19,25,8,17],regist:4,two:[0,14,20,21,2,11,32,12,4,22,6,15,13,36,37,35],coverag:19,bson_binary_subtype_user_defin:[29,1],taken:36,minor:19,more:[0,7,20,12,2,34,19,14,4,15,17,36,37,32,9],flag:17,stick:36,particular:36,cach:1,none:[2,15],outlin:[36,37],dev:13,histori:20,remain:[37,4],learn:[13,11,15],scan:[9,17],share:[13,19,15,20,28],shard:22,accept:[19,17],simple_document_insert_collection_no_saf:17,default_url:20,robinson:0,cours:36,newlin:4,divid:[32,14,17],rather:17,anoth:[0,4,36,21],hugh:15,simpl:[29,0,7,20,11,13,34,19,17,4,6,33,1,30,36,37,35,9],perman:20,resourc:[13,28],resultset:36,reflect:19,unlink:[25,22,37,4,8],associ:[37,4],keyorlist:9,github:[13,11,19,18,36],defineproperti:19,save_a_simple_document_modify_it_and_resave_it:17,caus:[36,19],callback:[0,23,20,12,22,19,17,4,6,35,36,37,28,9],spheric:17,doc_id:0,bson_data_oid:1,trade:37,through:[36,19,15,20,17],reconnect:[19,28],paramet:[0,20,12,2,22,19,23,4,6,35,36,37,28,9],style:[13,36,15],mongorepli:19,call:[0,9,13,19,4,37,28,20],asbuff:1,dbname:[19,20],stylu:18,rapidli:36,bypass:36,simple_limit_skip_queri:17,might:[6,37,20,36],alter:[0,35],good:[11,37,36],"return":[0,7,3,4,5,1,9,10,12,14,23,16,17,19,20,21,22,28,29,30,31,32,34,35,36,37],timestamp:[11,1,17,19,21,24,32,8],more_complex_index_test:[20,17],distancemultipli:17,compound:[20,17],karaco:13,readlen:4,emerleit:13,uploadd:22,unlik:9,authent:[25,19,23,20,8],easili:[19,14,32],achiev:0,skipvalu:9,found:[0,12,4,17,20],truncat:[35,37,4],hard:36,weren:0,realli:36,connect:[11,7,20,17,2,19,23,4,13,33,34,37,25,30,36,26,28,8,9],barrier:19,event:[7,9,22,19,4,34,36,37,28,20],mojo:13,b4ajeu13u6u:26,read_primari:19,pullal:36,foreground:[20,17],core2duo:19,advanc:[11,33,35,4,36,37],asc:[0,9,12],reason:4,base:[17,13,22,21,4,36,37],connectionopt:20,put:[29,9,17,19,4,24,25,37,8,30],seconddb:20,gethighbit:[24,14,32,8],tailabl:[19,9,17],omit:[36,3,37,19],dir:12,assign:[2,19],notifi:[36,37,17],articl:[11,37,33],lastnam:[0,6],number:[29,0,23,1,20,21,19,14,4,32,6,16,17,36,37,28,9],done:[0,7,20,17,22,19,12,23,34,36,37,28],construct:[32,14],autoclos:[22,37,7,4],create_and_drop_an_index:[20,17],miss:19,differ:[11,20,21,19,14,4,6,17,36,37,32,30],chunk_typ:4,script:[22,15],interact:[36,37,4,30],least:[0,17],custompkfactori:28,settim:21,statement:[36,37,20],illeg:[30,19,23,20,17],master:2,store:[1,9,13,22,4,36,37,20],schema:[11,15],otherid:21,option:[29,0,23,1,20,12,2,22,3,17,4,28,6,35,25,30,36,37,19,8,9],reseterrorhistori:[25,20,8],similarli:36,selector:[19,17,20,9],getter:[4,21],pars:[19,1,17],literarili:36,std:19,kind:37,bson_data_nul:1,whenev:[20,17],remov:[23,20,12,19,17,4,6,25,36,35,8],reus:[19,1,20],str:[32,14],consumpt:37,toward:15,cleaner:13,comput:11,luckili:[36,37],"null":[0,1,20,17,2,19,23,4,13,34,35,30,28,9],built:[13,36],equival:[36,17],valueof:[24,16,8,31],fromcollect:20,also:[0,9,12,11,19,4,6,36,37,35],build:[23,20,19,15,36,37],tool:[13,15],lubow:15,blackboard:[11,18],validatecollect:[19,23,25,8],reach:[37,7],most:[0,37,15,36],plai:15,plan:37,native_pars:[7,9,17,23,4,34,30,28,20],"16mb":22,filesystem:22,cover:20,part:[36,19,26,21],clean:[13,19,20],frombit:[24,14,32,8],ridicul:13,brightcoveexperi:15,session:[13,15],find:[0,7,20,12,13,22,19,17,23,6,34,25,36,8,9],firewal:19,nosql:[13,11],pretti:36,test_gs_weird_bug:4,numberofdocu:1,queu:13,batch_document_insert_collection_saf:17,hit:[20,17],unus:19,express:[0,11,17,13,22,18,36],fieldtoupd:36,test_map_reduce_functions_scop:17,nativ:[13,36,19,28],ferret:13,restart:[34,7],statist:[19,23,20,17],wrote:36,set:[0,23,1,20,21,2,22,19,12,4,6,35,15,17,36,37,28,9],jade:18,see:[0,12,22,32,14,6,35,36,37,28],easymongo:13,close:[7,20,17,13,22,19,23,4,34,25,30,36,37,28,8,9],my_f:4,chose:15,misalign:19,someth:[4,28],configur:[2,36,19,20,35],altern:[13,17],signatur:[4,9],complement:[32,14],javascript:[1,20,17,13,32,14,15,36],salzman:19,succeed:6,both:[19,17],last:[13,22,20,36],create_and_drop_all_index:[20,17],context:[15,28],logout:[25,23,20,8],whole:[36,17,4,20],createdat:9,load:[0,19],episod:11,jsmode:17,point:[9,17,32,14,36,37],instanti:[36,19],param:15,shutdown:19,suppli:[19,37],backend:36,faithfulli:[32,14],user_id:17,due:[36,19,30],empti:[29,0,17,4,9],bgcolor:15,strategi:[36,19],test_streamingrecords_funct:9,fire:[7,20,12,13,22,4,36,37,28],admindb:[23,20],imag:[22,37],ecosystem:15,understand:36,func:[1,17],look:[9,17,22,19,15,4,6,36,37],mdoq:13,straight:[36,37],batch:[36,19,9,17],"256k":37,getownpropertynam:19,behavior:[0,12,19,14,36,32],error:[0,23,7,20,12,13,22,19,17,4,6,34,35,36,28,9],fun:37,fixtur:13,robin:36,loop:19,real:[13,11,15],test_gs_unlink:4,readi:[34,7,4,36,9],key2:0,key1:0,jpg:4,itself:[11,9],test_deref_exampl:20,rid:19,simple_key_based_distinct_sub_query_filt:17,chase:19,decor:19,simple_document_insert_with_function_saf:17,geohaystacksearch:[19,25,8,17],coffeescript:[13,11,26],p_db:[2,20],higher:[2,19,37,28,17],"10gen":11,optim:[19,17],operaion:22,numberofretri:[19,20,28],iya_logo_final_bw:4,temporari:[4,17],user:[29,0,1,20,11,13,19,12,4,6,15,23],hello2:17,keyf:17,recent:15,travers:9,entri:[37,17,4,20],joyent:15,explan:[20,17],getlowbitsunsign:[24,14,32,8],a_1:17,collabor:15,shape:19,update_a_simple_document_multi:17,bson_data_timestamp:1,cur:37,colladow:13,tdegrunt:13,keeptemp:17,read_secondari:[2,19],input:[32,14,17],mod:[0,32,14],format:[0,20,17,12,23,9],big:[36,19,37],checksum:4,shiftright:[24,14,32,8],rs_name:[2,19],replsetserv:[29,23,1,20,21,2,34,19,17,4,7,30,9],backbon:15,success:[22,4,9],resolv:20,collect:[0,2,3,4,6,8,9,11,12,13,23,19,20,17,22,25,27,28,30,33,15,34,35,36,37],bson_data_cod:1,popular:[11,15,36],bamboo:19,variant:36,serverpair:19,often:[32,14],creation:[23,20,17,19,15,36],some:[29,0,7,20,11,22,19,17,4,6,15,30,36,37,9],back:[0,23,17,13,32,14,4,36,21],understood:36,dropallindex:[25,8,17],scale:[11,37,15,36,17],slaveok:[19,20,17],chunksiz:[22,37,4],retri:[36,19,20,28],larg:[0,20,17,22,36,37],intial:17,previou:[37,28],run:[11,20,17,2,19,12,36,37,33],lublow:15,simple_reset_error_history_col:20,step:37,simple_explain_queri:17,zir:13,subtract:[24,14,32,8],k1mnspb8wvq:26,allowfullscreen:[26,15,18],recordquerystat:20,block:[37,20,17],cygwin:19,within:[32,14],simple_index_test:17,ensur:[20,17,19,6,36,37],test_collection_index_exist:17,question:[15,32,14],"long":[11,1,9,21,19,14,24,36,8],custom:[0,19,37,28,17],includ:[0,15,20,11,19,17,4,6,35,36,28,9],forward:4,files:4,properli:[19,4],uniquedoc:17,ascend:[0,9,6],link:[11,37,36,33],translat:13,simple_count_exampl:17,line:[13,37,4],info:[19,23,37,20,17],concaten:[32,14,4],consist:19,caller:9,forceserverobjectid:[19,20,28],contin:13,readlin:[25,4,8],similar:22,constant:[29,1,9,4,24,25,8,20],multiplecoll2:20,parser:[19,1,20,28],doesn:[0,28,12],repres:[9,31,32,14,4,16,36,21],isconnect:19,titl:[0,17,27,12],unidirect:9,wakup:20,nice:[36,15],deseri:[1,9,19,24,36,8],bcoe:13,jannehietamaki:19,mongodb:[0,1,2,19,4,6,7,8,9,11,12,13,23,18,17,35,20,21,22,26,28,29,30,15,34,36,37],eval:[1,20,17,19,25,8,9],profilinglevel:[23,25,8],algorithm:[2,32,19,14,28],cursorinform:20,tradeoff:37,awesom:[11,26,18],far:4,hello:[29,7,20,12,17,4,1,36,37,30],code:[29,23,7,20,21,34,19,17,4,1,30,36,37,9],partial:[9,17],worldbuff:4,queri:[0,23,20,12,11,19,17,4,6,33,15,35,36,27,28,9],idvalu:0,mongoskin:13,replicasetcheckinterv:19,base64:[2,19,28,30],update_a_simple_document_upsert:17,send:[2,36,19,20,28],lower:[20,17],io_seek_end:4,sens:12,reapertimeout:[19,20,28],passiv:19,result2:30,degrunt:13,writebuff:19,untouch:28,relev:36,magic:13,gettim:[9,21],roll:11,fieldorspec:[20,17],fewer:17,"try":[36,19,17,37,12],race:19,marri:15,refer:[9,3,4,36,19,20],smaller:22,fortun:36,natur:[36,15],jump:[36,37,15],video:[11,37],odm:[13,11,26],download:36,odd:[32,14],append:[22,4,36],compat:19,index:[11,1,20,17,19,6,25,27,35,8,9],compar:[21,32,14,4,6,24,8],descriptor:37,access:[23,9,17,22,31,4,16,20],experiment:19,asced:9,lee:19,bson_data_int:1,batchsizevalu:9,cursor_count_collect:9,calipso:13,let:[7,9,17,19,4,36,37,20],filedescriptor:37,becom:36,sinc:[36,32,14,37,12],subtype_byte_arrai:29,nexttick:19,convert:[0,36,21],convers:[36,17],larger:[22,19,37],technolog:15,chang:[17,19,14,36,37,32],tempcollect:17,appli:[0,19,9,36],app:[2,11,19,15],mattinsl:13,api:[11,20,13,15,24,25,37],redi:15,cloud:11,chrisgibson:13,from:[29,0,23,1,30,20,21,2,11,14,12,4,32,35,15,17,22,36,37,19,9],batchsiz:[25,17,20,8,9],doubl:[11,19,24,16,36,8],next:[0,1,9,15,37,28],websit:[13,15],chr:4,panel:[11,15],sort:[0,9,12,19,21,25,6,17,8],src:[26,15,18],benchmark:19,name2:0,socketopt:[2,19,28],sollect:35,account:17,retriev:[0,23,9,12,22,19,17,4,36,37,20],scalabl:22,multiple_db_inst:20,annot:37,unopen:19,thin:13,fetch:[0,30,9,17,6,36,20],queryfailur:19,control:[36,19,37,28],objectid:[29,0,23,7,20,21,11,3,17,4,28,34,24,1,30,36,37,19,8,9],process:[11,9,13,19,14,32],lock:[19,37,20],username_:6,high:[20,17,32,14,36,19],tag:[19,17],serial:[1,20,17,19,24,8],pingresult:23,integration_test_:[2,20],instead:[0,20,17,2,19,6,37,28,9],npm:[36,19],pois:15,await:20,formattedorderclaus:19,originaldata:30,alloc:[19,1,20],bind:13,remove_all_documents_no_saf:17,correspond:[6,32,14,35],element:[0,4,36,9],issu:[36,19,17],chief:15,writ:4,allow:[20,17,19,23,35,36,37,28,9],subtyp:29,deoptim:19,doc2:36,doc3:36,doc1:36,alexeypetrushin:13,doc4:36,spank:19,autoindexid:20,server_opt:28,effici:[36,37,17],bunch:[19,20,17],perfect:36,total:[0,17],crash:19,greater:[0,32,14,9],python:11,databs:[22,35,28],dai:[11,15],auth:[19,20],renamecollect:[25,20,8],precess:36,numberofremoveddoc:17,writefil:[25,22,37,4,8],convin:0,anyth:19,edit:[37,4],npmj:13,slide:[11,15],deserializeddoc:1,exampledb:[36,37],subset:[9,17],opensync:4,chunk:[22,19,37,4],bson_binary_subtype_uuid:[29,1],default_content_typ:4,pushal:[36,19],our:[36,37,15,4,9],special:[36,32,14,37,9],out:[11,20,17,2,19,21,36,37,28,33],variabl:[36,19,17],trickier:[0,36],categori:37,suitabl:37,leverag:[36,15],ref:19,clone:13,math:21,jessica:[0,12],insid:[0,37,22,6],dropcollect:[25,35,20,8],manipul:17,releas:19,princess:17,unwant:0,could:[36,19],shiftleft:[24,14,32,8],keep:[22,19,20,36,17],length:[29,23,1,9,21,22,17,4,24,37,8,20],lte:0,primarki:0,minkei:[11,19,1,24,5],evanp:13,debugmessag:19,iszero:[24,14,32,8],should_correctly_rewind_and_restart_cursor:9,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:20,prioriti:19,start:[29,0,1,9,11,2,35,17,4,36,37],system:[13,35,37,4],messag:[20,12,19,23,4,17],createfromtim:[19,24,8,21],bson_data_max_kei:1,termin:4,"final":[36,19,15,17],idottv:13,deconstruct:37,test_gs_getc_fil:4,exactli:35,gridstorew:4,bson_data_object:1,replset:[2,20],bother:15,mongoserv:[35,28],tocollect:20,charact:[29,19,17,4,21],test_gs_puts_and_readlin:4,seriou:19,result:[0,23,7,30,20,12,14,19,21,4,32,17,22,36,37,28,9],deliveri:15,counter:[28,17],terribl:19,corrupt:23,have:[0,20,17,2,35,15,4,6,36,37],tabl:[36,26,35],need:[0,1,20,12,22,32,14,6,35,36,37,28],turn:[0,23,20],border:26,buildinfo:[23,25,8],min:[19,17,20,9],rout:13,mix:[0,6],andrewjston:19,milli:23,test_other_drop:17,orgiin:4,singl:[29,0,15,20,12,22,19,17,4],fileid:[37,7,4],statsync:4,whi:0,serverconfig:[19,20,28],why:[13,36,15],overwriten:4,url:[13,20],integration_tests_to_drop:20,request:[19,15,9],face:36,test_collect:12,snapshot:[9,17],"400m":15,determin:[36,9],"_id":[0,20,12,19,17,4,6,37,28,30],fact:[36,12],text:[15,32,14,37,4],serializefunct:[19,1,20,17],verbos:17,"static":13,nagl:[2,19,28],anywai:[20,17],setter:[4,21],textual:[32,14],locat:[36,17,4,9,20],playerkei:15,should:[0,23,20,17,32,14,37,30,21,35,9],noid:13,test_cursorstream_paus:34,local:[3,20],devnul:13,move:[22,19,4,36],ritch:[13,19],kiefer:15,gettimestamp:[19,24,8,21],donewithwrit:37,enabl:[19,20,28],organ:15,simple_batch_size_collect:9,tohexstr:[0,19,24,8,21],integr:[13,36,37],contain:[29,1,9,17,2,35,4,36,37,20],grab:[23,20,9],mon4mongo:13,view:13,modulo:[0,24,14,32,8],packet:19,meritt:13,fromint:[24,14,32,8],statu:[13,36,19],wire:[36,19],correctli:[36,19,17],pattern:11,state:[36,9,28],crude:36,world2:17,kei:[0,1,20,17,19,4,6,36,37,28,9],buckets:17,simple_queri:17,isol:19,job:[13,17],entir:[37,4,9],auto_reconnect:[7,9,17,2,23,4,34,30,36,37,28,20],crc32:1,addit:[0,1,20,17,32,14,23,37,9],mongod:13,plugin:15,admin:[11,15,20,17,19,23,25,8],mongoj:[13,11],equal:[29,0,23,7,20,21,34,32,14,4,24,1,17,30,36,8,9],etc:[0,28,17],instanc:[23,1,20,21,2,19,17,4,30,36,37,28,9],greaterthan:[24,14,32,8],mongoq:13,subtype_funct:29,comment:[19,9,17],toint:[24,14,32,8],walk:15,removealllisten:19,save_a_simple_docu:17,attende:15,addition:35,compon:19,json:[11,15,32,14,24,36],treat:[0,19,9],pkfactori:[20,17],immedi:12,bit:[0,1,22,32,14,36,37,19],assert:[29,23,7,20,21,34,17,4,1,30,9],ador:13,present:[6,35,15,11],replic:[2,20],multi:[17,12],plain:19,cursor:[0,7,20,11,19,17,23,34,25,36,8,9],defin:[29,0,1,20,12,19,14,4,32,17,36,28],setreadprefer:19,bson_data_arrai:1,observ:13,layer:[13,36,15],helper:[13,19],site:2,lightweight:13,tojson:[32,19,14,24,8],nodetut:11,getc:[25,4,8],cross:19,member:[2,19],world_no_saf:17,speaker:15,probabl:0,gett:13,difficult:37,incorrect:19,slave:2,hostnam:28,keepal:[2,19,28],upon:9,proxlet:15,retriv:23,student:26,serializewithbufferandindex:[24,1,8],php:11,chunk_siz:[22,4],off:[9,2,19,23,4,35,36,28,20],center:17,nevertheless:28,builder:15,well:[0,19,37,36],exampl:[29,0,23,7,20,21,11,30,12,4,35,34,6,33,1,17,22,36,37,28,9],command:[9,17,13,19,23,4,25,36,28,8,20],simple_geo_near_command:17,choos:[36,17],latest:36,distanc:17,paus:[34,7,25,8],less:[36,32,14],"boolean":[7,20,17,22,32,14,4,6,1,37,9],additon:6,tcp:36,arrj:13,indexinform:[20,17,19,6,25,8,9],simpli:0,web:[13,11,36],rapid:[11,15],seekloc:[37,4],add:[23,20,17,32,14,6,24,36,21,8],cleanup:[19,37],tjanczuk:13,logger:19,match:[0,23,17,12,32,14,36,35],karait:13,simple_key_based_distinct:17,piec:[36,32,14,37],know:35,password:[19,23,20],recurs:[14,32,1,4],isclos:[25,9,8],desc:[0,9],bson_data_str:1,insert:[0,23,1,20,11,19,12,4,25,35,34,17,36,27,28,8,9],resid:36,like:[0,15,20,17,13,32,14,6,37,9],fsync:[23,20,17],isui:15,chunkcollect:[25,4,8],necessari:0,"0xff":1,async:[13,36],page:[0,15,36,11],milewis:13,linux:19,gridf:[11,30,33,22,19,4,37],flush:[37,7,4],proper:19,fileinfo:37,newhex:21,librari:[13,11,19,15,37],leaf:13,lead:[19,14,32],leak:19,avoid:[6,19,23,36],octet:4,thank:19,leav:[19,12],kcbanner:13,speak:15,mode:[9,17,22,19,4,35,37,28,20],slight:36,journal:20,usag:[29,11,1,30,21,2,22,19,4,35,36,37,28],collection_nam:35,host:28,although:37,offset:[29,37,4],java:[32,14],cliftonc:13,simpler:[13,36,19,9,17],continu:13,about:[11,20,12,15,6,36,37,28,9],actual:[0,37,20,36,28],socket:[11,20,2,19,15,18,36,28],http:[11,13,19,15,18,36,26],dbinstanc:37,notequ:[24,14,32,8],constructor:[1,2,3,4,5,7,8,9,10,14,23,16,17,19,20,21,24,25,28,29,30,31,32,34],fals:[0,23,7,20,12,22,19,17,4,34,1,35,30,37,28,9],disabl:[2,19,28],own:[19,4],automat:[7,20,2,22,19,36,37,28,9],dataset:[0,36],bson:[0,7,3,4,5,1,8,9,10,11,12,23,16,17,19,20,21,24,28,29,30,31,34,35],merg:[19,17],val:17,pictur:37,transfer:20,mykei:36,trigger:[7,9,17,19,4,34],concat:0,"var":[29,0,23,1,20,21,2,22,35,12,4,34,7,17,30,36,37,28,9],fsname:30,"function":[0,1,2,19,4,7,9,12,13,14,23,17,35,20,21,22,28,29,30,32,34,36,37],brand:19,learnboost:[13,15],waitforconnect:19,overflow:[32,14],inlin:17,bug:[19,37],count:[0,20,12,19,17,4,25,35,8,9],made:[37,15],wise:0,whether:[32,14],wish:[29,1,20,17,23,4,37],displai:[15,20],asynchron:[2,36],record:[0,20,12,22,35,17,4,6,36,28,9],below:[11,20,12,32,14,36],limit:[0,9,17,22,25,36,8],otherwis:[1,9,32,14,4,36,37],problem:[19,23],myexperience1123429378001:15,evalu:[1,20],"int":[32,14],dure:[36,19,23,20,17],year:0,filenam:[22,19,37,4],replica:[2,19,20],implement:[13,36,19,14,32],ing:[11,15],eric:15,retrymilisecond:[19,20,28],inc:[36,19],tick:19,detail:[6,9,22],deepequ:[30,17,4,9,20],other:[0,15,11,2,19,14,4,36,37,32,33],bool:21,futur:[13,36,19,20],branch:19,stat:[19,25,8,17],findon:[0,20,17,19,25,36,8],"class":[7,3,4,5,1,9,10,14,23,16,17,19,20,21,29,30,31,32,15,34,36,37],geck:13,stai:17,experienc:15,eof:[25,22,37,4,8],integration_test:[7,9,17,23,4,34,30,20],kaij:19,"0_gnhwzhc":26},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Node.JS Specific Presentations","Double()","Collection()","Awesome Node.js + MongoDB Applications","Changelog","Db()","ObjectID()","GridStore","Admin()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Binary()","Grid()","Symbol()","Timestamp()","Articles","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","content/nodejsvideo","api-bson-generated/double","api-generated/collection","content/awesomeappsvideo","changelog/changelog","api-generated/db","api-bson-generated/objectid","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-bson-generated/symbol","api-bson-generated/timestamp","api-articles/index","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2"]}) \ No newline at end of file From 17df011878d36e9e176f2b484f6ececd2ec6fdf6 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Thu, 23 Feb 2012 17:16:38 +0100 Subject: [PATCH 14/56] Updated docs --- .buildinfo | 2 +- _sources/api-generated/collection.txt | 154 +++++++++++ _sources/api-generated/db.txt | 12 +- _sources/changelog/changelog.txt | 11 + _sources/github/github.txt | 71 +++-- api-articles/index.html | 10 +- api-articles/nodekoarticle1.html | 10 +- api-articles/nodekoarticle2.html | 10 +- api-bson-generated/binary.html | 10 +- api-bson-generated/bson.html | 10 +- api-bson-generated/code.html | 10 +- api-bson-generated/double.html | 10 +- api-bson-generated/index.html | 10 +- api-bson-generated/long.html | 10 +- api-bson-generated/maxkey.html | 10 +- api-bson-generated/minkey.html | 10 +- api-bson-generated/objectid.html | 10 +- api-bson-generated/symbol.html | 10 +- api-bson-generated/timestamp.html | 10 +- api-generated/admin.html | 10 +- api-generated/collection.html | 168 +++++++++++- api-generated/cursor.html | 10 +- api-generated/cursorstream.html | 10 +- api-generated/db.html | 14 +- api-generated/grid.html | 10 +- api-generated/gridstore.html | 10 +- api-generated/index.html | 11 +- api-generated/readstream.html | 10 +- changelog/changelog.html | 357 ++++++++++++++------------ content/awesomeappsvideo.html | 10 +- content/nodejsvideo.html | 10 +- content/tutorials.html | 10 +- contents.html | 11 +- genindex.html | 32 ++- github/github.html | 94 ++++--- index.html | 10 +- markdown-docs/collections.html | 10 +- markdown-docs/database.html | 10 +- markdown-docs/gridfs.html | 10 +- markdown-docs/index.html | 10 +- markdown-docs/indexes.html | 10 +- markdown-docs/insert.html | 10 +- markdown-docs/queries.html | 10 +- markdown-docs/replicaset.html | 10 +- objects.inv | Bin 1218 -> 1217 bytes search.html | 10 +- searchindex.js | 2 +- 47 files changed, 837 insertions(+), 432 deletions(-) diff --git a/.buildinfo b/.buildinfo index b751583e35f..5ce2524e8de 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 1afea3d5b2430fce039e23741c93a3b4 +config: f5ac064b640afa05489e507afb5e6d06 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/_sources/api-generated/collection.txt b/_sources/api-generated/collection.txt index bfe85b5a4be..056ec53eef1 100644 --- a/_sources/api-generated/collection.txt +++ b/_sources/api-generated/collection.txt @@ -1413,6 +1413,7 @@ Creates an index on the collection. Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a - **unique** {Boolean, default:false}, creates an unique index. - **sparse** {Boolean, default:false}, creates a sparse index. - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. @@ -1540,6 +1541,7 @@ Ensures that an index exists, if it does not it creates it Options + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a - **unique** {Boolean, default:false}, creates an unique index. - **sparse** {Boolean, default:false}, creates a sparse index. - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. @@ -2548,6 +2550,158 @@ Retrieve all the indexes on the collection. }); +--------- +aggregate +--------- + + +Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.1 + +.. js:function:: aggregate(pipline, callback) + + :param array pipline: a pipleline containing all the object for the execution. + :param function callback: returns matching documents. + :returns: null + + +**Examples** + + + + Correctly call the aggregation framework using a pipeline in an Array. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Some docs for insertion + var docs = [{ + title : "this is my title", author : "bob", posted : new Date() , + pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 }, + comments : [ + { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" } + ]}]; + + // Validate that we are running on at least version 2.1 of MongoDB + db.admin().serverInfo(function(err, result){ + + if(parseInt((result.version.replace(/\./g, ''))) >= 210) { + // Create a collection + db.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArray', function(err, collection) { + // Insert the docs + collection.insert(docs, {safe:true}, function(err, result) { + + // Execute aggregate, notice the pipeline is expressed as an Array + collection.aggregate([ + { $project : { + author : 1, + tags : 1, + }}, + { $unwind : "$tags" }, + { $group : { + _id : { tags : 1 }, + authors : { $addToSet : "$author" } + }} + ], function(err, result) { + assert.equal(null, err); + assert.equal('good', result[0]._id.tags); + assert.deepEqual(['bob'], result[0].authors); + assert.equal('fun', result[1]._id.tags); + assert.deepEqual(['bob'], result[1].authors); + + db.close(); + }); + }); + }); + } else { + db.close(); + test.done(); + } + }); + }); + + + + Correctly call the aggregation framework using a pipeline expressed as an argument list. + + .. code-block:: javascript + + var Db = require('mongodb').Db, + Server = require('mongodb').Server, + ReplSetServers = require('mongodb').ReplSetServers, + ObjectID = require('mongodb').ObjectID, + Binary = require('mongodb').Binary, + GridStore = require('mongodb').GridStore, + Code = require('mongodb').Code, + BSON = require('mongodb').pure().BSON, + assert = require('assert'); + + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + + // Establish connection to db + db.open(function(err, db) { + // Some docs for insertion + var docs = [{ + title : "this is my title", author : "bob", posted : new Date() , + pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 }, + comments : [ + { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" } + ]}]; + + // Validate that we are running on at least version 2.1 of MongoDB + db.admin().serverInfo(function(err, result){ + + if(parseInt((result.version.replace(/\./g, ''))) >= 210) { + // Create a collection + client.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArguments', function(err, collection) { + // Insert the docs + collection.insert(docs, {safe:true}, function(err, result) { + + // Execute aggregate, notice the pipeline is expressed as function call parameters + // instead of an Array. + collection.aggregate( + { $project : { + author : 1, + tags : 1, + }}, + { $unwind : "$tags" }, + { $group : { + _id : { tags : 1 }, + authors : { $addToSet : "$author" } + }} + , function(err, result) { + assert.equal(null, err); + assert.equal('good', result[0]._id.tags); + assert.deepEqual(['bob'], result[0].authors); + assert.equal('fun', result[1]._id.tags); + assert.deepEqual(['bob'], result[1].authors); + + db.close(); + }); + }); + }); + } else { + db.close(); + test.done(); + } + }); + }); + + ----- stats ----- diff --git a/_sources/api-generated/db.txt b/_sources/api-generated/db.txt index 65fa8c9955b..70bc34a1347 100644 --- a/_sources/api-generated/db.txt +++ b/_sources/api-generated/db.txt @@ -1895,7 +1895,7 @@ Options // Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Fetch basic indexInformation for collection db.indexInformation('more_index_information_test', function(err, indexInformation) { @@ -1972,17 +1972,17 @@ Drop a database. dbs = dbs.databases; // Did we find the db var found = false; - + // Check if we have the db in the list for(var i = 0; i < dbs.length; i++) { if(dbs[i].name == 'integration_tests_to_drop') found = true; } - + // We should not find the databases - assert.equal(false, found); - + if(process.env['JENKINS'] == null) assert.equal(false, found); + db.close(); - }); + }); }); }); }); diff --git a/_sources/changelog/changelog.txt b/_sources/changelog/changelog.txt index dd5e3fed0a2..b48901cd6d8 100644 --- a/_sources/changelog/changelog.txt +++ b/_sources/changelog/changelog.txt @@ -2,6 +2,17 @@ Changelog ========= +0.9.9.3 2012-02-23 +------------------ +* document: save callback arguments are both undefined, (Issue #518) +* Native BSON parser install error with npm, (Issue #517) + +0.9.9.2 2012-02-17 +------------------ +* Improved detection of Buffers using Buffer.isBuffer instead of instanceof. +* Added wrap error around db.dropDatabase to catch all errors (Issue #512) +* Added aggregate helper to collection, only for MongoDB >= 2.1 + 0.9.9.1 2012-02-15 ------------------ * Better handling of safe when using some commands such as createIndex, ensureIndex, addUser, removeUser, createCollection. diff --git a/_sources/github/github.txt b/_sources/github/github.txt index 1cac6b1781b..82be51714af 100644 --- a/_sources/github/github.txt +++ b/_sources/github/github.txt @@ -62,7 +62,7 @@ Web frameworks using MongoDB * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 20:47:37 on 15/1/2012 + - 23:45:35 on 17/1/2012 * - **Homepage** - http://search.npmjs.org/#/bread * - **Url** @@ -95,7 +95,7 @@ Web frameworks using MongoDB * - **Forks** - 1 * - **Watchers** - - 17 + - 18 Object Document Modeling Libraries ---------------------------------- @@ -134,7 +134,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 15:24:47 on 10/1/2012 + - 13:55:0 on 23/1/2012 * - **Homepage** - http:// * - **Url** @@ -142,9 +142,9 @@ Object Document Modeling Libraries * - **Clone Url** - https://github.com/LearnBoost/mongoose.git * - **Forks** - - 156 + - 160 * - **Watchers** - - 1666 + - 1695 .. topic:: mongo-model @@ -167,7 +167,7 @@ Object Document Modeling Libraries * - **Forks** - 3 * - **Watchers** - - 23 + - 24 .. topic:: mongodb-expressions @@ -262,7 +262,7 @@ Content Management Systems * - **Forks** - 97 * - **Watchers** - - 717 + - 728 Grid FS libraries or tools -------------------------- @@ -288,7 +288,7 @@ Grid FS libraries or tools * - **Forks** - 1 * - **Watchers** - - 6 + - 7 Wrapper libraries to ease the use of development or provide simple ODM like behaviours -------------------------------------------------------------------------------------- @@ -314,7 +314,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 18 * - **Watchers** - - 216 + - 226 .. topic:: mongoq @@ -360,7 +360,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 7 * - **Watchers** - - 67 + - 69 .. topic:: mongojs @@ -383,7 +383,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 8 * - **Watchers** - - 81 + - 90 .. topic:: mongode @@ -511,7 +511,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 8:10:6 on 14/1/2012 + - 13:48:57 on 20/1/2012 * - **Homepage** - http://http://github.com/meritt/easymongo * - **Url** @@ -521,7 +521,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 1 * - **Watchers** - - 2 + - 3 REST api's around MongoDB or resource based libraries ----------------------------------------------------- @@ -545,9 +545,9 @@ REST api's around MongoDB or resource based libraries * - **Clone Url** - https://github.com/tdegrunt/mongodb-rest.git * - **Forks** - - 19 + - 20 * - **Watchers** - - 111 + - 117 .. topic:: lazyBum @@ -829,7 +829,7 @@ General frameworks over MongoDB :header-rows: 0 * - **Activity Level** - - .. image:: ../static/active.png + - .. image:: ../static/nonactive.png * - **Last push** - 9:49:41 on 20/9/2011 * - **Homepage** @@ -913,7 +913,7 @@ Translation libraries or frameworks * - **Forks** - 12 * - **Watchers** - - 83 + - 84 Libraries or Applications for analytics --------------------------------------- @@ -937,9 +937,9 @@ Libraries or Applications for analytics * - **Clone Url** - https://github.com/square/cube.git * - **Forks** - - 118 + - 119 * - **Watchers** - - 1486 + - 1504 Libraries for the connect middleware ------------------------------------ @@ -965,7 +965,7 @@ Libraries for the connect middleware * - **Forks** - 2 * - **Watchers** - - 6 + - 8 .. topic:: connect-mongodb @@ -988,7 +988,7 @@ Libraries for the connect middleware * - **Forks** - 17 * - **Watchers** - - 125 + - 126 .. topic:: connect-mongo @@ -1009,9 +1009,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/kcbanner/connect-mongo.git * - **Forks** - - 21 + - 23 * - **Watchers** - - 76 + - 78 Libraries or applications for continous integration --------------------------------------------------- @@ -1037,11 +1037,34 @@ Libraries or applications for continous integration * - **Forks** - 15 * - **Watchers** - - 133 + - 135 Exampe applications ------------------- +.. topic:: nodejs-blackboard + + more testing, "social" blackboard + + .. list-table:: + :widths: 25 85 + :header-rows: 0 + + * - **Activity Level** + - .. image:: ../static/active.png + * - **Last push** + - 14:44:2 on 17/1/2012 + * - **Homepage** + - http://node.kamikazepanda.com + * - **Url** + - https://github.com/gotik/nodejs-blackboard + * - **Clone Url** + - https://github.com/gotik/nodejs-blackboard.git + * - **Forks** + - 4 + * - **Watchers** + - 9 + .. topic:: node-mongo-cms standard blog written in nodejs (express) and mongodb diff --git a/api-articles/index.html b/api-articles/index.html index 95cc4c49e19..c1a0d23f101 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -7,7 +7,7 @@ - Articles — MongoDB Node.JS Driver 0.9.9.1 documentation + Articles — MongoDB Node.JS Driver 0.9.9.3 documentation @@ -15,7 +15,7 @@ - +
  • @@ -132,7 +132,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -443,7 +443,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -931,7 +931,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -163,7 +163,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -180,7 +180,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -155,7 +155,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -431,7 +431,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -170,7 +170,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -1122,7 +1122,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -1527,6 +1527,7 @@

    createIndex
    Options
      +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a
    • unique {Boolean, default:false}, creates an unique index.
    • sparse {Boolean, default:false}, creates a sparse index.
    • background {Boolean, default:false}, creates the index in the background, yielding whenever possible.
    • @@ -1658,6 +1659,7 @@

      ensureIndex
      Options
        +
      • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a
      • unique {Boolean, default:false}, creates an unique index.
      • sparse {Boolean, default:false}, creates a sparse index.
      • background {Boolean, default:false}, creates the index in the background, yielding whenever possible.
      • @@ -2754,6 +2756,160 @@

        indexes +

        aggregate

        +

        Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.1

        +
        +
        +aggregate(pipline, callback)
        +
        +++ + + + + + +
        Arguments:
          +
        • pipline (array) – a pipleline containing all the object for the execution.
        • +
        • callback (function) – returns matching documents.
        • +
        +
        Returns:

        null

        +
        +
        + +

        Examples

        +
        +

        Correctly call the aggregation framework using a pipeline in an Array.

        +
        var Db = require('mongodb').Db,
        +    Server = require('mongodb').Server,
        +    ReplSetServers = require('mongodb').ReplSetServers,
        +    ObjectID = require('mongodb').ObjectID,
        +    Binary = require('mongodb').Binary,
        +    GridStore = require('mongodb').GridStore,
        +    Code = require('mongodb').Code,
        +    BSON = require('mongodb').pure().BSON,
        +    assert = require('assert');
        +
        +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
        + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
        +
        +// Establish connection to db
        +db.open(function(err, db) {
        +  // Some docs for insertion
        +  var docs = [{
        +      title : "this is my title", author : "bob", posted : new Date() ,
        +      pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 },
        +      comments : [
        +        { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" }
        +      ]}];
        +
        +  // Validate that we are running on at least version 2.1 of MongoDB
        +  db.admin().serverInfo(function(err, result){
        +
        +    if(parseInt((result.version.replace(/\./g, ''))) >= 210) {
        +      // Create a collection
        +      db.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArray', function(err, collection) {
        +        // Insert the docs
        +        collection.insert(docs, {safe:true}, function(err, result) {
        +
        +          // Execute aggregate, notice the pipeline is expressed as an Array
        +          collection.aggregate([
        +              { $project : {
        +                   author : 1,
        +                   tags : 1,
        +              }},
        +              { $unwind : "$tags" },
        +              { $group : {
        +                   _id : { tags : 1 },
        +                   authors : { $addToSet : "$author" }
        +              }}
        +            ], function(err, result) {
        +              assert.equal(null, err);
        +              assert.equal('good', result[0]._id.tags);
        +              assert.deepEqual(['bob'], result[0].authors);
        +              assert.equal('fun', result[1]._id.tags);
        +              assert.deepEqual(['bob'], result[1].authors);
        +
        +              db.close();
        +          });
        +        });
        +      });
        +    } else {
        +      db.close();
        +      test.done();
        +    }
        +  });
        +});
        +
        +
        +

        Correctly call the aggregation framework using a pipeline expressed as an argument list.

        +
        var Db = require('mongodb').Db,
        +    Server = require('mongodb').Server,
        +    ReplSetServers = require('mongodb').ReplSetServers,
        +    ObjectID = require('mongodb').ObjectID,
        +    Binary = require('mongodb').Binary,
        +    GridStore = require('mongodb').GridStore,
        +    Code = require('mongodb').Code,
        +    BSON = require('mongodb').pure().BSON,
        +    assert = require('assert');
        +
        +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
        + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
        +
        +// Establish connection to db
        +db.open(function(err, db) {
        +  // Some docs for insertion
        +  var docs = [{
        +      title : "this is my title", author : "bob", posted : new Date() ,
        +      pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 },
        +      comments : [
        +        { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" }
        +      ]}];
        +
        +  // Validate that we are running on at least version 2.1 of MongoDB
        +  db.admin().serverInfo(function(err, result){
        +
        +    if(parseInt((result.version.replace(/\./g, ''))) >= 210) {
        +      // Create a collection
        +      client.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArguments', function(err, collection) {
        +        // Insert the docs
        +        collection.insert(docs, {safe:true}, function(err, result) {
        +
        +          // Execute aggregate, notice the pipeline is expressed as function call parameters
        +          // instead of an Array.
        +          collection.aggregate(
        +              { $project : {
        +                   author : 1,
        +                   tags : 1,
        +              }},
        +              { $unwind : "$tags" },
        +              { $group : {
        +                   _id : { tags : 1 },
        +                   authors : { $addToSet : "$author" }
        +              }}
        +            , function(err, result) {
        +              assert.equal(null, err);
        +              assert.equal('good', result[0]._id.tags);
        +              assert.deepEqual(['bob'], result[0].authors);
        +              assert.equal('fun', result[1]._id.tags);
        +              assert.deepEqual(['bob'], result[1].authors);
        +
        +              db.close();
        +          });
        +        });
        +      });
        +    } else {
        +      db.close();
        +      test.done();
        +    }
        +  });
        +});
        +
        +
        +
        +

        stats

        Get all the collection statistics.

        @@ -2863,6 +3019,7 @@

        Page Contents

      • geoNear
      • geoHaystackSearch
      • indexes
      • +
      • aggregate
      • stats
      @@ -2900,6 +3057,7 @@

      Core Documentation

    • geoNear
    • geoHaystackSearch
    • indexes
    • +
    • aggregate
    • stats
    @@ -2960,7 +3118,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -1201,7 +1201,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -380,7 +380,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -2142,7 +2142,7 @@

    indexInformation// Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Fetch basic indexInformation for collection db.indexInformation('more_index_information_test', function(err, indexInformation) { @@ -2232,7 +2232,7 @@

    dropDatabase} // We should not find the databases - assert.equal(false, found); + if(process.env['JENKINS'] == null) assert.equal(false, found); db.close(); }); @@ -2436,7 +2436,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -356,7 +356,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -2080,7 +2080,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -388,7 +388,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.1 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • @@ -931,7 +931,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -163,7 +163,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -180,7 +180,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -155,7 +155,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -431,7 +431,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -170,7 +170,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -146,6 +146,29 @@

    buildInfo +

    serverStatus

    +

    Retrieve this db’s server status.

    +
    +
    +serverStatus(callback)
    +
    +++ + + + + + +
    Arguments:
      +
    • callback (function) – returns the server status.
    • +
    +
    Returns:

    null

    +
    +
    +

    profilingLevel

    @@ -1014,6 +1037,84 @@

    listDatabases +

    replSetGetStatus

    +

    Get ReplicaSet status

    +
    +
    +replSetGetStatus(callback)
    +
    +++ + + + + + +
    Arguments:
      +
    • callback (function) – returns the replica set status (if available).
    • +
    +
    Returns:

    null

    +
    +
    + +

    Examples

    +
    +

    Retrieve the current replicaset status if the server is running as part of a replicaset

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +
    +  // Drop the current database if it exists to avoid problems
    +  db.dropDatabase(function(err, done) {
    +
    +    // Grab a collection object
    +    db.collection('test', function(err, collection) {
    +
    +      // Force the creation of the collection by inserting a document
    +      // Collections are not created until the first document is inserted
    +      collection.insert({'a':1}, {safe:true}, function(err, doc) {
    +
    +        // Use the admin database for the operation
    +        db.admin(function(err, adminDb) {
    +
    +         // Add the new user to the admin database
    +         adminDb.addUser('admin', 'admin', function(err, result) {
    +
    +           // Authenticate using the newly added user
    +           adminDb.authenticate('admin', 'admin', function(err, result) {
    +
    +             // Retrive the server Info, returns error if we are not
    +             // running a replicaset
    +             adminDb.replSetGetStatus(function(err, info) {
    +               assert.ok(err != null);
    +
    +               db.close();
    +             })
    +           });
    +         });
    +       });
    +     });
    +   });
    + });
    + });
    +
    +
    +
    +

    @@ -1030,6 +1131,7 @@

    Page Contents

  • Admin()
  • @@ -1053,6 +1156,7 @@

    Core Documentation

  • Admin()
  • Cursor()
  • @@ -1122,7 +1227,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -3118,7 +3118,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -1201,7 +1201,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -380,7 +380,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -2436,7 +2436,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -356,7 +356,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • @@ -65,7 +65,8 @@

    Constructor Arguments:
    • db (db) – A database instance to interact with.
    • -
    • fileIdObject (string) – ObjectID or the name for the file.
    • +
    • id (objectid) – an unique ObjectID for this file
    • +
    • [filename] (string) – optional a filename for this file, no unique constrain on the field
    • mode (string) – set the mode for this file.
    • options (object) – optional properties to specify. Recognized keys:
    @@ -264,6 +265,70 @@

    open}); +

    A simple example showing how to save a file with a filename allowing for multiple files with the same name

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 1}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +  // Create a file and open it
    +  var gridStore = new GridStore(db, new ObjectID(), "test_gs_getc_file", "w");
    +  gridStore.open(function(err, gridStore) {
    +    // Write some content to the file
    +    gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) {
    +      // Flush the file to GridFS
    +      gridStore.close(function(err, fileData) {
    +        assert.equal(null, err);
    +
    +        // Create another file with same name and and save content to it
    +        gridStore = new GridStore(db, new ObjectID(), "test_gs_getc_file", "w");
    +        gridStore.open(function(err, gridStore) {
    +          // Write some content to the file
    +          gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) {
    +            // Flush the file to GridFS
    +            gridStore.close(function(err, fileData) {
    +              assert.equal(null, err);
    +
    +              // Open the file in read mode using the filename
    +              var gridStore2 = new GridStore(db, "test_gs_getc_file", "r");
    +              gridStore2.open(function(err, gridStore) {
    +
    +                // Read first character and verify
    +                gridStore.getc(function(err, chr) {
    +                  assert.equal('h', chr);
    +
    +                  // Open the file using an object id
    +                  gridStore2 = new GridStore(db, fileData._id, "r");
    +                  gridStore2.open(function(err, gridStore) {
    +
    +                    // Read first character and verify
    +                    gridStore.getc(function(err, chr) {
    +                      assert.equal('h', chr);
    +
    +                      db.close();
    +                    })
    +                  });
    +                });
    +              });
    +            });
    +          });
    +        });
    +      });
    +    });
    +  });
    +});
    +
    +
    @@ -388,7 +388,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.3 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • -

    Examples

    -
    -

    A simple example showing the usage of the binary put method.

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -// Create an empty Binary object
    -var binary = new Binary(new Buffer(''), BSON.BSON_BINARY_SUBTYPE_DEFAULT);
    -// Write some character to the Binary value
    -binary.put('h');
    -binary.put('e');
    -binary.put('l');
    -binary.put('l');
    -binary.put('o');
    -// Validate the content of the binary
    -assert.equal('hello', binary.toString('ascii'));
    -
    -
    -
    - @@ -443,7 +327,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -931,7 +931,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -163,7 +163,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -180,7 +180,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -155,7 +155,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -431,7 +431,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -170,7 +170,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -1155,8 +1155,6 @@

    replSetGetStatus// Retrive the server Info, returns error if we are not // running a replicaset adminDb.replSetGetStatus(function(err, info) { - assert.ok(err != null); - db.close(); }) }); @@ -1282,7 +1280,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -3118,7 +3118,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -1201,7 +1201,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -380,7 +380,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -2436,7 +2436,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -127,7 +127,7 @@

    putgrid.put(originalData, {}, function(err, result) { // Fetch the content grid.get(result._id, function(err, data) { - assert.deepEqual(originalData.toString('hex'), data.toString('hex')); + assert.deepEqual(originalData.toString('base64'), data.toString('base64')); db.close(); }); @@ -356,7 +356,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -391,7 +391,7 @@

    writeFile// Read back all the written content and verify the correctness GridStore.read(db, fileId, function(err, fileData) { - assert.equal(data.toString('hex'), fileData.toString('hex')) + assert.equal(data.toString('base64'), fileData.toString('base64')) assert.equal(fileSize, fileData.length); db.close(); @@ -439,7 +439,7 @@

    writeFile// Read back all the written content and verify the correctness GridStore.read(db, fileId, function(err, fileData) { - assert.equal(data.toString('hex'), fileData.toString('hex')); + assert.equal(data.toString('base64'), fileData.toString('base64')); assert.equal(fileSize, fileData.length); db.close(); @@ -1033,7 +1033,7 @@

    read// Read the entire file gs2.read(function(err, data2) { // Compare the file content against the orgiinal - assert.equal(data.toString('hex'), data2.toString('hex')); + assert.equal(data.toString('base64'), data2.toString('base64')); db.close(); }); @@ -2145,7 +2145,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -388,7 +388,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.5 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • @@ -327,7 +327,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -931,7 +931,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -163,7 +163,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -180,7 +180,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -155,7 +155,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -431,7 +431,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -170,7 +170,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -208,7 +208,7 @@

    serverStatusadminDb.authenticate('admin', 'admin', function(err, result) { // Retrive the server Info - adminDb.serverInfo(function(err, info) { + adminDb.serverStatus(function(err, info) { assert.equal(null, err); assert.ok(info != null); @@ -1280,7 +1280,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -556,95 +556,6 @@

    save¶ -

    Examples

    -
    -

    Example of a simple document save with safe set to false

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    - {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    -
    -// Establish connection to db
    -db.open(function(err, db) {
    -
    -  // Fetch the collection
    -  db.collection("save_a_simple_document", function(err, collection) {
    -
    -    // Save a document with no safe option
    -    collection.save({hello:'world'});
    -
    -    // Wait for a second
    -    setTimeout(function() {
    -
    -      // Find the saved document
    -      collection.findOne({hello:'world'}, function(err, item) {
    -        assert.equal(null, err);
    -        assert.equal('world', item.hello);
    -        db.close();
    -      });
    -    }, 1000);
    -  });
    -});
    -
    -
    -

    Example of a simple document save and then resave with safe set to true

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    - {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    -
    -// Establish connection to db
    -db.open(function(err, db) {
    -
    -  // Fetch the collection
    -  db.collection("save_a_simple_document_modify_it_and_resave_it", function(err, collection) {
    -
    -    // Save a document with no safe option
    -    collection.save({hello:'world'}, {safe:true}, function(err, result) {
    -
    -      // Find the saved document
    -      collection.findOne({hello:'world'}, function(err, item) {
    -        assert.equal(null, err);
    -        assert.equal('world', item.hello);
    -
    -        // Update the document
    -        item['hello2'] = 'world2';
    -
    -        // Save the item with the additional field
    -        collection.save(item, {safe:true}, function(err, result) {
    -
    -          // Find the changed document
    -          collection.findOne({hello:'world'}, function(err, item) {
    -            assert.equal(null, err);
    -            assert.equal('world', item.hello);
    -            assert.equal('world2', item.hello2);
    -
    -            db.close();
    -          });
    -        });
    -      });
    -    });
    -  });
    -});
    -
    -
    -
    -

    Example of a simple document update using upsert (the document will be inserted if it does not exist)

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    - {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    -
    -// Establish connection to db
    -db.open(function(err, db) {
    -
    -  // Get a collection
    -  db.collection('update_a_simple_document_upsert', function(err, collection) {
    -
    -    // Update the document using an upsert operation, ensuring creation if it does not exist
    -    collection.update({a:1}, {b:2, a:1}, {upsert:true, safe:true}, function(err, result) {
    -      assert.equal(null, err);
    -      assert.equal(1, result);
    -
    -      // Fetch the document that we modified and check if it got inserted correctly
    -      collection.findOne({a:1}, function(err, item) {
    -        assert.equal(null, err);
    -        assert.equal(1, item.a);
    -        assert.equal(2, item.b);
    -        db.close();
    -      });
    -    });
    -  });
    -});
    -
    -
    -

    Example of an update across multiple documents using the multi option.

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    - {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    -
    -// Establish connection to db
    -db.open(function(err, db) {
    -
    -  // Get a collection
    -  db.collection('update_a_simple_document_multi', function(err, collection) {
    -
    -    // Insert a couple of documentations
    -    collection.insert([{a:1, b:1}, {a:1, b:2}], {safe:true}, function(err, result) {
    -
    -      // Update multiple documents using the multi option
    -      collection.update({a:1}, {$set:{b:0}}, {safe:true, multi:true}, function(err, numberUpdated) {
    -        assert.equal(null, err);
    -        assert.equal(2, numberUpdated);
    -
    -        // Fetch all the documents and verify that we have changed the b value
    -        collection.find().toArray(function(err, items) {
    -          assert.equal(null, err);
    -          assert.equal(1, items[0].a);
    -          assert.equal(0, items[0].b);
    -          assert.equal(1, items[1].a);
    -          assert.equal(0, items[1].b);
    -
    -          db.close();
    -        });
    -      })
    -    });
    -  });
    -});
    -
    -
    -
    -

    Example of running the distinct command against a collection with a filter query

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    - {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    -
    -// Establish connection to db
    -db.open(function(err, db) {
    -
    -  // Crete the collection for the distinct example
    -  db.createCollection('simple_key_based_distinct_sub_query_filter', function(err, collection) {
    -
    -    // Insert documents to perform distinct against
    -    collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}},
    -      {a:2, b:{c:'a'}}, {a:3}, {a:3}, {a:5, c:1}], {safe:true}, function(err, ids) {
    -
    -      // Peform a distinct query with a filter against the documents
    -      collection.distinct('a', {c:1}, function(err, docs) {
    -        assert.deepEqual([5], docs.sort());
    -
    -        db.close();
    -      });
    -    })
    -  });
    -});
    -
    -
    -
    -

    A simple map reduce example using the inline output type on MongoDB > 1.7.6

    +

    A simple map reduce example using the inline output type on MongoDB > 1.7.6 returning the statistics

    var Db = require('mongodb').Db,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
    @@ -2125,8 +1737,9 @@ 

    mapReducevar reduce = function(k,vals) { return 1; }; // Execute map reduce and return results inline - collection.mapReduce(map, reduce, {out : {inline: 1}}, function(err, results) { + collection.mapReduce(map, reduce, {out : {inline: 1}, verbose:true}, function(err, results, stats) { assert.equal(2, results.length); + assert.ok(stats != null); db.close(); }); @@ -2366,43 +1979,6 @@

    options
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    - {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    -
    -// Establish connection to db
    -db.open(function(err, db) {
    -
    -  // Create a test collection that we are getting the options back from
    -  db.createCollection('test_collection_options', {'capped':true, 'size':1024}, function(err, collection) {
    -    assert.ok(collection instanceof Collection);
    -    assert.equal('test_collection_options', collection.collectionName);
    -
    -    // Let's fetch the collection options
    -    collection.options(function(err, options) {
    -      assert.equal(true, options.capped);
    -      assert.equal(1024, options.size);
    -      assert.equal("test_collection_options", options.create);
    -
    -      db.close();
    -    });
    -  });
    -});
    -
    -

    -
    - - - @@ -3118,7 +2531,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -1201,7 +1201,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -380,7 +380,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -2436,7 +2436,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -356,7 +356,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -2145,7 +2145,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -149,7 +149,9 @@

    pause }); // For each data item - stream.on("end", function(item) {}); + stream.on("end", function(item) { + stream.destroy(); + }); // When the stream is done stream.on("close", function() { db.close(); @@ -264,7 +266,7 @@

    resume// Open the file file.open(function(err, file) { // Peform a find to get a cursor - var stream = file.stream(); + var stream = file.stream(true); // For each data item stream.on("data", function(item) { @@ -388,7 +390,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.6 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • @@ -327,7 +327,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -931,7 +931,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -163,7 +163,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -180,7 +180,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -155,7 +155,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -431,7 +431,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -170,7 +170,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -847,21 +847,19 @@

    profilingInfoadminDb.setProfilingLevel('all', function(err, level) { // Execute a query command - collection.find(function(err, cursor) { - cursor.toArray(function(err, items) { + collection.find().toArray(function(err, items) { - // Turn off profiling - adminDb.setProfilingLevel('off', function(err, level) { + // Turn off profiling + adminDb.setProfilingLevel('off', function(err, level) { - // Retrive the profiling information - adminDb.profilingInfo(function(err, infos) { - assert.ok(infos.constructor == Array); - assert.ok(infos.length >= 1); - assert.ok(infos[0].ts.constructor == Date); - assert.ok(infos[0].millis.constructor == Number); + // Retrive the profiling information + adminDb.profilingInfo(function(err, infos) { + assert.ok(infos.constructor == Array); + assert.ok(infos.length >= 1); + assert.ok(infos[0].ts.constructor == Date); + assert.ok(infos[0].millis.constructor == Number); - db.close(); - }); + db.close(); }); }); }); @@ -1280,7 +1278,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -556,6 +556,95 @@

    save¶ +

    Examples

    +
    +

    Example of a simple document save with safe set to false

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +
    +  // Fetch the collection
    +  db.collection("save_a_simple_document", function(err, collection) {
    +
    +    // Save a document with no safe option
    +    collection.save({hello:'world'});
    +
    +    // Wait for a second
    +    setTimeout(function() {
    +
    +      // Find the saved document
    +      collection.findOne({hello:'world'}, function(err, item) {
    +        assert.equal(null, err);
    +        assert.equal('world', item.hello);
    +        db.close();
    +      });
    +    }, 1000);
    +  });
    +});
    +
    +
    +

    Example of a simple document save and then resave with safe set to true

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +
    +  // Fetch the collection
    +  db.collection("save_a_simple_document_modify_it_and_resave_it", function(err, collection) {
    +
    +    // Save a document with no safe option
    +    collection.save({hello:'world'}, {safe:true}, function(err, result) {
    +
    +      // Find the saved document
    +      collection.findOne({hello:'world'}, function(err, item) {
    +        assert.equal(null, err);
    +        assert.equal('world', item.hello);
    +
    +        // Update the document
    +        item['hello2'] = 'world2';
    +
    +        // Save the item with the additional field
    +        collection.save(item, {safe:true}, function(err, result) {
    +
    +          // Find the changed document
    +          collection.findOne({hello:'world'}, function(err, item) {
    +            assert.equal(null, err);
    +            assert.equal('world', item.hello);
    +            assert.equal('world2', item.hello2);
    +
    +            db.close();
    +          });
    +        });
    +      });
    +    });
    +  });
    +});
    +
    +
    +
    +

    Example of a simple document update using upsert (the document will be inserted if it does not exist)

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +
    +  // Get a collection
    +  db.collection('update_a_simple_document_upsert', function(err, collection) {
    +
    +    // Update the document using an upsert operation, ensuring creation if it does not exist
    +    collection.update({a:1}, {b:2, a:1}, {upsert:true, safe:true}, function(err, result) {
    +      assert.equal(null, err);
    +      assert.equal(1, result);
    +
    +      // Fetch the document that we modified and check if it got inserted correctly
    +      collection.findOne({a:1}, function(err, item) {
    +        assert.equal(null, err);
    +        assert.equal(1, item.a);
    +        assert.equal(2, item.b);
    +        db.close();
    +      });
    +    });
    +  });
    +});
    +
    +
    +

    Example of an update across multiple documents using the multi option.

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +
    +  // Get a collection
    +  db.collection('update_a_simple_document_multi', function(err, collection) {
    +
    +    // Insert a couple of documentations
    +    collection.insert([{a:1, b:1}, {a:1, b:2}], {safe:true}, function(err, result) {
    +
    +      // Update multiple documents using the multi option
    +      collection.update({a:1}, {$set:{b:0}}, {safe:true, multi:true}, function(err, numberUpdated) {
    +        assert.equal(null, err);
    +        assert.equal(2, numberUpdated);
    +
    +        // Fetch all the documents and verify that we have changed the b value
    +        collection.find().toArray(function(err, items) {
    +          assert.equal(null, err);
    +          assert.equal(1, items[0].a);
    +          assert.equal(0, items[0].b);
    +          assert.equal(1, items[1].a);
    +          assert.equal(0, items[1].b);
    +
    +          db.close();
    +        });
    +      })
    +    });
    +  });
    +});
    +
    +
    +
    +

    Example of running the distinct command against a collection with a filter query

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +
    +  // Crete the collection for the distinct example
    +  db.createCollection('simple_key_based_distinct_sub_query_filter', function(err, collection) {
    +
    +    // Insert documents to perform distinct against
    +    collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}},
    +      {a:2, b:{c:'a'}}, {a:3}, {a:3}, {a:5, c:1}], {safe:true}, function(err, ids) {
    +
    +      // Peform a distinct query with a filter against the documents
    +      collection.distinct('a', {c:1}, function(err, docs) {
    +        assert.deepEqual([5], docs.sort());
    +
    +        db.close();
    +      });
    +    })
    +  });
    +});
    +
    +
    +

    findAndModify

    @@ -1241,7 +1629,7 @@

    createIndex// Create an index on the a field collection.createIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Show that duplicate records got dropped collection.find({}).toArray(function(err, items) { @@ -1333,7 +1721,7 @@

    ensureIndex// Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Show that duplicate records got dropped collection.find({}).toArray(function(err, items) { @@ -1417,7 +1805,7 @@

    indexInformation// Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Fetch basic indexInformation for collection collection.indexInformation(function(err, indexInformation) { @@ -1493,7 +1881,7 @@

    dropIndex// Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Drop the index collection.dropIndex("a_1_b_1", function(err, result) { @@ -1581,7 +1969,7 @@

    reIndexdb.open(function(err, db) { // Create a collection we want to drop later - db.createCollection('create_and_drop_all_indexes', function(err, collection) { + db.createCollection('shouldCorrectlyForceReindexOnCollection', function(err, collection) { assert.equal(null, err); // Insert a bunch of documents for the index @@ -1591,7 +1979,7 @@

    reIndex// Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Force a reindex of the collection collection.reIndex(function(err, result) { @@ -1616,7 +2004,7 @@

    reIndex

    mapReduce

    -

    Run Map Reduce across a collection.

    +

    Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.

    Options

    + + + + @@ -2531,7 +3119,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -318,23 +318,22 @@

    eachcollection.insert({'a':1}, {safe:true}, function(err, ids) { // Grab a cursor - collection.find(function(err, cursor) { + var cursor = collection.find(); - // Execute the each command, triggers for each document - cursor.each(function(err, item) { + // Execute the each command, triggers for each document + cursor.each(function(err, item) { - // If the item is null then the cursor is exhausted/empty and closed - if(item == null) { + // If the item is null then the cursor is exhausted/empty and closed + if(item == null) { - // Show that the cursor is closed - cursor.toArray(function(err, items) { - assert.ok(err != null); + // Show that the cursor is closed + cursor.toArray(function(err, items) { + assert.ok(err != null); - // Let's close the db - db.close(); - }); - }; - }); + // Let's close the db + db.close(); + }); + }; }); }); }); @@ -485,14 +484,14 @@

    limit

    Sets the limit parameter of this cursor to the given value.

    -limit(limit, callback)
    +limit(limit[, callback])
    @@ -549,14 +548,14 @@

    skip

    Sets the skip parameter of this cursor to the given value.

    -skip(skip, callback)
    +skip(skip[, callback])

    Arguments:
    • limit (number) – the new limit.
    • -
    • callback (function) – this will be called after executing this method. The first parameter will contain an error object when the limit given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
    • +
    • [callback] (function) – this optional callback will be called after executing this method. The first parameter will contain an error object when the limit given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
    @@ -613,14 +612,14 @@

    batchSize
    -batchSize(batchSize, callback)
    +batchSize(batchSize[, callback])

    Arguments:
    • skip (number) – the new skip value.
    • -
    • callback (function) – this will be called after executing this method. The first parameter will contain an error object when the skip value given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
    • +
    • [callback] (function) – this optional callback will be called after executing this method. The first parameter will contain an error object when the skip value given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
    @@ -1201,7 +1200,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -380,7 +380,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -1564,7 +1564,7 @@

    previousErrorsassert.equal(null, err); // Force a unique index - collection.ensureIndex({a:1}, {unique:true}, function(err, result) { + collection.ensureIndex({a:1}, {unique:true, safe:true}, function(err, result) { assert.equal(null, err); // Force some errors @@ -1644,7 +1644,7 @@

    resetErrorHistoryassert.equal(null, err); // Force a unique index - collection.ensureIndex({a:1}, {unique:true}, function(err, result) { + collection.ensureIndex({a:1}, {unique:true, safe:true}, function(err, result) { assert.equal(null, err); // Force some errors @@ -1740,7 +1740,7 @@

    createIndex// Create an index on the a field db.createIndex('more_complex_index_test', {a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Show that duplicate records got dropped collection.find({}).toArray(function(err, items) { @@ -1833,7 +1833,7 @@

    ensureIndex// Create an index on the a field db.ensureIndex('more_complex_ensure_index_test', {a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Show that duplicate records got dropped collection.find({}).toArray(function(err, items) { @@ -1985,7 +1985,7 @@

    dropIndex// Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Drop the index db.dropIndex("create_and_drop_an_index", "a_1_b_1", function(err, result) { @@ -2058,7 +2058,7 @@

    reIndex// Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { // Force a reindex of the collection db.reIndex('create_and_drop_all_indexes', function(err, result) { @@ -2219,23 +2219,26 @@

    dropDatabasedb.dropDatabase(function(err, result) { assert.equal(null, err); - // Get the admin database - db.admin().listDatabases(function(err, dbs) { - // Grab the databases - dbs = dbs.databases; - // Did we find the db - var found = false; + // Wait to seconds to let it replicate across + setTimeout(function() { + // Get the admin database + db.admin().listDatabases(function(err, dbs) { + // Grab the databases + dbs = dbs.databases; + // Did we find the db + var found = false; - // Check if we have the db in the list - for(var i = 0; i < dbs.length; i++) { - if(dbs[i].name == 'integration_tests_to_drop') found = true; - } + // Check if we have the db in the list + for(var i = 0; i < dbs.length; i++) { + if(dbs[i].name == 'integration_tests_to_drop') found = true; + } - // We should not find the databases - if(process.env['JENKINS'] == null) assert.equal(false, found); + // We should not find the databases + if(process.env['JENKINS'] == null) assert.equal(false, found); - db.close(); - }); + db.close(); + }); + }, 2000); }); }); }); @@ -2436,7 +2439,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -356,7 +356,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -1676,9 +1676,11 @@

    GridStore.list// Establish connection to db db.open(function(err, db) { + // Our file id + var fileId = new ObjectID(); // Open a file for writing - var gridStore = new GridStore(db, "foobar2", "w"); + var gridStore = new GridStore(db, fileId, "foobar2", "w"); gridStore.open(function(err, gridStore) { // Write some content to the file @@ -1728,8 +1730,10 @@

    GridStore.listassert.ok(items.length >= 0); assert.ok(!found); + // Specify seperate id + var fileId2 = new ObjectID(); // Write another file to GridFS - var gridStore2 = new GridStore(db, "foobar3", "w"); + var gridStore2 = new GridStore(db, fileId2, "foobar3", "w"); gridStore2.open(function(err, gridStore) { // Write the content gridStore2.write('my file', function(err, gridStore) { @@ -2145,7 +2149,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -390,7 +390,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • - + @@ -76,7 +76,7 @@

    Web frameworks using MongoDB

    - +
    Arguments:
    • batchSize (number) – the new batch size.
    • -
    • callback (function) – this will be called after executing this method. The first parameter will contain an error object when the batchSize given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
    • +
    • [callback] (function) – this optional callback will be called after executing this method. The first parameter will contain an error object when the batchSize given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -458,7 +458,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -686,7 +686,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -976,7 +976,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • Last push23:23:51 on 15/2/20120:19:12 on 12/3/2012
    Homepage http://Watchers56
    @@ -97,7 +97,7 @@

    Web frameworks using MongoDBLast push -8:44:25 on 14/2/2012 +3:0:43 on 9/3/2012 Homepage http:// @@ -112,7 +112,7 @@

    Web frameworks using MongoDBWatchers -4 +5 @@ -184,7 +184,7 @@

    Web frameworks using MongoDBWatchers -18 +19 @@ -244,7 +244,7 @@

    Object Document Modeling LibrariesLast push -17:43:49 on 15/2/2012 +18:58:47 on 9/3/2012 Homepage http:// @@ -256,10 +256,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git Forks -170 +178 Watchers -1782 +1876 @@ -280,7 +280,7 @@

    Object Document Modeling LibrariesLast push -12:36:28 on 24/1/2012 +14:48:3 on 31/2/2012 Homepage http://http://alexeypetrushin.github.com/mongo-model @@ -292,10 +292,10 @@

    Object Document Modeling Librarieshttps://github.com/alexeypetrushin/mongo-model.git Forks -3 +4 Watchers -27 +35 @@ -312,7 +312,7 @@

    Object Document Modeling Libraries Activity Level -../_images/active.png +../_images/nonactive.png Last push @@ -427,10 +427,10 @@

    Content Management SystemsLast push -8:56:17 on 10/1/2012 +16:57:40 on 11/3/2012 Homepage -http:// +http://calip.so Url https://github.com/cliftonc/calipso @@ -439,10 +439,10 @@

    Content Management Systemshttps://github.com/cliftonc/calipso.git Forks -105 +109 Watchers -754 +778 @@ -505,7 +505,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -18:21:16 on 14/2/2012 +11:34:57 on 5/3/2012 Homepage http:// @@ -517,10 +517,10 @@

    Wrapper libraries to ease the use of development or provide simple ODM like https://github.com/guileen/node-mongoskin.git Forks -20 +24 Watchers -248 +278 @@ -592,7 +592,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 7 Watchers -71 +76 @@ -628,7 +628,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 8 Watchers -108 +127 @@ -649,7 +649,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -5:52:4 on 24/1/2012 +5:14:49 on 11/3/2012 Homepage http:// @@ -664,7 +664,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 1 Watchers -34 +36 @@ -697,10 +697,10 @@

    Wrapper libraries to ease the use of development or provide simple ODM like https://github.com/idottv/node-mongodb-wrapper.git Forks -4 +5 Watchers -26 +28 @@ -757,7 +757,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -21:22:2 on 13/2/2012 +18:10:31 on 27/2/2012 Homepage http:// @@ -772,7 +772,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 1 Watchers -1 +3 @@ -829,7 +829,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -12:40:4 on 28/1/2012 +12:37:47 on 23/2/2012 Homepage http://http://github.com/meritt/easymongo @@ -844,7 +844,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 1 Watchers -3 +7 @@ -864,7 +864,7 @@

    REST api’s around MongoDB or resource based libraries Activity Level -../_images/active.png +../_images/nonactive.png Last push @@ -880,10 +880,10 @@

    REST api’s around MongoDB or resource based librarieshttps://github.com/tdegrunt/mongodb-rest.git Forks -21 +24 Watchers -125 +129 @@ -900,7 +900,7 @@

    REST api’s around MongoDB or resource based libraries Activity Level -../_images/active.png +../_images/nonactive.png Last push @@ -1030,7 +1030,7 @@

    Test helpers and librariesWatchers -27 +30 @@ -1089,7 +1089,7 @@

    Queue libraries using MongoDB Activity Level -../_images/active.png +../_images/nonactive.png Last push @@ -1125,7 +1125,7 @@

    Queue libraries using MongoDB Activity Level -../_images/active.png +../_images/nonactive.png Last push @@ -1144,7 +1144,7 @@

    Queue libraries using MongoDBWatchers -63 +65 @@ -1183,7 +1183,7 @@

    Logging libraries or applicationsWatchers -3 +4 @@ -1204,7 +1204,7 @@

    Logging libraries or applicationsLast push -15:48:0 on 14/2/2012 +6:56:41 on 4/3/2012 Homepage http://http://kaba-cceac.github.com/nodeEventStore/ @@ -1240,7 +1240,7 @@

    Logging libraries or applicationsLast push -20:40:20 on 19/11/2011 +19:45:47 on 1/3/2012 Homepage http://dev/null @@ -1255,7 +1255,7 @@

    Logging libraries or applicationsWatchers -15 +14 @@ -1294,7 +1294,7 @@

    Monitoring applications or librariesWatchers -3 +11 @@ -1333,7 +1333,7 @@

    General frameworks over MongoDBWatchers -20 +21 @@ -1389,7 +1389,7 @@

    Translation libraries or frameworks Activity Level -../_images/active.png +../_images/nonactive.png Last push @@ -1405,10 +1405,10 @@

    Translation libraries or frameworkshttps://github.com/masylum/dialect-http.git Forks -5 +6 Watchers -21 +23 @@ -1429,7 +1429,7 @@

    Translation libraries or frameworksLast push -13:50:41 on 29/0/2012 +9:21:6 on 22/2/2012 Homepage http:// @@ -1441,10 +1441,10 @@

    Translation libraries or frameworkshttps://github.com/masylum/dialect.git Forks -12 +14 Watchers -86 +92 @@ -1468,7 +1468,7 @@

    Libraries or Applications for analyticsLast push -18:34:32 on 26/0/2012 +17:10:35 on 11/3/2012 Homepage http://http://square.github.com/cube @@ -1480,10 +1480,10 @@

    Libraries or Applications for analyticshttps://github.com/square/cube.git Forks -120 +136 Watchers -1554 +1685 @@ -1503,11 +1503,11 @@

    Libraries for the connect middleware Activity Level -../_images/nonactive.png +../_images/active.png Last push -21:22:25 on 13/8/2011 +5:6:21 on 24/2/2012 Homepage http://https://github.com/bartt/connect-session-mongo @@ -1522,7 +1522,7 @@

    Libraries for the connect middlewareWatchers -10 +9 @@ -1555,10 +1555,10 @@

    Libraries for the connect middlewarehttps://github.com/masylum/connect-mongodb.git Forks -18 +21 Watchers -131 +139 @@ -1579,7 +1579,7 @@

    Libraries for the connect middlewareLast push -18:50:9 on 14/11/2011 +15:8:21 on 6/3/2012 Homepage http:// @@ -1591,10 +1591,10 @@

    Libraries for the connect middlewarehttps://github.com/kcbanner/connect-mongo.git Forks -32 +37 Watchers -87 +101 @@ -1618,7 +1618,7 @@

    Libraries or applications for continous integration Last push -7:45:48 on 28/1/2012 +14:19:55 on 11/3/2012 Homepage http:// @@ -1630,10 +1630,10 @@

    Libraries or applications for continous integrationhttps://github.com/ryankee/concrete.git Forks -16 +17 Watchers -142 +147 @@ -1657,7 +1657,7 @@

    Exampe applicationsLast push -14:44:2 on 17/1/2012 +2:15:58 on 8/3/2012 Homepage http://node.kamikazepanda.com @@ -1672,7 +1672,7 @@

    Exampe applicationsWatchers -10 +12 @@ -1708,7 +1708,7 @@

    Exampe applicationsWatchers -2 +3 @@ -1800,7 +1800,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • @@ -114,7 +114,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 0.9.9.7 documentation »
  • +
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • diff --git a/genindex.html b/genindex.html index 251d51ee0d7..bf83c73f1a9 100644 --- a/genindex.html +++ b/genindex.html @@ -697,17 +697,21 @@

    R

    removeUser() (built-in function), [1]
    -

    -
    rename() (built-in function)
    +
    +
    renameCollection() (built-in function)
    +
    ReplSet() (class) +
    + +
    replSetGetStatus() (built-in function)
    @@ -746,6 +750,10 @@

    S

    +
    Server() (class) +
    + +
    serverStatus() (built-in function)
    diff --git a/github/github.html b/github/github.html index 19791c3edfc..9e55680ffa6 100644 --- a/github/github.html +++ b/github/github.html @@ -1483,7 +1483,7 @@

    Libraries or Applications for analyticsWatchers -1685 +1686 diff --git a/index.html b/index.html index 39eb18a01c5..684b9cf0292 100644 --- a/index.html +++ b/index.html @@ -97,6 +97,8 @@

    API DocumentationGridStore()
  • ReadStream()
  • Grid()
  • +
  • Server()
  • +
  • ReplSet
  • Binary JSON API
      diff --git a/objects.inv b/objects.inv index 7ed4168a355ff6048e42f8980a679af808a5f71c..e77794ac7d42db599b871c3873ea56f28d3eef26 100644 GIT binary patch delta 1135 zcmV-#1d#jI3F!%tiGRUz+cprr`ztupUZqYBz2qiYPVCl^GEy>~X{QH}SW<{VfCWHB z>h$Bg0A*2RC=q~s@`%7<7rSqFAJ(O$Oi!WWTF);z$|NLw z*+eWxw@XBeQB@Kr7-zwghznSyV8>*wAC!_xdn>qA_-U9D`6SDp!q zb&BPO>nS2R2e))y3Ir+P{zif$!%O`zLstRbZo2io3 zjC0ovA%8qd=pW;f$QzI){q?O%eYX}wL&f&!kzjZGvh|sBnD?cR$-j0DJ=n<&LPtCL zxxxbE5{XN&DqAitS2i1iv)E%^FNh&2(Id#|aSf(dltzUrBRs1)t~N<}fo=58u|K=P zd$rozof}ZQrqc~OM!WTXqZn%uXQYMfJxB}LcYjFBiCg;i;Vz0#;$BU(&rCHmdH=|4 zQXV4uQ7w?CzJzzAnNs8sRMF>~)pGg<&}kD!2PI>-PTj!RP9gI>qZ_pXTOt-(+hkVi z;h&oDC@Y*hDI!2I!qJT_9}02ioC%`FAfLKTL+F8h1f6+p?bFP8;sbi}CVsOcyoOai zE`O>IWh!|`kWpOmBy_#{dGh=p%xvd%o`b^Xa;YO-jY8-3aU~D~Fxa>|jmY&cJ`e$G zLX7imA&(%$U6Bjrd7v{IdCPN0{|QP)i7Kc#5+tNb8$(R310VH|_^6F$Mhe1cj(bKw zLmu}iYakI3(zCi2rMP`+d=;7%0_dC6#edLTTsM)v3`+|I?7JP7_ec(CM)qDRXzaGkmKbha~}o1$*1{Yr$BdJwt}%`bOq|54W(Q+aIAWz)Ss=EC~)IojBn{drkmZ}&phDTfgPLfxjb@dK&WKc9JiAdgwmjazmc&s(3=^2x9*3Qlcw8;)xWf6oQD2q<9`IvOVAZP BFJAxv delta 1116 zcmV-i1f%=u3DyaaiGNLx+cprr@2?QhT7%HzOvYfAo0@<~$5 zA$h7l-4!4Pj9$MUEt;tsh|0FziOsj;v`sVNGb!M1F<(QTe1FsLGETHk-X^4ClT=GF z!L>mV1N7HSQfN%yB$K;mDT-;XWI1O>*Os{znPE~48}oYl$yh-tckoq%8nA4QXxf@o zO6H6+Q9OxUUbP~$WTG`Jz$~rva+Z2HYFG){kg{r5NQud|8}=_;-8QpIOVwIsTPt3i zm9S-sC;jUK7=Humzm5CzcfA-fMzPcy_+hm|F{+JJXA%Fz#P4tzNfI9Y1rDu|-m=`R zS+O-yNB^#vf%lAGKl*^P81*l&%Z=|W({F&ow6!;KgP{>cl-G-Nnn@vWNpEqA_-S*>l3N1h3a zJjL?E^%9YsgBv=h0zpc+KaF_1`~g9?aiHT&n^1fj`3QSoi2Vppm*s~&Zmfe(jHU4` zzx&bVK!%&}uOX9)>L5m1xnn#nMkr+9w0a2zqIm~V9&^z8%a(|^deZl#s(=QEnJQV$ zICsqu!hf@b@iDH5ya8F#-+mU=cex-MDs_(@Np`m{*D-Se^FH*k_}8wX2M4)9=x9ej z->?9=MBx&=RZSO{nXS&jS?;l}7sQa1=n>@fvYv@@ zy?X5(&Q>3M6`BE!K$I5gGW}^ z>LH>{S%LEPCA?A1lp=>9qMvV8%jr)*R9iGydtv=&jyJ%5q|E}Fd@-=cy=`tfFQ3%j=zi&3T6qDLg( z0L=<%-2VDD2d>N0-k!DaUWstY4MN*cn7c$rr`bJ(d7^yapxw=H?*Ib!reWnEO?4c> zsgA$>FM1wNT_5p?kq=#$G1K8GP&-iJe0q9xeTE(I5X%;NOHzXWL)02;aO@eXu2s|i zBNWQ>&(Y4#>YtbQ>&;$Bn{pV@0n|-8dmJFu8mP^}3zq47F7?<0$iNL?Olo$jf>0Xt i9B*Xo3+2s1x=Yxhbka24F#by|<23aD4*vtvm?``~#W5WK diff --git a/searchindex.js b/searchindex.js index 11deefba697..b7d195ff290 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{DBRef:[3,0,1,""],removeUser:[19,1,1,""],profilingInfo:[22,1,1,""],getNumBitsAbs:[31,1,1,""],batchSize:[9,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],MinKey:[5,0,1,""],shiftRight:[31,1,1,""],writeFile:[4,1,1,""],getTimestamp:[20,1,1,""],Grid:[29,0,1,""],replSetGetStatus:[22,1,1,""],indexInformation:[19,1,1,""],previousErrors:[19,1,1,""],CursorStream:[33,0,1,""],findAndModify:[16,1,1,""],renameCollection:[19,1,1,""],toHexString:[20,1,1,""],indexExists:[16,1,1,""],getLowBits:[31,1,1,""],streamRecords:[9,1,1,""],ObjectID:[20,0,1,""],isNegative:[31,1,1,""],lessThan:[31,1,1,""],isCapped:[16,1,1,""],dropAllIndexes:[16,1,1,""],lastError:[19,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],Long:[14,0,1,""],dropIndex:[19,1,1,""],findAndRemove:[16,1,1,""],cursorInfo:[19,1,1,""],geoNear:[16,1,1,""],toString:[31,1,1,""],listDatabases:[22,1,1,""],isOdd:[31,1,1,""],calculateObjectSize:[1,1,1,""],dropDatabase:[19,1,1,""],mapReduce:[16,1,1,""],Cursor:[9,0,1,""],MaxKey:[10,0,1,""],resetErrorHistory:[19,1,1,""],toArray:[9,1,1,""],reIndex:[19,1,1,""],collectionsInfo:[19,1,1,""],greaterThanOrEqual:[31,1,1,""],Binary:[28,0,1,""],valueOf:[30,1,1,""],validateCollection:[22,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],Timestamp:[31,0,1,""],Symbol:[30,0,1,""],dropCollection:[19,1,1,""],Collection:[16,0,1,""],toNumber:[31,1,1,""],isZero:[31,1,1,""],getHighBits:[31,1,1,""],shiftLeft:[31,1,1,""],createCollection:[19,1,1,""],greaterThan:[31,1,1,""],getLowBitsUnsigned:[31,1,1,""],geoHaystackSearch:[16,1,1,""],lessThanOrEqual:[31,1,1,""],notEquals:[31,1,1,""],GridStore:[4,0,1,""],findOne:[16,1,1,""],ensureIndex:[19,1,1,""],chunkCollection:[4,1,1,""],nextObject:[9,1,1,""],"generationTime number [Getter|Setter]":[20,2,1,""],toJSON:[31,1,1,""],Db:[19,0,1,""],serverStatus:[22,1,1,""],profilingLevel:[22,1,1,""],collectionNames:[19,1,1,""],ReadStream:[7,0,1,""],setProfilingLevel:[22,1,1,""],Admin:[22,0,1,""],Double:[15,0,1,""],shiftRightUnsigned:[31,1,1,""],isClosed:[9,1,1,""],BSON:[1,0,1,""],addUser:[19,1,1,""],toInt:[31,1,1,""],deserializeStream:[1,1,1,""],createIndex:[19,1,1,""],buildInfo:[22,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[20,1,1,""],createFromHexString:[20,1,1,""]},Timestamp:{fromBits:[31,1,1,""],fromNumber:[31,1,1,""],fromInt:[31,1,1,""],fromString:[31,1,1,""]},Db:{connect:[19,1,1,""]},Long:{fromBits:[14,1,1,""],fromNumber:[14,1,1,""],fromInt:[14,1,1,""],fromString:[14,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:13,returnkei:[18,9,16],maxscan:[18,9,16],readfilesync:4,prefix:[18,34],crete:16,createindex:[19,16,18,6,24,8],world_safe2:16,world_safe1:16,pedro:11,test_map_reduce_functions_inlin:16,deviat:18,under:18,everi:[0,9,27,21],test_gs_seek_with_buff:4,arrj:13,simple_next_object_collect:9,upload:21,correct:[1,19,20,18,4,35],gotik:[13,17],"10k":18,cceac:13,seper:4,direct:[6,9,35],second:[19,12,2,18,20,4,34,16,36,27,9],street:13,aggreg:[18,24,8,16],even:[0,32,16],attemp:[18,19,16],neg:[18,14,31],"while":[0,18,4,21,9],"new":[0,1,2,18,4,6,7,9,12,14,22,16,34,19,20,21,27,29,31,33,35,36],net:13,metadata:[21,36,4],"_event":18,rootcollect:4,never:[18,19],here:[35,36,4],epce4qkoh5:32,io_seek_set:4,anymor:18,loos:[13,35],getlowbit:[23,14,31,8],findandmodifi:[18,16,24,8,12],vincentcr:18,pvorb:13,schemaless:35,sessionstorag:13,middlewar:[13,32],sarah:16,describ:32,would:[0,19,16,18,14,6,36,31],aaron:18,concret:13,overhead:35,recommend:[35,32,16],type:[10,11,1,16,21,3,22,4,5,32,15,36,35,28,30,18,37],tell:[19,16,4,24,35,36,8],relat:6,notic:[35,36,16],warn:[16,19,12],exce:4,hold:[35,1,4,9],must:[0,31,14,16],join:32,err:[0,22,7,19,12,2,21,18,16,4,33,34,29,35,36,27,9],aheckmann:18,setup:[2,36,19],work:[0,9,18,32,4,35,25,36,19],test_gs_tel:4,rework:18,root:[36,4,29],overrid:[18,16,19,9],give:32,simple_geo_haystack_command:16,indic:[0,12,11,34,6,21,35,27],want:[0,19,16,34,4,6,15,35,36,27],david:12,unsign:[31,14],end:[7,9,16,21,18,32,4,33,35,36,34],replicaset:[11,19,2,18,22,35,26],quot:[18,9],playerid:32,how:[11,32,9,16,22,4,37,35,25,36,19],"_id_":[19,16],recoveri:2,env:19,rewind:[0,9,18,4,24,8],milisecond:[18,19,20],config:[2,18,19],updat:[28,11,22,19,16,18,12,32,24,35,36,26,8],maxdist:16,recogn:4,after:[7,9,12,13,21,18,32,4,33,1,36],listdatabas:[24,18,22,19,8],befor:[0,19,16,2,18,6,35,36,27],wrong:18,gs2:4,beauti:[11,32],descriptior:21,parallel:35,demonstr:32,attempt:[35,18,22,27],third:4,zzdhidden:13,exclud:[9,16],perform:[0,22,19,16,18,14,31,9],maintain:32,errorobject:18,order:[0,9,12,16,6,27],oper:[0,22,19,12,18,14,34,31,6,16,35,36,27,9],cursorinfo:[24,19,8],over:[19,16,13,18,32,27,9],becaus:[13,31,14],readbuff:[18,36],flexibl:13,vari:18,digest:[18,36],uuid:[28,1],fit:[35,9],fix:[18,36],mongolia:13,better:[35,18,27],complex:[35,19,16],loggerinst:18,persist:[35,17,16],split:[31,14,4],them:35,thei:[35,18,14,36,31],safe:[12,19,16,18,22,33,35,34,9],update_a_simple_docu:16,yourself:32,bread:13,"instanceof":[9,16,18,22,4,19],choic:18,guileen:13,changelog:[11,18],bonu:35,timeout:[2,18,9,27,16],each:[0,7,19,16,2,18,14,4,31,33,24,36,27,8,9],debug:18,went:16,a_simple_collect:19,mean:[9,2,18,32,35,36,27],resum:[33,7,24,8],nin:0,eventstor:13,extract:18,newli:[6,34,22],monitor:13,content:[28,0,7,29,12,13,21,32,4,35,36,8],daniel:[0,27,21],reader:18,got:[35,19,16],more_index_information_test:[19,16],navig:36,worthwhil:36,rail:13,default_port:27,situat:18,standard:[13,18],md5:[28,18,1,4],filter:[32,19,16],mvc:13,pagin:16,regress:18,onto:18,rang:[0,18,16],instruct:2,alreadi:[9,12,21,34,4,6,35,27],wrapper:13,unlin:4,getnumbitsab:[23,14,31,8],primari:[0,19,16,2,18,35,27,9],hexstr:20,rewritten:18,top:[13,31,14,16],startindex:1,tonumb:[23,14,31,8],ton:[35,36],tom:32,kamikazepanda:[13,17],listen:[18,9],consol:[0,1,12,21,34,35,36,27],namespac:3,eventlisten:18,took:9,incur:35,removeus:[24,18,22,19,8],silli:35,target:[36,16],provid:[19,16,13,31,14,4,35,36],cursorstream:[24,11,33,9,8],project:[13,11,25,32,16],matter:35,iron:35,myexperience620186085001:32,beginn:11,websocket:[13,35],abov:[35,36,12],modern:13,mind:35,raw:[0,19,16,18,12,34,36,27,9],manner:[18,36],increment:[35,32],seek:[21,18,4,24,36,8],dbref:[11,19,3,23,35,18,8],ensureindex:[19,16,18,6,24,8],simple_limit_collect:9,data2:4,simplifi:[13,18,36],evangelist:32,insur:18,plenti:36,usernam:[6,22,19],object:[0,1,2,18,4,6,7,9,11,12,13,22,16,34,19,20,21,27,28,29,37,32,33,35,36],deleg:27,regular:[0,21],tradit:35,simplic:36,don:[18,27,16],doc:[0,22,1,19,12,13,18,16,4,33,35,9],flow:18,doe:[32,19,12,18,14,4,34,16,35,36,31],masylum:13,bson_data_d:1,radix:[31,14],random:4,speedup:18,syntax:18,test_stream_funct:9,identifi:[35,34,36],absolut:[31,14,36,4],acquir:9,field2:0,explain:[0,19,16,24,8,9],field1:0,theme:35,busi:35,rich:35,ppf_qxbkwm4g:32,io_seek_cur:4,cachefunct:1,nasti:18,test_cursorstream_destroi:33,stop:18,collectionsinfo:[24,19,8],bson_data_numb:1,report:35,youtub:[25,32,17],databank:13,bar:4,emb:[25,32,17],patch:18,bad:16,previouli:9,fileidobject:[],steam:9,fieldnam:0,fair:36,indexnam:[19,16],num:16,structur:[0,36,35],previouserror:[24,19,8],respons:[0,32,9],fail:[29,16,18,22,35,19],christian:32,awar:16,said:36,databas:[0,29,22,19,12,13,11,18,16,4,37,34,21,35,36,26,27,9],test_gs_empty_file_eof:4,discoveri:32,gridstor:[11,22,7,19,20,21,18,16,4,33,37,1,24,29,36,26,8,9],simplest:[13,0,36],awai:36,lotsofdoc:35,side:13,accord:2,newnam:16,getlasterror:[22,19,16],howev:9,against:[0,22,19,20,18,14,4,16,31,9],logic:[0,18],seri:13,com:[11,13,18,32,17,35,25],con:32,assur:9,can:[0,14,19,20,2,21,18,12,34,31,6,16,35,36,27,9],simple_explain_collect:9,height:[25,32,17],foobar2:4,path:[21,18,4],guid:11,assum:[31,14],duplic:[6,18,16,19,9],three:[35,36,4],been:[18,36,19,9],much:[35,36,32,12],basic:[11,19,37,16,35,36],quickli:32,life:36,regul:9,nodeeventstor:13,search:[13,11,35,16],argument:[28,31,22,7,19,20,33,3,14,4,30,1,15,16,29,36,18,9],child:19,"catch":[18,16],laurie71:18,another_root:4,subsequ:[19,16],peform:[33,7,19,16,9],dissect:36,properti:[0,20,21,18,4,23,24,8],calcul:1,marriag:[11,32],"typeof":[18,1,4],maxbsons:18,succes:16,toolkit:13,sever:[12,2,34,6,35,27],grown:35,usessl:19,test_is_close_function_on_cursor:9,receiv:36,make:[0,9,12,18,16,6,35,36,27],transpar:32,meetup:[11,32],drawback:36,descend:[6,9],isneg:[23,14,31,8],complet:16,reset_error_histori:19,pick:[35,18,36,19],hang:18,hand:27,fairli:18,tune:36,scenario:27,geohaystack:16,test_close_function_on_cursor:9,client:[22,9,12,13,18,16,4,29,35,19],thi:[28,0,22,7,19,20,13,14,18,12,4,31,6,32,36,16,21,35,25,27,9],everyth:12,settimeout:[33,18,7,19,16],left:[31,14,19,27,16],protocol:[35,18],just:[0,36,35,16],laptop:18,ordin:[19,16],farther:7,yet:27,languag:[13,35,32],previous:18,wmode:32,easi:13,collectionn:27,had:9,board:32,els:[16,22,27,12],ffffff:32,save:[19,16,21,18,12,4,24,27,8],dynamicstream:32,applic:[11,19,13,18,32,17,35,36],which:[0,32,2,21,18,14,4,31,34,36,27],preserv:9,background:[19,16],test_ev:19,apart:[35,36],measur:18,specif:[0,32,19,11,18,20,4,16,35,34,9],arbitrari:[18,4],negat:[23,14,31,8],collection2:[19,16],collection1:16,underli:33,www:[11,19,13,32,17,25],right:[32,31,14,36,35],old:4,creek:32,deal:35,manual:[11,8],interv:18,deserializestream:[23,1,8],dead:18,intern:[0,31,14,21,16],successfulli:9,thu:12,txt:4,nwtj:13,timestampd:20,multipli:[23,14,31,8,16],originalhex:20,christkv:[35,18],condit:[0,18,16],foo:16,localhost:[13,35,34,36,19],a_simple_create_drop_collect:19,collection_stats_test:16,promot:35,repositori:[13,35,18],post:[0,31,14,34,16],ryanke:13,plug:35,obj:16,unpars:18,bson_deseri:18,slightli:35,simul:[31,14,36],commit:19,book:[0,11],simple_previous_error_col:19,bson_data_symbol:1,"float":[35,31,14],encod:[2,35,18,27],bound:[16,19,9],down:[18,19],wrap:[0,7,30,18,33,15],storag:[13,35,36],git:[13,18],wai:[0,12,16,13,18,14,35,36,31],support:[0,18,36,35,21],serverinfo:16,avail:[7,9,16,2,33,18,22,4,32,35,36,19],width:[25,32,17],test_rename_collection3:16,test_rename_collection2:16,constantli:35,bulqmxg0vdc:32,lowest:18,head:[36,4],medium:22,form:[18,32,4],forc:[18,16,22,19,9],"true":[0,22,1,19,12,2,21,18,16,4,32,33,6,7,34,29,35,36,27,9],reset:[0,4,9,19],new_nam:34,bugfix:18,geospati:[19,16],maximum:[35,18,19,9],until:[35,22,19],deprect:9,fundament:35,dropallindex:[24,8,16],emit:[35,18,33,19,16],shouldcorrectlyfailonretryduetoappcloseofdb:19,featur:36,"abstract":13,fromstr:[31,18,14,23,8],exist:[0,22,19,12,21,18,16,4,6,34,24,35,36,27,8],videoplay:32,check:[0,22,7,19,16,21,18,14,4,33,6,1,35,31,9],test_collection_opt:16,bson_binary_subtype_md5:[28,1],test_to_a_after_each:9,floor:20,when:[0,1,9,12,2,21,18,16,4,32,33,7,34,35,36,27],refactor:18,simple_limit_skip_find_one_queri:16,test:[22,19,12,13,21,18,16,4,17,35,36,34,9],forceclos:19,miliscecond:[33,7],node:[11,9,2,18,32,13,17,35,25,8],piplelin:16,consid:16,sql:35,cachefunctionscrc32:1,dropdup:[18,19,16],teixeira:11,longer:[18,4],ignor:[35,1,16],time:[11,32,19,20,2,18,16,13,37,35,27,9],push:[19,13,18,33,35,9],backward:[18,9],daili:32,concept:[35,18],skip:[24,0,9,8,16],global:18,primer:[11,36,32,37],row:16,millisecond:27,middl:16,depend:18,fog:32,dropindex:[24,6,19,8,16],sourc:[32,17,9],string:[28,0,22,1,19,20,21,3,14,4,30,31,6,34,16,29,35,36,18,9],feasibl:36,test_cursorstream_resum:33,logmeup:13,contenttyp:21,level:[19,16,13,18,22,4],did:[18,19],dig:35,eventemitt:[18,9],iter:[9,16],item:[7,9,16,18,22,4,33,35,19],team:32,quick:[35,36,32],div:[32,23,14,31,8],round:35,databasenam:[19,27],wtimeout:[18,22,19,16],addtoset:[35,16],sign:[31,14,34],slow_onli:22,cost:18,port:[18,19,27],comparis:4,checkoutwrit:19,repli:[35,22,16],muq2w2u5x9m:25,current:[31,22,19,21,3,14,4,32,35,36,18],subtype_uuid:28,boost:13,deriv:[31,14],gener:[11,19,16,13,18,20,36,27],wait:[19,16],box:35,bson_data_regexp:1,shift:[18,14,31],simpleemitt:18,queue:[13,35],behav:18,examp:13,numberofretri:[18,19,27],extrem:18,weird:18,werehamst:13,checkkei:1,extra:0,modul:[13,18],prefer:[0,18,35],toarrai:[0,19,16,13,18,22,24,35,8,9],bxhflrwemeg:17,instal:[35,18],includeloc:16,aaaaipotmrk:32,perf:18,memori:[0,9,11,18,37,35,36],regep:35,serverstatu:[18,22,24,8],connector:[11,32],live:[35,18,36],handler:36,value2:0,value1:0,criteria:12,scope:[35,18,1,19,16],prev:16,maxkei:[10,11,1,18,23,8],multiplecoll1:19,python:11,qard:13,finit:[31,14],visual:13,examin:35,content_typ:[21,36],fly:13,cap:[35,18,19,16],uniqu:[0,19,16,4,6,27],test_correctly_access_collect:19,whatev:27,bson_binary_subtype_funct:[28,1],mongo:[11,19,12,13,18,32,35,36,37],stream:[7,9,21,18,33,4,1,24,35,36,8],predict:18,bson_data_long:1,createcollect:[19,16,18,33,24,35,34,8,9],topic:[11,32],nocr:13,cube:13,kaflr8pi5nk:25,occur:[0,9,12,21,18,4,6,34,27],alwai:[35,31,14,9,16],multipl:[31,16,2,18,14,4,27],ping:[24,18,22,19,8],fieldvalu:0,write:[28,1,19,2,21,18,4,23,7,24,35,36,8,29],foreach:[4,16],pure:[22,7,19,20,33,18,16,4,1,29,9],nyc:[11,32],map:[35,18,16],product:[32,31,14],max:[18,16,19,9],dive:[35,36],date:[1,9,16,18,20,22,6,35],docstartindex:1,data:[28,11,7,19,16,21,18,32,4,33,37,1,17,29,35,36,9],grow:35,sbrekken:18,inform:[9,16,2,21,22,4,6,13,35,27,19],"switch":18,reaper:[18,19,27],combin:[32,4,19],keepgoingexampl:16,filedata:4,talk:32,increas:18,still:[0,18,12],pointer:[0,34,4,27,21],dynam:32,test_map_reduce_funct:16,group:[11,16,18,32,24,25,36,8],gte:0,indexexist:[18,24,8,16],jim:16,nodelai:[2,18,27],platform:35,mbostock:18,requir:[22,7,19,12,33,18,20,4,34,1,16,29,35,36,27,9],m_tddbw6qnuu4iuxlyo:32,main:[11,36,32,35],non:[13,18,16],"6pjmp23z0lw":25,simple_skip_collect:9,col2:19,col3:19,initi:[9,16,18,4,35,36,19],col1:19,verifi:[19,16,22,4,20],now:[35,18,36,19],discuss:[11,32],nor:34,introduct:[2,11,37,32,35],mapreduc:[18,24,8,16],name:[28,0,22,1,19,12,2,21,3,16,4,27,6,32,34,36,18,9],drop:[19,16,18,22,6,24,34,8],revert:0,crypto:18,separ:[0,18,4],mongoerror:18,recreat:27,jprichardson:13,failov:[2,18],replai:18,dialect:13,replac:[0,16,18,12,4,35],individu:[0,18],firej:13,a_1_b_1:[19,16],contributor:32,poolreadi:18,serverclust:18,happen:[33,7,4,9],shown:[35,36],accomplish:36,space:[1,19],streetsaheadllc:13,profil:[22,9,16],stuff:[2,11,36,37,35],factori:[0,27,16],brett:32,million:32,orm:[13,32],mime:4,sethml:18,replacethiscollect:16,org:[13,11,19],"byte":[28,0,1,19,20,21,18,35,36,27],care:[2,0,35],bradberri:32,synchron:35,thing:[35,36,27],place:[11,31,14],year2013:18,frequent:[31,14],first:[0,22,19,12,21,18,20,4,34,32,16,35,36,27,9],origin:[16,12],bson_binary_:18,directli:[0,9,35],onc:[6,35],arrai:[28,0,22,1,19,12,2,21,18,16,4,35,34,9],"0x7f":1,reopen:[4,27],fast:13,happi:[13,11,32],open:[22,7,19,12,2,21,18,16,4,33,34,32,24,29,35,36,27,8,9],predefin:1,size:[0,1,19,16,21,18,14,4,36,31,9],given:[28,9,16,31,14,4,36,19],breviti:[35,36],workaround:18,paramt:9,collectionnam:[19,16,34,22,6,24,36,8],conveni:[0,31,14],subtype_md5:28,especi:35,copi:2,specifi:[28,0,9,16,21,18,4,35,36,27,19],test_arrai:9,keepgo:[18,16],than:[0,9,12,2,21,18,14,31,16,36,27],png:[21,4],serv:32,firebas:13,tedeh:18,were:[9,12],posit:[28,21,31,14,4,36],browser:13,pre:[22,1,19,16],fork:13,sai:36,sam:16,pro:32,ani:[0,19,12,13,35,36,9],subroutin:18,simple_rename_collection_2:19,deliv:32,bitwis:[35,31,14],squar:13,alias:0,destroi:[33,7,24,8],note:[31,14,19,9],take:[0,1,2,18,32,35,36],createfromhexstr:[0,18,23,8,20],begin:[0,4],sure:[36,9],normal:9,buffer:[28,0,1,19,12,21,18,16,4,34,29,36,27,9],clearer:18,getyear:16,homepag:13,renam:[19,16,34,24,35,8],byte_valu:28,later:[36,19,16],indexbound:[19,16],test_gs_read_stream:4,runtim:18,parseint:16,axi:16,show:[7,19,20,33,16,4,1,29,35,9],atom:[35,18,16],objectid3:20,objectid2:20,concurr:18,limitrequest:18,corner:18,onli:[0,22,19,12,2,18,16,4,6,35,36,27,9],slow:[18,22,19,16],dice:35,setprofilinginfo:22,activ:[13,18],written:[28,16,13,31,14,4,36],analyt:[13,11,32,35],overwritten:36,min_valu:[31,14],variou:[13,22,16],get:[7,18,4,6,8,9,11,12,13,22,16,34,19,20,21,24,27,29,37,32,33,35,36],secondari:[2,18,16,19,9],ssl:[18,19],cannot:[19,16,31,14,35,18,9],shiftrightunsign:[23,14,31,8],geo:16,gen:32,nolock:[18,19],doabl:0,seldom:18,yield:[18,16,19,34,12],isarrai:1,caboos:13,nettl:13,where:[28,0,1,19,12,2,21,18,16,4,6,35,36,34],highbit:[31,14],desced:9,wiki:35,khwang:13,testcas:18,infinit:[18,14,31],detect:[2,18],heckmann:18,fs_chunk:36,integration_tests_2:19,timestamplib:31,wayt:16,enough:9,between:[35,18,32,19,27],"import":[35,36],across:[18,19,27,16],spars:[6,19,16],august:[11,32],tut:11,test_group:16,come:[21,31,14,16],simple_find_and_modify_operations_:16,region:16,gwt:[31,14],tutori:[11,25,36],mani:[35,9],fromnumb:[23,14,31,8],reindex:[24,18,19,8,16],iscap:[18,24,8,16],db_option:27,period:[0,34],dispatch:35,createcreateindexcommand:18,fs_file:36,lessthan:[23,14,31,8],reaperinterv:[18,19,27],cursor_information_collect:19,cursorinst:9,coupl:[35,16],aciev:0,simplereach:32,rebuilt:[19,16],derefer:[24,18,19,8],lowbit:[31,14],geonear:[18,24,8,16],"1mb":36,those:[31,14],"case":[9,16,31,14,6,35,36,18],myself:35,bson_seri:18,tostr:[29,16,31,14,4,23,20,36,8],trick:[11,36],invok:36,idhex:0,firstext:22,simple_sort_collect:9,trello:[11,32],advantag:35,createexperi:32,eras:[21,34],dynamicgui:13,ascii:[2,18,27],acess:19,develop:[13,11,32,35],author:[0,16,21,12],media:13,same:[0,19,20,18,14,4,6,16,31,9],binari:[28,0,22,7,19,20,11,18,12,4,34,33,23,1,16,21,35,29,8,9],html:11,document:[0,22,1,19,11,2,21,18,12,4,32,33,6,34,7,16,13,35,36,27,9],howtonod:11,createpk:27,exhaust:9,ifram:[25,32,17],finish:[36,16],closest:[31,14,16],utf8:[2,35,18,4,27],nest:[0,6],oid:3,driver:[0,12,2,11,18,32,34,13,24,35,36,27,8,37],gotend:4,capabl:32,newobjectid:20,improv:18,extern:[11,18],defo:0,bson_data_boolean:1,crud:[11,37,35],appropri:32,moder:32,framework:[13,16],brightcov:32,without:[1,19,31,14,27,34,18],model:[13,32,16],dereferenc:19,upsert:[16,12],ourexamplefiletowrit:4,execut:[22,9,16,18,12,4,35,19],tip:11,rest:[13,18,16,20],hint:[9,16],db_connector:[34,27],except:[35,18,4,12],littl:35,desktop:11,blog:[13,0,34,11],framebord:[25,32,17],default_chunk_s:4,haystack:16,vimeo:11,found2:4,around:[13,11,18,35],read:[28,7,19,16,2,21,18,4,23,24,35,36,8,9],streamrecord:[24,35,18,9,8],grid:[28,11,29,13,18,24,36,8],pop:35,world:[7,19,12,16,4,1,36,29],lasterror:[24,18,19,8],reap:18,subtype_user_defin:28,saniti:18,poolsiz:[7,9,16,18,22,4,33,29,35,27,19],realtim:[11,32],integ:[0,1,20,31,14,35,18],server:[32,22,1,19,20,2,33,18,12,4,13,34,7,16,29,35,36,27,9],firebaseco:13,either:[21,18,36,35],output:[0,16],greaterthanorequ:[23,14,31,8],manag:[13,21,18,35],kvalheim:32,bson_binary_subtype_byte_arrai:[28,1],eventloop:36,"_bsontyp":18,intact:12,generationtim:20,setnodelai:18,slice:35,writedata:36,node_ev:18,confirm:35,definit:11,legal:16,evolv:35,profilinginfo:[22,24,8],bson_data_binari:1,power:[13,32],broken:18,aquir:19,bson_binary_subtype_default:[28,18,1],regexp:[35,18,1],"throw":[35,18,36,12],comparison:20,pointer_to_collect:0,firstnam:[0,6],nocooki:[25,32,17],numbit:[31,14],bson_data_code_w_scop:1,gump:16,act:36,luck:36,readstream:[24,11,7,9,8],addus:[24,18,22,19,8],test_collections_info:19,your:[16,2,32,4,13,35,36],loc:16,log:[0,1,9,12,13,21,18,16,22,34,35,36,27],hex:[0,20],overwrit:[22,4],errormessag:18,strict:[18,34,19,27,16],interfac:[7,9,13,18,33,35,29],low:[35,31,14,36],lot:[11,9,16,18,6,33,35,36],isvid:32,tupl:6,shamelessli:35,replsetsrv:2,faster:[6,18],pull:[35,18,22],dirti:35,possibl:[0,19,12,13,18,16,6,35],"default":[28,0,22,1,19,20,2,21,18,12,4,6,34,16,35,36,27,9],remove_subset_of_documents_saf:16,dropdatabas:[19,18,22,24,27,8],bson_data_min_kei:1,expect:[0,27],gone:[29,16,4,19],creat:[0,22,1,19,20,2,21,18,16,4,32,33,6,7,34,29,35,36,27,9],certain:[6,35],watcher:13,intro:35,file:[7,19,13,21,18,4,36,29],bob:16,russel:32,calculateobjects:[23,1,8],again:[18,4,9],kaba:13,compel:32,orient:11,field:[0,32,19,12,18,16,4,6,35,9],valid:[1,19,16,34,22,20,9],longlib:14,you:[0,1,19,12,2,21,18,16,6,32,34,35,36,27,9],scttnlsn:13,pefrom:16,sequenc:18,symbol:[11,1,30,18,23,35,8],briefli:32,opt_radix:[31,14],pool:[18,19,27],reduc:[18,14,31,16],lessthanorequ:[23,14,31,8],coreh:13,directori:18,descript:[28,1,4,9,19],tricki:35,potenti:18,alright:35,cpu:[18,36],unset:35,represent:[10,28,32,29,20,3,14,4,5,15,30,31],all:[0,22,1,19,11,2,21,18,12,4,6,34,16,35,36,27,9],forget:35,numberupd:16,dollar:34,month:32,simple_rename_collect:19,erhangundogan:13,follow:[0,9,12,2,4,6,35,36],fetchsiz:9,disk:[36,7,4,16,9],nodej:[13,32,17],subtype_default:28,nextobject:[24,0,19,8,9],init:9,introduc:32,setprofilinglevel:[22,24,8],evaul:19,util:[13,18],test_rename_collect:16,failur:[35,18],veri:[11,18,36,35],base698:13,list:[19,16,18,22,4,24,35,36,34,8],resav:16,adjust:[18,36],findandremov:[18,24,8,16],small:[18,36,25],retun:1,eas:13,zero:[18,14,31,20],design:[11,32],pass:[1,19,20,2,18,16,4,34,36,27,9],excit:32,what:[11,9,34,32,35,36],abc:[0,4,12],xor:[23,14,31,8],sub:[28,32,16],sum:[31,14],brief:25,delet:[19,16,21,18,4,24,35,36,27,8,29],version:[18,36,19,27,16],cruso:0,method:[0,9,11,18,20,4,37,34,16,35,36,27,29],full:[18,19,16],hash:[0,18,36,19,27],variat:35,behaviour:13,getmorecommand:[9,16],foobar3:4,strong:25,modifi:[35,18,16,12],valu:[0,1,18,4,6,8,9,12,14,22,15,16,34,19,20,21,23,27,28,30,31,32,35,36],bartt:13,isodd:[23,14,31,8],ahead:[13,35,36,16],showdiskloc:[18,9,16],amount:[35,31,14,19],croucher:32,social:13,action:11,mongoos:[13,11,25,32],narrow:16,evalfunct:1,via:35,shorthand:12,lazybum:13,c_1:16,deprec:19,default_root_collect:4,establish:[7,9,16,18,22,4,33,29,19],select:[18,16,27,34,12],test_collection_is_cap:16,distinct:[18,24,8,16],regist:4,two:[0,14,19,20,2,11,31,12,4,21,6,32,13,35,36,34],coverag:18,bson_binary_subtype_user_defin:[28,1],taken:35,minor:18,more:[0,7,19,12,2,33,18,14,4,13,32,16,35,36,31,9],flag:16,stick:35,particular:35,cach:1,none:[2,32],outlin:[35,36],dev:13,histori:19,remain:[36,4],learn:[13,11,32],scan:[9,16],share:[13,18,32,19,27],shard:21,accept:[18,16],simple_document_insert_collection_no_saf:16,default_url:19,robinson:0,cours:35,newlin:4,divid:[31,14,16],rather:16,anoth:[0,4,35,20],hugh:32,simpl:[0,7,19,11,13,33,18,16,4,6,37,1,29,35,36,34,9],perman:19,resourc:[13,27],resultset:35,reflect:18,unlink:[24,21,36,4,8],associ:[36,4],keyorlist:9,shouldcorrectlyexecutesimpleaggregationpipelineusingargu:16,github:[13,11,18,17,35],defineproperti:18,save_a_simple_document_modify_it_and_resave_it:16,caus:[35,18],callback:[0,22,19,12,21,18,16,4,6,34,35,36,27,9],spheric:16,doc_id:0,bson_data_oid:1,trade:36,through:[35,18,32,19,16],reconnect:[18,27],paramet:[0,22,19,12,2,21,18,16,4,6,34,35,36,27,9],style:[13,35,32],mongorepli:18,call:[0,9,16,13,18,4,36,27,19],asbuff:1,dbname:[18,19],stylu:17,rapidli:35,bypass:35,simple_limit_skip_queri:16,cool:16,might:[6,36,19,35],alter:[0,34],good:[11,36,35,16],"return":[0,7,3,4,5,1,9,10,12,14,22,15,16,18,19,20,21,27,28,29,30,31,33,34,35,36],timestamp:[11,1,16,18,20,23,31,8],more_complex_index_test:[19,16],distancemultipli:16,compound:[19,16],karaco:13,readlen:4,emerleit:13,uploadd:21,unlik:9,authent:[24,18,22,19,8],easili:[18,14,31],achiev:0,skipvalu:9,found:[0,12,4,16,19],truncat:[18,36,4,34],hard:35,weren:0,realli:35,connect:[11,7,19,16,2,18,22,4,13,37,33,36,24,29,35,25,27,8,9],barrier:18,event:[7,9,21,18,4,33,35,36,27,19],mojo:13,b4ajeu13u6u:25,read_primari:18,pullal:35,foreground:[19,16],core2duo:18,advanc:[11,37,34,4,35,36],differ:[11,19,20,18,14,4,6,16,35,36,31,29],asc:[0,9,12],reason:4,base:[16,13,21,20,4,35,36],connectionopt:19,put:[28,9,16,18,4,23,24,36,8,29],seconddb:19,gethighbit:[23,14,31,8],tailabl:[18,9,16],omit:[35,3,36,18],dir:12,assign:[2,18],notifi:[35,36,16],articl:[11,36,37],lastnam:[0,6],number:[28,0,22,1,19,20,18,14,4,31,6,15,16,35,36,27,9],done:[0,7,19,16,21,18,12,22,33,35,36,27],construct:[31,14],autoclos:[21,36,7,4],create_and_drop_an_index:[19,16],miss:18,pageview:16,chunk_typ:4,script:[21,32],interact:[35,36,4,29],least:[0,16],custompkfactori:27,settim:20,statement:[35,36,19],illeg:[29,18,22,19,16],master:[2,18],store:[1,9,13,21,4,35,36,19],schema:[11,32],otherid:20,option:[28,0,22,1,19,12,2,21,3,16,4,27,6,34,24,29,35,36,18,8,9],reseterrorhistori:[24,19,8],similarli:35,selector:[18,16,19,9],getter:[4,20],pars:[18,1,16],fileid2:4,literarili:35,std:18,kind:36,bson_data_nul:1,whenev:[19,16],remov:[22,19,12,18,16,4,6,24,35,34,8],reus:[18,1,19],str:[31,14],consumpt:36,toward:32,cleaner:13,comput:11,luckili:[35,36],"null":[0,1,19,16,2,18,22,4,13,33,34,29,27,9],built:[13,35],equival:[35,16],valueof:[23,15,8,30],fromcollect:19,also:[0,9,12,11,18,4,6,35,36,34],build:[22,19,18,32,35,36],tool:[13,32],pipelin:16,lubow:32,blackboard:[13,11,17],choos:[35,16],reach:[36,7],most:[0,36,32,35],plai:32,plan:36,native_pars:[7,9,16,22,4,33,29,27,19],"16mb":21,filesystem:21,clear:18,cover:19,part:[35,18,22,25,20],clean:[13,18,19],frombit:[23,14,31,8],ridicul:13,brightcoveexperi:32,session:[13,32],find:[0,7,19,12,13,21,18,16,22,6,33,24,35,8,9],firewal:18,nosql:[13,11],pretti:35,test_gs_weird_bug:4,numberofdocu:1,queu:13,batch_document_insert_collection_saf:16,hit:[19,16],unus:18,express:[0,11,16,13,21,17,35],fieldtoupd:35,test_map_reduce_functions_scop:16,nativ:[13,35,18,27],ferret:13,restart:[33,7],statist:[18,22,19,16],wrote:35,set:[0,22,1,19,20,2,21,18,12,4,6,34,32,16,35,36,27,9],jade:17,see:[0,12,21,31,14,6,34,35,36,27],easymongo:13,close:[7,19,16,13,21,18,22,4,33,24,29,35,36,27,8,9],my_f:4,chose:32,misalign:18,jenkin:19,someth:[4,27],configur:[2,35,18,19,34],altern:[13,16],signatur:[4,9],complement:[31,14],javascript:[1,19,16,13,31,14,32,35],salzman:18,succeed:6,both:[18,16],last:[13,21,19,35],create_and_drop_all_index:19,context:[18,32,27],logout:[24,22,19,8],whole:[35,16,4,19],createdat:9,load:[0,18],episod:11,jsmode:16,point:[9,16,31,14,35,36],instanti:[35,18],param:32,shutdown:18,suppli:[18,36],backend:35,faithfulli:[31,14],user_id:16,due:[35,18,29],empti:[0,18,16,4,9],bgcolor:32,strategi:[35,18],test_streamingrecords_funct:9,fire:[7,19,12,13,21,4,35,36,27],admindb:[22,19],imag:[21,36],ecosystem:32,understand:35,func:[1,16],look:[9,16,21,18,32,4,6,35,36],mdoq:13,straight:[35,36],batch:[35,18,9,16],"256k":36,getownpropertynam:18,behavior:[0,12,18,14,35,31],error:[0,22,7,19,12,13,21,18,16,4,6,33,34,35,27,9],fun:[36,16],fixtur:13,robin:35,loop:18,real:[13,11,32],test_gs_unlink:4,readi:[33,7,4,35,9],key2:0,key1:0,jpg:4,itself:[11,9],test_deref_exampl:19,rid:18,simple_key_based_distinct_sub_query_filt:16,chase:18,decor:18,simple_document_insert_with_function_saf:16,geohaystacksearch:[18,24,8,16],coffeescript:[13,11,25],p_db:[2,19],higher:[2,18,36,27,16],"10gen":11,optim:[18,16],operaion:21,more_complex_ensure_index_test:[19,16],iya_logo_final_bw:4,temporari:[4,16],user:[28,0,1,19,11,13,18,12,4,6,32,22],hello2:16,keyf:16,recent:32,travers:9,entri:[36,16,4,19],joyent:32,explan:[19,16],getlowbitsunsign:[23,14,31,8],a_1:16,collabor:32,shape:18,update_a_simple_document_multi:16,bson_data_timestamp:1,cur:36,colladow:13,tdegrunt:13,keeptemp:16,read_secondari:[2,18],input:[31,14,16],mod:[0,31,14],format:[0,19,16,12,22,9],big:[35,18,36],checksum:4,shiftright:[23,14,31,8],rs_name:[2,18],replsetserv:[22,1,19,20,2,33,18,16,4,7,29,9],backbon:32,success:[21,4,9],resolv:19,collect:[0,2,3,4,6,8,9,11,12,13,22,34,19,16,21,24,26,27,29,37,32,33,18,35,36],bson_data_cod:1,popular:[11,32,35],bamboo:18,variant:35,serverpair:18,often:[31,14],creation:[22,19,16,18,32,35],some:[0,7,19,11,21,18,16,4,6,32,29,35,36,9],back:[0,22,16,13,31,14,4,35,20],understood:35,sampl:35,scale:[11,36,32,35,16],slaveok:[18,19,16],chunksiz:[21,18,36,4],retri:[35,18,19,27],larg:[0,19,16,21,18,35,36],intial:16,previou:[36,27],run:[11,22,19,16,2,18,12,35,36,37],lublow:32,simple_reset_error_history_col:19,step:36,simple_explain_queri:16,zir:13,subtract:[23,14,31,8],k1mnspb8wvq:25,allowfullscreen:[25,32,17],recordquerystat:19,block:[36,19,16],cygwin:18,within:[31,14],simple_index_test:16,ensur:[19,16,18,6,35,36],test_collection_index_exist:16,question:[32,31,14],"long":[11,1,9,20,18,14,23,35,8],custom:[0,18,36,27,16],includ:[0,32,19,11,18,16,4,6,34,35,27,9],forward:4,files:[18,4],properli:[18,4],isbuff:18,uniquedoc:16,ascend:[0,9,6],link:[11,36,37,35],translat:13,simple_count_exampl:16,line:[13,36,4],info:[18,22,36,19,16],concaten:[31,14,4],consist:18,caller:9,forceserverobjectid:[18,19,27],contin:13,readlin:[24,4,8],similar:21,constant:[28,1,9,4,23,24,8,19],multiplecoll2:19,parser:[18,1,19,27],doesn:[0,27,12],repres:[9,30,31,14,4,15,35,20],isconnect:18,titl:[0,16,26,12],unidirect:9,wakup:19,nice:[35,32],deseri:[1,9,18,23,35,8],bcoe:13,jannehietamaki:18,mongodb:[0,1,2,18,4,6,7,8,9,11,12,13,22,17,16,34,19,20,21,25,27,29,32,33,35,36],eval:[1,19,16,18,24,8,9],profilinglevel:[22,24,8],algorithm:[2,31,18,14,27],cursorinform:19,tradeoff:36,awesom:[11,25,17],far:4,hello:[7,19,12,16,4,1,35,36,29],code:[22,7,19,20,33,18,16,4,1,29,35,36,9],partial:[9,16],worldbuff:4,queri:[0,22,19,12,11,18,16,4,6,37,32,34,35,26,27,9],idvalu:0,mongoskin:13,replicasetcheckinterv:18,base64:[2,29,18,4,27],update_a_simple_document_upsert:16,send:[2,35,18,19,27],lower:[19,16],io_seek_end:4,sens:12,reapertimeout:[18,19,27],passiv:18,shouldcorrectlyforcereindexoncollect:16,result2:29,degrunt:13,writebuff:18,untouch:27,relev:35,magic:13,gettim:[9,20],roll:11,fieldorspec:[19,16],fewer:16,"try":[35,18,16,36,12],race:18,marri:32,refer:[9,3,4,35,18,19],smaller:21,fortun:35,natur:[35,32],jump:[35,36,32],video:[11,36],odm:[13,11,25],download:35,odd:[31,14],append:[21,4,35],compat:18,index:[11,1,19,16,18,6,24,26,34,8,9],compar:[20,31,14,4,6,23,8],descriptor:36,access:[9,16,21,22,4,30,15,19],experiment:18,asced:9,lee:18,bson_data_int:1,batchsizevalu:9,cursor_count_collect:9,calipso:13,let:[7,9,16,18,4,35,36,19],filedescriptor:36,becom:35,sinc:[35,31,14,36,12],subtype_byte_arrai:28,nexttick:18,convert:[0,35,20],convers:[35,16],larger:[21,18,36],technolog:32,chang:[16,18,14,35,36,31],tempcollect:16,appli:[0,18,9,35],app:[2,11,18,32],mattinsl:13,api:[11,19,13,32,23,24,36],redi:32,cloud:11,chrisgibson:13,from:[28,0,22,1,29,19,20,2,11,14,12,4,31,34,32,16,21,35,36,18,9],batchsiz:[24,16,19,8,9],doubl:[11,18,23,15,35,8],next:[0,1,9,32,36,27],websit:[13,32],chr:4,panel:[11,32],sort:[0,9,12,18,20,24,6,16,8],src:[25,32,17],benchmark:18,name2:0,insensit:9,socketopt:[2,18,27],sollect:34,account:16,retriev:[0,22,9,12,21,18,16,4,35,36,19],scalabl:21,multiple_db_inst:19,annot:36,unopen:18,thin:13,fetch:[0,29,9,16,6,35,19],queryfailur:18,control:[35,18,36,27],objectid:[0,22,7,19,20,11,3,16,4,27,33,23,1,29,35,36,18,8,9],process:[11,19,13,18,14,31,9],lock:[18,36,19],username_:6,high:[19,16,31,14,35,18],tag:[18,16],serial:[1,19,16,18,23,8],pingresult:22,integration_test_:[2,19],instead:[0,19,16,2,18,6,36,27,9],npm:[35,18],pois:32,await:19,formattedorderclaus:18,originaldata:29,alloc:[18,1,19],bind:13,remove_all_documents_no_saf:16,correspond:[6,31,14,34],element:[0,4,35,9],issu:[35,18,16],chief:32,writ:4,allow:[9,16,18,22,4,34,35,36,27,19],subtyp:28,deoptim:18,doc2:35,doc3:35,move:[21,18,4,35],alexeypetrushin:13,doc4:35,spank:18,autoindexid:19,server_opt:27,effici:[35,36,16],bunch:[18,19,16],perfect:35,total:[0,16],crash:18,greater:[0,31,14,9],handl:[32,9,16,31,14,4,35,36,18],databs:[21,34,27],dai:[11,32],auth:[18,19],renamecollect:[24,19,8],precess:35,numberofremoveddoc:16,writefil:[24,21,36,4,8],convin:0,anyth:18,edit:[36,4],npmj:13,slide:[11,32],deserializeddoc:1,exampledb:[35,36],subset:[9,16],unwind:16,themselv:18,opensync:4,chunk:[21,18,36,4],bson_binary_subtype_uuid:[28,1],default_content_typ:4,pushal:[35,18],our:[35,36,32,4,9],special:[35,31,14,36,9],out:[11,19,16,2,18,20,35,36,27,37],variabl:[35,18,16],calip:13,trickier:[0,35],categori:36,suitabl:36,leverag:[35,32],ref:18,clone:13,math:20,jessica:[0,12],insid:[0,36,21,6],dropcollect:[24,34,19,8],manipul:16,releas:18,princess:16,replsetgetstatu:[18,22,24,8],unwant:0,could:[35,18],shiftleft:[23,14,31,8],keep:[21,18,19,35,16],length:[28,22,1,9,20,21,16,4,23,36,8,19],lte:0,primarki:0,minkei:[11,18,1,23,5],evanp:13,debugmessag:18,iszero:[23,14,31,8],should_correctly_rewind_and_restart_cursor:9,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:19,prioriti:18,start:[28,0,1,9,11,2,34,16,4,35,36],system:[13,34,36,4],messag:[19,12,18,22,4,16],createfromtim:[18,23,8,20],bson_data_max_kei:1,termin:4,"final":[35,18,32,16],idottv:13,deconstruct:36,test_gs_getc_fil:4,exactli:34,gridstorew:4,bson_data_object:1,replset:[2,19],pgebheim:18,bother:32,mongoserv:[34,27],tocollect:19,charact:[28,18,16,4,20],test_gs_puts_and_readlin:4,seriou:18,result:[0,22,7,29,19,12,14,18,20,4,31,16,21,35,36,27,9],deliveri:32,counter:[27,16],terribl:18,corrupt:[18,22],have:[0,19,16,2,34,32,4,6,35,36],tabl:[35,25,34],need:[0,1,19,12,21,31,14,34,6,16,35,36,27],turn:[0,18,22,19],border:25,buildinfo:[22,24,8],min:[18,16,19,9],rout:13,mix:[0,6],andrewjston:18,milli:22,test_other_drop:16,orgiin:4,singl:[28,0,32,19,12,21,18,16,4],fileid:[36,7,4],statsync:4,whi:0,serverconfig:[18,19,27],why:[13,35,32],overwriten:4,url:[13,19],integration_tests_to_drop:19,request:[18,32,9],face:35,piplin:16,test_collect:12,snapshot:[9,16],"400m":32,determin:[35,9],constrain:4,"_id":[0,19,12,18,16,4,6,36,27,29],fact:[35,12],text:[14,16,31,32,4,36],serializefunct:[18,1,19,16],verbos:16,"static":13,nagl:[2,18,27],anywai:[19,16],setter:[4,20],textual:[31,14],locat:[35,16,4,9,19],playerkei:32,should:[0,22,19,16,31,14,36,29,20,34,9],noid:13,test_cursorstream_paus:33,local:[3,19],devnul:13,doc1:35,ritch:[13,18],kiefer:32,gettimestamp:[18,23,8,20],donewithwrit:36,enabl:[18,19,27],organ:32,simple_batch_size_collect:9,tohexstr:[0,18,23,8,20],integr:[13,35,36],contain:[28,1,9,16,2,34,4,35,36,19],grab:[22,19,9],mon4mongo:13,view:13,modulo:[0,23,14,31,8],packet:18,meritt:13,fromint:[23,14,31,8],statu:[13,35,18,22],wire:[35,18],correctli:[35,18,16],pattern:11,boundari:18,state:[35,18,9,27],crude:35,world2:16,kei:[0,1,19,16,18,4,6,35,36,27,9],buckets:16,simple_queri:16,isol:18,job:[13,16],entir:[36,4,9],joe:16,auto_reconnect:[7,9,16,2,22,4,33,29,35,36,27,19],crc32:1,addit:[0,1,19,16,31,14,22,36,9],mongod:13,plugin:32,admin:[11,32,19,16,18,22,24,8],mongoj:[13,11],equal:[0,22,7,19,20,33,31,14,4,23,1,16,29,35,8,9],etc:[0,27,16],instanc:[22,1,19,20,2,18,16,4,29,35,36,27,9],greaterthan:[23,14,31,8],mongoq:13,subtype_funct:28,comment:[18,9,16],toint:[23,14,31,8],walk:32,removealllisten:18,save_a_simple_docu:16,attende:32,addition:34,compon:18,json:[11,32,31,14,23,35],treat:[0,18,9],pkfactori:[19,16],immedi:12,bit:[0,1,21,31,14,35,36,18],assert:[22,7,19,20,33,16,4,1,29,9],ador:13,present:[6,34,32,11],replic:[2,19],multi:[18,16,12],plain:18,align:18,cursor:[0,7,19,11,18,16,33,24,35,8,9],defin:[28,0,1,19,12,18,14,4,31,16,35,27],setreadprefer:18,bson_data_arrai:1,observ:13,layer:[13,35,32],helper:[13,18],site:2,lightweight:13,tojson:[31,18,14,23,8],nodetut:11,getc:[24,4,8],cross:18,member:[2,18],world_no_saf:16,speaker:32,probabl:0,gett:13,difficult:36,incorrect:18,slave:2,hostnam:27,keepal:[2,18,27],upon:9,proxlet:32,retriv:22,student:25,serializewithbufferandindex:[23,1,8],php:11,chunk_siz:[21,4],off:[9,2,18,22,4,34,35,27,19],center:16,nevertheless:27,builder:32,well:[0,18,36,35],exampl:[0,22,7,19,20,11,29,12,4,33,6,34,1,37,16,21,35,36,27,9],command:[9,16,13,18,22,4,24,35,27,8,19],simple_geo_near_command:16,validatecollect:[18,22,24,8],undefin:18,latest:35,distanc:16,paus:[33,7,24,8],less:[35,31,14],"boolean":[7,19,16,21,31,14,4,6,1,36,9],additon:6,tcp:35,mojodna:18,indexinform:[19,16,18,6,24,8,9],simpli:0,web:[13,11,35],rapid:[11,32],seekloc:[36,4],add:[22,19,16,31,14,6,23,35,20,8],cleanup:[18,36],tjanczuk:13,logger:18,match:[0,22,16,12,31,14,35,34],karait:13,agnost:18,simple_key_based_distinct:16,piec:[35,31,14,36],know:34,password:[18,22,19],recurs:[14,31,1,4],isclos:[24,9,8],desc:[0,9],bson_data_str:1,insert:[0,22,1,19,11,18,12,4,24,34,33,16,35,26,27,8,9],resid:35,like:[0,32,19,16,13,31,14,6,36,9],fsync:[22,19,16],isui:32,chunkcollect:[24,4,8],necessari:0,"0xff":1,async:[13,35],page:[0,32,35,11],milewis:13,linux:18,gridf:[11,29,37,21,18,4,36],flush:[36,7,4],proper:18,fileinfo:36,newhex:20,librari:[13,11,18,32,36],leaf:13,lead:[18,14,31],aaronasachimp:18,leak:18,avoid:[6,18,22,35],octet:4,thank:18,leav:[18,12],kcbanner:13,speak:32,mode:[9,16,21,18,4,34,36,27,19],slight:35,journal:19,usag:[11,1,29,20,2,21,18,4,34,35,36,27],collection_nam:34,host:27,although:36,offset:[28,18,36,4],java:[31,14],cliftonc:13,simpler:[13,35,18,9,16],continu:13,about:[11,19,12,32,6,35,36,27,9],actual:[0,36,19,35,27],socket:[11,19,2,18,32,17,35,27],http:[11,13,18,32,17,35,25],dbinstanc:36,notequ:[23,14,31,8],constructor:[1,2,3,4,5,7,8,9,10,14,22,15,16,18,19,20,23,24,27,28,29,30,31,33],fals:[0,22,7,19,12,21,18,16,4,33,1,34,29,36,27,9],disabl:[2,18,27],own:[18,4],automat:[7,19,2,21,18,35,36,27,9],dataset:[0,35],bson:[0,7,3,4,5,1,8,9,10,11,12,22,15,16,18,19,20,23,27,28,29,30,33,34],merg:[18,16],val:16,pictur:36,transfer:19,mykei:35,trigger:[7,9,16,18,4,33],concat:0,"var":[0,22,1,19,20,2,21,34,12,4,33,7,16,29,35,36,27,9],fsname:29,"function":[0,1,2,18,4,7,9,12,13,14,22,16,34,19,20,21,27,28,29,31,33,35,36],shouldcorrectlyexecutesimpleaggregationpipelineusingarrai:16,brand:18,learnboost:[13,32],waitforconnect:18,gain:18,overflow:[31,14],inlin:[18,16],bug:[18,36],count:[0,19,12,18,16,4,24,34,8,9],made:[18,32,36],wise:0,whether:[18,14,31],wish:[28,1,19,16,22,4,36],displai:[32,19],asynchron:[2,35],record:[0,19,12,21,34,16,4,6,35,27,9],below:[11,19,12,31,14,35],limit:[0,9,16,21,18,24,35,8],otherwis:[1,9,31,14,4,35,36],problem:[18,22],myexperience1123429378001:32,evalu:[1,19],"int":[31,14],dure:[35,18,22,19,16],year:0,filenam:[21,18,36,4],replica:[2,18,22,19],implement:[13,35,18,14,31],ing:[11,32],eric:32,retrymilisecond:[18,19,27],inc:[35,18],tick:18,detail:[6,9,21],deepequ:[29,16,4,9,19],other:[0,32,11,2,18,14,4,16,35,36,31,37],bool:20,futur:[13,35,18,19],branch:18,stat:[18,24,8,16],findon:[0,19,16,18,24,35,8],"class":[7,3,4,5,1,9,10,14,22,15,16,18,19,20,28,29,30,31,32,33,35,36],geck:13,stai:16,experienc:32,eof:[24,21,36,4,8],integration_test:[7,9,16,22,4,33,29,19],kaij:18,"0_gnhwzhc":25},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Double()","Collection()","Awesome Node.js + MongoDB Applications","Changelog","Db()","ObjectID()","GridStore","Admin()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Binary()","Grid()","Symbol()","Timestamp()","Node.JS Specific Presentations","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver","Articles"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/double","api-generated/collection","content/awesomeappsvideo","changelog/changelog","api-generated/db","api-bson-generated/objectid","markdown-docs/gridfs","api-generated/admin","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-bson-generated/symbol","api-bson-generated/timestamp","content/nodejsvideo","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2","api-articles/index"]}) \ No newline at end of file +Search.setIndex({objects:{"":{DBRef:[3,0,1,""],removeUser:[19,1,1,""],profilingInfo:[22,1,1,""],getNumBitsAbs:[32,1,1,""],batchSize:[9,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],MinKey:[5,0,1,""],shiftRight:[32,1,1,""],writeFile:[4,1,1,""],getTimestamp:[20,1,1,""],Grid:[30,0,1,""],replSetGetStatus:[22,1,1,""],indexInformation:[19,1,1,""],previousErrors:[19,1,1,""],CursorStream:[35,0,1,""],findAndModify:[16,1,1,""],renameCollection:[19,1,1,""],toHexString:[20,1,1,""],indexExists:[16,1,1,""],getLowBits:[32,1,1,""],streamRecords:[9,1,1,""],ObjectID:[20,0,1,""],isNegative:[32,1,1,""],lessThan:[32,1,1,""],isCapped:[16,1,1,""],dropAllIndexes:[16,1,1,""],lastError:[19,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],Long:[14,0,1,""],dropIndex:[19,1,1,""],findAndRemove:[16,1,1,""],cursorInfo:[19,1,1,""],geoNear:[16,1,1,""],toString:[32,1,1,""],listDatabases:[22,1,1,""],isOdd:[32,1,1,""],calculateObjectSize:[1,1,1,""],dropDatabase:[19,1,1,""],Server:[23,0,1,""],Cursor:[9,0,1,""],MaxKey:[10,0,1,""],resetErrorHistory:[19,1,1,""],toArray:[9,1,1,""],reIndex:[19,1,1,""],collectionsInfo:[19,1,1,""],greaterThanOrEqual:[32,1,1,""],Binary:[29,0,1,""],valueOf:[31,1,1,""],validateCollection:[22,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],Timestamp:[32,0,1,""],Symbol:[31,0,1,""],dropCollection:[19,1,1,""],Collection:[16,0,1,""],toNumber:[32,1,1,""],isZero:[32,1,1,""],getHighBits:[32,1,1,""],shiftLeft:[32,1,1,""],createCollection:[19,1,1,""],greaterThan:[32,1,1,""],getLowBitsUnsigned:[32,1,1,""],ReplSet:[34,0,1,""],geoHaystackSearch:[16,1,1,""],mapReduce:[16,1,1,""],lessThanOrEqual:[32,1,1,""],notEquals:[32,1,1,""],GridStore:[4,0,1,""],findOne:[16,1,1,""],ensureIndex:[19,1,1,""],chunkCollection:[4,1,1,""],nextObject:[9,1,1,""],"generationTime number [Getter|Setter]":[20,2,1,""],toJSON:[32,1,1,""],Db:[19,0,1,""],serverStatus:[22,1,1,""],profilingLevel:[22,1,1,""],collectionNames:[19,1,1,""],ReadStream:[7,0,1,""],setProfilingLevel:[22,1,1,""],Admin:[22,0,1,""],Double:[15,0,1,""],shiftRightUnsigned:[32,1,1,""],isClosed:[9,1,1,""],BSON:[1,0,1,""],addUser:[19,1,1,""],toInt:[32,1,1,""],deserializeStream:[1,1,1,""],createIndex:[19,1,1,""],buildInfo:[22,1,1,""]},GridStore:{read:[4,1,1,""],exist:[4,1,1,""],readlines:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[20,1,1,""],createFromHexString:[20,1,1,""]},Timestamp:{fromBits:[32,1,1,""],fromNumber:[32,1,1,""],fromInt:[32,1,1,""],fromString:[32,1,1,""]},Db:{connect:[19,1,1,""]},Long:{fromBits:[14,1,1,""],fromNumber:[14,1,1,""],fromInt:[14,1,1,""],fromString:[14,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:13,returnkei:[18,9,16],maxscan:[18,9,16],readfilesync:4,prefix:[18,36],crete:16,createindex:[19,16,18,6,25,8],world_safe2:16,world_safe1:16,pedro:11,test_map_reduce_functions_inlin:16,deviat:18,under:18,everi:[0,9,28,21],test_gs_seek_with_buff:4,arrj:13,simple_next_object_collect:9,upload:21,correct:[1,19,20,18,4,37],gotik:[13,17],"10k":18,cceac:13,seper:4,direct:[6,9,37],second:[19,12,2,18,20,4,36,16,38,28,9],street:13,aggreg:[18,25,8,16],even:[0,33,16],attemp:[18,19,16],neg:[18,14,32],"while":[0,18,4,21,9],"new":[0,1,2,18,4,6,7,9,12,14,22,16,36,19,20,21,28,30,32,35,37,38],net:13,metadata:[21,38,4],"_event":18,rootcollect:4,never:[18,19],here:[37,38,4],epce4qkoh5:33,io_seek_set:4,anymor:18,loos:[13,37],getlowbit:[24,14,32,8],findandmodifi:[18,16,25,8,12],vincentcr:18,pvorb:13,schemaless:37,sessionstorag:13,middlewar:[13,33],sarah:16,describ:33,would:[0,19,16,18,14,6,38,32],aaron:18,concret:13,overhead:37,recommend:[37,33,16],type:[10,11,1,16,21,3,22,4,5,33,15,38,37,29,31,18,39],tell:[19,16,4,25,37,38,8],relat:6,notic:[37,38,16],warn:[16,19,12],exce:4,hold:[37,1,4,9],must:[0,32,14,16],join:33,err:[0,22,7,19,12,2,21,18,16,4,35,36,30,37,38,28,9],aheckmann:18,setup:[2,38,19],work:[0,9,18,33,4,37,26,38,19],test_gs_tel:4,rework:18,root:[38,4,30],overrid:[18,16,19,9],give:33,simple_geo_haystack_command:16,indic:[0,12,11,36,6,21,37,28],want:[0,19,16,36,4,23,6,15,37,38,28],david:12,unsign:[32,14],end:[7,9,16,21,18,33,4,35,37,38,36],replicaset:[11,19,2,18,22,37,27,34],quot:[18,9],playerid:33,how:[11,33,9,16,22,4,39,37,26,38,19],"_id_":[19,16],recoveri:2,env:19,rewind:[0,9,18,4,25,8],milisecond:[18,19,34,20],config:[2,18,19],updat:[29,11,22,19,16,18,12,33,25,37,38,27,8],maxdist:16,recogn:4,after:[7,9,12,13,21,18,33,4,35,1,38],listdatabas:[25,18,22,19,8],befor:[0,19,16,2,18,34,6,37,38,28],wrong:18,gs2:4,beauti:[11,33],descriptior:21,parallel:37,demonstr:33,attempt:[37,18,22,28,34],third:4,zzdhidden:13,exclud:[9,16],perform:[0,22,19,16,18,14,32,9],maintain:33,errorobject:18,order:[0,9,12,16,6,28],oper:[0,22,19,12,18,14,36,32,6,16,37,38,28,9],cursorinfo:[25,19,8],over:[19,16,13,18,33,28,9],becaus:[13,32,14],readbuff:[18,38],flexibl:13,vari:18,digest:[18,38],uuid:[29,1],fit:[37,9],fix:[18,38],mongolia:13,better:[37,18,28],complex:[37,19,16],loggerinst:18,persist:[37,17,16],split:[32,14,4],them:37,thei:[37,18,14,38,32],safe:[12,19,16,18,22,35,37,36,9],update_a_simple_docu:16,yourself:33,bread:13,"instanceof":[9,16,18,22,4,19],choic:18,guileen:13,changelog:[11,18],bonu:37,timeout:[9,16,2,18,23,28],each:[0,7,19,16,2,18,14,4,34,32,35,25,38,28,8,9],debug:[18,23],went:16,a_simple_collect:19,mean:[9,2,18,33,37,38,28],resum:[35,7,25,8],nin:0,eventstor:13,extract:18,newli:[6,36,22],monitor:13,content:[29,0,7,30,12,13,21,33,4,37,38,8],daniel:[0,28,21],reader:18,got:[37,19,16],more_index_information_test:[19,16],navig:38,worthwhil:38,rail:13,default_port:28,situat:18,standard:[13,18],md5:[29,18,1,4],filter:[33,19,16],mvc:13,pagin:16,regress:18,onto:18,rang:[0,18,16],instruct:2,alreadi:[9,12,21,36,4,6,37,28],wrapper:13,unlin:4,getnumbitsab:[24,14,32,8],primari:[0,19,16,2,18,37,28,9],hexstr:20,rewritten:18,top:[13,32,14,16],startindex:1,tonumb:[24,14,32,8],ton:[37,38],tom:33,kamikazepanda:[13,17],listen:[18,9],consol:[0,1,12,21,36,37,38,28],namespac:3,eventlisten:18,took:9,incur:37,removeus:[25,18,22,19,8],silli:37,target:[38,16],provid:[19,16,13,32,14,4,37,38,34],cursorstream:[25,11,35,9,8],project:[13,11,26,33,16],matter:37,iron:37,myexperience620186085001:33,beginn:11,websocket:[13,37],abov:[37,38,12],modern:13,mind:37,raw:[0,19,16,18,12,36,38,28,9],manner:[18,38],increment:[37,33],seek:[21,18,4,25,38,8],dbref:[11,19,3,24,37,18,8],ensureindex:[19,16,18,6,25,8],simple_limit_collect:9,data2:4,simplifi:[13,18,38],evangelist:33,insur:18,plenti:38,usernam:[6,22,19],object:[0,1,2,18,4,6,7,9,11,12,13,22,16,34,19,20,21,23,28,29,30,39,33,35,36,37,38],deleg:28,regular:[0,21],tradit:37,simplic:38,don:[18,28,16],doc:[0,22,1,19,12,13,18,16,4,35,37,9],flow:18,doe:[33,19,12,18,14,4,36,16,37,38,32],masylum:13,bson_data_d:1,radix:[32,14],random:4,speedup:18,syntax:18,test_stream_funct:9,identifi:[37,36,38],absolut:[32,14,38,4],acquir:9,field2:0,explain:[0,19,16,25,8,9],field1:0,theme:37,busi:37,rich:37,ppf_qxbkwm4g:33,io_seek_cur:4,cachefunct:1,nasti:18,test_cursorstream_destroi:35,stop:18,collectionsinfo:[25,19,8],bson_data_numb:1,report:37,youtub:[26,33,17],databank:13,bar:4,emb:[26,33,17],patch:18,bad:16,previouli:9,fileidobject:[],steam:9,fieldnam:0,fair:38,indexnam:[19,16],num:16,structur:[0,38,37],previouserror:[25,19,8],respons:[0,33,9],fail:[30,16,18,22,37,19],christian:33,awar:16,said:38,databas:[0,30,22,19,12,13,11,18,16,4,39,36,21,37,38,27,28,9],test_gs_empty_file_eof:4,discoveri:33,gridstor:[11,22,7,19,20,21,18,16,4,35,39,1,25,30,38,27,8,9],simplest:[13,0,38],awai:38,lotsofdoc:37,side:13,accord:2,newnam:16,getlasterror:[22,19,16],howev:9,against:[0,22,19,20,18,14,4,16,32,9],logic:[0,18],seri:13,com:[11,13,18,33,17,37,26],con:33,assur:9,can:[0,14,19,20,2,21,18,12,36,32,6,16,37,38,28,9],simple_explain_collect:9,height:[26,33,17],foobar2:4,path:[21,18,4],guid:11,assum:[32,14],duplic:[6,18,16,19,9],three:[37,38,4],been:[18,38,19,9],much:[37,38,33,12],basic:[11,19,39,16,37,38],quickli:33,life:38,regul:9,nodeeventstor:13,search:[13,11,37,16],argument:[29,32,22,7,19,20,35,3,14,4,23,34,1,15,38,16,30,31,18,9],child:19,"catch":[18,16],laurie71:18,another_root:4,subsequ:[19,16],peform:[35,7,19,16,9],dissect:38,properti:[0,20,21,18,4,24,25,8],calcul:1,marriag:[11,33],"typeof":[18,1,4],maxbsons:18,succes:16,toolkit:13,sever:[12,2,36,6,37,28],grown:37,usessl:19,test_is_close_function_on_cursor:9,receiv:38,make:[0,9,12,18,16,6,37,38,28],transpar:33,meetup:[11,33],drawback:38,descend:[6,9],isneg:[24,14,32,8],complet:16,reset_error_histori:19,pick:[37,18,38,19],hang:18,hand:28,fairli:18,tune:38,scenario:28,geohaystack:16,test_close_function_on_cursor:9,client:[22,9,12,13,18,16,4,30,37,19],thi:[29,0,22,7,19,20,13,14,18,12,4,32,6,33,38,16,21,37,26,28,9],everyth:12,settimeout:[35,18,7,19,16],left:[32,14,19,28,16],protocol:[37,18],just:[0,38,37,16],laptop:18,ordin:[19,16],farther:7,yet:28,languag:[13,37,33],previous:18,wmode:33,easi:13,collectionn:28,had:9,board:33,els:[16,22,28,12],ffffff:33,save:[19,16,21,18,12,4,25,28,8],dynamicstream:33,applic:[11,19,13,18,33,17,37,38],which:[0,33,2,21,18,14,4,32,36,38,28],preserv:9,background:[19,16],test_ev:19,apart:[37,38],measur:18,specif:[0,33,19,11,18,20,4,16,37,36,9],arbitrari:[18,4],negat:[24,14,32,8],collection2:[19,16],collection1:16,underli:35,www:[11,19,13,33,17,26],right:[33,32,14,38,37],old:4,creek:33,deal:37,manual:[11,8],interv:18,deserializestream:[24,1,8],dead:18,intern:[0,32,14,21,16],successfulli:9,thu:12,txt:4,nwtj:13,timestampd:20,multipli:[24,14,32,8,16],originalhex:20,christkv:[37,18],condit:[0,18,16],foo:16,localhost:[13,37,36,38,19],a_simple_create_drop_collect:19,collection_stats_test:16,promot:37,repositori:[13,37,18],post:[0,32,14,36,16],ryanke:13,plug:37,obj:16,unpars:18,bson_deseri:18,slightli:37,simul:[32,14,38],commit:19,book:[0,11],simple_previous_error_col:19,bson_data_symbol:1,"float":[37,32,14],encod:[2,37,18,28],bound:[16,19,9],down:[18,19],wrap:[0,7,31,18,35,15],storag:[13,37,38],git:[13,18],wai:[0,12,16,13,18,14,37,38,32],support:[0,21,18,23,37,38],serverinfo:16,avail:[7,9,16,2,35,18,22,4,33,37,38,34,19],width:[26,33,17],test_rename_collection3:16,test_rename_collection2:16,constantli:37,bulqmxg0vdc:33,lowest:18,head:[38,4],medium:22,form:[18,33,4],forc:[18,16,22,19,9],"true":[0,22,1,19,12,2,21,18,16,4,33,35,6,7,36,30,37,38,28,9],reset:[0,4,9,19],new_nam:36,bugfix:18,geospati:[19,16],maximum:[37,18,19,9],until:[37,22,19],deprect:9,fundament:37,dropallindex:[25,8,16],emit:[37,18,35,19,16],shouldcorrectlyfailonretryduetoappcloseofdb:19,featur:38,"abstract":13,fromstr:[32,18,14,24,8],exist:[0,22,19,12,21,18,16,4,6,36,25,37,38,28,8],videoplay:33,check:[0,22,7,19,16,21,18,14,4,34,35,6,1,37,32,9],test_collection_opt:16,bson_binary_subtype_md5:[29,1],test_to_a_after_each:9,floor:20,when:[0,1,9,12,2,21,18,16,4,33,35,7,36,37,38,28],refactor:18,simple_limit_skip_find_one_queri:16,test:[22,19,12,13,21,18,16,4,17,37,38,36,9],forceclos:19,miliscecond:[35,7],node:[11,9,2,18,33,13,17,37,26,8],piplelin:16,consid:16,sql:37,cachefunctionscrc32:1,dropdup:[18,19,16],teixeira:11,longer:[18,4],ignor:[37,1,16],time:[11,33,19,20,2,18,16,34,13,39,37,28,9],push:[19,13,18,35,37,9],backward:[18,9],daili:33,concept:[37,18],skip:[25,0,9,8,16],global:18,read_secondary_onli:[34,23],row:16,millisecond:28,middl:16,depend:18,fog:33,dropindex:[25,6,19,8,16],sourc:[33,17,9],string:[0,1,3,4,6,9,14,22,16,34,19,20,21,23,29,30,31,32,18,36,37,38],feasibl:38,test_cursorstream_resum:35,logmeup:13,contenttyp:21,level:[19,16,13,18,22,4],did:[18,19],dig:37,eventemitt:[18,9],iter:[9,16],item:[7,9,16,18,22,4,35,37,19],team:33,quick:[37,38,33],div:[33,24,14,32,8],round:[37,34],databasenam:[19,28],wtimeout:[18,22,19,16],addtoset:[37,16],sign:[32,14,36],slow_onli:22,cost:18,port:[18,19,23,28],comparis:4,checkoutwrit:19,repli:[37,22,16],muq2w2u5x9m:26,current:[32,22,19,21,3,14,4,33,37,38,18],subtype_uuid:29,boost:13,deriv:[32,14],gener:[11,19,16,13,18,20,38,28],wait:[19,34,16],box:37,bson_data_regexp:1,shift:[18,14,32],simpleemitt:18,queue:[13,37],behav:18,examp:13,numberofretri:[18,19,28],extrem:18,weird:18,werehamst:13,checkkei:1,extra:0,modul:[13,18],prefer:[0,18,34,23,37],toarrai:[0,19,16,13,18,22,25,37,8,9],bxhflrwemeg:17,instal:[37,18],includeloc:16,aaaaipotmrk:33,perf:18,memori:[0,9,11,18,39,37,38],regep:37,serverstatu:[18,22,25,8],connector:[11,33],live:[37,18,38],handler:38,value2:0,value1:0,criteria:12,scope:[37,18,1,19,16],prev:16,maxkei:[10,11,1,18,24,8],multiplecoll1:19,python:11,qard:13,finit:[32,14],visual:13,examin:37,content_typ:[21,38],fly:13,cap:[37,18,19,16],uniqu:[0,19,16,4,6,28],primer:[11,38,33,39],test_correctly_access_collect:19,whatev:28,bson_binary_subtype_funct:[29,1],mongo:[11,19,12,13,18,33,37,38,39],stream:[7,9,21,18,35,4,1,25,37,38,8],predict:18,bson_data_long:1,createcollect:[19,16,18,35,25,37,36,8,9],topic:[11,33],nocr:13,cube:13,kaflr8pi5nk:26,occur:[0,9,12,21,18,4,6,36,28],alwai:[37,32,14,9,16],multipl:[32,16,2,18,14,4,28],ping:[19,18,22,25,34,8],fieldvalu:0,write:[29,1,19,2,21,18,4,24,7,25,37,38,8,30],foreach:[4,16],pure:[22,7,19,20,35,18,16,4,1,30,9],nyc:[11,33],map:[37,18,16],product:[33,32,14],max:[18,16,19,9],dive:[37,38],date:[1,9,16,18,20,22,6,37],docstartindex:1,data:[29,11,7,19,16,21,18,33,4,35,39,1,17,30,37,38,9],grow:37,sbrekken:18,inform:[9,16,2,21,22,4,6,13,37,28,19],"switch":18,reaper:[18,19,28],combin:[33,4,19],keepgoingexampl:16,filedata:4,talk:33,increas:18,still:[0,18,12],pointer:[0,36,4,28,21],dynam:33,test_map_reduce_funct:16,group:[11,16,18,33,25,26,38,8],gte:0,indexexist:[18,25,8,16],jim:16,nodelai:[2,18,28,23],platform:37,mbostock:18,requir:[22,7,19,12,35,18,20,4,36,1,16,30,37,38,28,9],m_tddbw6qnuu4iuxlyo:33,main:[11,38,33,37],non:[13,18,16],"6pjmp23z0lw":26,simple_skip_collect:9,col2:19,col3:19,initi:[9,16,18,4,37,38,19],col1:19,verifi:[19,16,22,4,20],now:[37,18,38,19],discuss:[11,33],nor:36,introduct:[2,11,39,33,37],mapreduc:[18,25,8,16],name:[29,0,22,1,19,12,2,21,3,16,4,28,6,36,33,34,38,18,9],drop:[19,16,18,22,6,25,36,8],revert:0,crypto:18,separ:[0,18,4],mongoerror:18,recreat:28,jprichardson:13,failov:[2,18],replai:18,dialect:13,replac:[0,16,18,12,4,37],individu:[0,18],firej:13,a_1_b_1:[19,16],contributor:33,poolreadi:18,serverclust:18,happen:[35,7,4,9],shown:[37,38],accomplish:38,space:[1,19],streetsaheadllc:13,profil:[22,9,16],stuff:[2,11,38,39,37],factori:[0,28,16],brett:33,million:33,orm:[13,33],mime:4,sethml:18,replacethiscollect:16,org:[13,11,19],"byte":[29,0,1,19,20,21,18,37,38,28],care:[2,0,37],bradberri:33,synchron:37,thing:[37,38,28],place:[11,32,14],year2013:18,frequent:[32,14],first:[0,22,19,12,21,18,20,4,36,33,16,37,38,28,9],origin:[16,12],bson_binary_:18,directli:[0,9,37],onc:[6,37],arrai:[29,0,22,1,19,12,2,21,18,16,4,36,37,34,9],"0x7f":1,reopen:[4,28],fast:13,happi:[13,11,33],open:[22,7,19,12,2,21,18,16,4,35,36,33,25,30,37,38,28,8,9],predefin:1,size:[0,1,19,16,21,18,14,4,38,32,9],given:[29,9,16,32,14,4,38,19],breviti:[37,38],workaround:18,paramt:9,collectionnam:[19,16,36,22,6,25,38,8],conveni:[0,32,14],subtype_md5:29,especi:37,copi:2,specifi:[29,0,9,16,21,18,4,37,38,28,19],test_arrai:9,keepgo:[18,16],than:[0,9,12,2,21,18,14,32,16,38,28],png:[21,4],serv:33,firebas:13,tedeh:18,were:[9,12],posit:[29,21,32,14,4,38],browser:13,pre:[22,1,19,16],fork:13,sai:38,sam:16,pro:33,ani:[0,19,12,13,37,38,9],subroutin:18,simple_rename_collection_2:19,deliv:33,bitwis:[37,32,14],squar:13,alias:0,destroi:[35,7,25,8],note:[32,14,19,9],take:[0,1,2,18,33,37,38],createfromhexstr:[0,18,24,8,20],begin:[0,4],sure:[38,9],normal:9,buffer:[29,0,1,19,12,21,18,16,4,36,30,38,28,9],clearer:18,getyear:16,homepag:13,renam:[19,16,36,25,37,8],byte_valu:29,later:[38,19,16],indexbound:[19,16],test_gs_read_stream:4,runtim:18,parseint:16,axi:16,show:[7,19,20,35,16,4,1,30,37,9],atom:[37,18,16],objectid3:20,objectid2:20,concurr:18,limitrequest:18,corner:18,onli:[0,22,19,12,2,18,16,4,6,37,38,28,9],slow:[18,22,19,16],dice:37,setprofilinginfo:22,activ:[13,18],written:[29,16,13,32,14,4,38],analyt:[13,11,33,37],overwritten:38,min_valu:[32,14],variou:[13,22,16],get:[7,18,4,6,8,9,11,12,13,22,16,36,19,20,21,25,28,30,39,33,35,37,38],secondari:[19,16,2,18,23,34,9],ssl:[18,19,23],cannot:[19,16,32,14,37,18,9],shiftrightunsign:[24,14,32,8],geo:16,gen:33,nolock:[18,19],doabl:0,seldom:18,yield:[18,16,19,36,12],isarrai:1,caboos:13,nettl:13,where:[29,0,1,19,12,2,21,18,16,4,6,37,38,36],highbit:[32,14],desced:9,wiki:37,khwang:13,testcas:18,infinit:[18,14,32],detect:[2,18],heckmann:18,fs_chunk:38,integration_tests_2:19,timestamplib:32,wayt:16,enough:9,between:[19,18,33,28,37,34],"import":[37,38],across:[18,19,28,16],spars:[6,19,16],august:[11,33],tut:11,test_group:16,come:[21,32,14,16],simple_find_and_modify_operations_:16,region:16,gwt:[32,14],tutori:[11,26,38],mani:[37,9],fromnumb:[24,14,32,8],reindex:[25,18,19,8,16],iscap:[18,25,8,16],db_option:28,period:[0,36],dispatch:37,createcreateindexcommand:18,fs_file:38,lessthan:[24,14,32,8],reaperinterv:[18,19,28],cursor_information_collect:19,cursorinst:9,coupl:[37,16],aciev:0,simplereach:33,rebuilt:[19,16],derefer:[25,18,19,8],lowbit:[32,14],geonear:[18,25,8,16],"1mb":38,those:[32,14],"case":[9,16,32,14,6,37,38,18],myself:37,bson_seri:18,tostr:[30,16,32,14,4,24,20,38,8],trick:[11,38],invok:38,idhex:0,firstext:22,simple_sort_collect:9,trello:[11,33],advantag:37,createexperi:33,eras:[21,36],dynamicgui:13,ascii:[2,18,28],acess:19,develop:[13,11,33,37],author:[0,16,21,12],media:13,same:[0,19,20,18,14,4,6,16,32,9],binari:[29,0,22,7,19,20,11,18,12,4,36,35,24,1,16,21,37,30,8,9],html:11,document:[0,22,1,19,11,2,21,18,12,4,33,35,6,36,7,16,13,37,38,28,9],howtonod:11,createpk:28,exhaust:9,ifram:[26,33,17],finish:[38,16],closest:[32,14,16],utf8:[2,37,18,4,28],nest:[0,6],oid:3,driver:[0,12,2,11,18,33,36,13,25,37,38,28,8,39],gotend:4,capabl:33,newobjectid:20,improv:18,extern:[11,18],defo:0,bson_data_boolean:1,crud:[11,39,37],appropri:33,moder:33,framework:[13,16],brightcov:33,without:[1,19,32,14,28,36,18],model:[13,33,16],dereferenc:19,upsert:[16,12],ourexamplefiletowrit:4,execut:[22,9,16,18,12,4,37,19],tip:11,rest:[13,18,16,20],hint:[9,16],db_connector:[36,28],except:[37,18,4,12],littl:37,desktop:11,blog:[13,0,36,11],framebord:[26,33,17],default_chunk_s:4,haystack:16,vimeo:11,found2:4,around:[13,11,18,37],read:[29,7,19,16,2,21,18,4,23,24,25,37,38,34,8,9],streamrecord:[25,37,18,9,8],grid:[29,11,30,13,18,25,38,8],pop:37,world:[7,19,12,16,4,1,38,30],lasterror:[25,18,19,8],reap:18,subtype_user_defin:29,saniti:18,poolsiz:[7,9,16,18,22,4,23,35,30,37,28,19],realtim:[11,33],integ:[0,1,20,32,14,37,18],server:[1,2,18,4,7,9,11,12,13,22,16,34,19,20,23,25,28,30,33,35,36,37,38],firebaseco:13,either:[21,18,38,37],output:[0,16],greaterthanorequ:[24,14,32,8],manag:[13,21,18,37],kvalheim:33,bson_binary_subtype_byte_arrai:[29,1],eventloop:38,"_bsontyp":18,intact:12,generationtim:20,setnodelai:18,slice:37,writedata:38,node_ev:18,confirm:37,definit:11,legal:16,evolv:37,profilinginfo:[22,25,8],bson_data_binari:1,read_primar:23,power:[13,33],broken:18,aquir:19,bson_binary_subtype_default:[29,18,1],regexp:[37,18,1],"throw":[37,18,38,12],comparison:20,pointer_to_collect:0,firstnam:[0,6],nocooki:[26,33,17],numbit:[32,14],bson_data_code_w_scop:1,gump:16,act:38,luck:38,readstream:[25,11,7,9,8],addus:[25,18,22,19,8],test_collections_info:19,your:[16,2,33,4,13,37,38],loc:16,log:[0,1,9,12,13,21,18,16,22,23,36,37,38,28],hex:[0,20],overwrit:[22,4],errormessag:18,strict:[18,36,19,28,16],interfac:[7,9,13,18,35,37,30],low:[37,32,14,38],lot:[11,9,16,18,6,35,37,38],isvid:33,tupl:6,shamelessli:37,replsetsrv:2,faster:[6,18],pull:[37,18,22],dirti:37,possibl:[0,19,12,13,18,16,6,37],"default":[29,0,22,1,19,20,2,21,18,12,4,23,34,6,36,16,37,38,28,9],remove_subset_of_documents_saf:16,dropdatabas:[19,18,22,25,28,8],bson_data_min_kei:1,expect:[0,28],gone:[30,16,4,19],creat:[0,22,1,19,20,2,21,18,16,4,33,35,6,7,36,30,37,38,28,9],certain:[6,37],watcher:13,intro:37,file:[7,19,13,21,18,4,38,30],bob:16,russel:33,calculateobjects:[24,1,8],again:[18,4,9],kaba:13,compel:33,orient:11,field:[0,33,19,12,18,16,4,6,37,9],valid:[1,19,16,36,22,20,9],longlib:14,you:[0,1,19,12,2,21,18,16,23,6,33,36,37,38,28,9],scttnlsn:13,pefrom:16,sequenc:18,symbol:[11,1,31,18,24,37,8],briefli:33,opt_radix:[32,14],pool:[18,19,23,28],reduc:[18,14,32,16],lessthanorequ:[24,14,32,8],coreh:13,directori:18,descript:[29,1,4,9,19],tricki:37,potenti:18,alright:37,cpu:[18,38],unset:37,represent:[10,29,33,30,20,3,14,4,5,15,31,32],all:[0,22,1,19,11,2,21,18,12,4,6,36,16,37,38,28,9],forget:37,numberupd:16,dollar:36,month:33,simple_rename_collect:19,erhangundogan:13,follow:[0,9,12,2,4,6,37,38],fetchsiz:9,disk:[38,7,4,16,9],nodej:[13,33,17],subtype_default:29,nextobject:[25,0,19,8,9],init:9,introduc:33,setprofilinglevel:[22,25,8],evaul:19,util:[13,18],test_rename_collect:16,failur:[37,18],veri:[11,18,38,37],base698:13,list:[19,16,18,22,4,36,25,37,38,34,8],resav:16,adjust:[18,38],findandremov:[18,25,8,16],small:[18,38,26],retun:1,eas:13,zero:[18,14,32,20],design:[11,33],pass:[1,19,20,2,18,16,4,36,38,28,9],excit:33,what:[11,9,36,33,37,38],abc:[0,4,12],xor:[24,14,32,8],sub:[29,33,16],sum:[32,14],brief:26,delet:[19,16,21,18,4,25,37,38,28,8,30],version:[18,38,19,28,16],cruso:0,method:[0,9,11,18,20,4,39,36,16,37,38,28,30],full:[18,19,16],hash:[0,18,38,19,28],variat:37,behaviour:13,getmorecommand:[9,16],foobar3:4,strong:26,modifi:[37,18,16,12],valu:[0,1,18,4,6,8,9,12,14,22,15,16,36,19,20,21,24,28,29,31,32,33,37,38],bartt:13,isodd:[24,14,32,8],ahead:[13,37,38,16],showdiskloc:[18,9,16],amount:[37,32,14,19],croucher:33,social:13,action:11,mongoos:[13,11,26,33],narrow:16,evalfunct:1,via:37,shorthand:12,lazybum:13,c_1:16,deprec:[19,34],default_root_collect:4,establish:[7,9,16,18,22,4,35,30,19],select:[34,16,36,12,28,18],test_collection_is_cap:16,distinct:[18,25,8,16],regist:4,two:[0,14,19,20,2,11,32,12,4,21,6,33,13,37,38,36],coverag:18,bson_binary_subtype_user_defin:[29,1],taken:37,minor:18,more:[0,7,19,12,2,35,18,14,4,13,33,16,37,38,32,9],flag:16,stick:37,particular:37,cach:1,none:[2,33],outlin:[37,38],dev:13,histori:19,remain:[38,4],learn:[13,11,33],scan:[9,16],share:[13,18,33,19,28],shard:21,accept:[18,16],simple_document_insert_collection_no_saf:16,default_url:19,robinson:0,cours:37,newlin:4,divid:[32,14,16],rather:16,anoth:[0,4,37,20],hugh:33,simpl:[0,7,19,11,13,35,18,16,4,6,39,1,30,37,38,36,9],perman:19,resourc:[13,28],resultset:37,reflect:18,unlink:[25,21,38,4,8],associ:[38,4],keyorlist:9,shouldcorrectlyexecutesimpleaggregationpipelineusingargu:16,github:[13,11,18,17,37],defineproperti:18,save_a_simple_document_modify_it_and_resave_it:16,caus:[37,18],callback:[0,22,19,12,21,18,16,4,6,36,37,38,28,9],spheric:16,doc_id:0,bson_data_oid:1,trade:38,through:[37,18,33,19,16],reconnect:[18,28,23,34],paramet:[0,22,19,12,2,21,18,16,4,6,36,37,38,28,9],style:[13,37,33],mongorepli:18,call:[0,9,16,13,18,4,38,28,19],asbuff:1,dbname:[18,19],stylu:17,rapidli:37,bypass:37,simple_limit_skip_queri:16,cool:16,might:[6,38,19,37],alter:[0,36],good:[11,38,37,16],"return":[0,7,3,4,5,1,9,10,12,14,22,15,16,18,19,20,21,28,29,30,31,32,35,36,37,38],timestamp:[11,1,16,18,20,24,32,8],more_complex_index_test:[19,16],distancemultipli:16,compound:[19,16],karaco:13,readlen:4,emerleit:13,uploadd:21,unlik:9,authent:[25,18,22,19,8],easili:[18,14,32],achiev:0,skipvalu:9,found:[0,12,4,16,19],truncat:[18,38,4,36],hard:37,weren:0,realli:37,connect:[11,7,19,16,2,18,22,4,23,34,13,39,35,38,25,30,37,26,28,8,9],barrier:18,event:[7,9,21,18,4,35,37,38,28,19],mojo:13,b4ajeu13u6u:26,read_primari:[18,34],pullal:37,foreground:[19,16],core2duo:18,advanc:[11,39,36,4,37,38],differ:[11,19,20,18,14,4,6,16,37,38,32,30],asc:[0,9,12],reason:[4,23],base:[16,13,21,20,4,37,38],connectionopt:19,put:[29,9,16,18,4,24,25,38,8,30],seconddb:19,gethighbit:[24,14,32,8],tailabl:[18,9,16],omit:[37,3,38,18],dir:12,assign:[2,18],notifi:[37,38,16],articl:[11,38,39],lastnam:[0,6],number:[29,0,22,1,19,20,18,14,4,23,34,32,6,15,16,37,38,28,9],done:[0,7,19,16,21,18,12,22,35,37,38,28],construct:[32,14],autoclos:[21,38,7,4],create_and_drop_an_index:[19,16],miss:18,pageview:16,chunk_typ:4,script:[21,33],interact:[37,38,4,30],least:[0,16],custompkfactori:28,settim:20,statement:[37,38,19],illeg:[30,18,22,19,16],master:[2,18],store:[1,9,13,21,4,37,38,19],schema:[11,33],otherid:20,option:[0,1,2,3,4,6,8,9,12,22,34,19,16,21,23,25,28,29,30,18,36,37,38],reseterrorhistori:[25,19,8],similarli:37,selector:[18,16,19,9],getter:[4,20],pars:[18,1,16],fileid2:4,literarili:37,std:18,kind:38,bson_data_nul:1,whenev:[19,16],remov:[22,19,12,18,16,4,6,25,37,36,8],reus:[18,1,19],str:[32,14],consumpt:38,toward:33,cleaner:13,comput:11,luckili:[37,38],"null":[0,1,19,16,2,18,22,4,23,34,13,35,36,30,28,9],built:[13,37],equival:[37,16],valueof:[24,15,8,31],fromcollect:19,also:[0,9,12,11,18,4,6,37,38,36],build:[22,19,18,33,37,38],tool:[13,33],pipelin:16,lubow:33,blackboard:[13,11,17],choos:[37,34,16],reach:[38,7],most:[0,38,33,37],plai:33,plan:38,native_pars:[7,9,16,22,4,35,30,28,19],"16mb":21,filesystem:21,clear:18,cover:19,part:[37,18,22,26,20],clean:[13,18,19],frombit:[24,14,32,8],ridicul:13,brightcoveexperi:33,session:[13,33],find:[0,7,19,12,13,21,18,16,22,6,35,25,37,8,9],firewal:18,nosql:[13,11],pretti:37,test_gs_weird_bug:4,numberofdocu:1,queu:13,batch_document_insert_collection_saf:16,hit:[19,16],unus:18,express:[0,11,16,13,21,17,37],fieldtoupd:37,test_map_reduce_functions_scop:16,nativ:[13,37,18,28],ferret:13,restart:[35,7],statist:[18,22,19,34,16],wrote:37,set:[0,22,1,19,20,2,21,18,12,4,23,6,36,33,16,37,38,28,9],jade:17,see:[0,12,21,32,14,6,36,37,38,28],easymongo:13,close:[7,19,16,13,21,18,22,4,35,25,30,37,38,28,8,9],my_f:4,chose:33,misalign:18,jenkin:19,someth:[4,28],particip:34,configur:[2,37,18,19,36],altern:[13,16],signatur:[4,9],complement:[32,14],javascript:[1,19,16,13,32,14,33,37],salzman:18,succeed:6,both:[18,16],last:[13,21,19,37],create_and_drop_all_index:19,context:[18,33,28],logout:[25,22,19,8],whole:[37,16,4,19],createdat:9,load:[0,18],episod:11,jsmode:16,point:[9,16,32,14,37,38],instanti:[37,18],param:33,shutdown:18,suppli:[18,38],backend:37,faithfulli:[32,14],user_id:16,due:[37,18,30],empti:[0,18,16,4,9],bgcolor:33,strategi:[37,18,34],test_streamingrecords_funct:9,fire:[7,19,12,13,21,4,37,38,28],admindb:[22,19],imag:[21,38],ecosystem:33,understand:37,func:[1,16],reconnectwait:34,look:[9,16,21,18,33,4,6,37,38],mdoq:13,straight:[37,38],batch:[37,18,9,16],"256k":38,getownpropertynam:18,behavior:[0,12,18,14,37,32],error:[0,22,7,19,12,13,21,18,16,4,23,6,35,36,37,28,9],fun:[38,16],fixtur:13,robin:[37,34],loop:18,real:[13,11,33],test_gs_unlink:4,readi:[35,7,4,37,9],key2:0,key1:0,jpg:4,itself:[11,9],test_deref_exampl:19,rid:18,simple_key_based_distinct_sub_query_filt:16,chase:18,decor:18,simple_document_insert_with_function_saf:16,geohaystacksearch:[18,25,8,16],coffeescript:[13,11,26],p_db:[2,19],higher:[2,18,38,28,16],"10gen":11,optim:[18,16],operaion:21,more_complex_ensure_index_test:[19,16],iya_logo_final_bw:4,temporari:[4,16],user:[29,0,1,19,11,13,18,12,4,6,33,22],hello2:16,keyf:16,recent:33,travers:9,entri:[38,16,4,19],joyent:33,readprefer:[34,23],explan:[19,16],getlowbitsunsign:[24,14,32,8],a_1:16,collabor:33,shape:18,update_a_simple_document_multi:16,bson_data_timestamp:1,cur:38,colladow:13,tdegrunt:13,keeptemp:16,read_secondari:[2,18,34,23],input:[32,14,16],mod:[0,32,14],format:[0,19,16,12,22,9],big:[37,18,38],checksum:4,shiftright:[24,14,32,8],rs_name:[2,18,34],replsetserv:[22,1,19,20,2,35,18,16,4,7,30,9],backbon:33,success:[21,4,9],resolv:19,collect:[0,2,3,4,6,8,9,11,12,13,22,34,19,16,21,25,27,28,30,39,33,36,35,18,37,38],bson_data_cod:1,popular:[11,33,37],bamboo:18,variant:37,serverpair:18,often:[32,14],creation:[22,19,16,18,33,37],some:[0,7,19,11,21,18,16,4,6,33,30,37,38,9],back:[0,22,16,13,32,14,4,37,20],understood:37,sampl:37,scale:[11,38,33,37,16],slaveok:[18,19,23,16],chunksiz:[21,18,38,4],retri:[37,18,19,34,28],larg:[0,19,16,21,18,37,38],intial:16,previou:[38,28],run:[11,22,19,16,2,18,12,37,38,39],lublow:33,simple_reset_error_history_col:19,step:38,simple_explain_queri:16,zir:13,subtract:[24,14,32,8],k1mnspb8wvq:26,allowfullscreen:[26,33,17],recordquerystat:19,block:[38,19,16],cygwin:18,within:[32,14],simple_index_test:16,ensur:[19,16,18,6,37,38],test_collection_index_exist:16,question:[33,32,14],"long":[11,1,9,20,18,14,24,37,8],custom:[0,18,38,28,16],includ:[0,33,19,11,18,16,4,6,36,37,28,9],forward:4,files:[18,4],properli:[18,4],isbuff:18,uniquedoc:16,ascend:[0,9,6],hainterv:34,link:[11,38,39,37],translat:13,simple_count_exampl:16,line:[13,38,4],info:[18,22,38,19,16],concaten:[32,14,4],consist:18,caller:9,forceserverobjectid:[18,19,28],contin:13,readlin:[25,4,8],similar:21,constant:[29,1,9,4,24,25,8,19],multiplecoll2:19,parser:[18,1,19,28],doesn:[0,28,12],repres:[9,20,32,14,4,23,15,37,31],isconnect:18,"_isus":[],titl:[0,16,27,12],unidirect:9,wakup:19,nice:[37,33],deseri:[1,9,18,24,37,8],bcoe:13,jannehietamaki:18,mongodb:[0,1,2,18,4,6,7,8,9,11,12,13,22,17,16,36,19,20,21,23,26,28,30,33,35,37,38],eval:[1,19,16,18,25,8,9],profilinglevel:[22,25,8],algorithm:[2,32,18,14,28],cursorinform:19,tradeoff:38,awesom:[11,26,17],far:4,hello:[7,19,12,16,4,1,37,38,30],code:[22,7,19,20,35,18,16,4,1,30,37,38,9],partial:[9,16],worldbuff:4,queri:[0,22,19,12,11,18,16,4,6,39,33,36,37,27,28,9],idvalu:0,mongoskin:13,replicasetcheckinterv:18,base64:[2,30,18,4,28],update_a_simple_document_upsert:16,send:[2,37,18,19,28],lower:[19,16],io_seek_end:4,sens:12,reapertimeout:[18,19,28],passiv:18,shouldcorrectlyforcereindexoncollect:16,result2:30,degrunt:13,writebuff:18,untouch:28,relev:37,magic:13,gettim:[9,20],roll:11,fieldorspec:[19,16],fewer:16,"try":[37,18,16,38,12],race:18,marri:33,refer:[9,3,4,37,18,19],smaller:21,fortun:37,natur:[37,33],jump:[37,38,33],video:[11,38],odm:[13,11,26],download:37,odd:[32,14],append:[21,4,37],compat:18,index:[11,1,19,16,18,6,25,27,36,8,9],compar:[20,32,14,4,6,24,8],descriptor:38,access:[9,16,21,22,4,31,15,19],experiment:18,asced:9,lee:18,bson_data_int:1,batchsizevalu:9,cursor_count_collect:9,calipso:13,let:[7,9,16,18,4,37,38,19],filedescriptor:38,becom:37,sinc:[37,32,14,38,12],subtype_byte_arrai:29,nexttick:18,convert:[0,37,20],convers:[37,16],larger:[21,18,38],technolog:33,chang:[16,18,14,37,38,32],tempcollect:16,appli:[0,18,9,37],app:[2,11,18,33],mattinsl:13,api:[11,19,13,33,24,25,38],redi:33,cloud:11,chrisgibson:13,from:[0,1,2,36,4,9,11,12,14,22,16,34,19,20,21,23,29,30,32,33,18,37,38],batchsiz:[25,16,19,8,9],doubl:[11,18,24,15,37,8],next:[0,1,9,33,38,28],websit:[13,33],chr:4,panel:[11,33],sort:[0,9,12,18,20,25,6,16,8],src:[26,33,17],benchmark:18,name2:0,insensit:9,socketopt:[2,18,28,23],sollect:36,account:16,retriev:[0,22,9,12,21,18,16,4,37,38,19],scalabl:21,multiple_db_inst:19,annot:38,unopen:18,thin:13,fetch:[0,30,9,16,6,37,19],queryfailur:18,control:[37,18,38,28],objectid:[0,22,7,19,20,11,3,16,4,28,35,24,1,30,37,38,18,8,9],process:[11,19,13,18,14,32,9],lock:[18,38,19],username_:6,high:[19,16,32,14,34,37,18],tag:[18,16],serial:[1,19,16,18,24,8],readprefr:23,pingresult:22,integration_test_:[2,19],instead:[0,19,16,2,18,23,6,38,28,9],npm:[37,18],pois:33,await:19,formattedorderclaus:18,originaldata:30,alloc:[18,1,19],bind:13,remove_all_documents_no_saf:16,correspond:[6,32,14,36],element:[0,4,37,9],issu:[37,18,16],chief:33,writ:4,allow:[9,16,18,22,4,23,34,36,37,38,28,19],subtyp:29,deoptim:18,doc2:37,doc3:37,move:[21,18,4,37],alexeypetrushin:13,doc4:37,spank:18,autoindexid:19,server_opt:28,effici:[37,38,16],bunch:[18,19,16],perfect:37,total:[0,16],crash:18,greater:[0,32,14,9],handl:[33,9,16,32,14,4,37,38,18],databs:[21,36,28],dai:[11,33],auth:[18,19],renamecollect:[25,19,8],precess:37,numberofremoveddoc:16,writefil:[25,21,38,4,8],convin:0,anyth:18,edit:[38,4],npmj:13,slide:[11,33],deserializeddoc:1,exampledb:[37,38],subset:[9,16],unwind:16,themselv:18,opensync:4,chunk:[21,18,38,4],bson_binary_subtype_uuid:[29,1],default_content_typ:4,pushal:[37,18],our:[37,38,33,4,9],special:[37,32,14,38,9],out:[11,19,16,2,18,20,37,38,28,39],variabl:[37,18,16],calip:13,trickier:[0,37],categori:38,suitabl:38,leverag:[37,33],ref:18,clone:13,math:20,jessica:[0,12],insid:[0,38,21,6],dropcollect:[25,36,19,8],manipul:16,releas:18,princess:16,replsetgetstatu:[18,22,25,8],unwant:0,could:[37,18],shiftleft:[24,14,32,8],keep:[21,18,19,37,16],length:[29,22,1,9,20,21,16,4,24,38,8,19],lte:0,primarki:0,minkei:[11,18,1,24,5],evanp:13,debugmessag:18,iszero:[24,14,32,8],should_correctly_rewind_and_restart_cursor:9,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:19,prioriti:18,start:[29,0,1,9,11,2,36,16,4,37,38],system:[13,36,38,4],messag:[19,12,18,22,4,23,16],createfromtim:[18,24,8,20],bson_data_max_kei:1,termin:4,"final":[37,18,33,16],idottv:13,deconstruct:38,test_gs_getc_fil:4,exactli:36,gridstorew:4,bson_data_object:1,replset:[2,11,19,25,34],pgebheim:18,bother:33,mongoserv:[36,28],tocollect:19,charact:[29,18,16,4,20],test_gs_puts_and_readlin:4,seriou:18,result:[0,22,7,30,19,12,14,18,20,4,32,16,21,37,38,28,9],deliveri:33,counter:[28,16],terribl:18,corrupt:[18,22],have:[0,19,16,2,36,33,4,23,6,37,38],tabl:[37,26,36],need:[0,1,19,12,21,32,14,36,23,6,16,37,38,28],turn:[0,18,22,19,34],border:26,buildinfo:[22,25,8],min:[18,16,19,9],rout:13,mix:[0,6],andrewjston:18,milli:22,test_other_drop:16,orgiin:4,singl:[29,0,33,19,12,21,18,16,4,23],fileid:[38,7,4],statsync:4,whi:0,serverconfig:[18,19,28],why:[13,37,33],overwriten:4,url:[13,19],integration_tests_to_drop:19,request:[18,33,9],face:37,piplin:16,test_collect:12,snapshot:[9,16],"400m":33,determin:[37,9],constrain:4,"_id":[0,19,12,18,16,4,6,38,28,30],fact:[37,12],text:[14,16,32,33,4,38],serializefunct:[18,1,19,16],verbos:16,"static":13,nagl:[2,18,28],anywai:[19,16],setter:[4,20],textual:[32,14],locat:[37,16,4,9,19],playerkei:33,should:[0,22,19,16,32,14,38,30,20,36,9],noid:13,test_cursorstream_paus:35,local:[3,19],devnul:13,doc1:37,ritch:[13,18],kiefer:33,gettimestamp:[18,24,8,20],donewithwrit:38,enabl:[18,19,28],organ:33,simple_batch_size_collect:9,tohexstr:[0,18,24,8,20],integr:[13,37,38],contain:[29,1,9,16,2,36,4,23,37,38,19],grab:[22,19,9],mon4mongo:13,view:13,legaci:23,modulo:[0,24,14,32,8],packet:18,meritt:13,fromint:[24,14,32,8],statu:[13,37,18,22,34],wire:[37,18],correctli:[37,18,16],pattern:11,boundari:18,state:[37,18,9,28],crude:37,world2:16,kei:[0,1,19,16,18,4,6,37,38,28,9],buckets:16,simple_queri:16,isol:18,job:[13,16],entir:[38,4,9],joe:16,auto_reconnect:[7,9,16,2,22,4,23,35,30,37,38,28,19],crc32:1,addit:[0,1,19,16,32,14,22,38,34,9],mongod:[13,23],plugin:33,admin:[11,33,19,16,18,22,25,8],mongoj:[13,11],equal:[0,22,7,19,20,35,32,14,4,24,1,16,30,37,8,9],etc:[0,28,16],instanc:[22,1,19,20,2,18,16,4,30,37,38,28,9],greaterthan:[24,14,32,8],mongoq:13,subtype_funct:29,comment:[18,9,16],toint:[24,14,32,8],walk:33,removealllisten:18,save_a_simple_docu:16,attende:33,addition:36,compon:18,json:[11,33,32,14,24,37],treat:[0,18,9],pkfactori:[19,16],immedi:12,bit:[0,1,21,32,14,37,38,18],assert:[22,7,19,20,35,16,4,1,30,9],ador:13,present:[6,36,33,11],replic:[2,19],multi:[18,16,12],plain:18,align:18,cursor:[0,7,19,11,18,16,35,25,37,8,9],defin:[29,0,1,19,12,18,14,4,32,16,37,28],setreadprefer:18,bson_data_arrai:1,observ:13,layer:[13,37,33],helper:[13,18],site:2,lightweight:13,tojson:[32,18,14,24,8],nodetut:11,getc:[25,4,8],cross:18,member:[2,18],world_no_saf:16,speaker:33,probabl:0,gett:13,difficult:38,incorrect:18,slave:2,hostnam:28,keepal:[2,18,28,23],upon:9,proxlet:33,retriv:22,student:26,serializewithbufferandindex:[24,1,8],php:11,chunk_siz:[21,4],off:[9,2,18,22,4,36,37,28,19],center:16,nevertheless:28,builder:33,well:[0,18,38,37],exampl:[0,22,7,19,20,11,30,12,4,35,6,36,1,39,16,21,37,38,28,9],command:[9,16,13,18,22,4,23,25,37,28,8,19],simple_geo_near_command:16,validatecollect:[18,22,25,8],undefin:18,latest:37,distanc:16,paus:[35,7,25,8],less:[37,32,14],"boolean":[7,19,16,21,32,14,4,23,6,1,38,34,9],additon:6,tcp:37,mojodna:18,indexinform:[19,16,18,6,25,8,9],simpli:0,web:[13,11,37],rapid:[11,33],seekloc:[38,4],add:[22,19,16,32,14,6,24,37,20,8],cleanup:[18,38],tjanczuk:13,logger:[18,23],match:[0,22,16,12,32,14,37,36],karait:13,agnost:18,simple_key_based_distinct:16,piec:[37,32,14,38],know:36,password:[18,22,19],recurs:[14,32,1,4],isclos:[25,9,8],desc:[0,9],bson_data_str:1,insert:[0,22,1,19,11,18,12,4,23,25,36,35,16,37,27,28,8,9],resid:37,like:[0,33,19,16,13,32,14,6,38,9],fsync:[22,19,16],isui:33,chunkcollect:[25,4,8],necessari:0,"0xff":1,async:[13,37],page:[0,33,37,11],milewis:13,linux:18,gridf:[11,30,39,21,18,4,38],flush:[38,7,4],proper:18,fileinfo:38,newhex:20,librari:[13,11,18,33,38],leaf:13,lead:[18,14,32],aaronasachimp:18,leak:18,avoid:[6,18,22,37],octet:4,thank:18,leav:[18,12],kcbanner:13,speak:33,mode:[9,16,21,18,4,36,38,28,19],slight:37,journal:19,usag:[11,1,30,20,2,21,18,4,36,37,38,28],collection_nam:36,host:[28,23],although:38,offset:[29,18,38,4],java:[32,14],cliftonc:13,simpler:[13,37,18,9,16],continu:13,about:[11,19,12,33,6,37,38,28,9],actual:[0,38,19,37,28],socket:[11,19,2,18,33,23,17,37,28],http:[11,13,18,33,17,37,26],dbinstanc:38,notequ:[24,14,32,8],constructor:[1,2,3,4,5,7,8,9,10,14,22,15,16,18,19,20,23,24,25,28,29,30,31,32,34,35],fals:[0,22,7,19,12,21,18,16,4,23,34,35,1,36,30,38,28,9],disabl:[2,18,28],own:[18,4],automat:[7,19,2,21,18,37,38,28,9],dataset:[0,37],bson:[0,7,3,4,5,1,8,9,10,11,12,22,15,16,18,19,20,24,28,29,30,31,35,36],merg:[18,16],val:16,pictur:38,transfer:19,mykei:37,trigger:[7,9,16,18,4,35],concat:0,"var":[0,22,1,19,20,2,21,36,12,4,35,7,16,30,37,38,28,9],fsname:30,"function":[0,1,2,18,4,7,9,12,13,14,22,16,34,19,20,21,23,28,29,30,32,35,36,37,38],shouldcorrectlyexecutesimpleaggregationpipelineusingarrai:16,brand:18,learnboost:[13,33],waitforconnect:18,gain:18,overflow:[32,14],inlin:[18,16],bug:[18,38],count:[0,19,12,18,16,4,25,36,8,9],made:[18,33,38],wise:0,whether:[18,14,32],wish:[29,1,19,16,22,4,38],displai:[33,19],asynchron:[2,37],record:[0,19,12,21,36,16,4,6,37,28,9],below:[11,19,12,32,14,37],limit:[0,9,16,21,18,25,37,8],otherwis:[1,9,32,14,4,37,38],problem:[18,22],myexperience1123429378001:33,evalu:[1,19],"int":[32,14],dure:[37,18,22,19,16],year:0,filenam:[21,18,38,4],replica:[2,18,22,19],implement:[13,37,18,14,32],ing:[11,33],eric:33,retrymilisecond:[18,19,28],inc:[37,18],tick:18,detail:[6,9,21],deepequ:[30,16,4,9,19],other:[0,33,11,2,18,14,4,16,37,38,32,39],bool:20,futur:[13,37,18,19],branch:18,stat:[18,25,8,16],findon:[0,19,16,18,25,37,8],"class":[7,3,4,5,1,9,10,14,22,15,16,34,19,20,23,29,30,31,32,33,35,18,37,38],geck:13,stai:16,experienc:33,eof:[25,21,38,4,8],integration_test:[7,9,16,22,4,35,30,19],kaij:18,"0_gnhwzhc":26},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Double()","Collection()","Awesome Node.js + MongoDB Applications","Changelog","Db()","ObjectID()","GridStore","Admin()","Server()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Binary()","Grid()","Symbol()","Timestamp()","Node.JS Specific Presentations","ReplSet","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver","Articles"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/double","api-generated/collection","content/awesomeappsvideo","changelog/changelog","api-generated/db","api-bson-generated/objectid","markdown-docs/gridfs","api-generated/admin","api-generated/server","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-bson-generated/symbol","api-bson-generated/timestamp","content/nodejsvideo","api-generated/replset","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2","api-articles/index"]}) \ No newline at end of file From 5b5cae3b08de10ac8e31b1264fd1fca4e92d9de9 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Fri, 20 Apr 2012 15:10:19 +0200 Subject: [PATCH 21/56] Updated docs --- _sources/api-generated/db.txt | 9 +- _sources/api-generated/replset.txt | 28 +++++ _sources/api-generated/server.txt | 28 +++++ _sources/github/github.txt | 78 ++++++------- api-generated/db.html | 11 +- api-generated/replset.html | 177 +++++++++++++++++++++++++++++ api-generated/server.html | 177 +++++++++++++++++++++++++++++ genindex.html | 2 +- github/github.html | 78 ++++++------- objects.inv | Bin 1257 -> 1260 bytes searchindex.js | 2 +- 11 files changed, 506 insertions(+), 84 deletions(-) create mode 100644 _sources/api-generated/replset.txt create mode 100644 _sources/api-generated/server.txt create mode 100644 api-generated/replset.html create mode 100644 api-generated/server.html diff --git a/_sources/api-generated/db.txt b/_sources/api-generated/db.txt index 40a64d74dde..759de15c9c5 100644 --- a/_sources/api-generated/db.txt +++ b/_sources/api-generated/db.txt @@ -2003,10 +2003,15 @@ Connect to MongoDB using a url as documented at www.mongodb.org/display/DOCS/Connections -.. js:function:: Db.connect(url, options, callback) + + +Options + - **uri_decode_auth** {Boolean, default:false} uri decode the user name and password for authentication + +.. js:function:: Db.connect(url[, options], callback) :param string url: connection url for MongoDB. - :param object options: additional options not covered by the url. + :param object [options]: optional options for insert command :param function callback: callback returns the initialized db. :returns: null diff --git a/_sources/api-generated/replset.txt b/_sources/api-generated/replset.txt new file mode 100644 index 00000000000..2ef148b59af --- /dev/null +++ b/_sources/api-generated/replset.txt @@ -0,0 +1,28 @@ +======= +ReplSet +======= + +------------------ +Constructor +------------------ + + +ReplSet constructor provides replicaset functionality + + + .. js:class:: ReplSet + + :param array list: of server objects participating in the replicaset. + :param object [options]: additional options for the collection. + + +Options + - **ha** {Boolean, default:false}, turn on high availability. + - **haInterval** {Number, default:2000}, time between each replicaset status check. + - **reconnectWait** {Number, default:1000}, time to wait in miliseconds before attempting reconnect. + - **retries** {Number, default:30}, number of times to attempt a replicaset reconnect. + - **rs_name** {String}, the name of the replicaset to connect to. + - **readPreference** {String}, the prefered read preference (Server.READ_PRIMARY, Server.READ_SECONDARY, Server.READ_SECONDARY_ONLY). + - **read_secondary** {Boolean, deprecated}, allow reads from secondary. + - **strategy** {String, default:null}, selection strategy for reads choose between (ping and statistical, default is round-robin) + diff --git a/_sources/api-generated/server.txt b/_sources/api-generated/server.txt new file mode 100644 index 00000000000..782a6888994 --- /dev/null +++ b/_sources/api-generated/server.txt @@ -0,0 +1,28 @@ +======== +Server() +======== + +------------------ +Constructor +------------------ + + +Class representing a single MongoDB Server connection + + + .. js:class:: Server() + + :param string host: the server host + :param number port: the server port + :param object [options]: optional options for insert command + + +Options + - **readPreference** {String, default:null}, set's the read preference (Server.READ_PRIMAR, Server.READ_SECONDARY_ONLY, Server.READ_SECONDARY) + - **ssl** {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support) + - **slaveOk** {Boolean, default:false}, legacy option allowing reads from secondary, use **readPrefrence** instead. + - **poolSize** {Number, default:1}, number of connections in the connection pool, set to 1 as default for legacy reasons. + - **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), timeout:(number)) + - **logger** {Object, default:null}, an object representing a logger that you want to use, needs to support functions debug, log, error **({error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}})**. + - **auto_reconnect** {Boolean, default:false}, reconnect on error. + diff --git a/_sources/github/github.txt b/_sources/github/github.txt index d54eef1548d..30de94f171c 100644 --- a/_sources/github/github.txt +++ b/_sources/github/github.txt @@ -16,7 +16,7 @@ Web frameworks using MongoDB * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 0:19:12 on 12/3/2012 + - 16:2:27 on 13/3/2012 * - **Homepage** - http:// * - **Url** @@ -39,7 +39,7 @@ Web frameworks using MongoDB * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 3:0:43 on 9/3/2012 + - 3:4:26 on 16/3/2012 * - **Homepage** - http:// * - **Url** @@ -62,7 +62,7 @@ Web frameworks using MongoDB * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 12:40:40 on 6/2/2012 + - 10:10:55 on 17/3/2012 * - **Homepage** - http://search.npmjs.org/#/bread * - **Url** @@ -134,7 +134,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 18:58:47 on 9/3/2012 + - 23:56:15 on 19/3/2012 * - **Homepage** - http:// * - **Url** @@ -142,9 +142,9 @@ Object Document Modeling Libraries * - **Clone Url** - https://github.com/LearnBoost/mongoose.git * - **Forks** - - 178 + - 182 * - **Watchers** - - 1876 + - 1902 .. topic:: mongo-model @@ -157,7 +157,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 14:48:3 on 31/2/2012 + - 23:4:26 on 17/3/2012 * - **Homepage** - http://http://alexeypetrushin.github.com/mongo-model * - **Url** @@ -167,7 +167,7 @@ Object Document Modeling Libraries * - **Forks** - 4 * - **Watchers** - - 35 + - 38 .. topic:: mongodb-expressions @@ -227,9 +227,9 @@ Content Management Systems :header-rows: 0 * - **Activity Level** - - .. image:: ../static/nonactive.png + - .. image:: ../static/active.png * - **Last push** - - 19:13:40 on 11/6/2011 + - 6:25:45 on 18/3/2012 * - **Homepage** - http:// * - **Url** @@ -252,7 +252,7 @@ Content Management Systems * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 16:57:40 on 11/3/2012 + - 10:54:59 on 16/3/2012 * - **Homepage** - http://calip.so * - **Url** @@ -260,9 +260,9 @@ Content Management Systems * - **Clone Url** - https://github.com/cliftonc/calipso.git * - **Forks** - - 109 + - 108 * - **Watchers** - - 778 + - 787 Grid FS libraries or tools -------------------------- @@ -312,9 +312,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/guileen/node-mongoskin.git * - **Forks** - - 24 + - 25 * - **Watchers** - - 278 + - 283 .. topic:: mongoq @@ -383,7 +383,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 8 * - **Watchers** - - 127 + - 130 .. topic:: mongode @@ -406,7 +406,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 1 * - **Watchers** - - 36 + - 37 .. topic:: node-mongodb-wrapper @@ -419,7 +419,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 14:13:28 on 27/1/2012 + - 17:45:57 on 19/3/2012 * - **Homepage** - http://http://i.tv * - **Url** @@ -427,9 +427,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/idottv/node-mongodb-wrapper.git * - **Forks** - - 5 + - 7 * - **Watchers** - - 28 + - 31 .. topic:: mongodb-async @@ -547,7 +547,7 @@ REST api's around MongoDB or resource based libraries * - **Forks** - 24 * - **Watchers** - - 129 + - 136 .. topic:: lazyBum @@ -779,7 +779,7 @@ Logging libraries or applications * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 19:45:47 on 1/3/2012 + - 11:52:6 on 19/3/2012 * - **Homepage** - http://dev/null * - **Url** @@ -789,7 +789,7 @@ Logging libraries or applications * - **Forks** - 1 * - **Watchers** - - 14 + - 17 Monitoring applications or libraries ------------------------------------ @@ -911,9 +911,9 @@ Translation libraries or frameworks * - **Clone Url** - https://github.com/masylum/dialect.git * - **Forks** - - 14 + - 15 * - **Watchers** - - 92 + - 96 Libraries or Applications for analytics --------------------------------------- @@ -929,7 +929,7 @@ Libraries or Applications for analytics * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 17:10:35 on 11/3/2012 + - 1:24:7 on 20/3/2012 * - **Homepage** - http://http://square.github.com/cube * - **Url** @@ -937,9 +937,9 @@ Libraries or Applications for analytics * - **Clone Url** - https://github.com/square/cube.git * - **Forks** - - 136 + - 138 * - **Watchers** - - 1686 + - 1699 Libraries for the connect middleware ------------------------------------ @@ -963,9 +963,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/bartt/connect-session-mongo.git * - **Forks** - - 4 + - 5 * - **Watchers** - - 9 + - 10 .. topic:: connect-mongodb @@ -986,9 +986,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/masylum/connect-mongodb.git * - **Forks** - - 21 + - 23 * - **Watchers** - - 139 + - 144 .. topic:: connect-mongo @@ -1001,9 +1001,9 @@ Libraries for the connect middleware * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 15:8:21 on 6/3/2012 + - 1:10:40 on 15/3/2012 * - **Homepage** - - http:// + - http://http://kcbanner.github.com/connect-mongo/ * - **Url** - https://github.com/kcbanner/connect-mongo * - **Clone Url** @@ -1011,7 +1011,7 @@ Libraries for the connect middleware * - **Forks** - 37 * - **Watchers** - - 101 + - 109 Libraries or applications for continous integration --------------------------------------------------- @@ -1027,9 +1027,9 @@ Libraries or applications for continous integration * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 14:19:55 on 11/3/2012 + - 0:9:49 on 15/3/2012 * - **Homepage** - - http:// + - http://http://ryankee.github.com/concrete * - **Url** - https://github.com/ryankee/concrete * - **Clone Url** @@ -1037,7 +1037,7 @@ Libraries or applications for continous integration * - **Forks** - 17 * - **Watchers** - - 147 + - 150 Exampe applications ------------------- @@ -1086,5 +1086,5 @@ Exampe applications * - **Forks** - 1 * - **Watchers** - - 3 + - 4 diff --git a/api-generated/db.html b/api-generated/db.html index 0d01d53067a..73995e6ed09 100644 --- a/api-generated/db.html +++ b/api-generated/db.html @@ -2251,16 +2251,23 @@

      dropDatabase

      Connect to MongoDB using a url as documented at

      www.mongodb.org/display/DOCS/Connections

      +
      +
      Options
      +
        +
      • uri_decode_auth {Boolean, default:false} uri decode the user name and password for authentication
      • +
      +
      +
      -Db.connect(url, options, callback)
      +Db.connect(url[, options], callback)
      diff --git a/api-generated/replset.html b/api-generated/replset.html new file mode 100644 index 00000000000..059f34d9c61 --- /dev/null +++ b/api-generated/replset.html @@ -0,0 +1,177 @@ + + + + + + + + + ReplSet — MongoDB Node.JS Driver 0.9.9.8 documentation + + + + + + + + + + + + + +
      +
      +
      +
      + +
      +

      ReplSet

      +
      +

      Constructor

      +

      ReplSet constructor provides replicaset functionality

      +
      +
      +
      +class ReplSet()
      +
      Arguments:
      • url (string) – connection url for MongoDB.
      • -
      • options (object) – additional options not covered by the url.
      • +
      • [options] (object) – optional options for insert command
      • callback (function) – callback returns the initialized db.
      +++ + + + +
      Arguments:
        +
      • list (array) – of server objects participating in the replicaset.
      • +
      • [options] (object) – additional options for the collection.
      • +
      +
      +
      + + +
      +
      Options
      +
        +
      • ha {Boolean, default:false}, turn on high availability.
      • +
      • haInterval {Number, default:2000}, time between each replicaset status check.
      • +
      • reconnectWait {Number, default:1000}, time to wait in miliseconds before attempting reconnect.
      • +
      • retries {Number, default:30}, number of times to attempt a replicaset reconnect.
      • +
      • rs_name {String}, the name of the replicaset to connect to.
      • +
      • readPreference {String}, the prefered read preference (Server.READ_PRIMARY, Server.READ_SECONDARY, Server.READ_SECONDARY_ONLY).
      • +
      • read_secondary {Boolean, deprecated}, allow reads from secondary.
      • +
      • strategy {String, default:null}, selection strategy for reads choose between (ping and statistical, default is round-robin)
      • +
      +
      +
      + + + + + + + +
      +
      + +

      Page Contents

      + + + +

      Core Documentation

      + + + + +

      This Page

      + +
      +
      +
      + + + + + + + + + \ No newline at end of file diff --git a/api-generated/server.html b/api-generated/server.html new file mode 100644 index 00000000000..8743d110466 --- /dev/null +++ b/api-generated/server.html @@ -0,0 +1,177 @@ + + + + + + + + + Server() — MongoDB Node.JS Driver 0.9.9.8 documentation + + + + + + + + + + + + + +
      +
      +
      +
      + +
      +

      Server()

      +
      +

      Constructor

      +

      Class representing a single MongoDB Server connection

      +
      +
      +
      +class Server()
      +
      +++ + + + +
      Arguments:
        +
      • host (string) – the server host
      • +
      • port (number) – the server port
      • +
      • [options] (object) – optional options for insert command
      • +
      +
      +
      + +
      +
      +
      Options
      +
        +
      • readPreference {String, default:null}, set’s the read preference (Server.READ_PRIMAR, Server.READ_SECONDARY_ONLY, Server.READ_SECONDARY)
      • +
      • ssl {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support)
      • +
      • slaveOk {Boolean, default:false}, legacy option allowing reads from secondary, use readPrefrence instead.
      • +
      • poolSize {Number, default:1}, number of connections in the connection pool, set to 1 as default for legacy reasons.
      • +
      • socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), timeout:(number))
      • +
      • logger {Object, default:null}, an object representing a logger that you want to use, needs to support functions debug, log, error ({error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}}).
      • +
      • auto_reconnect {Boolean, default:false}, reconnect on error.
      • +
      +
      +
      +
      +
      + + +
      +
      +
      +
      +
      + +

      Page Contents

      + + + +

      Core Documentation

      + + + + +

      This Page

      + +
      +
      +
      +
      + + + + + + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html index bf83c73f1a9..2c8880d4221 100644 --- a/genindex.html +++ b/genindex.html @@ -892,7 +892,7 @@

      V

  • -
    valueOf() (built-in function), [1] +
    valueOf() (built-in function), [1]
    diff --git a/github/github.html b/github/github.html index 9e55680ffa6..8b7cb9b5ecd 100644 --- a/github/github.html +++ b/github/github.html @@ -61,7 +61,7 @@

    Web frameworks using MongoDBLast push -0:19:12 on 12/3/2012 +16:2:27 on 13/3/2012 Homepage http:// @@ -97,7 +97,7 @@

    Web frameworks using MongoDBLast push -3:0:43 on 9/3/2012 +3:4:26 on 16/3/2012 Homepage http:// @@ -133,7 +133,7 @@

    Web frameworks using MongoDBLast push -12:40:40 on 6/2/2012 +10:10:55 on 17/3/2012 Homepage http://search.npmjs.org/#/bread @@ -244,7 +244,7 @@

    Object Document Modeling LibrariesLast push -18:58:47 on 9/3/2012 +23:56:15 on 19/3/2012 Homepage http:// @@ -256,10 +256,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git Forks -178 +182 Watchers -1876 +1902 @@ -280,7 +280,7 @@

    Object Document Modeling LibrariesLast push -14:48:3 on 31/2/2012 +23:4:26 on 17/3/2012 Homepage http://http://alexeypetrushin.github.com/mongo-model @@ -295,7 +295,7 @@

    Object Document Modeling LibrariesWatchers -35 +38 @@ -387,11 +387,11 @@

    Content Management Systems Activity Level -../_images/nonactive.png +../_images/active.png Last push -19:13:40 on 11/6/2011 +6:25:45 on 18/3/2012 Homepage http:// @@ -427,7 +427,7 @@

    Content Management SystemsLast push -16:57:40 on 11/3/2012 +10:54:59 on 16/3/2012 Homepage http://calip.so @@ -439,10 +439,10 @@

    Content Management Systemshttps://github.com/cliftonc/calipso.git Forks -109 +108 Watchers -778 +787 @@ -517,10 +517,10 @@

    Wrapper libraries to ease the use of development or provide simple ODM like https://github.com/guileen/node-mongoskin.git Forks -24 +25 Watchers -278 +283 @@ -628,7 +628,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 8 Watchers -127 +130 @@ -664,7 +664,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 1 Watchers -36 +37 @@ -685,7 +685,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -14:13:28 on 27/1/2012 +17:45:57 on 19/3/2012 Homepage http://http://i.tv @@ -697,10 +697,10 @@

    Wrapper libraries to ease the use of development or provide simple ODM like https://github.com/idottv/node-mongodb-wrapper.git Forks -5 +7 Watchers -28 +31 @@ -883,7 +883,7 @@

    REST api’s around MongoDB or resource based librariesWatchers -129 +136 @@ -1240,7 +1240,7 @@

    Logging libraries or applicationsLast push -19:45:47 on 1/3/2012 +11:52:6 on 19/3/2012 Homepage http://dev/null @@ -1255,7 +1255,7 @@

    Logging libraries or applicationsWatchers -14 +17 @@ -1441,10 +1441,10 @@

    Translation libraries or frameworkshttps://github.com/masylum/dialect.git Forks -14 +15 Watchers -92 +96 @@ -1468,7 +1468,7 @@

    Libraries or Applications for analyticsLast push -17:10:35 on 11/3/2012 +1:24:7 on 20/3/2012 Homepage http://http://square.github.com/cube @@ -1480,10 +1480,10 @@

    Libraries or Applications for analyticshttps://github.com/square/cube.git Forks -136 +138 Watchers -1686 +1699 @@ -1519,10 +1519,10 @@

    Libraries for the connect middlewarehttps://github.com/bartt/connect-session-mongo.git Forks -4 +5 Watchers -9 +10 @@ -1555,10 +1555,10 @@

    Libraries for the connect middlewarehttps://github.com/masylum/connect-mongodb.git Forks -21 +23 Watchers -139 +144 @@ -1579,10 +1579,10 @@

    Libraries for the connect middlewareLast push -15:8:21 on 6/3/2012 +1:10:40 on 15/3/2012 Homepage -http:// +http://http://kcbanner.github.com/connect-mongo/ Url https://github.com/kcbanner/connect-mongo @@ -1594,7 +1594,7 @@

    Libraries for the connect middlewareWatchers -101 +109 @@ -1618,10 +1618,10 @@

    Libraries or applications for continous integration Last push -14:19:55 on 11/3/2012 +0:9:49 on 15/3/2012 Homepage -http:// +http://http://ryankee.github.com/concrete Url https://github.com/ryankee/concrete @@ -1633,7 +1633,7 @@

    Libraries or applications for continous integration17 Watchers -147 +150 @@ -1708,7 +1708,7 @@

    Exampe applicationsWatchers -3 +4 diff --git a/objects.inv b/objects.inv index e77794ac7d42db599b871c3873ea56f28d3eef26..828e178c488e66011528a8248f0339a7ac34eda6 100644 GIT binary patch delta 1115 zcmV-h1f=`v3G4}wpnqaAooS~BkXTZPL4XB7Me6k9y98xYWGE4UeDa9E0*l?ZyKmQp zq)bpaMB32zoFu@b*}JGb&Wh8*d}j*&Q}jvFibM2Nf4a*-j0nAcJxMfMH4v5V`Wu^X zr)_bw;WNqMZnfM(7Jbw2Q%Vx>e?B>2+5K7uiz{)_FOzw5(@F^VOX zfgeuG6{Ffnb$@2@PfYv{#|bCl(_i4&3F#fn%$DUl6ZG`&iW&I8`1PlcD2rDA@_O9# z%`*80xJ)~FBV#m;$b+n}SZf`pmACuIrL+sstSa>2Q+f8g&Ww2!ettzf}v8E za*cE+NZZTFvDWPjKA0L-#E^t&@T(tsLurt=Q^M1V<7yM<7dXn`ocd?q|F2p*n==Nr zZ@AmIVYFQz)|#m*b4GQ@!GY?KLyzjTjC9>Zq<<$TZN;7H@Q}}HXi~=`tHF8v(W@vdfxV?@E|R$ zIVmDQF~ZS|9i{Ry=8_4brXZi#O=IYRLjWUsWe4-rTH*s*@+OM3C%l49HZ7`;MIw1m zkbhBJapZ)9{MlOm4`z1DD$77&eY#ZCu6m)@vs`h+2n=HTrU|*>!$&+&s}N%RI*|u( z>b}T@^gL1-jdV@3qYUp)P%=mqsq`bZv%v&Ofgjtk4fHc)VZB-7)&RGh<)%~W^opbGCOK>46+e>^)J7@hzK~CCb4_bveOD~ zwI#s4uXGru{f18r9Hm``UN22r#_vBnYsb3Jum|oV*+Fkj3UHr$ZL#f~ntIi(=~Qs$ zg<0xzu(FH#=jHnbyH~PGI80CpYB!zDB1pLfTBZI0%k({$dTQP>(nL(L)m~H(O1%dD hMurYVZ|36t8HM+F!j^8o{FhXWQ{Vq={10z!OVH^nHe3Jz delta 1112 zcmV-e1gHD#3F!%tpnp;_ooS~BkXTZPL4XB7Me6k9y8vZTWGE4UeDa9EVi&t_cOTZJ zq)brQC)&{WoTR{$$-AUFOv>ZJbZbifQ}RjDnnUtrKiw4|283R}9wnNs8i>la-Hpw+ z|2Ho{$ogZ8z*+xT-d*m6ocN%C@z5aZ;i#Q@rV4AHf(<|83l#zwKef7{$`s zzz?SticxK(I)C%{CnkP}!$^?u>Mw9;h4hx?X3dJNiMslC#SDC4{QA`gj76`1c|C4i zvrNAMF4I=t$PKzi6j4?$(rG4zz$3lkbu!jrdf7xQMz>2ui&0e)Cm3hJlZXpgrC`To ztsj(qA_-U9D`6SDp!qb&BPO>whUCIS03NUJ3*$;r_JZZSqG1 z-Nu2AGi^fgY2+j9eIfQEJYAF@_NZ6~-xyQlS$_8`n*$MU+`ooQDyoAj(#l=qX)#hl z25zgDP#~Ij5M?n3t-oxEh|4E^PpS%Nu$!rp)r@o33?V#9=pW;f$QzI){q?O%eYX}w zL&f&!k$+%!`?B?!bC~y~kIBDw4L#V&4MImd`nkda|`igR|IUUN49t zDbXXy>2VFFSCmGDDkD6rIj%NIdVy{9&apqc!F#pZ+npOwyQb3(J4U^(>e*>_0GiCg;i;Vz0#;$BU(&rCHmdH=|4Qhy#I`cW;Ar@n-Dq?uCW5LD6Uo7Hmq z2GD5}Mh7Khw@%%_*iIqyJ);}70$U;$TH9n+>fxW7@F**sJ1HVSF~ZS}EguST=9~$l z#vq@%O+)B`eFU9(ZSB*{dEx_l@+N+>BfN%HJ}#;cWh!|`kWpOmBy_#{dGh=p%xvd% zo_~YF=5nbcU5!HL^>HN-12EXQJB`ToFFp_fYeJ0kZ6S{!#9fgK<$0hp8hOieNB;>* zMu{q@I1(hJN*hB=tpgwRkNBvKW=0CaXpVbEKSLh(C~F`Q5z@1|7Nxj-YJ3%%6$0p+ z)Wy(TTsM)v3`+|I?7JP7_ec(CM)qOq|54W(Q+aIAWz)Ss=261> z^f}ttnf-ZLUvKw9)+vV(0z%!Uv+)C|)=TeW2SO%URV;r}W6@=2DfxnTl eGtiqEe7Ek0mXoI2ht Date: Wed, 25 Apr 2012 12:43:30 +0200 Subject: [PATCH 22/56] Updated docs --- .buildinfo | 2 +- _sources/changelog/changelog.txt | 6 + _sources/github/github.txt | 46 ++-- api-articles/index.html | 10 +- api-articles/nodekoarticle1.html | 10 +- api-articles/nodekoarticle2.html | 10 +- api-bson-generated/binary.html | 10 +- api-bson-generated/bson.html | 10 +- api-bson-generated/code.html | 10 +- api-bson-generated/double.html | 10 +- api-bson-generated/index.html | 10 +- api-bson-generated/long.html | 10 +- api-bson-generated/maxkey.html | 10 +- api-bson-generated/minkey.html | 10 +- api-bson-generated/objectid.html | 10 +- api-bson-generated/symbol.html | 10 +- api-bson-generated/timestamp.html | 10 +- api-generated/admin.html | 10 +- api-generated/collection.html | 10 +- api-generated/cursor.html | 10 +- api-generated/cursorstream.html | 10 +- api-generated/db.html | 10 +- api-generated/grid.html | 10 +- api-generated/gridstore.html | 10 +- api-generated/index.html | 10 +- api-generated/readstream.html | 10 +- api-generated/replset.html | 10 +- api-generated/server.html | 10 +- changelog/changelog.html | 391 +++++++++++++++--------------- content/awesomeappsvideo.html | 10 +- content/nodejsvideo.html | 10 +- content/tutorials.html | 10 +- contents.html | 10 +- genindex.html | 26 +- github/github.html | 56 ++--- index.html | 10 +- markdown-docs/collections.html | 10 +- markdown-docs/database.html | 10 +- markdown-docs/gridfs.html | 10 +- markdown-docs/index.html | 10 +- markdown-docs/indexes.html | 10 +- markdown-docs/insert.html | 10 +- markdown-docs/queries.html | 10 +- markdown-docs/replicaset.html | 10 +- objects.inv | Bin 1260 -> 1260 bytes search.html | 10 +- searchindex.js | 2 +- 47 files changed, 467 insertions(+), 452 deletions(-) diff --git a/.buildinfo b/.buildinfo index afd88cd735f..9078b699cb1 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: e6a7ba5b9aa083dd05493da861726be9 +config: adb21fea789ae1bdbe163620738eb5f2 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/_sources/changelog/changelog.txt b/_sources/changelog/changelog.txt index 5077bc600d5..017417dd46e 100644 --- a/_sources/changelog/changelog.txt +++ b/_sources/changelog/changelog.txt @@ -2,6 +2,12 @@ Changelog ========= +1.0.0 2012-04-25 +---------------- +- Fixes to handling of failover on server error +- Only emits error messages if there are error listeners to avoid uncaught events +- Server.isConnected using the server state variable not the connection pool state + 0.9.9.8 2012-04-12 ------------------ - _id=0 is being turned into an ObjectID (Issue #551) diff --git a/_sources/github/github.txt b/_sources/github/github.txt index 30de94f171c..e208b13c804 100644 --- a/_sources/github/github.txt +++ b/_sources/github/github.txt @@ -16,7 +16,7 @@ Web frameworks using MongoDB * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 16:2:27 on 13/3/2012 + - 6:19:20 on 24/3/2012 * - **Homepage** - http:// * - **Url** @@ -134,7 +134,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 23:56:15 on 19/3/2012 + - 2:49:53 on 25/3/2012 * - **Homepage** - http:// * - **Url** @@ -142,9 +142,9 @@ Object Document Modeling Libraries * - **Clone Url** - https://github.com/LearnBoost/mongoose.git * - **Forks** - - 182 + - 185 * - **Watchers** - - 1902 + - 1917 .. topic:: mongo-model @@ -157,7 +157,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 23:4:26 on 17/3/2012 + - 0:37:32 on 22/3/2012 * - **Homepage** - http://http://alexeypetrushin.github.com/mongo-model * - **Url** @@ -252,7 +252,7 @@ Content Management Systems * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 10:54:59 on 16/3/2012 + - 7:15:44 on 22/3/2012 * - **Homepage** - http://calip.so * - **Url** @@ -260,9 +260,9 @@ Content Management Systems * - **Clone Url** - https://github.com/cliftonc/calipso.git * - **Forks** - - 108 + - 111 * - **Watchers** - - 787 + - 792 Grid FS libraries or tools -------------------------- @@ -314,7 +314,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 25 * - **Watchers** - - 283 + - 288 .. topic:: mongoq @@ -325,7 +325,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha :header-rows: 0 * - **Activity Level** - - .. image:: ../static/active.png + - .. image:: ../static/nonactive.png * - **Last push** - 7:17:31 on 19/11/2011 * - **Homepage** @@ -383,7 +383,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 8 * - **Watchers** - - 130 + - 131 .. topic:: mongode @@ -429,7 +429,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 7 * - **Watchers** - - 31 + - 30 .. topic:: mongodb-async @@ -547,7 +547,7 @@ REST api's around MongoDB or resource based libraries * - **Forks** - 24 * - **Watchers** - - 136 + - 137 .. topic:: lazyBum @@ -694,7 +694,7 @@ Queue libraries using MongoDB * - **Forks** - 2 * - **Watchers** - - 5 + - 6 .. topic:: karait @@ -929,7 +929,7 @@ Libraries or Applications for analytics * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 1:24:7 on 20/3/2012 + - 22:31:7 on 24/3/2012 * - **Homepage** - http://http://square.github.com/cube * - **Url** @@ -937,9 +937,9 @@ Libraries or Applications for analytics * - **Clone Url** - https://github.com/square/cube.git * - **Forks** - - 138 + - 145 * - **Watchers** - - 1699 + - 1770 Libraries for the connect middleware ------------------------------------ @@ -965,7 +965,7 @@ Libraries for the connect middleware * - **Forks** - 5 * - **Watchers** - - 10 + - 11 .. topic:: connect-mongodb @@ -986,9 +986,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/masylum/connect-mongodb.git * - **Forks** - - 23 + - 24 * - **Watchers** - - 144 + - 147 .. topic:: connect-mongo @@ -1009,9 +1009,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/kcbanner/connect-mongo.git * - **Forks** - - 37 + - 38 * - **Watchers** - - 109 + - 115 Libraries or applications for continous integration --------------------------------------------------- @@ -1037,7 +1037,7 @@ Libraries or applications for continous integration * - **Forks** - 17 * - **Watchers** - - 150 + - 156 Exampe applications ------------------- diff --git a/api-articles/index.html b/api-articles/index.html index 1ff7fdeb13b..60f69879db2 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -7,7 +7,7 @@ - Articles — MongoDB Node.JS Driver 0.9.9.8 documentation + Articles — MongoDB Node.JS Driver 1.0.0 documentation @@ -15,7 +15,7 @@ - + @@ -132,7 +132,7 @@

    Navigation

  • index
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -327,7 +327,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -931,7 +931,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -163,7 +163,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -180,7 +180,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -155,7 +155,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -431,7 +431,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -170,7 +170,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -1278,7 +1278,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -3119,7 +3119,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -1200,7 +1200,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -380,7 +380,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -2446,7 +2446,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -356,7 +356,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -2149,7 +2149,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -390,7 +390,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 0.9.9.8 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • @@ -163,7 +163,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -180,7 +180,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -155,7 +155,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -75,81 +75,6 @@

    Constructor -

    Properties

    -

    Returns the generation time in seconds that this ID was generated.

    -
    -
    -generationTime number [Getter|Setter]
    -
    - -

    Examples

    -
    -

    Get and set the generation time for an ObjectID

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -// Create a new ObjectID
    -var objectId = new ObjectID();
    -// Get the generation time
    -var generationTime = objectId.generationTime;
    -// Add 1000 miliseconds to the generation time
    -objectId.generationTime = generationTime + 1000;
    -
    -// Create a timestamp
    -var timestampDate = new Date();
    -timestampDate.setTime((generationTime + 1000) * 1000);
    -
    -// Get the timestamp and validate correctness
    -assert.equal(timestampDate.toString(), objectId.getTimestamp().toString());
    -
    -
    -
    - -
    -

    toHexString

    -

    Return the ObjectID id as a 24 byte hex string representation

    -
    -
    -toHexString()
    -
    --- - - - -
    Returns:string return the 24 byte hex string representation.
    -
    - -

    Examples

    -
    -

    Generate a 24 character hex string representation of the ObjectID

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -// Create a new ObjectID
    -var objectId = new ObjectID();
    -// Verify that the hex string is 24 characters long
    -assert.equal(24, objectId.toHexString().length);
    -
    -
    @@ -170,7 +170,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -981,7 +981,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -1278,7 +1278,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -298,6 +298,7 @@

    remove
  • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
  • +
  • single {Boolean, default:false}, removes the first document found.
  • @@ -3119,7 +3120,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -1200,7 +1200,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -380,7 +380,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -2446,7 +2446,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -356,7 +356,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • @@ -1554,6 +1554,53 @@

    stream}); +

    A simple example showing how to pipe a file stream through from gridfs to a file

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 1}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +  // Open a file for writing
    +  var gridStoreWrite = new GridStore(db, "test_gs_read_stream_pipe", "w", {chunkSize:1024});
    +  gridStoreWrite.writeFile("./test/gridstore/test_gs_weird_bug.png", function(err, result) {
    +    // Open the gridStore for reading and pipe to a file
    +    var gridStore = new GridStore(db, "test_gs_read_stream_pipe", "r");
    +    gridStore.open(function(err, gridStore) {
    +      // Grab the read stream
    +      var stream = gridStore.stream(true);
    +      // When the stream is finished close the database
    +      stream.on("end", function(err) {
    +        // Read the original content
    +        var originalData = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png");
    +        // Ensure we are doing writing before attempting to open the file
    +        fs.readFile("./test_gs_weird_bug_streamed.tmp", function(err, streamedData) {
    +          // Compare the data
    +          assert.deepEqual(originalData, streamedData);
    +
    +          // Close the database
    +          db.close();
    +        });
    +      })
    +
    +      // Create a file write stream
    +      var fileStream = fs.createWriteStream("./test_gs_weird_bug_streamed.tmp");
    +      // Pipe out the data
    +      stream.pipe(fileStream);
    +    })
    +  })
    +});
    +
    +
    @@ -390,7 +390,7 @@

    Navigation

  • previous |
  • -
  • MongoDB Node.JS Driver 1.0.0 documentation »
  • +
  • MongoDB Node.JS Driver 1.0.1 documentation »
  • + + + - \ No newline at end of file diff --git a/api-articles/nodekoarticle1.html b/api-articles/nodekoarticle1.html index cb8642dfefe..cfddfa2a342 100644 --- a/api-articles/nodekoarticle1.html +++ b/api-articles/nodekoarticle1.html @@ -1,13 +1,14 @@ + - A Basic introduction to Mongo DB — MongoDB Node.JS Driver 1.0.1 documentation + A Basic introduction to Mongo DB — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -357,10 +360,7 @@

    Links and stuff
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-articles/nodekoarticle2.html b/api-articles/nodekoarticle2.html index 66536742f21..ce20980faa9 100644 --- a/api-articles/nodekoarticle2.html +++ b/api-articles/nodekoarticle2.html @@ -1,13 +1,14 @@ + - A primer for GridFS using the Mongo DB driver — MongoDB Node.JS Driver 1.0.1 documentation + A primer for GridFS using the Mongo DB driver — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -287,10 +290,7 @@

    Links and stuff
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-bson-generated/binary.html b/api-bson-generated/binary.html index 4e4a0fc7fbf..d9337b992b0 100644 --- a/api-bson-generated/binary.html +++ b/api-bson-generated/binary.html @@ -1,13 +1,14 @@ + - Binary() — MongoDB Node.JS Driver 1.0.1 documentation + Binary() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -239,10 +236,7 @@

    length
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-bson-generated/bson.html b/api-bson-generated/bson.html index f35c94fc12e..11f96c27d11 100644 --- a/api-bson-generated/bson.html +++ b/api-bson-generated/bson.html @@ -1,13 +1,14 @@ + - BSON() — MongoDB Node.JS Driver 1.0.1 documentation + BSON() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -833,10 +830,7 @@

    serializeWithBufferAndIndex
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-bson-generated/code.html b/api-bson-generated/code.html index 3273ace2fe9..2c3072602f7 100644 --- a/api-bson-generated/code.html +++ b/api-bson-generated/code.html @@ -1,13 +1,14 @@ + - DBRef() — MongoDB Node.JS Driver 1.0.1 documentation + DBRef() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -87,10 +84,7 @@

    Constructor
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-bson-generated/double.html b/api-bson-generated/double.html index f8913fd9f85..7f907d571e0 100644 --- a/api-bson-generated/double.html +++ b/api-bson-generated/double.html @@ -1,13 +1,14 @@ + - Double() — MongoDB Node.JS Driver 1.0.1 documentation + Double() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -102,10 +99,7 @@

    valueOf
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-bson-generated/index.html b/api-bson-generated/index.html index 3b713b08bdc..75e1fb75dfe 100644 --- a/api-bson-generated/index.html +++ b/api-bson-generated/index.html @@ -1,13 +1,14 @@ + - Binary JSON API — MongoDB Node.JS Driver 1.0.1 documentation + Binary JSON API — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -48,6 +51,7 @@

    Binary JSON APIObjectID() @@ -298,10 +295,7 @@

    destroy
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-generated/db.html b/api-generated/db.html index 727ffe1b7df..f821ff75478 100644 --- a/api-generated/db.html +++ b/api-generated/db.html @@ -1,13 +1,14 @@ + - Db() — MongoDB Node.JS Driver 1.0.1 documentation + Db() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -79,10 +76,10 @@

    Constructor
  • strict {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, execute insert with a getLastError command returning the result of the insert command.
  • +
  • readPreference {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
  • native_parser {Boolean, default:false}, use c++ bson parser.
  • forceServerObjectId {Boolean, default:false}, force server to create _id fields instead of client.
  • pkFactory {Object}, object overriding the basic ObjectID primary key generation.
  • -
  • slaveOk {Boolean, default:false}, allow reads from secondaries.
  • serializeFunctions {Boolean, default:false}, serialize functions.
  • raw {Boolean, default:false}, peform operations using raw bson buffers.
  • recordQueryStats {Boolean, default:false}, record query statistics during execution.
  • @@ -189,6 +186,90 @@

    open}); +

    Example of Read Preference usage at the query level.

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +// Replica configuration
    +var replSet = new ReplSetServers( [
    +    new Server( RS.host, RS.ports[1], { auto_reconnect: true } ),
    +    new Server( RS.host, RS.ports[0], { auto_reconnect: true } ),
    +    new Server( RS.host, RS.ports[2], { auto_reconnect: true } )
    +  ],
    +  {rs_name:RS.name}
    +);
    +
    +// Create db instance
    +var db = new Db('integration_test_', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)});
    +// Trigger test once whole set is up
    +replSet.on("fullsetup", function() {
    +  // Rip out secondaries forcing an attempt to read from the primary
    +  db.serverConfig._state.secondaries = {};
    +
    +  // Grab the collection
    +  db.collection("read_preference_replicaset_test_0", function(err, collection) {
    +    // Attempt to read (should fail due to the server not being a primary);
    +    collection.find().setReadPreference(ReadPreference.SECONDARY).toArray(function(err, items) {
    +      assert.ok(err != null);
    +      assert.equal("No replica set secondary available for query with ReadPreference SECONDARY", err.message);
    +      // Does not get called or we don't care
    +      db.close();
    +    });
    +  });
    +});
    +
    +// Connect to the db
    +db.open(function(err, p_db) {
    +  db = p_db;
    +});
    +
    +
    +

    A Simple example off connecting to Mongos with a list of alternative proxies.

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +// Set up mongos connection
    +var mongos = new Mongos([
    +    new Server("localhost", 50000, { auto_reconnect: true }),
    +    new Server("localhost", 50001, { auto_reconnect: true })
    +  ])
    +
    +// Connect using the mongos connections
    +var db = new Db('integration_test_', mongos);
    +db.open(function(err, db) {
    +  assert.equal(null, err);
    +  assert.ok(db != null);
    +
    +  // Perform a simple insert into a collection
    +  var collection = db.collection("shard_test");
    +  // Insert a simple doc
    +  collection.insert({test:1}, {safe:true}, function(err, result) {
    +    assert.equal(null, err);
    +
    +    collection.findOne({test:1}, {}, {readPreference:new ReadPreference(ReadPreference.SECONDARY)}, function(err, item) {
    +      assert.equal(null, err);
    +      assert.equal(1, item.test);
    +
    +      db.close();
    +    })
    +  });
    +});
    +
    +
    @@ -543,10 +624,10 @@

    collection
  • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
  • -
  • slaveOk {Boolean, default:false}, Allow reads from secondaries.
  • serializeFunctions {Boolean, default:false}, serialize functions on the document.
  • raw {Boolean, default:false}, perform all operations using raw bson objects.
  • pkFactory {Object}, object overriding the basic ObjectID primary key generation.
  • +
  • readPreference {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
  • @@ -936,9 +1017,17 @@

    logout

    authenticate

    Authenticate a user against the server.

    +
    +
    Options
    +
      +
    • authdb {String}, The database that the credentials are for, +different from the name of the current DB, for example admin
    • +
    +
    +
    -authenticate(username, password, callback)
    +authenticate(username, password[, options], callback)
    @@ -946,6 +1035,7 @@

    authenticate

    @@ -1144,7 +1234,6 @@

    createCollection
  • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
  • -
  • slaveOk {Boolean, default:false}, Allow reads from secondaries.
  • serializeFunctions {Boolean, default:false}, serialize functions on the document.
  • raw {Boolean, default:false}, perform all operations using raw bson objects.
  • pkFactory {Object}, object overriding the basic ObjectID primary key generation.
  • @@ -1152,6 +1241,7 @@

    createCollection

    cursorInfo

    Returns the information available on allocated cursors.

    +
    +
    Options
    +
      +
    • readPreference {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
    • +
    +
    +
    -cursorInfo(callback)
    +cursorInfo([options], callback)

    Arguments:
    • username (string) – username.
    • password (string) – password.
    • +
    • [options] (object) – the options
    • callback (function) – returns the results.
    @@ -2247,6 +2346,68 @@

    dropDatabase +

    stats

    +

    Get all the db statistics.

    +
    +
    Options
    +
      +
    • scale {Number}, divide the returned sizes by scale value.
    • +
    • readPreference {String}, the preferred read preference ((Server.PRIMARY, Server.PRIMARY_PREFERRED, Server.SECONDARY, Server.SECONDARY_PREFERRED, Server.NEAREST).
    • +
    +
    +
    +
    +
    +stats([options], callback)
    +

    Arguments:
      +
    • [options] (object) – additional options during update.
    • callback (function) – for results.
    +++ + + + + + +
    Arguments:
      +
    • [options] (objects) – options for the stats command
    • +
    • callback (function) – returns statistical information for the db.
    • +
    +
    Returns:

    null

    +
    +
    + +

    Examples

    +
    +

    An example showing how to retrieve the db statistics

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +  assert.equal(null, err);
    +
    +  db.stats(function(err, stats) {
    +    assert.equal(null, err);
    +    assert.ok(stats != null);
    +
    +    db.close();
    +  })
    +});
    +
    +
    +
    +

    Db.connect

    Connect to MongoDB using a url as documented at

    @@ -2310,10 +2471,7 @@

    Db.connect
    - -

    Page Contents

    +

    Contents

    -

    Core Documentation

    -

    + + + + + - \ No newline at end of file diff --git a/api-generated/grid.html b/api-generated/grid.html index cdb2742eda3..72e7fa9368a 100644 --- a/api-generated/grid.html +++ b/api-generated/grid.html @@ -1,13 +1,14 @@ + - Grid() — MongoDB Node.JS Driver 1.0.1 documentation + Grid() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -274,10 +271,7 @@

    delete
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-generated/gridstore.html b/api-generated/gridstore.html index fc9944cc57c..153ebe016fe 100644 --- a/api-generated/gridstore.html +++ b/api-generated/gridstore.html @@ -1,13 +1,14 @@ + - GridStore() — MongoDB Node.JS Driver 1.0.1 documentation + GridStore() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -91,7 +88,7 @@

    Constructor
  • root {String}, root collection to use. Defaults to {GridStore.DEFAULT_ROOT_COLLECTION}.
  • -
  • chunk_type {String}, mime type of the file. Defaults to {GridStore.DEFAULT_CONTENT_TYPE}.
  • +
  • content_type {String}, mime type of the file. Defaults to {GridStore.DEFAULT_CONTENT_TYPE}.
  • chunk_size {Number}, size for the chunk. Defaults to {Chunk.DEFAULT_CHUNK_SIZE}.
  • metadata {Object}, arbitrary data the user wants to store.
  • @@ -451,81 +448,6 @@

    writeFile -

    write

    -

    Writes some data. This method will work properly only if initialized with mode “w” or “w+”.

    -
    -
    -write(data[, close], callback)
    -
    --- - - - - - -
    Arguments:
      -
    • data (string) – the data to write.
    • -
    • [close] (boolean) – closes this file after writing if set to true.
    • -
    • callback (function) – this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object.
    • -
    -
    Returns:

    null

    -
    -
    - -

    Examples

    -
    -

    A simple example showing how to use the write command with strings and Buffers.

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    - {auto_reconnect: false, poolSize: 1}), {native_parser: false});
    -
    -// Establish connection to db
    -db.open(function(err, db) {
    -  // Our file ID
    -  var fileId = new ObjectID();
    -
    -  // Open a new file
    -  var gridStore = new GridStore(db, fileId, 'w');
    -
    -  // Open the new file
    -  gridStore.open(function(err, gridStore) {
    -
    -    // Write a text string
    -    gridStore.write('Hello world', function(err, gridStore) {
    -
    -      // Write a buffer
    -      gridStore.write(new Buffer('Buffer Hello world'), function(err, gridStore) {
    -
    -        // Close the
    -        gridStore.close(function(err, result) {
    -
    -          // Read back all the written content and verify the correctness
    -          GridStore.read(db, fileId, function(err, fileData) {
    -            assert.equal('Hello worldBuffer Hello world', fileData.toString());
    -
    -            db.close();
    -          });
    -        });
    -      });
    -    });
    -  });
    -});
    -
    -
    -
    -

    close

    Saves this file to the database. This will overwrite the old entry if it @@ -1650,25 +1572,31 @@

    GridStore.exist// Open a file for writing var gridStore = new GridStore(db, null, "w"); gridStore.open(function(err, gridStore) { + assert.equal(null, err); // Writing some content to the file gridStore.write("hello world!", function(err, gridStore) { + assert.equal(null, err); // Flush the file to GridFS gridStore.close(function(err, result) { + assert.equal(null, err); // Check if the file exists using the id returned from the close function GridStore.exist(db, result._id, function(err, result) { + assert.equal(null, err); assert.equal(true, result); }) // Show that the file does not exist for a random ObjectID GridStore.exist(db, new ObjectID(), function(err, result) { + assert.equal(null, err); assert.equal(false, result); }); // Show that the file does not exist for a different file root GridStore.exist(db, result._id, 'another_root', function(err, result) { + assert.equal(null, err); assert.equal(false, result); db.close(); @@ -2065,6 +1993,99 @@

    GridStore.unlink +

    write

    +

    Writes some data. This method will work properly only if initialized with mode “w” or “w+”.

    +
    +
    +write(data[, close], callback)
    +
    +++ + + + + + +
    Arguments:
      +
    • data (string) – the data to write.
    • +
    • [close] (boolean) – closes this file after writing if set to true.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object.
    • +
    +
    Returns:

    null

    +
    +
    + +

    Examples

    +
    +

    A simple example showing how to use the write command with strings and Buffers.

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 1}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +  // Our file ID
    +  var fileId = new ObjectID();
    +
    +  // Open a new file
    +  var gridStore = new GridStore(db, fileId, 'w');
    +
    +  // Open the new file
    +  gridStore.open(function(err, gridStore) {
    +
    +    // Write a text string
    +    gridStore.write('Hello world', function(err, gridStore) {
    +
    +      // Write a buffer
    +      gridStore.write(new Buffer('Buffer Hello world'), function(err, gridStore) {
    +
    +        // Close the
    +        gridStore.close(function(err, result) {
    +
    +          // Read back all the written content and verify the correctness
    +          GridStore.read(db, fileId, function(err, fileData) {
    +            assert.equal('Hello worldBuffer Hello world', fileData.toString());
    +
    +            db.close();
    +          });
    +        });
    +      });
    +    });
    +  });
    +});
    +
    +
    +
    +

    +
    +

    pause

    +

    pause

    +
    +
    +pause()
    +
    + +
    +
    +

    resume

    +

    resume

    +
    +
    +resume()
    +
    +
    @@ -2074,10 +2095,7 @@

    GridStore.unlink
    - -

    Page Contents

    +

    Contents

    -

    Core Documentation

    + + +

    Manual

    + + +

    MongoDB Wiki

    + + -

    This Page

    - -

    Previous page

    -

    Grid()

    -

    Next page

    -

    ReadStream()

    + + + + + - \ No newline at end of file diff --git a/api-generated/index.html b/api-generated/index.html index 69b477ed215..f199866fe05 100644 --- a/api-generated/index.html +++ b/api-generated/index.html @@ -1,13 +1,14 @@ + - Driver API — MongoDB Node.JS Driver 1.0.1 documentation + Driver API — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -127,6 +130,7 @@

    Driver APIreIndex
  • indexInformation
  • dropDatabase
  • +
  • stats
  • Db.connect
  • @@ -139,6 +143,7 @@

    Driver APIcount
  • sort
  • limit
  • +
  • setReadPreference
  • skip
  • batchSize
  • nextObject
  • @@ -162,7 +167,6 @@

    Driver APIProperties
  • open
  • writeFile
  • -
  • write
  • close
  • chunkCollection
  • unlink
  • @@ -181,6 +185,9 @@

    Driver APIGridStore.read
  • GridStore.readlines
  • GridStore.unlink
  • +
  • write
  • +
  • pause
  • +
  • resume
  • ReadStream() @@ -215,10 +234,7 @@

    Driver API
    - -

    Page Contents

    +

    Contents

    -

    Core Documentation

    + +
      +
    +

    Manual

    + + +

    MongoDB Wiki

    + + -

    This Page

    -
    + + + + + - \ No newline at end of file diff --git a/api-generated/mongos.html b/api-generated/mongos.html new file mode 100644 index 00000000000..adfe485eb35 --- /dev/null +++ b/api-generated/mongos.html @@ -0,0 +1,284 @@ + + + + + + + + + + Mongos() — MongoDB Node.JS Driver 1.1.0 documentation + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +

    Mongos()

    +
    +

    Constructor

    +

    Mongos constructor provides a connection to a mongos proxy including failover to additional servers

    +
    +
    +
    +class Mongos()
    +
    +++ + + + +
    Arguments:
      +
    • list (array) – of mongos server objects
    • +
    • [options] (object) – additional options for the mongos connection
    • +
    +
    +
    + +
    +
    +
    Options
    +
      +
    • socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
    • +
    • ha {Boolean, default:true}, turn on high availability, attempts to reconnect to down proxies
    • +
    • haInterval {Number, default:2000}, time between each replicaset status check.
    • +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +

    Contents

    + + + + +
      +
    +

    Manual

    + + + + +

    MongoDB Wiki

    + + + + +
    +
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/api-generated/readpreference.html b/api-generated/readpreference.html new file mode 100644 index 00000000000..156aa57b983 --- /dev/null +++ b/api-generated/readpreference.html @@ -0,0 +1,289 @@ + + + + + + + + + + ReadPreference() — MongoDB Node.JS Driver 1.1.0 documentation + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +

    ReadPreference()

    +
    +

    Constructor

    +

    A class representation of the Read Preference.

    +
    +
    +
    +class ReadPreference()
    +
    +++ + + + + + +
    Arguments:
      +
    • the (string) – read preference type
    • +
    • tags (object) –
    • +
    +
    Returns:

    readpreference

    +
    +
    + +
    +
    +
    Read Preferences
    +
      +
    • ReadPreference.PRIMARY, Read from primary only. All operations produce an error (throw an exception where applicable) if primary is unavailable. Cannot be combined with tags (This is the default.).
    • +
    • ReadPreference.PRIMARY_PREFERRED, Read from primary if available, otherwise a secondary.
    • +
    • ReadPreference.SECONDARY, Read from secondary if available, otherwise error.
    • +
    • ReadPreference.SECONDARY_PREFERRED, Read from a secondary if available, otherwise read from the primary.
    • +
    • ReadPreference.NEAREST, All modes read from among the nearest candidates, but unlike other modes, NEAREST will include both the primary and all secondaries in the random selection.
    • +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +

    Contents

    + + + + +
      +
    +

    Manual

    + + + + +

    MongoDB Wiki

    + + + + +
    +
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/api-generated/readstream.html b/api-generated/readstream.html index f6fafe6801f..043e5aee91b 100644 --- a/api-generated/readstream.html +++ b/api-generated/readstream.html @@ -1,13 +1,14 @@ + - ReadStream() — MongoDB Node.JS Driver 1.0.1 documentation + ReadStream() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -118,7 +115,7 @@

    pause // File id var fileId = new ObjectID(); // Create a file - var file = new GridStore(db, fileId, "w"); + var file = new GridStore(db, fileId, "w", {chunk_size:5}); file.open(function(err, file) { // Write some content and flush to disk file.write('Hello world', function(err, file) { @@ -137,15 +134,12 @@

    pause assert.equal(false, stream.paused); // Pause stream stream.pause(); - // Check if cursor is paused - assert.equal(true, stream.paused); - // Restart the stream after 1 miliscecond setTimeout(function() { stream.resume(); // Check if cursor is paused assert.equal(false, stream.paused); - }, 1); + }, 100); }); // For each data item @@ -255,19 +249,26 @@

    resume// File id var fileId = new ObjectID(); // Create a file - var file = new GridStore(db, fileId, "w"); + var file = new GridStore(db, fileId, "w", {chunk_size:5}); file.open(function(err, file) { // Write some content and flush to disk - file.write('Hello world', function(err, file) { + var fileBody = 'Hello world'; + file.write(fileBody, function(err, file) { file.close(function(err, result) { - // Let's create a read file file = new GridStore(db, fileId, "r"); + // Open the file file.open(function(err, file) { // Peform a find to get a cursor var stream = file.stream(true); + // Pause the stream initially + stream.pause(); + + // Save read content here + var fileBuffer = ''; + // For each data item stream.on("data", function(item) { // Check if stream is paused @@ -275,22 +276,30 @@

    resume// Pause stream stream.pause(); // Check if cursor is paused - assert.equal(true, stream.paused); + // assert.equal(true, stream.paused); + + fileBuffer += item.toString('utf8'); // Restart the stream after 1 miliscecond setTimeout(function() { stream.resume(); // Check if cursor is paused assert.equal(false, stream.paused); - }, 1); + }, 100); }); // For each data item - stream.on("end", function(item) {}); + stream.on("end", function(item) { + }); // When the stream is done stream.on("close", function() { + // Have we received the same file back? + assert.equal(fileBuffer, fileBody); db.close(); }); + + // Resume the stream + stream.resume(); }); }); }); @@ -308,10 +317,7 @@

    resume
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/api-generated/replset.html b/api-generated/replset.html index 440f006967a..bb74190626c 100644 --- a/api-generated/replset.html +++ b/api-generated/replset.html @@ -1,13 +1,14 @@ + - ReplSet — MongoDB Node.JS Driver 1.0.1 documentation + ReplSet — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -57,7 +60,7 @@

    Constructor Arguments:
    • list (array) – of server objects participating in the replicaset.
    • -
    • [options] (object) – additional options for the collection.
    • +
    • [options] (object) – additional options for the replicaset connection.
    @@ -69,17 +72,45 @@

    Constructor
    Options
      -
    • ha {Boolean, default:false}, turn on high availability.
    • +
    • ha {Boolean, default:true}, turn on high availability.
    • haInterval {Number, default:2000}, time between each replicaset status check.
    • reconnectWait {Number, default:1000}, time to wait in miliseconds before attempting reconnect.
    • retries {Number, default:30}, number of times to attempt a replicaset reconnect.
    • rs_name {String}, the name of the replicaset to connect to.
    • -
    • readPreference {String}, the prefered read preference (Server.READ_PRIMARY, Server.READ_SECONDARY, Server.READ_SECONDARY_ONLY).
    • -
    • read_secondary {Boolean, deprecated}, allow reads from secondary.
    • +
    • socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
    • +
    • readPreference {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
    • strategy {String, default:null}, selection strategy for reads choose between (ping and statistical, default is round-robin)
    • +
    • secondaryAcceptableLatencyMS {Number, default:15}, sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms)
    + +
    +

    _isUsed

    +

    Return the used state

    +
    +
    +_isUsed()
    +
    + +
    +
    +

    _checkReplicaSet

    +

    @ignore

    +
    +
    +_checkReplicaSet()
    +
    + +
    +
    +

    _validateReplicaset

    +

    @ignore

    +
    +
    +_validateReplicaset()
    +
    +
    @@ -89,19 +120,22 @@

    Constructor
    - -

    Page Contents

    +

    Contents

    -

    Core Documentation

    + +
      +
    +

    Manual

    + + +

    MongoDB Wiki

    + + -

    This Page

    -
    + + + + + - \ No newline at end of file diff --git a/api-generated/server.html b/api-generated/server.html index 6fafcd414b7..8a08716aa31 100644 --- a/api-generated/server.html +++ b/api-generated/server.html @@ -1,13 +1,14 @@ + - Server() — MongoDB Node.JS Driver 1.0.1 documentation + Server() — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -70,16 +73,26 @@

    Constructor
    Options
      -
    • readPreference {String, default:null}, set’s the read preference (Server.READ_PRIMAR, Server.READ_SECONDARY_ONLY, Server.READ_SECONDARY)
    • +
    • readPreference {String, default:null}, set’s the read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST)
    • ssl {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support)
    • slaveOk {Boolean, default:false}, legacy option allowing reads from secondary, use readPrefrence instead.
    • poolSize {Number, default:1}, number of connections in the connection pool, set to 1 as default for legacy reasons.
    • -
    • socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), timeout:(number))
    • +
    • socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
    • logger {Object, default:null}, an object representing a logger that you want to use, needs to support functions debug, log, error ({error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}}).
    • auto_reconnect {Boolean, default:false}, reconnect on error.
    • +
    • disableDriverBSONSizeCheck {Boolean, default:false}, force the server to error if the BSON message is to big
    + +
    +

    setReadPreference

    +

    Always ourselves

    +
    +
    +setReadPreference()
    +
    +
    @@ -89,19 +102,20 @@

    Constructor
    - -

    Page Contents

    +

    Contents

    -

    Core Documentation

    + +
      +
    +

    Manual

    + + +

    MongoDB Wiki

    + + -

    This Page

    -
    + + + + + - \ No newline at end of file diff --git a/changelog/changelog.html b/changelog/changelog.html index 47b5778bccb..af73dd0e040 100644 --- a/changelog/changelog.html +++ b/changelog/changelog.html @@ -1,13 +1,14 @@ + - Changelog — MongoDB Node.JS Driver 1.0.1 documentation + Changelog — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -45,23 +48,102 @@

    Navigation

    Changelog

    -

    1.0.1

    +

    1.1.0

    +
      +
    • Added Mongos connection type with a fallback list for mongos proxies, supports ha (off by default) and will attempt to reconnect to failed proxies.

      +
    • +
    • Documents can now have a toBSON method that lets the user control the serialization behavior for documents being saved.

      +
    • +
    • Gridstore instance object now works as a readstream or writestream (thanks to code from Aaron heckmann (https://github.com/aheckmann/gridfs-stream)).

      +
    • +
    • Fix gridfs readstream (Issue #607, https://github.com/tedeh).

      +
    • +
    • Added disableDriverBSONSizeCheck property to Server.js for people who wish to push the inserts to the limit (Issue #609).

      +
    • +
    • Fixed bug where collection.group keyf given as Code is processed as a regular object (Issue #608, https://github.com/rrusso2007).

      +
    • +
    • Case mismatch between driver’s ObjectID and mongo’s ObjectId, allow both (Issue #618).

      +
    • +
    • Cleanup map reduce (Issue #614, https://github.com/aheckmann).

      +
    • +
    • Add proper error handling to gridfs (Issue #615, https://github.com/aheckmann).

      +
    • +
    • Ensure cursor is using same connection for all operations to avoid potential jump of servers when using replicasets.

      +
    • +
    • Date identification handled correctly in bson js parser when running in vm context.

      +
    • +
    • Documentation updates

      +
    • +
    • GridStore filename not set on read (Issue #621)

      +
    • +
    • Optimizations on the C++ bson parser to fix a potential memory leak and avoid non-needed calls

      +
    • +
    • Added support for awaitdata for tailable cursors (Issue #624)

      +
    • +
    • +
      Implementing read preference setting at collection and cursor level
      +
        +
      • collection.find().setReadPreference(Server.READ_SECONDARY)
      • +
      • db.collection(&quot;some&quot;, {readPreference:Server.READ_SECONDARY_ONLY})
      • +
      +
      +
      +
    • +
    • Replicaset now returns when the master is discovered on db.open and lets the rest of the connections happen asynchronous. +- ReplSet/ReplSetServers emits &quot;fullsetup&quot; when all servers have been connected to

      +
    • +
    • Prevent callback from executing more than once in getMore function (Issue #631, https://github.com/shankar0306)

      +
    • +
    • Corrupt bson messages now errors out to all callbacks and closes up connections correctly, Issue #634

      +
    • +
    • Replica set member status update when primary changes bug (Issue #635, https://github.com/alinsilvian)

      +
    • +
    • Fixed auth to work better when multiple connections are involved.

      +
    • +
    • Default connection pool size increased to 5 connections.

      +
    • +
    • Fixes for the ReadStream class to work properly with 0.8 of Node.js

      +
    • +
    • Added explain function support to aggregation helper

      +
    • +
    • Added socketTimeoutMS and connectTimeoutMS to socket options for repl_set.js and server.js

      +
    • +
    • Fixed addUser to correctly handle changes in 2.2 for getLastError authentication required

      +
    • +
    • Added index to gridstore chunks on file_id (Issue #649, https://github.com/jacobbubu)

      +
    • +
    • Fixed Always emit db events (Issue #657)

      +
    • +
    • Close event not correctly resets DB openCalled variable to allow reconnect

      +
    • +
    • Added open event on connection established for replicaset, mongos and server

      +
    • +
    +
    +
    +

    1.0.2 2012-05-15

    +
      +
    • Reconnect functionality for replicaset fix for mongodb 2.0.5
    • +
    +
    +
    +

    1.0.1 2012-05-12

    • Passing back getLastError object as 3rd parameter on findAndModify command.
    • Fixed a bunch of performance regressions in objectId and cursor.
    • Fixed issue #600 allowing for single document delete to be passed in remove command.
    -
    -

    1.0.0 2012-04-25

    +
    +

    1.0.0 2012-04-25

    • Fixes to handling of failover on server error
    • Only emits error messages if there are error listeners to avoid uncaught events
    • Server.isConnected using the server state variable not the connection pool state
    -
    -

    0.9.9.8 2012-04-12

    +
    +

    0.9.9.8 2012-04-12

    • _id=0 is being turned into an ObjectID (Issue #551)
    • fix for error in GridStore write method (Issue #559)
    • @@ -75,8 +157,8 @@

      0.9.9.8 2012-04-12https://github.com/AaronAsAChimp)

    -
    -

    0.9.9.7 2012-03-16

    +
    +

    0.9.9.7 2012-03-16

    + +
    + + + - \ No newline at end of file diff --git a/markdown-docs/replicaset.html b/markdown-docs/replicaset.html index 4180c90ba9b..b070a1f0f09 100644 --- a/markdown-docs/replicaset.html +++ b/markdown-docs/replicaset.html @@ -1,13 +1,14 @@ + - Replicasets — MongoDB Node.JS Driver 1.0.1 documentation + Replicasets — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + + @@ -128,10 +131,7 @@

    Socket options
    - -

    Page Contents

    +

    Contents

    + + + + + - \ No newline at end of file diff --git a/objects.inv b/objects.inv index bdb35c0b7f6da208e64b31e81c0493acf679f221..367c25009bb8fa0229b53aa32b73670eb74fac5e 100644 GIT binary patch delta 1209 zcmV;q1V;Pd39Sl{OaU>GO+0^5kJ~m3e!pK4V0%r5KJ2A$$>rL+?JhaQEe3QL4zfi% zYGlciqN_xv;vth~Bc$xl9F#{hM?>D{Uvgq|s=k111mf=^x zWm@Zh#4X#VHV>?2m*FguLf{Ug(NrK3AnC02gyp_M~y;ynq! zkYoz>Oy>GQDXH}6!|yFT1EYYX*Bx7eSX-%DH%61^f?_FS@v%P%Bn&I4xbY!gTO*#9 z10|xvR=t7*vAll=ulsV)`qP#OFJ-3hNtOY1b~05mn{#fvCAh~3{bOtjjdpKJfB#vf zyjcmnfl@T_fnYZqci}VZu+c`JQh#F`wzHGVax&PlFAq#Wu8`R{A7$j&T<=0KrumW> z5+apx>jipEsb7*49_1WY%dEXZFIxK)Uz^c9-+Huv15khal6G}>0BzUXePgI&T(A^! z7{OA=p}|rrHo7YF%aM;(>Z5vUQx|#Z1_*ss5Ce9qsNa)q@6;_S7f4Qb?oDd06gfH( zO9gHzTxW}R%EV@ox*@x&@QmG~8KDHp2v*sm!>rZAzd7Mvw^#)0)r92lV7k)CON~IjrMhReelD$s3CH**B8QwQ6PM z`M;RiF7g=j4Li#Ho+h&Xh%__N8arp@? z-9Fc!A@+M3mT>V1_eF{II`{<(w$#_%mfH1et>p&Dw2Qi{zc=L^pfBL9T7dlYksR?F z(e5;Xb7iV2$u>aq$em7~A6mDx!MYa}SVqn=KzKX)k&woouW!3R|9Gc$X7LVL3wM`+ z(7AsrVX~m|hLoNAjm*IgLz{=+-YNwgOj(bdNakC#g=lx0?*^{(T_gWMGrZuj46ozj zGDsy8cc0!>bL3~(19##tmN0H0l8S04XBORMX!2HMV|(s~K7IAR?!5SV{k)d+QsyCt z0iHswP}gwzv(PLNKz&C*Tn>@4woex)fb}iW@J1pKN}c|2Fw%EId-EfsS))Bh@2BbG XO;IVygj?kdbH=IbA2k01cR#3#YMVty delta 1131 zcmV-x1eE)&3g8KlOaU;FO+0@~bK5o$zWY~jrnyR;9D2!3vYgndBW0vyI@3-MAhDzn zg8++%B6a%Xy96atq$!breDa9E0{i|xtaC}3psuA^i+Pj%Rux9oxUC=s;wG`O1ABd)wkoeO|{`G$>44=Uqc%G&>w#iPPC5RN2Fkr zSW7X%vq2F9^w&gEs6^jIle=drvT3ShK4(UklBpGmVN&!9^KyGFtRR;=_^v_qNH#(= zZbS+tQ^uLdomey%Gi$^GGSPt5dyl75{iAlB__Agw$HnB=e)kq~< zD_)$Guz8G@{`Cor0rh|1#{K!bJd7BlSZocvIxSO-Y9rN|$Gj1p%Kzs zmYOxowkF8*pNbjy$oO^Bdz3}5e>)vFe6x&y04~!;{u3VAHMM(+5)(aOWQT1qy`nU%PY|A1j;mGSU*H>^ zbIPCXgg9wE+P@o6y9)gJQ9!%(E_Mu|#u;rP`w_H->|1}drDm67p}AcdwfHDp?Q&BM zRWEsDW%eEdAj%4?ju+qJFmk38Ie4*51%4f%sTA#1h3y`9LuJ*W8GA-MIvKVeY|65kR|6pc2w`mFrf$35%UyVZRopB`)J!!CU zHVw#i4eyCSsX~bJ%Z44mh1((*+Hfx<-tyAXe}a-hqR5~h@d+Btj9j(80Y19N@H3=g zZ>=ia0pU99S)uMbK0v+;%`yS>O?sZM_tsEwq{x4lQ%>Oq#LgCVdn5-`BY8Ovn|w)J zPKq^9oA{H}(=+B4lu(t$_&nGcVyqVt6wUxh<6rSj$2ohV_?_!_M4to(WTzRvE2v@wSPz^86g-wgGp{>$_|mwIS6 x((&p1m|)ikW-FBmrCxJ&BSUA8H`C|#Ji&XE;84}CX~mXt>iZ9b{{gNP6kEX5C+YwI diff --git a/search.html b/search.html index 1a4949cebbb..a2c96c1b7a6 100644 --- a/search.html +++ b/search.html @@ -1,13 +1,14 @@ + - Search — MongoDB Node.JS Driver 1.0.1 documentation + Search — MongoDB Node.JS Driver 1.1.0 documentation @@ -15,7 +16,7 @@ - + @@ -33,13 +34,15 @@ + @@ -77,13 +80,10 @@

    Search

    - -

    Page Contents

    - -

    Core Documentation

    +
      +
    +

    Manual

    + + +

    MongoDB Wiki

    + +
    + + + + + - \ No newline at end of file diff --git a/searchindex.js b/searchindex.js index d61a446505a..67e2ad9704c 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{DBRef:[3,0,1,""],removeUser:[10,1,1,""],profilingInfo:[22,1,1,""],getNumBitsAbs:[32,1,1,""],batchSize:[19,1,1,""],"chunkSize number [Getter|Setter]":[4,2,1,""],MinKey:[5,0,1,""],shiftRight:[32,1,1,""],writeFile:[4,1,1,""],getTimestamp:[8,1,1,""],toString:[32,1,1,""],replSetGetStatus:[22,1,1,""],indexInformation:[10,1,1,""],previousErrors:[10,1,1,""],CursorStream:[35,0,1,""],findAndModify:[20,1,1,""],renameCollection:[10,1,1,""],indexExists:[20,1,1,""],getLowBits:[32,1,1,""],collectionNames:[10,1,1,""],ObjectID:[8,0,1,""],isNegative:[32,1,1,""],lessThan:[32,1,1,""],isCapped:[20,1,1,""],dropAllIndexes:[20,1,1,""],lastError:[10,1,1,""],"md5 number [Getter|Setter]":[4,2,1,""],Long:[15,0,1,""],dropIndex:[10,1,1,""],findAndRemove:[20,1,1,""],cursorInfo:[10,1,1,""],geoNear:[20,1,1,""],Grid:[30,0,1,""],listDatabases:[22,1,1,""],isOdd:[32,1,1,""],calculateObjectSize:[1,1,1,""],dropDatabase:[10,1,1,""],mapReduce:[20,1,1,""],Cursor:[19,0,1,""],MaxKey:[11,0,1,""],resetErrorHistory:[10,1,1,""],Server:[23,0,1,""],toArray:[19,1,1,""],reIndex:[10,1,1,""],collectionsInfo:[10,1,1,""],greaterThanOrEqual:[32,1,1,""],Binary:[29,0,1,""],valueOf:[31,1,1,""],validateCollection:[22,1,1,""],serializeWithBufferAndIndex:[1,1,1,""],Timestamp:[32,0,1,""],Symbol:[31,0,1,""],dropCollection:[10,1,1,""],Collection:[20,0,1,""],toNumber:[32,1,1,""],isZero:[32,1,1,""],getHighBits:[32,1,1,""],shiftLeft:[32,1,1,""],createCollection:[10,1,1,""],greaterThan:[32,1,1,""],getLowBitsUnsigned:[32,1,1,""],ReplSet:[18,0,1,""],geoHaystackSearch:[20,1,1,""],lessThanOrEqual:[32,1,1,""],notEquals:[32,1,1,""],GridStore:[4,0,1,""],findOne:[20,1,1,""],ensureIndex:[10,1,1,""],chunkCollection:[4,1,1,""],nextObject:[19,1,1,""],toJSON:[32,1,1,""],Db:[10,0,1,""],serverStatus:[22,1,1,""],profilingLevel:[22,1,1,""],streamRecords:[19,1,1,""],ReadStream:[7,0,1,""],setProfilingLevel:[22,1,1,""],Admin:[22,0,1,""],Double:[16,0,1,""],shiftRightUnsigned:[32,1,1,""],isClosed:[19,1,1,""],BSON:[1,0,1,""],addUser:[10,1,1,""],toInt:[32,1,1,""],deserializeStream:[1,1,1,""],createIndex:[10,1,1,""],buildInfo:[22,1,1,""]},GridStore:{read:[4,1,1,""],readlines:[4,1,1,""],exist:[4,1,1,""],unlink:[4,1,1,""],list:[4,1,1,""]},ObjectID:{createFromTime:[8,1,1,""],createFromHexString:[8,1,1,""]},Timestamp:{fromBits:[32,1,1,""],fromNumber:[32,1,1,""],fromInt:[32,1,1,""],fromString:[32,1,1,""]},Db:{connect:[10,1,1,""]},Long:{fromBits:[15,1,1,""],fromNumber:[15,1,1,""],fromInt:[15,1,1,""],fromString:[15,1,1,""]},BSON:{serializeWithBufferAndIndex:[1,1,1,""],serialize:[1,1,1,""],deserializeStream:[1,1,1,""],calculateObjectSize:[1,1,1,""],deserialize:[1,1,1,""]}},terms:{nwt:14,returnkei:[34,19,20],maxscan:[34,19,20],readfilesync:4,prefix:[36,34],crete:20,createindex:[10,20,34,6,25,9],world_safe2:20,world_safe1:20,pedro:12,test_map_reduce_functions_inlin:20,deviat:34,under:34,jamuhl:14,everi:[0,19,28,21],test_gs_seek_with_buff:4,simple_next_object_collect:19,upload:21,correct:[1,10,8,34,4,37],gotik:[14,17],"10k":34,erhangundogan:14,seper:4,direct:[6,19,37],second:[10,13,2,36,20,4,38,34,8,28,19],street:14,aggreg:[34,25,9,20],even:[0,33,20],attemp:[34,10,20],neg:[32,15,34],"256k":38,"new":[0,1,2,36,4,6,7,8,10,13,15,22,34,19,20,21,28,30,32,35,37,38],net:14,metadata:[21,38,4],"_event":34,rootcollect:4,never:[34,10],here:[37,38,4],epce4qkoh5:33,path:[21,34,4],integration_tests_to_drop:10,anymor:34,loos:[14,37],getlowbit:[24,15,32,9],findandmodifi:[34,20,25,9,13],vincentcr:34,pvorb:14,schemaless:37,sessionstorag:14,middlewar:[14,33],sarah:20,describ:33,would:[0,10,20,32,15,6,38,34],init:19,concret:14,overhead:37,recommend:[37,33,20],type:[11,12,1,20,21,3,22,4,5,33,16,38,37,29,31,34,39],tell:[10,20,4,25,37,38,9],relat:6,notic:[37,38,20],warn:[20,10,13],exce:4,hold:[37,1,4,19],must:[0,32,15,20],join:33,err:[0,22,7,19,13,2,21,36,20,4,35,34,30,37,38,28,10],aheckmann:34,setup:[2,38,10],work:[0,10,34,33,4,37,26,38,19],test_gs_tel:4,rework:34,root:[38,4,30],overrid:[10,19,34,20],give:33,simple_geo_haystack_command:20,indic:[0,13,12,36,6,21,37,28],want:[0,10,20,36,4,23,6,16,37,38,28],keep:[21,34,10,37,20],unsign:[32,15],end:[7,19,20,21,36,33,4,35,37,38,34],replicaset:[12,10,2,34,22,37,27,18],quot:[34,19],playerid:33,how:[12,33,10,20,22,4,39,37,26,38,19],"_id_":[10,20],recoveri:2,env:10,rewind:[0,19,34,4,25,9],milisecond:[34,18,10],config:[2,34,10],updat:[29,12,33,10,20,13,34,22,25,37,38,27,9],maxdist:20,recogn:4,after:[7,19,13,14,21,34,33,4,35,1,38],listdatabas:[25,34,22,10,9],befor:[0,10,20,2,34,4,28,6,37,38,18],wrong:34,simple_document_insert_with_function_saf:20,beauti:[12,33],descriptior:21,parallel:37,demonstr:33,attempt:[34,22,4,18,37,28],third:4,zzdhidden:14,exclud:[19,20],receiv:38,maintain:33,errorobject:34,order:[0,19,13,20,6,28],origin:[20,4,13],cursorinfo:[25,10,9],over:[10,20,14,34,33,28,19],becaus:[14,32,15],readbuff:[34,38],flexibl:14,vari:34,digest:[34,38],uuid:[29,1],fit:[37,19],fix:[34,38],mongolia:14,better:[37,34,28],complex:[37,10,20],loggerinst:34,persist:[37,17,20],descend:[6,19],them:37,thei:[37,32,15,38,34],safe:[13,10,20,36,22,35,37,34,19],update_a_simple_docu:20,test_gs_weird_bug_stream:4,yourself:33,bread:14,"instanceof":[10,20,34,22,4,19],choic:34,guileen:14,changelog:[12,34],bonu:37,timeout:[19,20,2,34,23,28],each:[0,7,19,20,2,32,15,4,28,34,35,25,38,18,9,10],debug:[34,23],went:20,a_simple_collect:10,mean:[19,2,34,33,37,38,28],resum:[35,7,25,9],overflow:[32,15],nin:0,eventstor:14,extract:34,newli:[6,36,22],content:[29,0,7,30,13,14,21,33,4,37,38,9],daniel:[0,28,21],reader:34,got:[37,10,20],more_index_information_test:[10,20],navig:38,worthwhil:38,hang:34,findandremov:[34,25,9,20],situat:34,standard:[14,34],md5:[29,34,1,4],filter:[33,10,20],mvc:14,pagin:20,regress:34,onto:34,rang:[0,34,20],instruct:2,alreadi:[19,13,21,36,4,6,37,28],messag:[13,10,20,34,22,4,23],unlin:4,getnumbitsab:[24,15,32,9],mojo:14,hexstr:8,rewritten:34,top:[14,32,15,20],startindex:1,tonumb:[24,15,32,9],ton:[37,38],tom:33,kamikazepanda:[14,17],listen:[34,19],consol:[0,1,13,21,36,37,38,28],namespac:3,eventlisten:34,took:19,"_id":[0,10,13,34,20,4,6,38,28,30],incur:37,removeus:[25,34,22,10,9],silli:37,target:[38,20],provid:[10,20,14,32,15,4,37,38,18],zero:[32,15,34,8],project:[14,12,26,33,20],matter:37,iron:37,myexperience620186085001:33,beginn:12,websocket:[14,37],abov:[37,38,13],modern:14,mind:37,raw:[0,10,20,36,13,34,38,28,19],manner:[34,38],increment:[37,33],seek:[21,34,4,25,38,9],dbref:[12,10,3,24,37,34,9],ensureindex:[10,20,34,6,25,9],simple_limit_collect:19,data2:4,simplifi:[14,34,38],evangelist:33,insur:34,plenti:38,usernam:[6,22,10],object:[0,1,2,36,4,6,7,8,10,12,13,14,22,18,19,20,21,23,28,29,30,39,33,35,34,37,38],what:[12,19,36,33,37,38],regular:[0,21],choos:[37,18,20],tradit:37,simplic:38,don:[34,28,20],doc:[0,22,1,19,13,14,34,20,4,35,37,10],flow:34,doe:[13,33,10,20,32,15,4,34,37,38,36],masylum:14,bson_data_d:1,radix:[32,15],random:4,speedup:34,syntax:34,test_stream_funct:19,identifi:[37,36,38],absolut:[32,15,38,4],acquir:19,field2:0,explain:[0,10,20,25,9,19],field1:0,theme:37,busi:37,rich:37,ppf_qxbkwm4g:33,io_seek_cur:4,cachefunct:1,nasti:34,test_cursorstream_destroi:35,stop:34,collectionsinfo:[25,10,9],bson_data_numb:1,report:37,youtub:[26,33,17],databank:14,bar:4,emb:[26,33,17],patch:34,bad:20,previouli:19,steam:19,fieldnam:0,fair:38,indexnam:[10,20],num:20,tocollect:10,previouserror:[25,10,9],respons:[0,33,19],fail:[30,20,34,22,37,10],christian:33,awar:20,said:38,databas:[0,30,22,19,13,14,12,36,20,4,39,34,21,37,38,27,28,10],test_gs_empty_file_eof:4,discoveri:33,gridstor:[12,22,7,19,20,21,34,8,4,35,39,1,25,30,38,27,9,10],simplest:[14,0,38],awai:38,lotsofdoc:37,side:14,accord:2,newnam:20,simple_key_based_distinct:20,getlasterror:[34,22,10,20],howev:19,against:[0,22,10,20,32,15,4,8,34,19],logic:[0,34],browser:14,com:[12,14,34,33,17,37,26],con:33,assur:19,asced:19,simple_explain_collect:19,height:[26,33,17],getmorecommand:[19,20],io_seek_set:4,guid:12,assum:[32,15],duplic:[6,10,19,34,20],three:[37,38,4],been:[34,38,19,10],much:[37,38,33,13],basic:[12,10,39,20,37,38],quickli:33,life:38,regul:19,nodeeventstor:14,isodd:[24,15,32,9],ani:[0,10,13,14,37,38,19],child:10,"catch":[34,20],laurie71:34,another_root:4,subsequ:[10,20],dissect:38,properti:[0,21,34,4,25,9],calcul:1,marriag:[12,33],"typeof":[34,1,4],maxbsons:34,succes:20,toolkit:14,sever:[13,2,36,6,37,28],grown:37,usessl:10,test_is_close_function_on_cursor:19,perform:[0,22,10,20,32,15,34,19],make:[0,19,13,34,20,6,37,38,28],transpar:33,meetup:[12,33],filestream:4,drawback:38,split:[32,15,4],isneg:[24,15,32,9],complet:20,reset_error_histori:10,pick:[37,34,38,10],rail:14,hand:28,fairli:34,tune:38,scenario:28,geohaystack:20,test_close_function_on_cursor:19,client:[22,10,13,14,34,20,4,30,37,19],thi:[29,0,22,7,19,13,14,21,32,15,4,28,6,34,33,38,20,37,8,26,10],everyth:13,settimeout:[35,34,7,10,20],left:[32,15,10,28,20],protocol:[37,34],just:[0,38,37,20],laptop:34,ordin:[10,20],farther:7,yet:28,languag:[14,37,33],previous:34,wmode:33,easi:14,collectionn:28,had:19,board:33,els:[20,22,28,13],ffffff:33,save:[10,20,21,34,13,4,25,28,9],dynamicstream:33,applic:[12,10,14,34,33,17,37,38],milli:22,preserv:19,background:[10,20],test_ev:10,apart:[37,38],measur:34,specif:[0,33,10,20,12,36,8,4,37,34,19],arbitrari:[34,4],negat:[24,15,32,9],collection2:[10,20],collection1:20,underli:35,www:[12,10,14,33,17,26],right:[33,32,15,38,37],old:4,creek:33,deal:37,manual:[12,9],interv:34,deserializestream:[24,1,9],dead:34,intern:[0,32,15,21,20],successfulli:19,thu:13,m_tddbw6qnuu4iuxlyo:33,nwtj:14,timestampd:8,multipli:[24,15,32,9,20],fog:33,christkv:[37,34],condit:[0,34,20],foo:20,localhost:[14,37,36,38,10],a_simple_create_drop_collect:10,collection_stats_test:20,promot:37,repositori:[14,37,34],post:[0,32,15,36,20],ryanke:14,plug:37,obj:20,slightli:37,simul:[32,15,38],commit:10,simple_previous_error_col:10,bson_data_symbol:1,"float":[37,32,15],simple_skip_collect:19,bound:[10,19,20],down:[34,10],gridstorewrit:4,wrap:[0,7,31,34,35,16],storag:[14,37,38],git:[14,34],wai:[0,13,20,14,32,15,37,38,34],support:[0,21,34,23,37,38],happi:[14,12,33],avail:[7,19,20,2,35,34,22,4,33,37,38,18,10],width:[26,33,17],test_rename_collection3:20,call:[0,10,20,14,34,4,38,28,19],constantli:37,bulqmxg0vdc:33,fork:14,head:[38,4],medium:22,form:[34,33,4],forc:[10,22,19,34,20],"true":[0,22,1,19,13,2,21,36,20,4,33,35,6,7,34,30,37,38,28,10],reset:[0,10,4,19],new_nam:36,bugfix:34,highbit:[32,15],maximum:[37,34,19,10],until:[37,22,10],deprect:19,fundament:37,dropallindex:[25,9,20],emit:[37,34,35,10,20],shouldcorrectlyfailonretryduetoappcloseofdb:10,featur:38,"abstract":14,fromstr:[24,15,32,9,34],exist:[0,22,10,13,21,36,20,4,6,34,25,37,38,28,9],videoplay:33,check:[0,22,7,19,20,21,32,15,4,35,6,1,34,37,18,10],test_collection_opt:20,bson_binary_subtype_md5:[29,1],test_to_a_after_each:19,floor:8,tip:12,refactor:34,simple_limit_skip_find_one_queri:20,test:[22,19,13,14,21,36,20,4,17,37,38,34,10],forceclos:10,miliscecond:[35,7],node:[12,19,2,34,33,14,17,37,26,9],piplelin:20,consid:20,sql:37,cachefunctionscrc32:1,errormessag:34,teixeira:12,faster:[6,34],ignor:[37,1,20],time:[12,33,19,20,2,34,8,28,14,39,37,18,10],push:[19,14,34,35,37,10],backward:[34,19],daili:33,concept:[37,34],skip:[25,0,19,9,20],global:34,read_secondary_onli:[18,23],row:20,millisecond:28,middl:20,depend:34,originalhex:8,dropindex:[25,6,10,9,20],sourc:[33,17,19],string:[0,1,3,4,6,8,10,15,22,34,19,20,21,23,29,30,31,32,18,36,37,38],feasibl:38,cool:20,logmeup:14,contenttyp:21,level:[10,20,14,34,22,4],did:[34,10],dig:37,eventemitt:[34,19],iter:[19,20],item:[7,10,20,34,22,4,35,37,19],team:33,quick:[37,38,33],div:[33,24,15,32,9],round:[37,18],databasenam:[10,28],wtimeout:[34,22,10,20],addtoset:[37,20],sign:[32,15,36],slow_onli:22,cost:34,port:[34,10,23,28],comparis:4,checkoutwrit:10,repli:[37,22,20],muq2w2u5x9m:26,current:[22,10,21,3,15,4,33,34,37,38,32],subtype_uuid:29,boost:14,deriv:[32,15],gener:[12,10,8,14,34,20,38,28],wait:[10,18,20],box:37,bson_data_regexp:1,shift:[32,15,34],step:38,queue:[14,37],behav:34,examp:14,more_complex_ensure_index_test:[10,20],extrem:34,weird:34,werehamst:14,checkkei:1,extra:0,modul:[14,34],prefer:[0,34,18,23,37],toarrai:[0,10,20,14,34,22,25,37,9,19],bxhflrwemeg:17,instal:[37,34],includeloc:20,aaaaipotmrk:33,perf:34,memori:[0,19,12,34,39,37,38],regep:37,serverstatu:[34,22,25,9],connector:[12,33],live:[37,34,38],handler:38,value2:0,value1:0,criteria:13,scope:[37,34,1,10,20],prev:20,maxkei:[11,12,1,34,24,9],multiplecoll1:10,share:[14,34,33,10,28],finit:[32,15],visual:14,examin:37,content_typ:[21,38],fly:14,cap:[37,34,10,20],uniqu:[0,10,20,4,6,28],primer:[12,38,33,39],test_correctly_access_collect:10,whatev:28,bson_binary_subtype_funct:[29,1],mongo:[12,10,13,14,34,33,37,38,39],stream:[7,19,21,34,35,4,1,25,37,38,9],predict:34,bson_data_long:1,createcollect:[10,20,36,35,25,37,34,9,19],topic:[12,33],nocr:14,kaflr8pi5nk:26,occur:[0,19,13,21,36,4,6,34,28],alwai:[37,32,15,19,20],multipl:[20,2,32,15,4,34,28],ping:[10,34,22,25,18,9],fieldvalu:0,write:[29,1,10,2,21,34,4,24,7,25,37,38,9,30],foreach:[4,20],pure:[22,7,10,20,35,34,8,4,1,30,19],nyc:[12,33],map:[37,34,20],product:[33,32,15],max:[10,19,34,20],dive:[37,38],date:[1,19,8,34,22,6,20,37],docstartindex:1,data:[29,12,7,19,20,21,34,33,4,35,39,1,17,30,37,38,10],grow:37,sbrekken:34,inform:[19,20,2,21,22,4,6,14,37,28,10],"switch":34,reaper:[34,10,28],combin:[33,4,10],anoth:[0,4,37,8],filedata:4,talk:33,gettimestamp:[24,34,9,8],still:[0,34,13],pointer:[0,36,4,28,21],dynam:33,test_map_reduce_funct:20,group:[12,20,34,33,25,26,38,9],gte:0,indexexist:[34,25,9,20],jim:20,nodelai:[2,34,28,23],platform:37,mbostock:34,requir:[22,7,19,13,35,36,20,4,1,38,34,30,37,8,28,10],main:[12,38,33,37],non:[14,34,20],"6pjmp23z0lw":26,encod:[2,37,34,28],col2:10,col3:10,initi:[10,20,34,4,37,38,19],col1:10,verifi:[10,22,4,20],now:[37,34,38,10],discuss:[12,33],nor:36,introduct:[2,12,39,33,37],mapreduc:[34,25,9,20],name:[29,0,22,1,19,13,2,21,3,20,4,28,6,34,33,36,38,18,10],readfil:4,drop:[10,20,36,22,6,25,34,9],revert:0,crypto:34,separ:[0,34,4],mongoerror:34,recreat:28,jprichardson:14,failov:[2,34],replai:34,dialect:14,replac:[0,20,34,13,4,37],individu:[0,34],firej:14,a_1_b_1:[10,20],ensur:[10,20,34,4,6,37,38],poolreadi:34,serverclust:34,happen:[35,7,4,19],shown:[37,38],accomplish:38,"3rd":34,space:[1,10],streetsaheadllc:14,profil:[22,19,20],tohexstr:[0,34,8],factori:[0,28,20],variant:37,million:33,orm:[14,33],mime:4,sethml:34,replacethiscollect:20,org:[14,12,10],"byte":[29,0,1,10,8,21,34,37,38,28],care:[2,0,37],question:[33,32,15],bradberri:33,synchron:37,thing:[37,38,28],place:[12,32,15],year2013:34,frequent:[32,15],first:[0,22,10,13,21,36,20,4,33,38,34,37,8,28,19],oper:[0,22,19,13,32,15,36,6,34,20,37,38,28,10],bson_binary_:34,directli:[0,19,37],onc:[6,37],arrai:[29,0,22,1,19,13,2,21,36,20,4,34,37,18,10],"0x7f":1,reopen:[4,28],"long":[12,1,19,34,15,24,37,9],serverinfo:20,open:[22,7,19,13,2,21,36,20,4,35,34,33,25,30,37,38,28,9,10],predefin:1,size:[0,1,19,20,21,32,15,4,38,34,10],given:[29,10,20,32,15,4,38,19],breviti:[37,38],workaround:34,paramt:19,collectionnam:[10,20,36,22,6,25,38,9],conveni:[0,32,15],subtype_md5:29,especi:37,copi:2,specifi:[29,0,10,20,21,34,4,37,38,28,19],test_rename_collection2:20,test_arrai:19,keepgo:[34,20],than:[0,19,13,20,2,21,32,15,34,38,28],png:[21,4],serv:33,firebas:14,tedeh:34,were:[19,13],posit:[29,21,32,15,4,38],seri:14,pre:[22,1,10,20],lowest:34,sai:38,sam:20,pro:33,argument:[29,32,22,7,19,20,35,3,15,4,23,31,1,16,38,34,30,8,18,10],subroutin:34,simple_rename_collection_2:10,test_gs_read_stream_pip:4,deliv:33,bitwis:[37,32,15],squar:14,alias:0,destroi:[35,7,25,9],note:[32,15,19,10],take:[0,1,2,34,33,37,38],createfromhexstr:[0,24,34,9,8],begin:[0,4],sure:[38,19],normal:19,buffer:[29,0,1,19,13,21,36,20,4,34,30,38,28,10],clearer:34,getyear:20,homepag:14,deepequ:[30,10,20,4,19],renam:[10,20,36,25,37,9],byte_valu:29,later:[38,10,20],indexbound:[10,20],test_gs_read_stream:4,runtim:34,parseint:20,axi:20,show:[7,10,20,35,8,4,1,30,37,19],simple_count_exampl:20,objectid3:8,objectid2:8,concurr:34,limitrequest:34,corner:34,onli:[0,22,19,13,2,34,20,4,6,37,38,28,10],slow:[34,22,10,20],dice:37,setprofilinginfo:22,activ:[14,34],state:[37,34,19,28],analyt:[14,12,33,37],overwritten:38,min_valu:[32,15],variou:[14,22,20],get:[7,36,4,6,8,9,10,12,13,14,22,34,19,20,21,25,28,30,39,33,35,37,38],secondari:[10,20,2,34,23,18,19],ssl:[34,10,23],cannot:[10,20,32,15,37,34,19],shiftrightunsign:[24,15,32,9],geo:20,gen:33,nolock:[34,10],doabl:0,seldom:34,yield:[36,20,10,34,13],isarrai:1,caboos:14,nettl:14,where:[29,0,1,10,13,2,21,36,20,4,6,37,38,34],geospati:[10,20],desced:19,wiki:37,khwang:14,testcas:34,infinit:[32,15,34],detect:[2,34],heckmann:34,fs_chunk:38,integration_tests_2:10,wayt:20,enough:19,between:[10,34,33,28,37,18],"import":[37,38],across:[34,10,28,20],spars:[6,10,20],august:[12,33],tut:12,test_group:20,come:[21,32,15,20],simple_find_and_modify_operations_:20,region:20,gwt:[32,15],tutori:[12,26,38],mani:[37,19],fromnumb:[24,15,32,9],reindex:[25,34,10,9,20],iscap:[34,25,9,20],period:[0,36],dispatch:37,createcreateindexcommand:34,fs_file:38,lessthan:[24,15,32,9],constant:[29,1,10,4,24,25,9,19],reaperinterv:[34,10,28],cursor_information_collect:10,cursorinst:19,coupl:[37,20],aciev:0,rebuilt:[10,20],addit:[0,1,19,20,32,15,22,38,18,10],derefer:[25,34,10,9],lowbit:[32,15],geonear:[34,25,9,20],"1mb":38,those:[32,15],"case":[19,20,32,15,6,37,38,34],myself:37,bson_seri:34,tostr:[30,8,32,15,4,24,20,38,9],trick:[12,38],invok:38,isconnect:34,firstext:22,simple_sort_collect:19,trello:[12,33],advantag:37,createexperi:33,eras:[21,36],dynamicgui:14,ascii:[2,34,28],acess:10,develop:[14,12,33,37],author:[0,20,21,13],media:14,same:[0,19,20,32,15,4,6,8,34,10],binari:[29,0,22,7,19,12,21,36,13,4,35,24,1,20,30,37,8,34,9,10],html:12,document:[0,22,1,19,12,2,21,36,13,4,33,35,6,34,7,20,14,37,38,28,10],howtonod:12,createpk:28,exhaust:19,ifram:[26,33,17],finish:[38,4,20],closest:[32,15,20],utf8:[2,37,34,4,28],nest:[0,6],oid:3,driver:[0,13,2,12,36,33,34,14,25,37,38,28,9,39],gotend:4,capabl:33,newobjectid:8,improv:34,extern:[12,34],defo:0,bson_data_boolean:1,appropri:33,moder:33,distancemultipli:20,brightcov:33,without:[1,10,32,15,28,34,36],model:[14,33,20],dereferenc:10,upsert:[20,13],ourexamplefiletowrit:4,execut:[10,13,34,22,4,20,37,19],when:[0,1,19,13,2,21,36,20,4,33,35,7,34,37,38,28],rest:[14,34,8,20],hint:[19,20],db_connector:[36,28],except:[37,34,4,13],littl:37,desktop:12,blog:[14,0,36,12],framebord:[26,33,17],default_chunk_s:4,haystack:20,real:[14,12,33],around:[14,12,34,37],read:[29,7,19,20,2,21,34,4,23,24,25,37,38,18,9,10],grid:[29,12,30,14,34,25,38,9],pop:37,world:[7,10,20,13,4,1,38,30],lasterror:[25,34,10,9],reap:34,mod:[0,32,15],saniti:34,poolsiz:[7,10,20,34,22,4,23,35,30,37,28,19],realtim:[12,33],integ:[0,1,8,32,15,37,34],server:[1,2,36,4,7,8,10,12,13,14,22,34,19,20,23,25,28,30,33,18,35,37,38],firebaseco:14,either:[21,34,38,37],output:[0,20],greaterthanorequ:[24,15,32,9],manag:[14,21,34,37],kvalheim:33,bson_binary_subtype_byte_arrai:[29,1],eventloop:38,ascend:[0,19,6],intact:13,generationtim:[],setnodelai:34,slice:37,writedata:38,node_ev:34,confirm:37,definit:12,legal:20,evolv:37,profilinginfo:[22,25,9],bson_data_binari:1,read_primar:23,power:[14,33],broken:34,aquir:10,bson_binary_subtype_default:[29,34,1],regexp:[37,34,1],"throw":[37,34,38,13],comparison:8,pointer_to_collect:0,firstnam:[0,6],nocooki:[26,33,17],numbit:[32,15],bson_data_code_w_scop:1,gump:20,act:38,luck:38,other:[0,33,20,2,12,32,15,4,37,38,34,39],readstream:[25,12,7,19,9],addus:[25,34,22,10,9],test_collections_info:10,your:[20,2,33,4,14,37,38],loc:20,log:[0,1,19,20,14,21,36,13,22,23,34,37,38,28],hex:[0,8],overwrit:[22,4],dropdup:[34,10,20],strict:[36,34,10,28,20],interfac:[7,19,14,34,35,37,30],low:[37,32,15,38],lot:[12,19,20,34,6,35,37,38],isvid:33,tupl:6,shamelessli:37,replsetsrv:2,longer:[34,4],pull:[37,34,22],dirti:37,possibl:[0,10,13,14,34,20,6,37],"default":[29,0,22,1,19,13,2,21,36,20,4,23,28,6,38,34,37,8,18,10],remove_subset_of_documents_saf:20,dropdatabas:[10,34,22,25,28,9],auto_reconnect:[7,10,20,2,22,4,23,35,30,37,38,28,19],connect:[12,7,19,20,2,34,22,4,23,28,14,39,35,38,25,30,37,26,18,9,10],gone:[30,10,4,20],creat:[0,22,1,19,20,2,21,36,8,4,33,35,6,7,34,30,37,38,28,10],certain:[6,37],watcher:14,intro:37,file:[7,30,14,21,34,4,38,10],bob:20,russel:33,calculateobjects:[24,1,9],again:[34,4,19],kaba:14,compel:33,event:[7,10,21,34,4,35,37,38,28,19],field:[0,33,19,13,34,20,4,6,37,10],valid:[1,10,8,36,22,20,19],longlib:15,you:[0,1,19,13,2,21,36,20,23,6,33,34,37,38,28,10],scttnlsn:14,pefrom:20,sequenc:34,symbol:[12,1,31,34,24,37,9],briefli:33,opt_radix:[32,15],pool:[34,10,23,28],reduc:[32,15,34,20],lessthanorequ:[24,15,32,9],coreh:14,directori:34,descript:[29,10,1,4,19],tricki:37,potenti:34,alright:37,cpu:[34,38],unset:37,represent:[11,29,33,30,8,3,15,4,5,16,31,32],all:[0,22,1,19,12,2,21,36,13,4,6,34,20,37,38,28,10],forget:37,numberupd:20,dollar:36,month:33,simple_rename_collect:10,cceac:14,follow:[0,19,13,2,4,6,37,38],fetchsiz:19,disk:[38,7,4,20,19],nodej:[14,33,17],subtype_default:29,nextobject:[25,0,19,9,10],aaron:34,introduc:33,setprofilinglevel:[22,25,9],evaul:10,util:[14,34],test_rename_collect:20,failur:[37,34],veri:[12,34,38,37],base698:14,list:[10,20,36,22,4,34,25,37,38,18,9],resav:20,adjust:[34,38],default_port:28,small:[26,38,34],retun:1,cursorstream:[25,12,35,19,9],design:[12,33],pass:[1,10,20,2,36,8,4,34,38,28,19],excit:33,deleg:28,abc:[0,4,13],xor:[24,15,32,9],sub:[29,33,20],sum:[32,15],brief:26,delet:[10,20,21,34,4,25,37,38,28,9,30],version:[34,38,10,28,20],cruso:0,method:[0,19,8,12,36,20,4,39,34,37,38,28,30],full:[34,10,20],themselv:34,variat:37,behaviour:14,foobar2:4,foobar3:4,strong:26,modifi:[37,34,20,13],valu:[0,1,36,4,6,8,9,10,13,15,22,16,34,19,20,21,24,28,29,31,32,33,37,38],search:[14,12,37,20],ahead:[14,37,38,20],showdiskloc:[34,19,20],amount:[37,32,15,10],base:[8,14,21,20,4,37,38],social:14,action:12,mongoos:[14,12,26,33],narrow:20,evalfunct:1,via:37,shorthand:13,lazybum:14,c_1:20,deprec:[18,10],default_root_collect:4,establish:[7,10,20,34,22,4,35,30,19],select:[28,20,36,13,18,34],test_collection_is_cap:20,distinct:[34,25,9,20],regist:4,two:[0,33,10,13,2,12,32,15,4,21,6,38,14,37,8,36],coverag:34,bson_binary_subtype_user_defin:[29,1],taken:37,minor:34,more:[0,7,19,13,2,35,32,15,4,14,33,20,37,38,34,10],flag:20,stick:37,particular:37,cach:1,none:[2,33],outlin:[37,38],dev:14,histori:10,remain:[38,4],learn:[14,12,33],scan:[19,20],qard:14,shard:21,accept:[34,20],simple_document_insert_collection_no_saf:20,default_url:10,uri_decode_auth:10,learnboost:[14,33],robinson:0,cours:37,newlin:4,divid:[32,15,20],rather:20,keepgoingexampl:20,hugh:33,simpl:[0,7,19,12,14,35,36,20,4,6,39,1,30,37,38,34,10],perman:10,resourc:[14,28],resultset:37,reflect:34,unlink:[25,21,38,4,9],associ:[38,4],keyorlist:19,shouldcorrectlyexecutesimpleaggregationpipelineusingargu:20,github:[14,12,34,17,37],defineproperti:34,save_a_simple_document_modify_it_and_resave_it:20,caus:[37,34],callback:[0,22,19,13,21,36,20,4,6,34,37,38,28,10],spheric:20,doc_id:0,bson_data_oid:1,trade:38,through:[10,20,34,33,4,37],reconnect:[34,18,23,28],paramet:[0,22,19,13,2,21,36,20,4,6,34,37,38,28,10],style:[14,37,33],mongorepli:34,world_no_saf:20,batchsizevalu:19,asbuff:1,relev:37,stylu:17,rapidli:37,bypass:37,simple_limit_skip_queri:20,test_cursorstream_resum:35,might:[6,38,10,37],alter:[0,36],good:[12,38,37,20],"return":[0,7,3,4,5,1,8,10,11,13,15,22,16,36,19,20,21,28,29,30,31,32,35,34,37,38],timestamp:[12,1,8,32,20,24,34,9],more_complex_index_test:[10,20],framework:[14,20],compound:[10,20],karaco:14,readlen:4,emerleit:14,uploadd:21,unlik:19,authent:[25,34,22,10,9],easili:[32,15,34],achiev:0,skipvalu:19,found:[0,10,20,4,13],truncat:[36,38,4,34],hard:37,weren:0,realli:37,expect:[0,28],barrier:34,orient:12,primari:[0,10,20,2,34,37,28,19],b4ajeu13u6u:26,read_primari:[34,18],pullal:37,foreground:[10,20],core2duo:34,advanc:[12,39,36,4,37,38],differ:[12,10,20,32,15,4,6,38,37,8,34,30],asc:[0,19,13],reason:[4,23],croucher:33,connectionopt:10,put:[29,19,20,34,4,24,25,38,9,30],seconddb:10,gethighbit:[24,15,32,9],tailabl:[34,19,20],omit:[37,3,38,34],dir:13,assign:[2,34],notifi:[37,38,20],articl:[12,38,39],lastnam:[0,6],number:[29,0,22,1,19,20,32,15,4,23,28,6,16,38,34,37,8,18,10],done:[0,7,10,20,21,34,13,22,35,37,38,28],construct:[32,15],autoclos:[21,38,7,4],create_and_drop_an_index:[10,20],miss:34,pageview:20,chunk_typ:4,script:[21,33],interact:[37,38,4,30],least:[0,20],custompkfactori:28,settim:[],statement:[37,38,10],illeg:[30,22,10,34,20],master:[2,34],store:[1,10,14,21,4,37,38,19],schema:[12,33],otherid:8,option:[0,1,2,3,4,6,9,10,13,22,36,19,20,21,23,25,28,29,30,18,34,37,38],reseterrorhistori:[25,10,9],similarli:37,selector:[10,19,34,20],getter:4,pars:[34,1,20],fileid2:4,literarili:37,std:34,kind:38,bson_data_nul:1,whenev:[10,20],createwritestream:4,remov:[22,10,20,36,13,4,6,25,37,34,9],reus:[34,1,10],str:[32,15],consumpt:38,toward:33,cleaner:14,comput:12,luckili:[37,38],"null":[0,1,19,20,2,36,22,4,23,28,14,35,34,30,18,10],built:[14,37],equival:[37,20],valueof:[24,16,9,31],fromcollect:10,also:[0,19,13,12,36,4,6,37,38,34],build:[22,10,34,33,37,38],tool:[14,33],pipelin:20,lubow:33,blackboard:[14,12,17],validatecollect:[34,22,25,9],reach:[38,7],most:[0,38,33,37],plai:33,plan:38,native_pars:[7,10,20,22,4,35,30,28,19],"16mb":21,clear:34,part:[37,26,22,34,8],clean:[14,34,10],frombit:[24,15,32,9],ridicul:14,brightcoveexperi:33,session:[14,33],find:[0,7,19,13,14,21,34,20,22,6,35,25,37,9,10],firewal:34,nosql:[14,12],pretti:37,manipul:20,test_gs_weird_bug:4,numberofdocu:1,queu:14,batch_document_insert_collection_saf:20,hit:[10,20],unus:34,express:[0,12,20,14,21,17,37],fieldtoupd:37,test_map_reduce_functions_scop:20,nativ:[14,37,34,28],ferret:14,restart:[35,7],statist:[10,22,18,34,20],wrote:37,set:[0,22,1,19,13,2,21,36,20,4,23,6,33,34,37,38,28,10],jade:17,see:[0,13,21,32,15,6,36,37,38,28],easymongo:14,close:[7,19,20,14,21,34,22,4,35,25,30,37,38,28,9,10],my_f:4,lee:34,misalign:34,jenkin:10,someth:[4,28],particip:18,altern:[14,20],signatur:[4,19],complement:[32,15],javascript:[1,10,20,14,32,15,33,37],salzman:34,succeed:6,both:[34,20],last:[14,21,10,37],create_and_drop_all_index:10,context:[34,33,28],let:[7,10,20,34,4,37,38,19],corrupt:[34,22],whole:[37,10,4,20],createdat:19,load:[0,34],episod:12,jsmode:20,point:[19,20,32,15,37,38],instanti:[37,34],param:33,shutdown:34,suppli:[34,38],backend:37,faithfulli:[32,15],user_id:20,due:[37,34,30],empti:[0,34,20,4,19],otherwis:[1,19,32,15,4,37,38],bgcolor:33,txt:4,strategi:[37,34,18],test_streamingrecords_funct:19,wish:[29,1,10,20,22,4,38],fire:[7,10,13,14,21,4,37,38,28],admindb:[22,10],imag:[21,38],understand:37,func:[1,20],convers:[37,20],look:[19,20,21,34,33,4,6,37,38],mdoq:14,straight:[37,38],batch:[37,34,19,20],"while":[0,34,4,21,19],getownpropertynam:34,behavior:[0,13,32,15,37,34],error:[0,22,7,19,13,14,21,36,20,4,23,6,35,34,37,28,10],fun:[38,20],fixtur:14,robin:[37,18],loop:34,found2:4,test_gs_unlink:4,readi:[35,7,4,37,19],key2:0,key1:0,jpg:4,itself:[12,19],test_deref_exampl:10,rid:34,simple_key_based_distinct_sub_query_filt:20,chase:34,decor:34,gs2:4,geohaystacksearch:[34,25,9,20],coffeescript:[14,12,26],decod:10,p_db:[2,10],higher:[2,34,38,28,20],"10gen":12,optim:[34,20],operaion:21,numberofretri:[34,10,28],piec:[37,32,15,38],temporari:[4,20],user:[29,0,1,10,13,14,12,34,22,4,6,33],hello2:20,keyf:20,recent:33,travers:19,entri:[10,38,4,20],joyent:33,readprefer:[18,23],explan:[10,20],getlowbitsunsign:[24,15,32,9],a_1:20,collabor:33,shape:34,tempcollect:20,update_a_simple_document_multi:20,move:[21,34,4,37],password:[34,22,10],cur:38,colladow:14,tdegrunt:14,keeptemp:20,appli:[0,34,19,37],input:[32,15,20],subtype_user_defin:29,format:[0,10,20,13,22,19],big:[37,34,38],checksum:4,shiftright:[24,15,32,9],rs_name:[2,34,18],replsetserv:[22,1,19,20,2,35,34,8,4,7,30,10],like:[0,33,19,20,14,32,15,6,38,10],fsync:[22,10,20],resolv:10,collect:[0,2,3,4,6,9,10,12,13,14,22,36,19,20,21,25,27,28,30,39,33,18,35,34,37,38],bson_data_cod:1,popular:[12,33,37],bamboo:34,brett:33,serverpair:34,often:[32,15],creation:[22,10,20,34,33,37],some:[0,7,19,12,21,34,20,4,6,33,30,37,38,10],back:[0,22,8,14,32,15,4,20,37,34],understood:37,sampl:37,scale:[12,38,33,37,20],slaveok:[34,10,23,20],chunksiz:[21,34,38,4],bson_data_min_kei:1,retri:[37,34,18,28,10],larg:[0,10,20,21,34,37,38],intial:20,previou:[38,28],run:[12,10,13,20,2,34,22,37,38,39],lublow:33,simple_reset_error_history_col:10,simpleemitt:34,simple_explain_queri:20,from:[0,1,2,36,4,8,10,12,13,15,22,34,19,20,21,23,29,30,32,33,18,37,38],subtract:[24,15,32,9],k1mnspb8wvq:26,allowfullscreen:[26,33,17],recordquerystat:10,block:[38,10,20],cygwin:34,within:[32,15],simple_index_test:20,contributor:33,test_collection_index_exist:20,bson_deseri:34,fast:14,custom:[0,34,38,28,20],plain:34,includ:[0,19,20,12,36,33,4,6,34,37,28,10],forward:4,files:[34,4],properli:[34,4],isbuff:34,uniquedoc:20,"_bsontyp":34,hainterv:18,link:[12,38,39,37],translat:14,atom:[37,34,20],line:[14,38,4],info:[34,22,38,10,20],concaten:[32,15,4],consist:34,caller:19,forceserverobjectid:[34,10,28],gridf:[12,30,39,21,34,4,38],readlin:[25,4,9],similar:21,hash:[0,34,38,10,28],multiplecoll2:10,parser:[34,1,10,28],doesn:[0,28,13],repres:[19,8,32,15,4,23,16,37,31],idhex:0,titl:[0,20,27,13],unidirect:19,wakup:10,nice:[37,33],deseri:[1,19,34,24,37,9],bcoe:14,jannehietamaki:34,mongodb:[0,1,2,36,4,6,7,8,9,10,12,13,14,22,17,34,19,20,21,23,26,28,30,33,35,37,38],eval:[1,10,20,34,25,9,19],profilinglevel:[22,25,9],algorithm:[2,32,15,28,34],cursorinform:10,tradeoff:38,awesom:[12,26,17],far:4,hello:[7,10,20,13,4,1,37,38,30],code:[22,7,10,20,35,34,8,4,1,30,37,38,19],partial:[19,20],worldbuff:4,queri:[0,22,19,13,12,36,20,4,6,39,33,34,37,27,28,10],idvalu:0,mongoskin:14,octet:4,replicasetcheckinterv:34,base64:[2,30,4,34,28],update_a_simple_document_upsert:20,send:[2,37,34,10,28],lower:[10,20],io_seek_end:4,sens:13,reapertimeout:[34,10,28],passiv:34,shouldcorrectlyforcereindexoncollect:20,result2:30,account:20,writebuff:34,untouch:28,dbname:[34,10],magic:14,gettim:[19,8],roll:12,fieldorspec:[10,20],fewer:20,"try":[37,34,20,38,13],race:34,marri:33,refer:[10,3,4,37,34,19],smaller:21,fortun:37,natur:[37,33],jump:[37,38,33],video:[12,38],odm:[14,12,26],download:37,odd:[32,15],append:[21,4,37],compat:34,index:[12,1,19,20,36,6,25,27,34,9,10],compar:[8,32,15,4,6,24,9],descriptor:38,access:[10,20,21,22,4,31,16,19],experiment:34,can:[0,19,13,2,21,32,15,36,6,34,38,20,37,8,28,10],chose:33,bson_data_int:1,simplereach:33,cursor_count_collect:19,calipso:14,logout:[25,22,10,9],filedescriptor:38,becom:37,sinc:[37,32,15,38,13],subtype_byte_arrai:29,nexttick:34,convert:[0,37,8],reconnectwait:18,larger:[21,34,38],technolog:33,chang:[20,32,15,37,38,34],configur:[2,37,36,10,34],read_secondari:[2,34,18,23],app:[2,12,34,33],mattinsl:14,api:[12,10,14,33,24,25,38],redi:33,cloud:12,chrisgibson:14,zir:14,batchsiz:[25,10,19,9,20],doubl:[12,34,24,16,37,9],next:[0,1,19,33,38,28],websit:[14,33],chr:4,simpler:[14,37,34,19,20],sort:[0,19,13,34,20,6,25,8,9],src:[26,33,17],detail:[6,19,21],benchmark:34,name2:0,insensit:19,socketopt:[2,34,28,23],sollect:36,degrunt:14,retriev:[0,22,10,13,21,34,20,4,37,38,19],scalabl:21,multiple_db_inst:10,annot:38,tag:[34,20],thin:14,fetch:[0,10,19,20,6,37,30],queryfailur:34,control:[37,34,38,28],objectid:[0,22,7,19,12,35,3,20,4,24,1,38,34,30,37,8,28,9,10],process:[12,19,14,32,15,34,10],lock:[34,38,10],username_:6,high:[10,20,32,15,34,37,18],unopen:34,serial:[1,10,20,34,24,9],readprefr:23,pingresult:22,integration_test_:[2,10],instead:[0,10,20,2,34,23,6,38,28,19],npm:[37,34],pois:33,await:10,formattedorderclaus:34,originaldata:[4,30],alloc:[34,1,10],bind:14,remove_all_documents_no_saf:20,correspond:[6,32,15,36],element:[0,4,37,19],issu:[37,34,20],chief:33,writ:4,allow:[10,20,36,22,4,23,28,34,37,38,18,19],subtyp:29,deoptim:34,doc2:37,doc3:37,doc1:37,alexeypetrushin:14,doc4:37,spank:34,own:[34,4],server_opt:28,effici:[37,38,20],bunch:[34,10,20],perfect:37,total:[0,20],crash:34,greater:[0,32,15,19],handl:[15,19,20,32,33,4,37,38,34],databs:[21,36,28],dai:[12,33],auth:[34,10],renamecollect:[25,10,9],precess:37,numberofremoveddoc:20,writefil:[25,21,38,4,9],convin:0,anyth:34,edit:[38,4],npmj:14,slide:[12,33],deserializeddoc:1,exampledb:[37,38],subset:[19,20],unwind:20,opensync:4,chunk:[21,34,38,4],bson_binary_subtype_uuid:[29,1],default_content_typ:4,pushal:[37,34],our:[37,38,33,4,19],special:[37,32,15,38,19],out:[12,10,8,2,34,20,4,37,38,28,39],variabl:[37,34,20],calip:14,trickier:[0,37],categori:38,suitabl:38,merg:[34,20],ref:34,clone:14,math:8,jessica:[0,13],insid:[0,38,21,6],dropcollect:[25,36,10,9],unpars:34,releas:34,princess:20,replsetgetstatu:[34,22,25,9],unwant:0,could:[37,34],shiftleft:[24,15,32,9],david:13,length:[29,1,10,20,21,22,4,24,38,9,19],lte:0,transfer:10,minkei:[12,24,1,34,5],evanp:14,debugmessag:34,iszero:[24,15,32,9],should_correctly_rewind_and_restart_cursor:19,gridstore3:4,gridstore2:4,gridstore7:4,gridstore6:4,gridstore5:4,totalopen:10,prioriti:34,start:[29,0,1,19,12,2,36,20,4,37,38],system:[14,36,38,4],wrapper:14,createfromtim:[24,34,9,8],bson_data_max_kei:1,termin:4,"final":[37,34,33,20],idottv:14,deconstruct:38,test_gs_getc_fil:4,exactli:36,gridstorew:4,bson_data_object:1,replset:[2,12,18,25,10],pgebheim:34,bother:33,mongoserv:[36,28],structur:[0,38,37],charact:[29,34,4,20],test_gs_puts_and_readlin:4,seriou:34,result:[0,22,7,19,13,21,32,15,4,34,38,20,30,37,8,28,10],"function":[0,1,2,36,4,7,8,10,13,14,15,22,18,19,20,21,23,28,29,30,32,35,34,37,38],counter:[28,20],terribl:34,peform:[35,10,7,19,20],have:[0,10,20,2,36,33,4,23,6,37,38],tabl:[37,26,36],need:[0,1,10,13,21,32,15,36,23,6,20,37,38,28],turn:[0,34,22,18,10],border:26,buildinfo:[22,25,9],min:[10,19,34,20],rout:14,streameddata:4,mix:[0,6],andrewjston:34,which:[0,33,2,21,32,15,4,34,36,38,28],test_other_drop:20,orgiin:4,singl:[29,0,33,10,20,21,34,13,4,23],fileid:[38,7,4],statsync:4,whi:0,serverconfig:[34,10,28],why:[14,37,33],overwriten:4,url:[14,10],timestamplib:32,request:[34,33,19],uri:10,face:37,pipe:4,piplin:20,test_collect:13,snapshot:[19,20],"400m":33,determin:[37,19],constrain:4,streamrecord:[25,37,34,19,9],fact:[37,13],text:[15,20,32,33,4,38],serializefunct:[34,1,10,20],verbos:20,nagl:[2,34,28],anywai:[10,20],setter:4,textual:[32,15],locat:[37,10,20,4,19],playerkei:33,should:[0,22,10,8,32,15,20,30,38,36,19],noid:14,test_cursorstream_paus:35,local:[3,10],devnul:14,cube:14,ritch:[14,34],kiefer:33,increas:34,donewithwrit:38,enabl:[34,10,28],organ:33,simple_batch_size_collect:19,stuff:[2,12,38,39,37],integr:[14,37,38],contain:[29,1,10,20,2,36,4,23,37,38,19],grab:[10,22,4,19],mon4mongo:14,view:14,legaci:23,modulo:[0,24,15,32,9],packet:34,meritt:14,statu:[14,37,34,22,18],wire:[37,34],correctli:[37,34,20],pattern:12,boundari:34,written:[29,20,14,32,15,4,38],crude:37,world2:20,kei:[0,1,19,20,34,4,6,37,38,28,10],buckets:20,simple_queri:20,isol:34,job:[14,20],entir:[38,4,19],joe:20,db_option:28,crc32:1,monitor:14,mongod:[14,23],plugin:33,admin:[12,33,10,20,34,22,25,9],mongoj:[14,12],equal:[0,22,7,19,20,35,32,15,4,24,1,30,37,8,9,10],etc:[0,28,20],instanc:[22,1,10,20,2,34,8,4,30,37,38,28,19],greaterthan:[24,15,32,9],mongoq:14,uncaught:34,subtype_funct:29,comment:[34,19,20],toint:[24,15,32,9],walk:33,removealllisten:34,save_a_simple_docu:20,attende:33,addition:36,compon:34,json:[12,33,32,15,24,37],treat:[0,34,19],pkfactori:[10,20],immedi:13,bit:[0,1,21,32,15,37,38,34],assert:[22,7,10,20,35,8,4,1,30,19],ador:14,present:[6,36,33,12],replic:[2,10],multi:[34,20,13],vimeo:12,align:34,cursor:[0,7,19,20,12,34,35,25,37,9,10],defin:[29,0,1,10,20,13,32,15,4,34,37,28],setreadprefer:34,bson_data_arrai:1,observ:14,layer:[14,37,33],helper:[14,34],site:2,lightweight:14,tojson:[24,15,32,9,34],nodetut:12,getc:[25,4,9],cross:34,member:[2,34],python:12,speaker:33,inc:[37,34],gett:14,difficult:38,incorrect:34,slave:2,hostnam:28,keepal:[2,34,28,23],upon:19,proxlet:33,retriv:22,student:26,serializewithbufferandindex:[24,1,9],php:12,chunk_siz:[21,4],off:[10,2,36,22,4,34,37,28,19],center:20,nevertheless:28,builder:33,well:[0,34,38,37],exampl:[0,22,7,19,12,21,36,13,4,35,6,39,1,38,20,30,37,8,28,10],command:[10,20,14,34,22,4,23,25,37,28,9,19],simple_geo_near_command:20,filesystem:21,undefin:34,latest:37,distanc:20,paus:[35,7,25,9],less:[37,32,15],"boolean":[7,19,20,21,32,15,4,23,6,1,38,18,10],additon:6,tcp:37,mojodna:34,indexinform:[10,20,34,6,25,9,19],simpli:0,web:[14,12,37],rapid:[12,33],seekloc:[38,4],add:[15,10,20,32,22,6,24,37,9],cleanup:[34,38],tjanczuk:14,logger:[34,23],match:[0,22,20,13,32,15,37,36],branch:34,agnost:34,crud:[12,39,37],iya_logo_final_bw:4,know:36,bson_data_timestamp:1,recurs:[15,32,1,4],isclos:[25,19,9],desc:[0,19],bson_data_str:1,insert:[0,22,1,19,12,36,13,4,23,25,34,35,20,37,27,28,9,10],resid:37,backbon:33,success:[21,4,19],isui:33,chunkcollect:[25,4,9],necessari:0,"0xff":1,async:[14,37],page:[0,33,37,12],milewis:14,linux:34,contin:14,flush:[38,7,4],proper:34,fileinfo:38,newhex:8,librari:[14,12,34,33,38],tmp:4,leaf:14,lead:[32,15,34],aaronasachimp:34,leak:34,avoid:[6,34,22,37],fromint:[24,15,32,9],thank:34,leav:[34,13],kcbanner:14,speak:33,mode:[10,20,21,36,4,34,38,28,19],slight:37,journal:10,usag:[12,1,30,8,2,21,36,4,34,37,38,28],collection_nam:36,host:[28,23],although:38,offset:[29,34,38,4],java:[32,15],cliftonc:14,panel:[12,33],about:[12,10,13,33,6,37,38,28,19],actual:[0,38,10,37,28],socket:[12,10,2,34,33,23,17,37,28],http:[12,14,34,33,17,37,26],dbinstanc:38,notequ:[24,15,32,9],constructor:[1,2,3,4,5,7,8,9,10,11,15,22,16,18,19,20,23,24,25,28,29,30,31,32,35,34],fals:[0,22,7,19,13,21,36,20,4,23,28,35,1,34,30,38,18,10],disabl:[2,34,28],autoindexid:10,automat:[7,19,2,21,34,37,38,28,10],dataset:[0,37],bson:[0,7,3,4,5,1,8,9,10,11,12,13,22,16,36,19,20,24,28,29,30,31,35,34],leverag:[37,33],val:20,pictur:38,primarki:0,mykei:37,trigger:[7,19,20,34,4,35],concat:0,"var":[0,22,1,19,13,2,21,36,20,4,35,7,38,30,37,8,28,10],fsname:30,deliveri:33,shouldcorrectlyexecutesimpleaggregationpipelineusingarrai:20,brand:34,continu:14,waitforconnect:34,gain:34,eas:14,inlin:[34,20],bug:[34,38],count:[0,19,13,36,20,4,25,34,9,10],made:[34,33,38],wise:0,whether:[32,15,34],ecosystem:33,displai:[33,10],asynchron:[2,37],record:[0,19,13,21,36,20,4,6,37,28,10],below:[12,10,13,32,15,37],limit:[0,19,20,21,34,25,37,9],"static":14,problem:[34,22],myexperience1123429378001:33,evalu:[1,10],"int":[32,15],dure:[37,34,22,10,20],year:0,filenam:[21,34,38,4],replica:[2,34,22,10],implement:[14,37,32,15,34],ing:[12,33],eric:33,retrymilisecond:[34,10,28],probabl:0,tick:34,arrj:14,bartt:14,book:[0,12],bool:8,futur:[14,37,34,10],karait:14,stat:[34,25,9,20],findon:[0,10,20,34,25,37,9],"class":[7,3,4,5,1,8,10,11,15,22,16,34,19,20,23,29,30,31,32,33,18,35,37,38],geck:14,stai:20,experienc:33,eof:[25,21,38,4,9],integration_test:[7,10,20,22,4,35,30,19],kaij:34,"0_gnhwzhc":26},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","ObjectID()","Node.JS MongoDB Driver Manual Contents","Db()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Double()","Awesome Node.js + MongoDB Applications","ReplSet","Cursor()","Collection()","GridStore","Admin()","Server()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Binary()","Grid()","Symbol()","Timestamp()","Node.JS Specific Presentations","Changelog","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver","Articles"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","contents","api-generated/db","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/double","content/awesomeappsvideo","api-generated/replset","api-generated/cursor","api-generated/collection","markdown-docs/gridfs","api-generated/admin","api-generated/server","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","api-bson-generated/binary","api-generated/grid","api-bson-generated/symbol","api-bson-generated/timestamp","content/nodejsvideo","changelog/changelog","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2","api-articles/index"]}) \ No newline at end of file +Search.setIndex({objects:{"":{DBRef:[4,0,1,""],"_validateReplicaset":[20,1,1,""],removeUser:[12,1,1,""],profilingInfo:[25,1,1,""],getNumBitsAbs:[36,1,1,""],batchSize:[21,1,1,""],"chunkSize number [Getter|Setter]":[5,2,1,""],MinKey:[6,0,1,""],shiftRight:[36,1,1,""],writeFile:[5,1,1,""],getTimestamp:[9,1,1,""],toString:[36,1,1,""],replSetGetStatus:[25,1,1,""],indexInformation:[12,1,1,""],previousErrors:[12,1,1,""],CursorStream:[39,0,1,""],findAndModify:[22,1,1,""],renameCollection:[12,1,1,""],toHexString:[9,1,1,""],indexExists:[22,1,1,""],getLowBits:[36,1,1,""],collectionNames:[12,1,1,""],ObjectID:[9,0,1,""],isNegative:[36,1,1,""],lessThan:[36,1,1,""],isCapped:[22,1,1,""],dropAllIndexes:[22,1,1,""],lastError:[12,1,1,""],"md5 number [Getter|Setter]":[5,2,1,""],Long:[17,0,1,""],dropIndex:[12,1,1,""],findAndRemove:[22,1,1,""],cursorInfo:[12,1,1,""],geoNear:[22,1,1,""],Grid:[34,0,1,""],listDatabases:[25,1,1,""],isOdd:[36,1,1,""],calculateObjectSize:[2,1,1,""],dropDatabase:[12,1,1,""],mapReduce:[22,1,1,""],Cursor:[21,0,1,""],MaxKey:[13,0,1,""],resetErrorHistory:[12,1,1,""],Server:[26,0,1,""],toArray:[21,1,1,""],reIndex:[12,1,1,""],collectionsInfo:[12,1,1,""],greaterThanOrEqual:[36,1,1,""],Binary:[33,0,1,""],valueOf:[35,1,1,""],validateCollection:[25,1,1,""],serializeWithBufferAndIndex:[2,1,1,""],setReadPreference:[26,1,1,""],"_isUsed":[20,1,1,""],Timestamp:[36,0,1,""],Symbol:[35,0,1,""],dropCollection:[12,1,1,""],Collection:[22,0,1,""],toNumber:[36,1,1,""],isZero:[36,1,1,""],getHighBits:[36,1,1,""],ReadPreference:[24,0,1,""],shiftLeft:[36,1,1,""],createCollection:[12,1,1,""],greaterThan:[36,1,1,""],Mongos:[10,0,1,""],getLowBitsUnsigned:[36,1,1,""],ReplSet:[20,0,1,""],geoHaystackSearch:[22,1,1,""],lessThanOrEqual:[36,1,1,""],notEquals:[36,1,1,""],GridStore:[5,0,1,""],findOne:[22,1,1,""],ensureIndex:[12,1,1,""],chunkCollection:[5,1,1,""],nextObject:[21,1,1,""],"_checkReplicaSet":[20,1,1,""],toJSON:[36,1,1,""],Db:[12,0,1,""],serverStatus:[25,1,1,""],profilingLevel:[25,1,1,""],streamRecords:[21,1,1,""],ReadStream:[8,0,1,""],setProfilingLevel:[25,1,1,""],Admin:[25,0,1,""],Double:[18,0,1,""],shiftRightUnsigned:[36,1,1,""],isClosed:[21,1,1,""],BSON:[2,0,1,""],addUser:[12,1,1,""],toInt:[36,1,1,""],deserializeStream:[2,1,1,""],createIndex:[12,1,1,""],buildInfo:[25,1,1,""]},GridStore:{read:[5,1,1,""],exist:[5,1,1,""],readlines:[5,1,1,""],unlink:[5,1,1,""],list:[5,1,1,""]},ObjectID:{createFromTime:[9,1,1,""],createFromHexString:[9,1,1,""]},Timestamp:{fromBits:[36,1,1,""],fromString:[36,1,1,""],fromInt:[36,1,1,""],fromNumber:[36,1,1,""]},Db:{connect:[12,1,1,""]},Long:{fromBits:[17,1,1,""],fromNumber:[17,1,1,""],fromInt:[17,1,1,""],fromString:[17,1,1,""]},BSON:{serializeWithBufferAndIndex:[2,1,1,""],serialize:[2,1,1,""],deserializeStream:[2,1,1,""],calculateObjectSize:[2,1,1,""],deserialize:[2,1,1,""]}},terms:{nwt:16,returnkei:[38,21,22],maxscan:[38,21,22],readfilesync:[5,32],prefix:[40,38],crete:22,createindex:[12,22,38,7,28,11],world_safe2:22,world_safe1:22,pedro:14,test_map_reduce_functions_inlin:22,deviat:38,under:38,jamuhl:16,everi:[0,21,31,23],test_gs_seek_with_buff:5,affect:32,disabledriverbsonsizecheck:[38,26],simple_next_object_collect:21,upload:23,correct:[2,12,9,38,5,41],math:9,gotik:[16,19],"10k":38,throught:32,seper:[5,32],direct:[7,21,41],second:[12,15,3,40,22,5,42,38,9,31,21],street:16,aggreg:[38,32,28,11,22],even:[0,37,22],subsequ:[12,22],attemp:[38,12,22],neg:[36,17,38],"256k":42,"new":[0,2,3,40,5,7,8,9,12,15,17,25,38,21,22,23,31,32,34,36,39,41,42],net:16,metadata:[23,42,5],"_event":38,rootcollect:5,never:[38,12],here:[41,42,8,5],comparedata:32,epce4qkoh5:37,path:[23,38,5],integration_tests_to_drop:12,anymor:38,loos:[16,41],getlowbit:[27,17,36,11],findandmodifi:[38,22,28,11,15],expireaftersecond:12,vincentcr:38,pvorb:16,schemaless:41,replicatset:32,m_tddbw6qnuu4iuxlyo:37,middlewar:[16,37],sarah:22,describ:37,would:[0,12,22,36,17,7,42,38],init:21,concret:16,overhead:41,recommend:[41,37,22],type:[13,14,2,32,22,23,4,25,24,5,6,37,18,42,41,33,35,38,43],tell:[12,22,5,28,41,42,11],relat:7,notic:[41,42,22],warn:[22,12,15],exce:5,rip:12,hold:[41,2,5,21],must:[0,36,17,32,22],join:37,err:[0,25,8,21,15,3,23,40,22,5,39,38,34,41,42,32,31,12],aheckmann:38,setup:[3,42,12,32],work:[0,12,21,38,37,5,41,29,42,32],test_gs_tel:5,rework:38,root:[42,5,34],overrid:[12,32,21,38,22],give:37,simple_geo_haystack_command:22,indic:[0,15,14,40,7,23,41,31],unavail:[24,32],want:[0,12,22,40,5,26,7,18,41,42,31,32],keep:[23,38,12,41,22],unsign:[36,17],end:[8,21,22,23,40,37,5,39,41,42,38],replicaset:[14,1,12,3,38,25,41,30,10,20,32],quot:[38,21],playerid:37,how:[14,37,12,22,25,5,43,32,41,29,42,21],"_id_":[12,22],recoveri:3,env:12,rewind:[0,21,38,5,28,11],verifi:[12,9,25,5,22],chase:38,config:[3,38,12],updat:[33,14,1,25,12,22,38,15,37,28,41,42,30,11],maxdist:22,recogn:5,lte:0,after:[8,21,15,16,23,38,37,5,39,2,42],listdatabas:[28,38,25,12,11],befor:[0,12,22,3,38,5,31,7,41,42,20,32],wrong:38,simple_document_insert_with_function_saf:22,beauti:[14,37],parallel:41,demonstr:37,attempt:[12,38,25,5,20,41,10,31,32],third:5,credenti:12,zzdhidden:16,exclud:[21,22],receiv:[42,8],maintain:37,errorobject:38,order:[0,21,15,22,7,31],origin:[22,5,15],cursorinfo:[28,12,11],over:[12,21,22,16,38,37,31,32],becaus:[16,36,17],readbuff:[38,42],flexibl:16,vari:38,digest:[38,42],uuid:[33,2],fit:[41,21],fix:[38,42],mongolia:16,better:[14,1,32,38,41,31],complex:[41,32,12,22],loggerinst:38,persist:[41,19,22],descend:[7,21],them:41,thei:[32,36,17,41,42,38],authdb:12,safe:[15,12,22,40,25,39,41,38,21],update_a_simple_docu:22,test_gs_weird_bug_stream:5,yourself:37,bread:16,"instanceof":[12,22,38,25,5,21],choic:38,guileen:16,changelog:[14,38],overflow:[36,17],bonu:41,timeout:[32,22,3,38,31,21],each:[0,8,21,22,3,36,17,5,31,38,39,28,32,42,10,20,11,12],debug:[38,26],went:22,a_simple_collect:12,mean:[32,3,38,37,41,42,31,21],resum:[28,39,8,5,11],customobject:32,reset_error_histori:12,eventstor:16,extract:38,newli:[7,40,25],content:[33,0,8,34,15,16,23,37,5,41,42,11,32],daniel:[0,31,23],reader:[38,32],got:[41,12,22],more_index_information_test:[12,22],navig:42,worthwhil:42,hang:38,findandremov:[38,28,11,22],situat:38,standard:[16,38],md5:[33,38,2,5],filter:[37,12,22],mvc:16,pagin:22,regress:38,onto:38,rang:[0,38,20,22],instruct:3,alreadi:[21,15,23,40,5,7,41,31],messag:[15,12,22,38,25,5,26],unlin:5,getnumbitsab:[27,17,36,11],mojo:16,hexstr:9,rewritten:[38,32],top:[16,36,17,22],keyf:[38,22],startindex:2,tonumb:[27,17,36,11],ton:[41,42],tom:37,recent:37,kamikazepanda:[16,19],listen:[38,21],consol:[0,2,32,15,23,40,41,42,31],namespac:4,eventlisten:38,took:21,"_id":[0,12,15,38,22,5,7,42,31,34],incur:41,removeus:[28,38,25,12,11],silli:41,target:[42,22],provid:[12,22,16,36,17,5,41,42,10,20],zero:[36,17,38,9],project:[16,14,29,37,22],matter:41,iron:41,myexperience620186085001:37,beginn:14,websocket:[16,41],behavior:[0,15,36,17,41,38],modern:16,mind:41,raw:[0,12,22,40,15,38,32,42,31,21],manner:[38,42],increment:[41,37],seek:[23,38,5,28,42,11],dbref:[14,12,4,27,41,38,11],ensureindex:[12,22,38,7,28,11],simple_limit_collect:21,data2:5,simplifi:[16,38,42],evangelist:37,insur:38,plenti:42,usernam:[7,25,12],object:[0,2,3,40,5,7,8,9,10,12,14,15,16,25,20,21,22,23,24,26,31,32,33,34,43,37,39,38,41,42],what:[14,21,40,37,41,42,32],regular:[0,38,23],tradit:41,simplic:42,don:[38,32,12,31,22],doc:[0,25,2,21,15,16,38,22,5,39,41,12],flow:38,doe:[15,37,32,22,36,17,5,38,41,42,40,12],masylum:16,bson_data_d:2,radix:[36,17],random:[24,5,32],speedup:38,syntax:38,test_stream_funct:21,identifi:[41,40,42,32],erhangundogan:16,involv:38,absolut:[36,17,42,5],acquir:21,field2:0,explain:[0,12,22,38,28,11,21],field1:0,theme:41,busi:41,rich:41,ppf_qxbkwm4g:37,io_seek_cur:5,cachefunct:2,nasti:38,test_cursorstream_destroi:39,stop:38,collectionsinfo:[28,12,11],bson_data_numb:2,report:41,youtub:[29,37,19],databank:16,bar:5,emb:[29,37,19],patch:38,bad:22,previouli:21,steam:21,fieldnam:0,fair:42,indexnam:[12,22],num:22,tocollect:12,previouserror:[28,12,11],respons:[0,37,21,32],fail:[32,22,38,25,41,12,34],christian:37,writestream:38,awar:22,said:[42,32],databas:[0,34,25,21,15,16,14,40,22,5,43,38,23,41,42,30,31,12],test_gs_empty_file_eof:5,discoveri:37,gridstor:[14,25,8,21,22,32,23,38,9,5,39,43,2,28,34,42,30,11,12],simplest:[16,0,42],awai:42,lotsofdoc:41,side:16,accord:3,newnam:22,getlasterror:[38,25,12,22],howev:21,against:[0,25,12,22,36,17,5,9,38,21],logic:[0,38],browser:16,com:[14,16,38,37,19,41,29],con:37,assur:21,asced:21,simple_explain_collect:21,height:[29,37,19],getmorecommand:[21,22],io_seek_set:5,guid:14,assum:[36,17],duplic:[7,12,21,38,22],three:[41,42,5],been:[38,32,42,21,12],much:[41,42,37,15],basic:[14,12,43,22,41,42],aswel:[],quickli:37,life:42,regul:21,nodeeventstor:16,isodd:[27,17,36,11],ani:[0,12,21,15,16,41,42,32],child:12,"catch":[38,22],laurie71:38,another_root:5,ident:[],mapreduce_integration_test:22,dissect:42,properti:[0,23,38,5,28,11],calcul:2,marriag:[14,37],"typeof":[38,2,5],aid:32,maxbsons:38,identifyserv:[],succes:22,toolkit:16,sever:[15,3,40,7,41,31],grown:41,usessl:12,test_is_close_function_on_cursor:21,perform:[0,25,12,22,36,17,38,21],make:[0,21,15,38,22,7,41,42,31,32],format:[0,12,22,15,25,21],meetup:[14,37],filestream:[5,32],drawback:42,split:[36,17,5],isneg:[27,17,36,11],complet:22,nin:0,rail:16,hand:31,fairli:[38,32],tune:42,scenario:31,geohaystack:22,test_close_function_on_cursor:21,client:[25,12,15,16,38,22,5,34,41,32,21],thi:[0,8,38,5,7,9,12,15,16,17,25,21,22,23,24,29,31,33,32,36,37,41,42],everyth:15,settimeout:[8,32,22,38,39,12],left:[32,22,36,17,31,12],protocol:[41,38],just:[0,42,32,41,22],laptop:38,ordin:[12,22],farther:8,yet:31,languag:[16,41,37],previous:38,doc1:41,wmode:37,easi:[16,32],collectionn:31,had:21,board:37,hap:32,els:[22,25,31,15],ffffff:37,save:[8,12,22,23,38,15,5,28,31,11],dynamicstream:37,applic:[14,12,22,16,38,37,24,19,32,41,42,21],milli:25,preserv:21,background:[12,22],test_ev:12,apart:[41,42],measur:38,specif:[0,37,12,22,14,40,9,5,32,41,38,21],arbitrari:[38,5],negat:[27,17,36,11],collection2:[12,22],collection1:22,underli:39,www:[14,12,16,37,19,29],right:[37,36,17,42,41],old:5,creek:37,deal:41,manual:[14,11],interv:38,deserializestream:[27,2,11],dead:38,intern:[0,36,17,23,22],sockettimeoutm:[38,10,20,26,32],successfulli:21,thu:15,txt:5,nwtj:16,timestampd:9,multipli:[27,17,36,11,22],fog:37,christkv:[41,38],condit:[0,38,22],foo:[32,22],localhost:[12,16,40,41,42,32],a_simple_create_drop_collect:12,collection_stats_test:22,statsync:5,promot:41,repositori:[16,41,38],post:[0,36,17,40,22],ryanke:16,plug:41,obj:22,slightli:41,simul:[36,17,42],commit:12,produc:[24,32],simple_previous_error_col:12,bson_data_symbol:2,"float":[41,36,17],simple_skip_collect:21,bound:[12,32,21,22],down:[38,10,12,32],gridstorewrit:5,wrap:[0,8,35,38,39,18],storag:[16,41,42],git:[16,38],rrusso2007:38,wai:[0,15,22,16,36,17,41,42,38],support:[0,1,32,14,23,38,26,41,42],happi:[16,14,37],avail:[14,1,8,21,22,3,39,38,25,24,5,37,32,41,42,10,20,12],width:[29,37,19],test_rename_collection3:22,call:[0,12,22,16,38,5,32,42,31,21],constantli:41,bulqmxg0vdc:37,fork:16,head:[42,5],medium:25,form:[38,37,5],forc:[12,22,38,25,26,21],"true":[0,2,3,40,5,7,8,10,12,15,25,38,21,22,23,31,32,34,37,20,39,41,42],reset:[0,12,5,38,21],awaidata:[21,22],new_nam:40,bugfix:38,highbit:[36,17],maximum:[41,38,21,12],until:[41,25,12,32],deprect:21,fundament:41,dropallindex:[28,11,22],emit:[32,22,38,39,41,12],shouldcorrectlyfailonretryduetoappcloseofdb:12,featur:[14,1,42,32],"abstract":16,fromstr:[27,17,36,11,38],exist:[0,25,12,15,23,40,22,5,7,38,28,41,42,31,11],videoplay:37,check:[0,25,8,21,22,23,36,17,5,39,7,2,38,32,41,10,20,12],test_collection_opt:22,bson_binary_subtype_md5:[33,2],test_to_a_after_each:21,floor:9,tip:14,refactor:38,simple_limit_skip_find_one_queri:22,test:[25,21,15,16,23,40,22,5,19,32,41,42,38,12],forceclos:12,miliscecond:[39,8],node:[14,21,3,38,37,16,19,41,29,11,32],insensit:21,consid:22,sql:41,cachefunctionscrc32:2,errormessag:38,teixeira:14,faster:[7,38,32],ignor:[41,2,20,22],time:[14,37,21,22,3,38,9,31,16,43,32,41,10,20,12],push:[21,16,38,39,41,12],backward:[38,21],daili:37,concept:[41,38],skip:[28,0,21,11,22],global:38,read_secondary_onli:[38,21],row:22,millisecond:31,middl:22,depend:38,readabl:32,originalhex:9,dropindex:[28,7,12,11,22],sourc:[37,19,21],string:[0,2,4,5,7,9,12,17,25,38,21,22,23,24,26,33,34,35,36,20,40,41,42],alinsilvian:38,feasibl:42,cool:22,logmeup:16,contenttyp:23,level:[12,22,16,38,25,5,32],did:[38,12],dig:41,eventemitt:[38,21],iter:[21,22],item:[8,12,22,38,25,5,39,32,41,21],team:37,quick:[41,42,37],div:[37,27,17,36,11],round:[41,20],databasenam:[12,31],wtimeout:[38,25,12,22],prevent:38,addtoset:[41,22],sign:[36,17,40],slow_onli:25,cost:38,port:[38,12,26,31],comparis:5,checkoutwrit:12,repli:[41,25,22],muq2w2u5x9m:29,current:[25,12,23,4,17,5,37,38,41,42,36],subtype_uuid:33,boost:16,deriv:[36,17],gener:[14,12,9,16,38,22,42,31],wait:[12,32,21,20,22],box:41,bson_data_regexp:2,shift:[36,17,38],step:42,queue:[16,41],behav:38,examp:16,numberofretri:[12,38,21,31,22],extrem:38,weird:38,werehamst:16,ourselv:26,regardless:32,checkkei:2,extra:[0,32],modul:[16,38],prefer:[0,1,21,22,14,38,24,26,32,41,20,12],toarrai:[0,12,22,16,38,25,28,32,41,11,21],bxhflrwemeg:19,instal:[41,38],includeloc:22,aaaaipotmrk:37,perf:38,memori:[0,21,14,38,43,41,42],regep:41,serverstatu:[38,25,28,11],connector:[14,37],live:[41,38,42],handler:42,value2:0,value1:0,criteria:15,scope:[41,38,2,12,22],prev:22,maxkei:[13,14,2,38,27,11],multiplecoll1:12,peopl:38,finit:[36,17],visual:16,examin:41,content_typ:[23,42,5],fly:16,cap:[41,38,12,22],uniqu:[0,12,22,5,7,31],primer:[14,42,37,43],test_correctly_access_collect:12,whatev:31,bson_binary_subtype_funct:[33,2],nearest:[12,22,24,26,20,32],connecttimeoutm:[38,10,20,26,32],mongo:[14,1,12,15,16,38,37,43,28,41,42,10,32],stream:[14,1,8,21,23,38,39,5,2,28,41,42,11,32],predict:38,bson_data_long:2,createcollect:[12,22,40,39,28,41,38,11,21],topic:[14,37],nocr:16,kaflr8pi5nk:29,occur:[0,21,15,23,40,5,7,38,31],alwai:[21,22,36,17,26,41,38],multipl:[32,22,3,36,17,5,38,31],ping:[32,38,25,28,20,11,12],fieldvalu:0,write:[33,2,12,3,23,38,5,27,8,28,32,41,42,11,34],foreach:[5,22],pure:[25,8,12,22,39,38,9,5,2,34,21],nyc:[14,37],map:[41,38,22],product:[37,36,17],max:[12,21,38,22],dive:[41,42],date:[2,21,9,38,25,7,22,41],docstartindex:2,data:[33,14,8,21,22,23,38,37,5,39,43,2,19,34,41,42,32,12],grow:41,sbrekken:38,inform:[21,22,3,23,25,5,7,16,41,31,12],"switch":38,reaper:[38,12,31],combin:[37,32,24,5,12],anoth:[0,5,41,9],filedata:[5,32],talk:37,gettimestamp:[27,38,11,9],still:[0,38,15],pointer:[0,40,5,31,23],dynam:37,test_map_reduce_funct:22,group:[14,22,38,37,28,29,42,11],gte:0,indexexist:[38,28,11,22],secondaryacceptablelatencym:[20,32],jim:22,nodelai:[3,38,26,31,10,20],platform:41,mbostock:38,requir:[25,8,21,15,39,40,22,5,2,42,38,34,41,9,32,31,12],main:[14,42,37,41],non:[16,38,22],"6pjmp23z0lw":29,encod:[3,41,38,31],col2:12,col3:12,initi:[8,12,22,38,5,41,42,21],col1:12,milisecond:[38,20,12],now:[41,38,42,12,32],discuss:[14,37],nor:40,introduct:[3,14,43,37,41],mapreduc:[38,28,11,22],name:[33,0,25,2,21,15,3,23,4,22,5,31,7,38,37,40,32,42,20,12],readfil:5,drop:[12,22,40,25,7,28,38,11],revert:0,crypto:38,separ:[0,38,5],mongoerror:38,jprichardson:16,failov:[3,38,10,32],replai:38,dialect:16,replac:[0,22,38,15,5,41],individu:[0,38,32],firej:16,a_1_b_1:[12,22],ensur:[12,22,38,5,7,41,42,32],poolreadi:38,serverclust:38,happen:[39,38,8,5,21],shown:[41,42,32],accomplish:42,logout:[28,25,12,11],"3rd":38,space:[2,12],streetsaheadllc:16,profil:[25,21,22],tohexstr:[0,27,38,11,9],factori:[0,31,22],variant:41,million:37,orm:[16,37],mime:5,sethml:38,replacethiscollect:22,org:[16,14,12],"byte":[33,0,2,12,9,23,38,41,42,31],care:[3,0,12,41],question:[37,36,17],bradberri:37,synchron:41,thing:[41,42,31],place:[14,36,17],year2013:38,frequent:[36,17],first:[0,25,12,15,23,40,22,5,37,42,38,41,9,31,21],oper:[0,25,21,15,23,36,17,24,40,7,38,22,32,41,42,31,12],bson_binary_:38,directli:[0,21,41],onc:[7,38,12,41,32],arrai:[33,0,25,2,21,15,3,23,40,22,5,38,41,10,20,12],fullsetup:[38,12,32],"0x7f":2,reopen:[5,31],"long":[14,2,21,9,38,17,27,41,11],serverinfo:22,open:[25,8,21,15,3,23,40,22,5,39,38,37,28,34,41,42,32,31,11,12],predefin:2,size:[0,2,21,22,23,36,17,5,32,42,38,12],given:[33,12,22,36,17,5,42,38,21],breviti:[41,42],workaround:38,paramt:21,collectionnam:[12,22,40,25,7,28,42,11],secondary_pref:[12,22,24,26,20,32],conveni:[0,36,17],subtype_md5:33,especi:41,copi:3,specifi:[33,0,12,22,23,38,5,41,42,31,21],test_rename_collection2:22,test_arrai:21,keepgo:[38,22],than:[0,21,15,22,3,23,36,17,38,42,31],png:[23,5],serv:37,firebas:16,tedeh:38,were:[21,15],posit:[33,23,36,17,5,42],seri:16,pre:[25,2,12,22],lowest:[38,20],sai:42,sam:22,pro:37,argument:[8,4,5,2,9,10,12,17,25,18,38,21,22,24,26,33,34,35,36,20,39,42],subroutin:38,simple_rename_collection_2:12,test_gs_read_stream_pip:5,deliv:37,bitwis:[41,36,17],squar:16,alias:0,destroi:[39,8,28,11],note:[36,17,21,12],take:[0,2,3,38,37,41,42],createfromhexstr:[0,27,38,11,9],begin:[0,5],sure:[42,21],normal:21,buffer:[33,0,2,21,15,23,40,22,5,38,34,42,31,12],clearer:38,getyear:22,homepag:16,deepequ:[32,21,22,5,12,34],renam:[12,22,40,28,41,11],byte_valu:33,later:[42,12,22],indexbound:[12,22],test_gs_read_stream:5,runtim:38,parseint:22,axi:22,show:[8,12,22,39,9,5,2,34,41,21],simple_count_exampl:22,objectid3:9,objectid2:9,concurr:38,limitrequest:38,corner:38,onli:[0,25,21,15,3,38,22,24,5,7,32,41,42,31,12],slow:[38,25,12,22],dice:41,fenc:20,setprofilinginfo:25,activ:[16,38,32],state:[41,38,21,31,20],analyt:[16,14,37,41],overwritten:42,min_valu:[36,17],variou:[16,25,22],get:[8,40,5,7,9,11,12,14,15,16,25,38,21,22,23,28,31,34,43,37,39,41,42],secondari:[12,22,3,38,24,26,32,20,21],ssl:[38,12,26],cannot:[32,21,22,36,17,24,41,38,12],shiftrightunsign:[27,17,36,11],geo:22,gen:37,nolock:[38,12],doabl:0,test_n:12,seldom:38,intermitt:32,yield:[40,22,12,38,15],isarrai:2,caboos:16,nettl:16,where:[33,0,2,12,15,3,23,40,22,24,5,7,41,42,38,32],geospati:[12,22],desced:21,wiki:41,khwang:16,testcas:38,infinit:[36,17,38],detect:[3,38],heckmann:38,fs_chunk:42,integration_tests_2:12,wayt:22,enough:21,between:[32,38,37,31,41,10,20,12],"import":[41,42,32],across:[38,32,12,31,22],spars:[7,12,22],august:[14,37],tut:14,test_group:22,come:[23,36,17,22],simple_find_and_modify_operations_:22,region:22,gwt:[36,17],tutori:[14,29,42],mani:[41,21],fromnumb:[27,17,36,11],among:[24,32],reindex:[28,38,12,11,22],iscap:[38,28,11,22],period:[0,40],dispatch:41,createcreateindexcommand:38,fs_file:42,lessthan:[27,17,36,11],constant:[33,2,12,5,27,28,11,21],reaperinterv:[38,12,31],cursor_information_collect:12,cursorinst:21,coupl:[41,22],aciev:0,rebuilt:[12,22],addit:[0,2,21,22,36,17,25,42,10,20,12],derefer:[28,38,12,11],emphas:32,lowbit:[36,17],geonear:[38,28,11,22],"1mb":42,those:[36,17],"case":[21,22,36,17,7,41,42,38],myself:41,bson_seri:38,tostr:[8,34,9,36,17,5,27,22,42,11],trick:[14,42],invok:42,isconnect:38,firstext:25,simple_sort_collect:21,trello:[14,37],advantag:41,eras:[23,40],dynamicgui:16,ascii:[3,38,31],acess:12,develop:[16,14,37,32,41],author:[0,22,23,15],media:16,same:[0,8,21,22,36,17,5,7,9,38,12],binari:[33,0,25,8,21,14,23,40,15,5,39,27,2,22,34,41,9,32,38,11,12],html:14,document:[0,2,3,40,5,7,8,12,14,15,16,25,38,21,22,23,31,32,37,39,41,42],howtonod:14,createpk:31,exhaust:21,ifram:[29,37,19],finish:[42,5,22],closest:[36,17,22],utf8:[8,3,38,5,41,31],nest:[0,7],oid:4,driver:[0,1,32,15,3,14,40,37,38,16,28,41,42,31,11,43],gotend:5,capabl:37,newobjectid:9,improv:[14,1,32,38],extern:[14,38],defo:0,bson_data_boolean:2,appropri:37,moder:37,distancemultipli:22,brightcov:37,without:[2,12,36,17,31,38,40],model:[16,37,22],dereferenc:12,upsert:[22,15],ourexamplefiletowrit:5,execut:[12,15,38,25,5,22,41,21],when:[0,37,2,21,15,3,23,40,22,5,31,39,8,38,41,42,20,32],rest:[16,38,9,22],hint:[21,22],db_connector:[40,31],except:[32,15,38,24,5,41],param:37,desktop:14,blog:[16,0,40,14],framebord:[29,37,19],bigger:32,default_chunk_s:5,haystack:22,real:[16,14,37],around:[16,14,38,41],read:[33,14,1,8,21,22,3,23,38,24,5,26,27,28,32,41,42,20,11,12],grid:[33,14,34,16,38,28,42,11],pop:41,world:[8,12,22,15,5,2,42,34],lasterror:[28,38,12,11],reap:38,subtype_user_defin:33,saniti:38,poolsiz:[8,12,22,38,25,5,26,39,34,41,31,21],realtim:[14,37],integ:[0,2,9,36,17,41,38],server:[2,3,40,5,8,9,10,12,14,15,16,25,20,21,22,26,28,31,32,34,37,39,38,41,42],firebaseco:16,either:[23,38,42,32,41],output:[0,22],greaterthanorequ:[27,17,36,11],manag:[16,23,38,41],kvalheim:37,bson_binary_subtype_byte_arrai:[33,2],eventloop:42,ascend:[0,21,7],intact:15,setnodelai:38,slice:41,writedata:42,node_ev:38,"_validatereplicaset":[20,28],confirm:41,definit:14,legal:22,evolv:41,profilinginfo:[25,28,11],bson_data_binari:2,power:[16,37],broken:38,aquir:12,bson_binary_subtype_default:[33,38,2],regexp:[41,38,2],"throw":[32,15,38,24,41,42],comparison:9,deflat:32,pointer_to_collect:0,firstnam:[0,7],nocooki:[29,37,19],numbit:[36,17],bson_data_code_w_scop:2,gump:22,act:42,luck:42,other:[0,1,37,32,14,3,36,17,24,5,22,41,42,38,43],readstream:[14,8,21,38,28,11],addus:[28,38,25,12,11],test_collections_info:12,your:[32,22,3,37,5,16,41,42],loc:22,log:[0,2,21,22,16,23,40,15,25,26,38,41,42,31,32],hex:[0,9],overwrit:[25,5],dropdup:[38,12,22],strict:[40,38,12,31,22],interfac:[8,21,16,38,39,41,34],low:[41,36,17,42],lot:[14,21,22,38,7,39,41,42],isvid:37,tupl:7,shamelessli:41,replsetsrv:3,longer:[38,5],pull:[41,38,25],dirti:41,possibl:[0,12,15,16,38,22,7,41],"default":[0,1,2,3,40,5,7,10,12,14,15,9,20,21,22,23,24,25,26,31,33,32,38,41,42],remove_subset_of_documents_saf:22,dropdatabas:[12,38,25,28,31,11],auto_reconnect:[8,12,22,3,25,5,26,39,34,41,42,32,31,21],connect:[8,3,38,5,10,11,12,14,16,25,20,21,22,26,28,29,31,32,34,43,39,41,42],gone:[34,12,5,22],creat:[0,25,2,21,22,3,23,40,9,5,37,39,7,8,38,34,41,42,32,31,12],certain:[7,41],watcher:16,intro:41,file:[8,34,16,23,38,5,32,42,12],russel:37,calculateobjects:[27,2,11],again:[38,32,5,21],kaba:16,compel:37,event:[8,12,23,38,5,39,32,41,42,31,21],field:[0,37,21,15,38,22,5,7,32,41,12],valid:[2,12,9,40,25,22,21],longlib:17,you:[0,2,21,15,3,23,40,22,26,7,37,38,32,41,42,31,12],scttnlsn:16,pefrom:22,sequenc:38,symbol:[14,2,35,38,27,41,11],briefli:37,opt_radix:[36,17],pool:[38,32,12,26,31],reduc:[36,17,38,22],lessthanorequ:[27,17,36,11],coreh:16,directori:38,descript:[33,12,2,5,21],tricki:41,potenti:38,alright:41,cpu:[38,42],unset:41,represent:[13,33,37,34,9,4,17,24,5,6,18,35,36],all:[0,25,2,21,14,3,23,40,15,24,5,7,38,22,32,41,42,31,12],forget:41,numberupd:22,dollar:40,month:37,simple_rename_collect:12,cceac:16,follow:[0,21,15,3,5,7,41,42,32],fetchsiz:21,disk:[8,32,22,5,42,21],nodej:[16,37,19],subtype_default:33,nextobject:[28,0,21,11,12],aaron:38,introduc:37,setprofilinglevel:[25,28,11],evaul:12,util:[16,38],candid:[24,32],test_rename_collect:22,failur:[41,38],veri:[14,38,42,32,41],base698:16,list:[12,22,40,25,5,38,28,41,42,10,20,11],resav:22,adjust:[38,42],default_port:31,small:[29,42,38],retun:2,cursorstream:[28,14,39,21,11],design:[14,37],pass:[2,12,22,3,40,9,5,38,42,31,21],excit:37,deleg:31,abc:[0,5,15],xor:[27,17,36,11],sub:[33,37,22],sum:[36,17],abl:32,brief:29,delet:[12,22,23,38,5,28,41,42,31,11,34],version:[38,42,12,31,22],cruso:0,method:[0,1,21,22,14,40,9,5,43,38,32,41,42,31,34],full:[38,12,22],themselv:38,variat:41,behaviour:16,foobar2:5,foobar3:5,strong:29,modifi:[41,38,22,15],valu:[0,2,40,5,7,9,11,12,15,17,25,18,38,21,22,23,27,31,33,35,36,37,41,42],search:[16,14,41,22],ahead:[16,41,42,22],showdiskloc:[38,21,22],amount:[41,36,17,12],base:[9,16,23,22,5,41,42],pick:[32,38,41,42,20,12],action:14,mongoos:[16,14,29,37],narrow:22,evalfunct:2,via:41,shorthand:15,lazybum:16,c_1:22,deprec:12,default_root_collect:5,"_checkreplicaset":[20,28],establish:[8,12,22,38,25,5,39,34,32,21],select:[32,22,40,15,24,31,38,20],test_collection_is_cap:22,distinct:[38,28,11,22],regist:5,two:[0,37,12,15,3,14,36,17,5,23,7,42,16,41,9,40,32],coverag:38,bson_binary_subtype_user_defin:[33,2],taken:41,minor:[14,1,32,38],more:[0,8,21,15,3,39,36,17,5,37,22,32,41,42,38,12],flag:22,stick:41,particular:41,cach:2,none:[3,37],outlin:[41,42,32],dev:16,histori:12,remain:[42,5],learn:[16,14,37],scan:[21,22],share:[16,38,37,12,31],shard:[23,32],accept:[38,22],simple_document_insert_collection_no_saf:22,default_url:12,uri_decode_auth:12,learnboost:[16,37],robinson:0,cours:41,newlin:5,divid:[36,17,12,22],rather:22,keepgoingexampl:22,hugh:37,simpl:[0,8,21,14,16,39,40,22,5,7,43,2,34,41,42,32,38,12],perman:12,griddata:32,resourc:[16,31],resultset:41,reflect:38,unlink:[28,23,42,5,11],associ:[42,5],keyorlist:21,shouldcorrectlyexecutesimpleaggregationpipelineusingargu:22,github:[16,14,38,19,41],defineproperti:38,save_a_simple_document_modify_it_and_resave_it:22,caus:[41,38],callback:[0,25,21,15,23,40,22,5,7,38,41,42,31,12],spheric:22,doc_id:0,bson_data_oid:2,trade:42,through:[12,22,38,37,5,41,32],reconnect:[38,10,20,26,31],paramet:[0,25,21,15,3,23,40,22,5,7,38,41,42,31,12],style:[16,41,37],mongorepli:38,world_no_saf:22,batchsizevalu:21,asbuff:2,relev:41,stylu:19,rapidli:41,bypass:41,simple_limit_skip_queri:22,test_cursorstream_resum:39,might:[7,42,12,41,32],alter:[0,40],good:[14,42,41,22],"return":[0,8,4,5,6,2,9,12,13,15,17,25,18,20,21,22,23,24,31,32,33,34,35,36,38,39,40,41,42],timestamp:[14,2,9,36,22,27,38,11],more_complex_index_test:[12,22],framework:[16,22],compound:[12,22],karaco:16,readlen:5,emerleit:16,uploadd:23,unlik:[24,21,32],authent:[12,38,25,28,11,32],easili:[36,17,38],achiev:0,skipvalu:21,found:[0,12,22,5,15],truncat:[40,42,5,38],hard:41,weren:0,realli:41,expect:[0,31],barrier:38,orient:14,primari:[0,12,22,3,38,24,26,31,32,41,20,21],b4ajeu13u6u:29,read_primari:[38,21],pullal:41,foreground:[12,22],core2duo:38,proxi:[38,10,12,32],advanc:[14,43,40,5,41,42],differ:[14,12,22,36,17,5,7,42,32,41,9,38,34],asc:[0,21,15],reason:[5,26],croucher:37,connectionopt:12,put:[33,21,22,38,5,27,28,42,11,34],seconddb:12,gethighbit:[27,17,36,11],tailabl:[38,21,22],omit:[41,4,42,38],dir:15,assign:[3,38],shard_test:12,major:[],notifi:[41,42,22],articl:[14,42,43],lastnam:[0,7],number:[33,0,25,2,21,22,36,17,5,26,31,7,18,42,38,32,41,9,10,20,12],done:[0,8,12,22,23,38,15,25,39,41,42,31,32],construct:[36,17],autoclos:[23,42,8,5],create_and_drop_an_index:[12,22],miss:38,pageview:22,script:[23,37],interact:[41,42,5,34],least:[0,32,22],custompkfactori:31,statement:[41,42,12],illeg:[34,25,12,38,22],master:[3,38],store:[2,12,16,23,5,41,42,21],schema:[14,37],otherid:9,option:[0,2,3,4,5,7,10,11,12,15,25,40,21,22,23,26,28,31,33,34,20,38,41,42],reseterrorhistori:[28,12,11],similarli:41,native_pars:[8,12,22,25,5,39,34,31,21],getter:5,pars:[38,2,22],fileid2:5,literarili:41,std:38,kind:42,bson_data_nul:2,whenev:[12,22],createwritestream:[5,32],remov:[25,12,22,40,15,5,7,28,41,38,11],reus:[38,2,12],str:[36,17],consumpt:42,toward:37,cleaner:16,comput:14,luckili:[41,42],expir:12,"null":[0,2,21,22,3,40,25,5,26,31,16,39,38,34,10,20,12],built:[16,41],equival:[41,22],valueof:[27,18,11,35],fromcollect:12,also:[0,21,15,14,40,5,7,41,42,38,32],build:[25,12,38,37,41,42],tool:[16,37],pipelin:22,distribut:32,lubow:37,blackboard:[16,14,19],choos:[41,32,20,22],reach:[42,8],most:[0,42,37,32,41],plai:37,plan:[42,22],selector:[12,21,38,22],"16mb":23,filesystem:23,clear:38,part:[41,29,25,38,9],clean:[16,38,12],frombit:[27,17,36,11],ridicul:16,brightcoveexperi:37,session:[16,37],find:[0,8,21,15,16,23,38,22,25,7,39,28,32,41,11,12],firewal:38,nosql:[16,14],pretti:41,jacobbubu:38,manipul:22,test_gs_weird_bug:5,numberofdocu:2,queu:16,batch_document_insert_collection_saf:22,hit:[12,22],unus:38,express:[0,14,22,16,23,19,41],fieldtoupd:41,test_map_reduce_functions_scop:22,nativ:[16,41,38,31],ferret:16,restart:[39,8],statist:[12,25,20,38,22],wrote:41,set:[0,25,2,21,15,3,23,40,22,5,26,31,7,37,38,32,41,42,20,12],jade:19,getmor:38,see:[0,32,15,23,36,17,7,40,41,42,31],easymongo:16,close:[8,21,22,16,23,38,25,5,39,28,34,41,42,32,31,11,12],my_f:5,lee:38,misalign:38,jenkin:12,someth:[5,31],particip:20,mismatch:38,altern:[16,12,22],signatur:[5,21],primary_pref:[12,22,24,26,20,32],complement:[36,17],javascript:[2,12,22,16,36,17,37,41],salzman:38,succeed:7,both:[38,24,32,22],last:[16,23,12,41],create_and_drop_all_index:12,context:[38,37,31],pdf:32,corrupt:[38,25],whole:[41,12,32,5,22],createdat:21,load:[0,38],episod:14,jsmode:22,point:[21,22,36,17,41,42],instanti:[41,38,32],littl:41,shutdown:38,suppli:[38,42],backend:41,identif:38,faithfulli:[36,17],user_id:22,due:[41,38,12,34],empti:[0,38,22,5,21],otherwis:[2,32,36,17,24,5,41,42,21],bgcolor:37,strategi:[41,38,20,32],test_streamingrecords_funct:21,wish:[33,2,12,22,38,25,5,42],fire:[8,12,15,16,23,5,41,42,31],admindb:[25,12],imag:[23,42],understand:41,func:[2,22],convers:[41,22],look:[21,22,23,38,37,5,7,41,42],mdoq:16,straight:[41,42],batch:[41,38,21,22],"while":[0,38,5,23,21],getownpropertynam:38,abov:[41,42,32,15],error:[0,25,8,21,15,16,23,40,22,24,5,26,7,39,38,32,41,31,12],fun:[42,22],fixtur:16,robin:[41,20],loop:38,found2:5,test_gs_unlink:5,readi:[8,32,5,39,41,21],key2:0,key1:0,"_state":12,jpg:5,itself:[14,21],test_deref_exampl:12,rid:38,simple_key_based_distinct_sub_query_filt:22,createexperi:37,decor:38,gs2:5,geohaystacksearch:[38,28,11,22],coffeescript:[16,14,29],decod:12,p_db:[3,12],higher:[32,22,3,38,42,31,12],"10gen":14,optim:[38,22],simple_key_based_distinct:22,more_complex_ensure_index_test:[12,22],piec:[41,36,17,42],temporari:[5,22],user:[33,0,2,12,15,16,14,38,25,5,7,37,32],hello2:22,bob:22,recreat:31,travers:21,entri:[12,42,5,22],joyent:37,readprefer:[14,12,22,38,24,26,28,20,32],explan:[12,22],getlowbitsunsign:[27,17,36,11],a_1:22,collabor:37,shape:38,tempcollect:22,update_a_simple_document_multi:22,move:[23,38,5,41,32],password:[38,25,12],cur:42,colladow:16,tdegrunt:16,keeptemp:22,appli:[0,38,21,41],sessionstorag:16,input:[36,17,22],mod:[0,36,17],transpar:37,big:[41,38,42,26],checksum:5,shiftright:[27,17,36,11],rs_name:[3,38,32,20,12],replsetserv:[25,2,21,22,3,39,38,9,5,8,34,12],like:[0,37,21,22,16,36,17,7,42,12],fsync:[25,12,22],resolv:12,collect:[0,3,4,5,7,11,12,14,15,16,25,40,21,22,23,28,30,31,32,34,43,37,39,38,41,42],bson_data_cod:2,popular:[14,37,41],bamboo:38,brett:37,serverpair:38,often:[36,17],creation:[25,12,22,38,37,41],some:[0,8,21,14,23,38,22,5,7,37,34,41,42,32,12],back:[0,8,32,22,16,36,17,5,41,9,38,25],understood:41,sampl:41,somecollect:32,scale:[14,12,22,37,41,42],slaveok:[38,26,22],chunksiz:[23,38,42,5],bson_data_min_kei:2,retri:[12,22,38,20,41,31,21],larg:[0,32,22,23,38,41,42,12],intial:[32,22],previou:[42,31],run:[14,12,15,22,3,38,25,43,41,42,32],lublow:37,simple_reset_error_history_col:12,simpleemitt:38,simple_explain_queri:22,from:[0,2,3,40,5,9,12,14,15,17,25,38,21,22,23,24,26,32,33,34,36,37,41,42],subtract:[27,17,36,11],k1mnspb8wvq:29,allowfullscreen:[29,37,19],recordquerystat:12,block:[42,12,22],cygwin:38,within:[36,17],simple_index_test:22,contributor:37,test_collection_index_exist:22,bson_deseri:38,fast:16,custom:[0,32,22,38,42,31],plain:38,includ:[14,37,21,0,40,22,24,5,7,38,32,41,10,31,12],forward:5,files:[38,5],properli:[38,5],isbuff:38,uniquedoc:22,"_bsontyp":38,hainterv:[10,20,32],link:[14,42,43,41],translat:16,atom:[41,38,22],line:[16,42,5],info:[38,25,42,12,22],concaten:[36,17,5],consist:[38,32],caller:21,forceserverobjectid:[38,12,31],gridf:[14,1,32,43,23,38,5,42,34],readlin:[28,5,11],similar:23,hash:[0,38,42,12,31],multiplecoll2:12,parser:[38,2,12,31],doesn:[0,31,15],repres:[21,9,36,17,5,26,18,41,35],idhex:0,"_isus":[20,28],titl:[0,22,30,15],unidirect:21,wakup:12,nice:[41,37],deseri:[2,21,38,27,41,11,32],bcoe:16,jannehietamaki:38,mongodb:[0,2,3,40,5,7,8,9,11,12,14,15,16,25,19,38,21,22,23,26,29,31,32,34,37,39,41,42],eval:[2,12,22,38,28,11,21],profilinglevel:[25,28,11],algorithm:[3,36,17,31,38],cursorinform:12,evenli:32,tradeoff:42,awesom:[14,29,19],filebodi:8,far:5,hello:[8,12,22,15,5,2,41,42,34],code:[25,8,12,22,39,38,9,5,2,34,41,42,32,21],partial:[21,22],worldbuff:5,queri:[0,25,21,15,14,40,22,5,7,43,37,38,32,41,30,31,12],idvalu:0,mongoskin:16,octet:5,replicasetcheckinterv:38,base64:[3,34,5,38,31],update_a_simple_document_upsert:22,send:[3,41,38,12,31],lower:[12,22],io_seek_end:5,sens:15,reapertimeout:[38,12,31],passiv:38,shouldcorrectlyforcereindexoncollect:22,result2:34,account:22,writebuff:38,untouch:31,dbname:[38,21,12],magic:16,gettim:[21,9],roll:14,fieldorspec:[12,22],fewer:22,"try":[41,38,22,42,15],race:38,marri:37,refer:[12,4,5,41,38,21],rack:32,smaller:[23,32],fortun:41,natur:[41,37],jump:[41,38,37,42],tobson:[14,1,32,38],video:[14,42],odm:[16,14,29],download:41,odd:[36,17],append:[23,5,41],compat:38,index:[14,2,21,22,40,7,28,32,30,38,11,12],compar:[32,9,36,17,5,7,27,11],descriptor:[23,42],access:[12,22,23,25,5,35,18,21],experiment:38,can:[0,21,15,3,23,36,17,40,7,38,42,22,32,41,9,31,12],chose:37,bson_data_int:2,simplereach:37,cursor_count_collect:21,calipso:16,let:[8,32,21,22,38,5,41,42,12],filedescriptor:42,becom:41,sinc:[41,36,17,42,15],subtype_byte_arrai:33,nexttick:38,convert:[0,41,9],reconnectwait:20,larger:[23,38,42],technolog:37,chang:[14,1,32,22,36,17,41,42,38],configur:[12,3,40,41,38,32],read_secondari:[3,38,21],app:[3,14,38,37],mattinsl:16,api:[14,12,16,37,27,28,42,32],redi:37,cloud:14,chrisgibson:16,zir:16,batchsiz:[28,12,21,11,22],doubl:[14,38,27,18,41,11],next:[0,2,21,37,42,31],websit:[16,37],chr:5,latenc:[20,32],simpler:[16,41,38,21,22],sort:[0,21,15,38,22,7,28,9,11],src:[29,37,19],detail:[7,21,23],repl_set:38,benchmark:38,name2:0,socketopt:[3,38,26,31,10,20],sollect:40,degrunt:16,retriev:[0,25,12,15,23,38,22,5,41,42,21],scalabl:23,multiple_db_inst:12,annot:42,tag:[38,24,32,22],thin:16,fetch:[0,12,21,22,7,41,34],queryfailur:38,control:[41,38,42,31,32],objectid:[0,25,8,21,14,39,4,22,5,27,2,42,38,34,41,9,31,11,12],process:[14,32,16,36,17,12,38,21],lock:[38,42,12],username_:7,high:[14,1,12,22,36,17,38,41,10,20,32],unopen:38,serial:[2,32,22,38,27,11,12],readprefr:26,pingresult:25,integration_test_:[3,12],instead:[0,12,22,3,38,26,7,42,31,21],npm:[41,38],pois:37,await:12,formattedorderclaus:38,awaitdata:[38,21,22],originaldata:[32,5,34],alloc:[38,2,12],bind:16,remove_all_documents_no_saf:22,correspond:[7,36,17,40],element:[0,5,41,21],issu:[41,38,22],chief:37,writ:5,allow:[21,22,40,25,5,26,38,41,42,31,32],subtyp:33,fallback:38,deoptim:38,doc2:41,doc3:41,opencal:38,alexeypetrushin:16,doc4:41,spank:38,own:[38,5],server_opt:31,createreadstream:32,effici:[41,42,22],bunch:[38,12,22],perfect:41,chosen:32,total:[0,22],crash:38,greater:[0,36,17,21],handl:[37,32,22,36,17,5,41,42,38,21],databs:[40,31],dai:[14,37],auth:[38,12],renamecollect:[28,12,11],precess:41,numberofremoveddoc:22,writefil:[32,23,5,28,42,11],convin:0,anyth:38,edit:[42,5],npmj:16,slide:[14,37],deserializeddoc:2,exampledb:[41,42,32],subset:[21,22],unwind:22,opensync:5,chunk:[23,38,42,5,32],bson_binary_subtype_uuid:[33,2],default_content_typ:5,pushal:[41,38],our:[41,42,37,5,21],special:[41,36,17,42,21],out:[14,12,9,3,38,22,5,43,41,42,31,32],variabl:[41,38,22],calip:16,trickier:[0,41],categori:42,suitabl:42,merg:[38,22],ref:38,clone:16,test_stream_writ:32,jessica:[0,15],insid:[0,42,23,7],dropcollect:[28,40,12,11],unpars:38,releas:38,princess:22,replsetgetstatu:[38,25,28,11],unwant:0,could:[41,38],shiftleft:[27,17,36,11],david:15,length:[33,25,2,12,22,23,9,5,27,42,11,21],outsid:32,transfer:12,minkei:[14,27,2,38,6],evanp:16,debugmessag:38,iszero:[27,17,36,11],should_correctly_rewind_and_restart_cursor:21,gridstore3:5,gridstore2:5,gridstore7:5,gridstore6:5,gridstore5:5,totalopen:12,prioriti:38,start:[33,0,2,21,14,3,40,22,5,41,42,32],system:[16,40,42,5,32],wrapper:16,createfromtim:[27,38,11,9],bson_data_max_kei:2,termin:5,"final":[41,38,37,22],idottv:16,deconstruct:42,test_gs_getc_fil:5,exactli:40,gridstorew:5,bson_data_object:2,replset:[14,32,3,38,28,20,12],pgebheim:38,bother:37,mongoserv:[40,31],structur:[0,42,41],charact:[33,38,9,5,22],test_gs_puts_and_readlin:5,seriou:38,result:[0,25,8,21,15,23,36,17,5,38,42,22,34,41,9,32,31,12],"function":[0,2,3,40,5,8,9,12,15,16,17,25,20,21,22,23,26,31,32,33,34,36,39,38,41,42],counter:[31,22],terribl:38,peform:[39,12,8,21,22],have:[0,8,12,22,3,40,37,5,26,7,41,42,38,32],tabl:[41,29,40],need:[0,2,12,15,23,36,17,40,26,7,38,22,41,42,31,32],turn:[0,32,38,25,10,20,12],border:29,buildinfo:[25,28,11],min:[12,21,38,22],rout:16,shankar0306:38,mix:[0,7],andrewjston:38,which:[0,37,3,23,36,17,5,38,40,42,31],test_other_drop:22,orgiin:5,singl:[33,0,37,12,22,23,38,15,5,26],fileid:[42,8,5],deploy:32,who:[38,32],whi:0,discov:[38,32],serverconfig:[38,12,31],test_gs_working_field_read:32,why:[16,41,37],overwriten:5,url:[16,12],timestamplib:36,request:[38,37,21],uri:12,face:41,pipe:[5,32],test_collect:15,snapshot:[21,22],"400m":37,determin:[41,21],constrain:5,streamrecord:[28,41,38,21,11],fact:[41,15],text:[17,22,36,37,5,42],serializefunct:[38,2,12,22],verbos:22,filebuff:8,nagl:[3,38,31],anywai:[12,22],setter:5,textual:[36,17],locat:[32,21,22,5,41,12],playerkei:37,should:[0,25,12,9,36,17,22,34,42,40,21],noid:16,test_cursorstream_paus:39,local:[4,12],devnul:16,cube:16,ritch:[16,38],kiefer:37,increas:38,donewithwrit:42,enabl:[38,32,12,31],organ:37,simple_batch_size_collect:21,stuff:[3,14,42,43,41],integr:[16,41,42],contain:[33,2,21,22,3,40,5,26,41,42,10,20,12],grab:[12,25,5,21],mon4mongo:16,view:16,legaci:26,modulo:[0,27,17,36,11],packet:38,meritt:16,statu:[32,16,38,25,41,10,20],wire:[41,38],correctli:[41,38,22],pattern:14,boundari:38,written:[33,22,16,36,17,5,42],crude:41,world2:22,kei:[0,2,21,22,38,5,7,41,42,31,12],buckets:22,simple_queri:22,isol:38,job:[16,22],entir:[42,5,21],joe:22,db_option:31,crc32:2,monitor:16,mongod:[16,32,26],plugin:37,admin:[14,37,12,22,38,25,28,11],mongoj:[16,14],equal:[0,25,8,21,22,39,36,17,5,27,2,34,41,9,11,12],etc:[0,31,22],instanc:[25,2,12,22,3,38,9,5,34,41,42,32,31,21],greaterthan:[27,17,36,11],mongoq:16,uncaught:38,subtype_funct:33,comment:[38,21,22],toint:[27,17,36,11],walk:37,removealllisten:38,save_a_simple_docu:22,attende:37,addition:[40,32],compon:38,json:[14,37,36,17,27,41],treat:[0,38,21],pkfactori:[12,22],immedi:15,bit:[0,2,23,36,17,41,42,38],assert:[25,8,12,22,39,9,5,2,34,21],ador:16,present:[7,40,37,14],replic:[3,12],multi:[38,22,15],vimeo:14,align:38,cursor:[0,8,21,22,14,38,39,28,41,11,12],defin:[33,0,2,12,22,15,36,17,5,38,41,31],setreadprefer:[32,38,26,28,12,11,21],bson_data_arrai:2,observ:16,layer:[16,41,37,32],helper:[16,38],streameddata:5,site:3,lightweight:16,tojson:[27,17,36,11,38],nodetut:14,getc:[28,5,11],cross:38,member:[3,38,32],python:14,speaker:37,inc:[41,38],gett:16,difficult:42,incorrect:38,slave:3,hostnam:31,keepal:[3,38,26,31,10,20],upon:21,proxlet:37,retriv:25,student:29,test_stream_write_2:32,serializewithbufferandindex:[27,2,11],php:14,chunk_siz:[23,8,5],off:[12,3,40,25,5,38,41,31,21],center:[32,22],nevertheless:31,builder:37,well:[0,38,42,32,41],exampl:[0,25,8,21,14,23,40,15,5,39,7,43,2,42,22,34,41,9,32,31,12],command:[12,22,16,38,25,5,26,28,41,31,11,21],simple_geo_near_command:22,validatecollect:[38,25,28,11],undefin:38,latest:41,distanc:22,paus:[28,39,8,5,11],less:[41,36,17],"boolean":[8,21,22,23,36,17,5,26,7,2,32,42,10,20,12],additon:7,tcp:41,mojodna:38,indexinform:[12,22,38,7,28,11,21],simpli:[0,32],web:[16,14,41],rapid:[14,37],seekloc:[42,5],add:[17,12,22,36,25,7,27,41,38,11],cleanup:[38,42],tjanczuk:16,logger:[38,26],match:[0,25,32,22,15,36,17,41,40],branch:38,agnost:38,crud:[14,43,41],iya_logo_final_bw:5,know:40,bson_data_timestamp:2,recurs:[17,36,2,5],isclos:[28,21,11],desc:[0,21],bson_data_str:2,insert:[0,25,2,21,14,40,15,5,26,28,38,39,22,41,30,31,11,12],resid:41,backbon:37,success:[23,5,21],isui:37,chunkcollect:[28,5,11],necessari:0,"0xff":2,async:[16,41],page:[0,37,41,14],read_preference_replicaset_test_0:12,milewis:16,linux:38,contin:16,flush:[42,8,5],proper:38,fileinfo:42,newhex:9,librari:[16,14,38,37,42],dc1:32,tmp:[5,32],leaf:16,lead:[36,17,38],aaronasachimp:38,leak:38,avoid:[7,38,25,41],fromint:[27,17,36,11],thank:38,leav:[38,15],kcbanner:16,speak:37,mode:[12,22,23,40,24,5,38,32,42,31,21],slight:41,journal:12,usag:[14,2,12,9,3,23,40,5,38,41,42,31,34],collection_nam:40,host:[12,26,31],file_id:[38,32],although:42,offset:[33,38,42,5],java:[36,17],cliftonc:16,panel:[14,37],about:[14,12,15,37,7,41,42,31,21],actual:[0,42,12,41,31],socket:[14,12,3,38,37,26,31,16,19,41,10,20],http:[14,16,38,37,19,41,29],dbinstanc:42,notequ:[27,17,36,11],constructor:[2,3,4,5,6,8,9,10,11,12,13,17,25,18,20,21,22,24,26,27,28,31,33,34,35,36,39,38],fals:[0,25,8,21,15,23,40,22,5,26,39,2,38,34,42,31,12],qard:16,disabl:[3,38,31,32],autoindexid:12,automat:[8,21,3,23,38,41,42,31,12],dataset:[0,41],bson:[0,8,4,5,6,2,9,11,12,13,14,15,25,18,40,21,22,26,27,31,33,34,35,39,38],leverag:[41,37],val:22,pictur:42,primarki:0,mykei:41,trigger:[8,12,22,38,5,39,21],concat:0,"var":[0,25,2,21,15,3,23,40,22,5,39,8,42,34,41,9,32,31,12],fsname:34,deliveri:37,shouldcorrectlyexecutesimpleaggregationpipelineusingarrai:22,brand:38,continu:16,waitforconnect:38,gain:38,eas:16,inlin:[38,22],bug:[38,42],count:[0,21,15,40,22,5,28,38,11,12],made:[38,37,42],wise:0,temp:32,whether:[36,17,32,38],ecosystem:37,displai:[37,12],asynchron:[3,41,38],record:[0,21,15,23,40,22,5,7,41,31,12],below:[14,32,15,36,17,41,12],limit:[0,21,22,23,38,28,41,11],"static":16,problem:[38,25],myexperience1123429378001:37,evalu:[2,12],"int":[36,17],dure:[41,38,25,12,22],year:0,filenam:[23,38,42,5],replica:[3,38,25,12,32],implement:[16,41,36,17,38],ing:[14,37],eric:37,retrymilisecond:[38,12,31],probabl:0,tick:38,arrj:16,bartt:16,book:[0,14],bool:9,futur:[16,41,38,12],karait:16,stat:[28,38,12,11,22],findon:[0,12,22,38,28,41,11],"class":[8,4,5,6,2,9,10,12,13,17,25,18,20,21,22,24,26,32,33,34,35,36,37,39,38,41,42],geck:16,stai:22,experienc:37,eof:[28,23,42,5,11],rule:32,integration_test:[8,12,22,25,5,39,34,21],kaij:38,"0_gnhwzhc":29},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","Updates","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","ObjectID()","Mongos()","Node.JS MongoDB Driver Manual Contents","Db()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Double()","Awesome Node.js + MongoDB Applications","ReplSet","Cursor()","Collection()","GridStore","ReadPreference()","Admin()","Server()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Mongo Driver and Mongo DB 2.2 Features","Binary()","Grid()","Symbol()","Timestamp()","Node.JS Specific Presentations","Changelog","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver","Articles"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","driver-articles/index","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","api-generated/mongos","contents","api-generated/db","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-bson-generated/double","content/awesomeappsvideo","api-generated/replset","api-generated/cursor","api-generated/collection","markdown-docs/gridfs","api-generated/readpreference","api-generated/admin","api-generated/server","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","driver-articles/anintroductionto1_1and2_2","api-bson-generated/binary","api-generated/grid","api-bson-generated/symbol","api-bson-generated/timestamp","content/nodejsvideo","changelog/changelog","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2","api-articles/index"]}) \ No newline at end of file From 3086ccdcb7627a1d5ea1c967d6fe2873c1dbdcf5 Mon Sep 17 00:00:00 2001 From: Christian Amor Kvalheim Date: Sun, 22 Jul 2012 21:32:59 +0200 Subject: [PATCH 26/56] Updated docs --- _sources/github/github.txt | 20 ++++---- api-articles/index.html | 25 ++++------ api-articles/nodekoarticle1.html | 27 +++++------ api-articles/nodekoarticle2.html | 27 +++++------ api-bson-generated/binary.html | 25 ++++------ api-bson-generated/bson.html | 25 ++++------ api-bson-generated/code.html | 25 ++++------ api-bson-generated/double.html | 25 ++++------ api-bson-generated/index.html | 25 ++++------ api-bson-generated/long.html | 25 ++++------ api-bson-generated/maxkey.html | 25 ++++------ api-bson-generated/minkey.html | 25 ++++------ api-bson-generated/objectid.html | 27 +++++------ api-bson-generated/symbol.html | 25 ++++------ api-bson-generated/timestamp.html | 25 ++++------ api-generated/admin.html | 27 +++++------ api-generated/collection.html | 27 +++++------ api-generated/cursor.html | 27 +++++------ api-generated/cursorstream.html | 27 +++++------ api-generated/db.html | 27 +++++------ api-generated/grid.html | 27 +++++------ api-generated/gridstore.html | 27 +++++------ api-generated/index.html | 25 ++++------ api-generated/mongos.html | 25 ++++------ api-generated/readpreference.html | 25 ++++------ api-generated/readstream.html | 27 +++++------ api-generated/replset.html | 25 ++++------ api-generated/server.html | 25 ++++------ changelog/changelog.html | 25 ++++------ content/awesomeappsvideo.html | 27 +++++------ content/nodejsvideo.html | 25 ++++------ content/tutorials.html | 25 ++++------ contents.html | 25 ++++------ .../anintroductionto1_1and2_2.html | 27 +++++------ driver-articles/index.html | 25 ++++------ genindex.html | 45 ++++++++---------- github/github.html | 45 ++++++++---------- index.html | 25 ++++------ markdown-docs/collections.html | 25 ++++------ markdown-docs/database.html | 25 ++++------ markdown-docs/gridfs.html | 25 ++++------ markdown-docs/index.html | 27 +++++------ markdown-docs/indexes.html | 25 ++++------ markdown-docs/insert.html | 25 ++++------ markdown-docs/queries.html | 25 ++++------ markdown-docs/replicaset.html | 25 ++++------ objects.inv | Bin 1325 -> 1325 bytes search.html | 27 +++++------ searchindex.js | 2 +- 49 files changed, 506 insertions(+), 736 deletions(-) diff --git a/_sources/github/github.txt b/_sources/github/github.txt index 95efbf48a64..6f28a82de24 100644 --- a/_sources/github/github.txt +++ b/_sources/github/github.txt @@ -134,7 +134,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 0:2:48 on 20/6/2012 + - 22:13:22 on 20/6/2012 * - **Homepage** - http:// * - **Url** @@ -144,7 +144,7 @@ Object Document Modeling Libraries * - **Forks** - 226 * - **Watchers** - - 2172 + - 2176 .. topic:: mongo-model @@ -252,7 +252,7 @@ Content Management Systems * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 9:4:13 on 9/6/2012 + - 19:12:6 on 22/6/2012 * - **Homepage** - http://calip.so * - **Url** @@ -260,9 +260,9 @@ Content Management Systems * - **Clone Url** - https://github.com/cliftonc/calipso.git * - **Forks** - - 132 + - 131 * - **Watchers** - - 883 + - 881 Grid FS libraries or tools -------------------------- @@ -337,7 +337,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 3 * - **Watchers** - - 48 + - 50 .. topic:: mongolia @@ -381,9 +381,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/gett/mongojs.git * - **Forks** - - 14 + - 16 * - **Watchers** - - 185 + - 188 .. topic:: mongode @@ -939,7 +939,7 @@ Libraries or Applications for analytics * - **Forks** - 179 * - **Watchers** - - 2045 + - 2046 Libraries for the connect middleware ------------------------------------ @@ -1037,7 +1037,7 @@ Libraries or applications for continous integration * - **Forks** - 22 * - **Watchers** - - 186 + - 187 Exampe applications ------------------- diff --git a/api-articles/index.html b/api-articles/index.html index 6308a52ef1b..990523916cf 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -246,22 +246,17 @@

    Navigation

    - + - + - + + + + + + + + + - + + + - + - + - + - + - + - + - + + + + - + + + + - + + + + - + + - + + + + + + - + + + + + - + - + @@ -36,7 +36,7 @@

    Navigation

  • | GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.0 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.2 documentation (index) »
  • @@ -234,7 +234,7 @@

    Navigation

    @@ -525,7 +525,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -1344,7 +1344,7 @@

    Navigation

    @@ -140,22 +140,20 @@

    insertdb.open(function(err, db) { // Fetch a collection to insert document into - db.collection("simple_document_insert_collection_no_safe", function(err, collection) { + var collection = db.collection("simple_document_insert_collection_no_safe"); + // Insert a single document + collection.insert({hello:'world_no_safe'}); - // Insert a single document - collection.insert({hello:'world_no_safe'}); - - // Wait for a second before finishing up, to ensure we have written the item to disk - setTimeout(function() { + // Wait for a second before finishing up, to ensure we have written the item to disk + setTimeout(function() { - // Fetch the document - collection.findOne({hello:'world_no_safe'}, function(err, item) { - assert.equal(null, err); - assert.equal('world_no_safe', item.hello); - db.close(); - }) - }, 1000); - }); + // Fetch the document + collection.findOne({hello:'world_no_safe'}, function(err, item) { + assert.equal(null, err); + assert.equal('world_no_safe', item.hello); + db.close(); + }) + }, 1000); }); @@ -2808,7 +2806,6 @@

    aggregate
  • readPreference {String}, the preferred read preference ((Server.PRIMARY, Server.PRIMARY_PREFERRED, Server.SECONDARY, Server.SECONDARY_PREFERRED, Server.NEAREST).
  • -
  • explain {Boolean}, return the query plan for the aggregation pipeline instead of the results.
  • @@ -2943,7 +2940,75 @@

    aggregateauthors : { $addToSet : "$author" } }} , function(err, result) { - assert.ok(err != null); + assert.equal(null, err); + assert.equal('good', result[0]._id.tags); + assert.deepEqual(['bob'], result[0].authors); + assert.equal('fun', result[1]._id.tags); + assert.deepEqual(['bob'], result[1].authors); + + db.close(); + }); + }); + }); + } else { + db.close(); + test.done(); + } + }); +}); + + +

    Correctly call the aggregation framework using a pipeline expressed as an argument list.

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 4}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +  // Some docs for insertion
    +  var docs = [{
    +      title : "this is my title", author : "bob", posted : new Date() ,
    +      pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 },
    +      comments : [
    +        { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" }
    +      ]}];
    +
    +  // Validate that we are running on at least version 2.1 of MongoDB
    +  db.admin().serverInfo(function(err, result){
    +
    +    if(parseInt((result.version.replace(/\./g, ''))) >= 210) {
    +      // Create a collection
    +      client.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArguments', function(err, collection) {
    +        // Insert the docs
    +        collection.insert(docs, {safe:true}, function(err, result) {
    +          // Execute aggregate, notice the pipeline is expressed as function call parameters
    +          // instead of an Array.
    +          collection.aggregate(
    +              { $project : {
    +                author : 1,
    +                tags : 1
    +              }},
    +              { $unwind : "$tags" },
    +              { $group : {
    +               _id : { tags : 1 },
    +               authors : { $addToSet : "$author" }
    +              }}
    +            , function(err, result) {
    +              assert.equal(null, err);
    +              assert.equal('good', result[0]._id.tags);
    +              assert.deepEqual(['bob'], result[0].authors);
    +              assert.equal('fun', result[1]._id.tags);
    +              assert.deepEqual(['bob'], result[1].authors);
    +
                   db.close();
               });
             });
    @@ -3223,7 +3288,7 @@ 

    Navigation

    @@ -1295,7 +1295,7 @@

    Navigation

    @@ -283,6 +283,47 @@

    destroy}); }); }); +} + +exports.shouldStreamDocumentsWithPauseAndResumeForFetching = function(test) { +var docs = [] + +for(var i = 0; i < 3000; i++) { + docs.push({'a':i}) +} + +var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 5, ssl:useSSL}), {native_parser: native_parser}); + +// Establish connection to db +db.open(function(err, db) { + db.createCollection('test_streaming_function_with_limit_for_fetching', function(err, collection) { + assert.ok(collection instanceof Collection); + + collection.insert(docs, {safe:true}, function(err, ids) { + // Peform a find to get a cursor + var stream = collection.find({}).stream(); + var data = []; + + // For each data item + stream.on("data", function(item) { + stream.pause() + + collection.findOne({}, function(err, result) { + data.push(1); + stream.resume(); + }) + }); + + // When the stream is done + stream.on("close", function() { + assert.equal(3000, data.length); + db.close(); + test.done(); + }); + }); + }); +}); @@ -458,7 +499,7 @@

    Navigation

    @@ -173,9 +173,9 @@

    open// Replica configuration var replSet = new ReplSetServers([ - new Server('localhost', 30000, { auto_reconnect: true } ), - new Server('localhost', 30001, { auto_reconnect: true } ), - new Server('localhost', 30002, { auto_reconnect: true } ) + new Server('localhost', 30000, { auto_reconnect: true } ) + // new Server('localhost', 30001, { auto_reconnect: true } ), + // new Server('localhost', 30002, { auto_reconnect: true } ) ] ); @@ -184,6 +184,7 @@

    openassert.equal(null, err); p_db.close(); }); +}

    Example of Read Preference usage at the query level.

    @@ -209,7 +210,7 @@

    open// Create db instance var db = new Db('integration_test_', replSet, {native_parser: (process.env['TEST_NATIVE'] != null)}); // Trigger test once whole set is up -replSet.on("fullsetup", function() { +db.on("fullsetup", function() { // Rip out secondaries forcing an attempt to read from the primary db.serverConfig._state.secondaries = {}; @@ -2187,6 +2188,7 @@

    indexInformation
  • full {Boolean, default:false}, returns the full raw index information.
  • +
  • readPreference {String}, the preferred read preference ((Server.PRIMARY, Server.PRIMARY_PREFERRED, Server.SECONDARY, Server.SECONDARY_PREFERRED, Server.NEAREST).
  • @@ -2662,7 +2664,7 @@

    Navigation

    @@ -434,7 +434,7 @@

    Navigation

    @@ -2280,7 +2280,7 @@

    Navigation

    @@ -215,9 +215,6 @@

    Driver APIReplSet

  • ReadPreference() @@ -247,7 +247,7 @@

    Navigation

  • | GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.0 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.2 documentation (index) »
  • @@ -252,7 +252,7 @@

    Navigation

    @@ -480,7 +480,7 @@

    Navigation

    @@ -84,33 +84,6 @@

    Constructor -

    _isUsed

    -

    Return the used state

    -
    -
    -_isUsed()
    -
    - - -
    -

    _checkReplicaSet

    -

    @ignore

    -
    -
    -_checkReplicaSet()
    -
    - -
    -
    -

    _validateReplicaset

    -

    @ignore

    -
    -
    -_validateReplicaset()
    -
    -
    @@ -124,9 +97,6 @@

    Contents

    @@ -283,7 +253,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -48,9 +48,9 @@

    Navigation

    @@ -222,7 +222,7 @@

    Navigation

    @@ -342,7 +342,7 @@

    Navigation

    @@ -241,7 +241,7 @@

    Navigation

    @@ -507,7 +507,7 @@

    Navigation

    @@ -325,6 +325,11 @@

    toBSON method +

    Much faster BSON C++ parser

    +
    +
    Thanks to the awesome people at Lucasfilm Singapore we have a new BSON C++ serializer/deserializer that performs on average 40-50% faster than the current implementation.
    + @@ -56,6 +56,7 @@

    UpdatesHigh availability “on” by default
  • Better stream support for GridFS
  • toBSON method
  • +
  • Much faster BSON C++ parser
  • Other minor changes
  • @@ -228,7 +229,7 @@

    Navigation

    @@ -51,8 +51,7 @@

    Navigation

    Index

    - _ - | A + A | B | C | D @@ -74,26 +73,6 @@

    Index

    | X
    -

    _

    - - - -
    - -
    _checkReplicaSet() (built-in function) -
    - - -
    _isUsed() (built-in function) -
    - -
    - -
    _validateReplicaset() (built-in function) -
    - -
    -

    A

    @@ -334,7 +313,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -344,7 +323,7 @@

    E

    - + @@ -100,7 +100,7 @@

    Web frameworks using MongoDB

    - + @@ -136,7 +136,7 @@

    Web frameworks using MongoDB

    - + @@ -247,7 +247,7 @@

    Object Document Modeling Libraries

    - + @@ -259,10 +259,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git

    - + - +
    @@ -190,7 +169,7 @@

    C

    -
    close() (built-in function), [1], [2] +
    close() (built-in function), [1], [2]
    @@ -232,7 +211,7 @@

    C

    -
    createIndex() (built-in function), [1] +
    createIndex() (built-in function), [1]
    @@ -320,7 +299,7 @@

    D

    -
    dropIndex() (built-in function), [1] +
    dropIndex() (built-in function), [1]
    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -478,7 +457,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -684,7 +663,7 @@

    P

    -
    put() (built-in function), [1] +
    put() (built-in function), [1]
    @@ -714,7 +693,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -816,7 +795,7 @@

    S

    -
    stats() (built-in function), [1] +
    stats() (built-in function), [1]
    @@ -1117,7 +1096,7 @@

    Navigation

    @@ -64,7 +64,7 @@

    Web frameworks using MongoDB

    Last push23:25:3 on 20/5/20125:54:6 on 27/6/2012
    Homepage http://Last push22:42:15 on 12/6/201223:25:46 on 25/6/2012
    Homepage http://Last push11:6:0 on 17/6/20129:34:59 on 23/6/2012
    Homepage http://search.npmjs.org/#/breadLast push22:13:22 on 20/6/201222:29:54 on 25/6/2012
    Homepage http://
    Forks226228
    Watchers21762188
    @@ -298,7 +298,7 @@

    Object Document Modeling LibrariesWatchers -43 +45 @@ -430,7 +430,7 @@

    Content Management SystemsLast push -19:12:6 on 22/6/2012 +20:43:6 on 22/6/2012 Homepage http://calip.so @@ -445,7 +445,7 @@

    Content Management SystemsWatchers -881 +890 @@ -520,10 +520,10 @@

    Wrapper libraries to ease the use of development or provide simple ODM like https://github.com/guileen/node-mongoskin.git Forks -4 +5 Watchers -34 +36 @@ -559,7 +559,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 3 Watchers -50 +48 @@ -631,7 +631,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 16 Watchers -188 +192 @@ -703,7 +703,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 8 Watchers -39 +38 @@ -832,7 +832,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -15:40:0 on 9/4/2012 +19:23:20 on 24/6/2012 Homepage http://http://github.com/meritt/easymongo @@ -886,7 +886,7 @@

    REST api’s around MongoDB or resource based librariesWatchers -160 +162 @@ -1258,7 +1258,7 @@

    Logging libraries or applicationsWatchers -18 +19 @@ -1357,7 +1357,7 @@

    General frameworks over MongoDBLast push -0:5:48 on 20/6/2012 +3:44:25 on 28/6/2012 Homepage http:// @@ -1428,7 +1428,7 @@

    Translation libraries or frameworks Activity Level -../_images/active.png +../_images/nonactive.png Last push @@ -1486,7 +1486,7 @@

    Libraries or Applications for analyticsWatchers -2046 +2047 @@ -1506,7 +1506,7 @@

    Libraries for the connect middleware Activity Level -../_images/active.png +../_images/nonactive.png Last push @@ -1636,7 +1636,7 @@

    Libraries or applications for continous integration22 Watchers -187 +186 @@ -1675,7 +1675,7 @@

    Exampe applicationsWatchers -16 +17 @@ -1902,7 +1902,7 @@

    Navigation

    @@ -73,6 +73,7 @@

    Driver UpdatesHigh availability “on” by default
  • Better stream support for GridFS
  • toBSON method
  • +
  • Much faster BSON C++ parser
  • Other minor changes
  • @@ -418,7 +419,7 @@

    Navigation

    @@ -390,7 +390,7 @@

    Navigation

    @@ -380,7 +380,7 @@

    Navigation

    @@ -412,7 +412,7 @@

    Navigation

    @@ -219,7 +219,7 @@

    Navigation

    @@ -322,7 +322,7 @@

    Navigation

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    diff --git a/genindex.html b/genindex.html index 260ab780ce8..bf8a4146c10 100644 --- a/genindex.html +++ b/genindex.html @@ -169,7 +169,7 @@

    C

    -
    close() (built-in function), [1], [2] +
    close() (built-in function), [1], [2]
    @@ -211,7 +211,7 @@

    C

    -
    createIndex() (built-in function), [1] +
    createIndex() (built-in function), [1]
    @@ -299,7 +299,7 @@

    D

    -
    dropIndex() (built-in function), [1] +
    dropIndex() (built-in function), [1]
    @@ -313,7 +313,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -323,7 +323,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -457,7 +457,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -663,7 +663,7 @@

    P

    -
    put() (built-in function), [1] +
    put() (built-in function), [1]
    @@ -693,7 +693,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -795,7 +795,7 @@

    S

    -
    stats() (built-in function), [1] +
    stats() (built-in function), [1]
    diff --git a/github/github.html b/github/github.html index 72eb780d0a6..6a981f686f6 100644 --- a/github/github.html +++ b/github/github.html @@ -247,7 +247,7 @@

    Object Document Modeling LibrariesLast push -21:50:49 on 1/7/2012 +21:41:30 on 2/7/2012 Homepage http:// @@ -259,10 +259,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git Forks -228 +229 Watchers -2204 +2207 @@ -445,7 +445,7 @@

    Content Management SystemsWatchers -894 +895 @@ -559,7 +559,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 3 Watchers -49 +50 @@ -886,7 +886,7 @@

    REST api’s around MongoDB or resource based librariesWatchers -163 +164 @@ -1486,7 +1486,7 @@

    Libraries or Applications for analyticsWatchers -2058 +2061 @@ -1558,10 +1558,10 @@

    Libraries for the connect middlewarehttps://github.com/masylum/connect-mongodb.git Forks -39 +40 Watchers -169 +171 diff --git a/objects.inv b/objects.inv index 32ce66d976d54dee6cb784148b9f452963fb1e6d..81b0e3b64faf54828e8101e279f49a8b01fb5fa2 100644 GIT binary patch delta 1158 zcmV;11bO?03V;fbiGRV8;x-Vy&sVrAxk73Wx$F&w*_}ydU<&V6s*=h0)2?~cm8~Txx2zW625ah>Mb{d%POvZl-UL-9z z1W)BpcPWS-qw}vPi)yL{qT*e9V)ff;T3AhZB`MskmRm@IZ-4q@%!$^)hk)d47HKJF zxHc$afc_Fo3YF>4!R+o?igcbRnJt;orDalx*f1&jjd?k}Hdc_yJ$%)mdMq0w8Z{=l zk_qEXq)#G|gI0uQOf-fmm~~;jTtpKbH7o;dNR~G%M8w3qko^mT+s1{`QZ-ibt`Kk5 zN)%ayC;jU)7=HumztDdCT`oq9Q7kG9{IFW87}Z9q3&dZT_#KWTLBgZI!Lc#YJC>L& zOLxZW=-(AH@QLx^qxU$AsDC*xH@>rsz5x!?#{M%d**$7|!)ER(n#WQITwyYsYTqn{ z*HwUg0J3>kQc`8a8v1$gB>du&E7&tx=m({w(vvs8w|`s>jRKNgN4a9OwzC@B1dqHB z6w4Azj>8!tIR`s*nfZcba9@v1cDW=(XgS82Hm-Cu@(~VrUaTKJY_w5+IN-+G`NWtB z&+_}UD%lg^X2~@IH$B7~dx)piNWJJet6oEjT;7A1zZ|swvLnJToAf=&bD+*3Qzi2S z=eF~Kdw+}&A7fK!GQ1i6^}XtPyApU4rEJI}!EQI<5;F_fS%Fs8XD_GIDCJ_c0jLd_@e2h#sL*M`k(Hfm~%CGHcp1q!o zZwP8%HNO51pzV0KZ;W+}3&}zb6C?{cv?NQdEPtoAn3diCV5xD{JKcU}m>063jR3EZ4X^7zKr4th)CjE5SOtlX@hCJp>9Z z8Y6aH$a-Q|y5JMGvfO*9=(fp~BHr6jZ@DAsKS4<^Qw2FkU4;rOG{h9z@#6o87hi8d z^wC7O}ggKHs)(>4i;0Dw&MJWkmJ% zG$kR8-Cy74!0>}lXV3C7vJvi(fzXAkYOEAy%Qe1@gt)!W@g z`StpKo!Ki{L>xvm3bm8^9*l1)!%W|EsmES&I+!j`1RGM*Eh-aAo&H2H()XeD=DR|> Y%DUEos*Af7t*Bs}y8c`8KMa^?M^Pp>5dZ)H delta 1165 zcmV;81akX;3Wf@hiGNLV+cprr`&V$Ly-J-NddW?)oY;*mdBkKo(@qZ{v7``#00V%E zl*y0p0+dCOrbGhD$s+=bkKMQX9@d4VOifaSJ@PYBmSMND2dj0e3a>F~zCv0tI=rHnffQX(by2O| ztj0FOE6)VQ(!{d;<*bmLgBv>awIBuD9!EwW`6J>ib~xiq8(&Boc@Mj>sCtV?7v;Mh zZmhj;jM?xgzmKbwJrSa-P^Sw7%G;Q2ZG(EV(T;Ku+f)3B>&oR zxVMvQgbtGU>4rJTC2AG#t!%kCU)gL7PGXOFypM1x=P*DFecLX{GpRvbs`Bt0WA zI_ub28D#C+K;oM0P0g4fhZfx|Bk2B{?5H$q(#7*i$59|Wu%qz7|Q|E~f=*g?} z&3~5g3Rc;$soocfR>(tMq=l^DAGq17?6q3t1M!FaUOye~W`m6vK0g+xV ziQO{SdahguV-JX8=aB)suG@OzXO9pPI!glqa=LADrnvX;s*z)hbg#Jk2b2slMHPLI zFWF#i^cEcbcgA?o@;L95DEx$ydwV}Z7Jv4vt6>ok)|1K@wDA+xS*g#vr*Pxv7~u+N zbZfD1{;%sd{H4H_9E(ItS>BU99wU7@bi=&g42Or#H5}9sfkhq)i2()LLk2<`x4*vb z0GHKrXV0d!^hIcv3kZ|J_BpW<{tpQdy7J9Php=FLxsKk*gzWKGd-Ln*PQcF8B!A*1 zAdUPB4-(i{I}ean;d9jL-$*<5cpqU4+{dy3$dVK=z6oY2VW Date: Sun, 12 Aug 2012 00:05:45 +0200 Subject: [PATCH 30/56] Updated docs --- .buildinfo | 2 +- _sources/api-generated/collection.txt | 190 +++++++++--------- .../anintroductionto1_1and2_2.txt | 54 +++++ _sources/github/github.txt | 48 ++--- api-articles/index.html | 10 +- api-articles/nodekoarticle1.html | 10 +- api-articles/nodekoarticle2.html | 10 +- api-bson-generated/binary.html | 10 +- api-bson-generated/bson.html | 10 +- api-bson-generated/code.html | 10 +- api-bson-generated/double.html | 10 +- api-bson-generated/index.html | 10 +- api-bson-generated/long.html | 10 +- api-bson-generated/maxkey.html | 10 +- api-bson-generated/minkey.html | 10 +- api-bson-generated/objectid.html | 10 +- api-bson-generated/symbol.html | 10 +- api-bson-generated/timestamp.html | 10 +- api-generated/admin.html | 10 +- api-generated/collection.html | 12 +- api-generated/cursor.html | 10 +- api-generated/cursorstream.html | 10 +- api-generated/db.html | 10 +- api-generated/grid.html | 10 +- api-generated/gridstore.html | 10 +- api-generated/index.html | 10 +- api-generated/mongos.html | 10 +- api-generated/readpreference.html | 10 +- api-generated/readstream.html | 10 +- api-generated/replset.html | 10 +- api-generated/server.html | 10 +- changelog/changelog.html | 10 +- content/awesomeappsvideo.html | 10 +- content/nodejsvideo.html | 10 +- content/tutorials.html | 10 +- contents.html | 10 +- .../anintroductionto1_1and2_2.html | 61 +++++- driver-articles/index.html | 11 +- genindex.html | 28 +-- github/github.html | 58 +++--- index.html | 11 +- markdown-docs/collections.html | 10 +- markdown-docs/database.html | 10 +- markdown-docs/gridfs.html | 10 +- markdown-docs/index.html | 10 +- markdown-docs/indexes.html | 10 +- markdown-docs/insert.html | 10 +- markdown-docs/queries.html | 10 +- markdown-docs/replicaset.html | 10 +- objects.inv | Bin 1280 -> 1286 bytes search.html | 10 +- searchindex.js | 2 +- 52 files changed, 492 insertions(+), 385 deletions(-) diff --git a/.buildinfo b/.buildinfo index 5358e8e35f2..53324be461b 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 8e2a30f2b31b9457e248cb80db967895 +config: 2945147f5e6c615fd68cc5e53636c20e tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/_sources/api-generated/collection.txt b/_sources/api-generated/collection.txt index 2a1b4ba47b0..d8e9ebfb0d1 100644 --- a/_sources/api-generated/collection.txt +++ b/_sources/api-generated/collection.txt @@ -37,7 +37,7 @@ Inserts a single document or a an array of documents into MongoDB. Options - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - - **keepGoing** {Boolean, default:false}, keep inserting documents even if one document has an error, *mongodb 1.9.1 >*. + - **continueOnError/keepGoing** {Boolean, default:false}, keep inserting documents even if one document has an error, *mongodb 1.9.1 >*. - **serializeFunctions** {Boolean, default:false}, serialize functions on the document. .. js:function:: insert(docs[, options], [callback]) @@ -492,29 +492,29 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Fetch the collection db.collection("save_a_simple_document", function(err, collection) { - + // Save a document with no safe option collection.save({hello:'world'}); - + // Wait for a second setTimeout(function() { - + // Find the saved document collection.findOne({hello:'world'}, function(err, item) { assert.equal(null, err); assert.equal('world', item.hello); db.close(); - }); - }, 1000); - }); + }); + }, 1000); + }); }); @@ -533,15 +533,15 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Fetch the collection db.collection("save_a_simple_document_modify_it_and_resave_it", function(err, collection) { - + // Save a document with no safe option collection.save({hello:'world'}, {safe:true}, function(err, result) { @@ -549,25 +549,25 @@ Options collection.findOne({hello:'world'}, function(err, item) { assert.equal(null, err); assert.equal('world', item.hello); - + // Update the document item['hello2'] = 'world2'; - + // Save the item with the additional field collection.save(item, {safe:true}, function(err, result) { - + // Find the changed document collection.findOne({hello:'world'}, function(err, item) { assert.equal(null, err); assert.equal('world', item.hello); - assert.equal('world2', item.hello2); - + assert.equal('world2', item.hello2); + db.close(); }); - }); - }); + }); + }); }); - }); + }); }); @@ -613,31 +613,31 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Get a collection db.collection('update_a_simple_document', function(err, collection) { - + // Insert a document, then update it collection.insert({a:1}, {safe:true}, function(err, doc) { - + // Update the document with an atomic operator collection.update({a:1}, {$set:{b:2}}); - + // Wait for a second then fetch the document setTimeout(function() { - + // Fetch the document that we modified collection.findOne({a:1}, function(err, item) { assert.equal(null, err); assert.equal(1, item.a); assert.equal(2, item.b); db.close(); - }); + }); }, 1000); }) }); @@ -659,27 +659,27 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Get a collection - db.collection('update_a_simple_document_upsert', function(err, collection) { + db.collection('update_a_simple_document_upsert', function(err, collection) { // Update the document using an upsert operation, ensuring creation if it does not exist collection.update({a:1}, {b:2, a:1}, {upsert:true, safe:true}, function(err, result) { assert.equal(null, err); assert.equal(1, result); - + // Fetch the document that we modified and check if it got inserted correctly collection.findOne({a:1}, function(err, item) { assert.equal(null, err); assert.equal(1, item.a); assert.equal(2, item.b); db.close(); - }); + }); }); }); }); @@ -700,23 +700,23 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Get a collection - db.collection('update_a_simple_document_multi', function(err, collection) { - + db.collection('update_a_simple_document_multi', function(err, collection) { + // Insert a couple of documentations collection.insert([{a:1, b:1}, {a:1, b:2}], {safe:true}, function(err, result) { - + // Update multiple documents using the multi option collection.update({a:1}, {$set:{b:0}}, {safe:true, multi:true}, function(err, numberUpdated) { assert.equal(null, err); assert.equal(2, numberUpdated); - + // Fetch all the documents and verify that we have changed the b value collection.find().toArray(function(err, items) { assert.equal(null, err); @@ -724,10 +724,10 @@ Options assert.equal(0, items[0].b); assert.equal(1, items[1].a); assert.equal(0, items[1].b); - + db.close(); }); - }) + }) }); }); }); @@ -772,11 +772,11 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db - db.open(function(err, db) { + // Establish connection to db + db.open(function(err, db) { // Crete the collection for the distinct example db.createCollection('simple_key_based_distinct', function(err, collection) { @@ -784,7 +784,7 @@ Options // Insert documents to perform distinct against collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}}, {a:2, b:{c:'a'}}, {a:3}, {a:3}], {safe:true}, function(err, ids) { - + // Peform a distinct query against the a field collection.distinct('a', function(err, docs) { assert.deepEqual([0, 1, 2, 3], docs.sort()); @@ -816,11 +816,11 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db - db.open(function(err, db) { + // Establish connection to db + db.open(function(err, db) { // Crete the collection for the distinct example db.createCollection('simple_key_based_distinct_sub_query_filter', function(err, collection) { @@ -828,7 +828,7 @@ Options // Insert documents to perform distinct against collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}}, {a:2, b:{c:'a'}}, {a:3}, {a:3}, {a:5, c:1}], {safe:true}, function(err, ids) { - + // Peform a distinct query with a filter against the documents collection.distinct('a', {c:1}, function(err, docs) { assert.deepEqual([5], docs.sort()); @@ -878,30 +878,30 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db - db.open(function(err, db) { + // Establish connection to db + db.open(function(err, db) { // Crete the collection for the distinct example db.createCollection('simple_count_example', function(err, collection) { // Insert documents to perform distinct against collection.insert([{a:1}, {a:2}, {a:3}, {a:4, b:1}], {safe:true}, function(err, ids) { - + // Perform a total count command collection.count(function(err, count) { assert.equal(null, err); assert.equal(4, count); - + // Peform a partial account where b=1 collection.count({b:1}, function(err, count) { assert.equal(null, err); - assert.equal(1, count); - + assert.equal(1, count); + db.close(); - }); + }); }); }); }); @@ -939,22 +939,22 @@ Drop the collection BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { // Create a collection we want to drop later db.createCollection('test_other_drop', function(err, collection) { assert.equal(null, err); - + // Drop the collection - collection.drop(function(err, reply) { + collection.drop(function(err, reply) { // Ensure we don't have the collection in the set of names db.collectionNames(function(err, replies) { - + var found = false; // For each collection in the list of collection names in this db look for the // dropped collection @@ -972,7 +972,7 @@ Drop the collection db.close(); }); }); - }); + }); }); @@ -2247,12 +2247,12 @@ Returns the options of the collection. BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a test collection that we are getting the options back from db.createCollection('test_collection_options', {'capped':true, 'size':1024}, function(err, collection) { assert.ok(collection instanceof Collection); @@ -2266,7 +2266,7 @@ Returns the options of the collection. db.close(); }); - }); + }); }); @@ -2301,12 +2301,12 @@ Returns if the collection is a capped collection BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a test collection that we are getting the options back from db.createCollection('test_collection_is_capped', {'capped':true, 'size':1024}, function(err, collection) { assert.ok(collection instanceof Collection); @@ -2318,7 +2318,7 @@ Returns if the collection is a capped collection db.close(); }); - }); + }); }); @@ -2354,19 +2354,19 @@ Checks if one or more indexes exist on the collection BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a test collection that we are getting the options back from db.createCollection('test_collection_index_exists', {safe:true}, function(err, collection) { assert.equal(null, err); // Create an index on the collection collection.createIndex('a', {safe:true}, function(err, indexName) { - + // Let's test to check if a single index exists collection.indexExists("a_1", function(err, result) { assert.equal(true, result); @@ -2384,7 +2384,7 @@ Checks if one or more indexes exist on the collection }); }); }); - }); + }); }); @@ -2561,19 +2561,19 @@ Retrieve all the indexes on the collection. BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { // Crete the collection for the distinct example db.createCollection('simple_key_based_distinct', function(err, collection) { - + // Create a geo 2d index collection.ensureIndex({loc:"2d"}, {safe:true}, function(err, result) { assert.equal(null, err); - + // Create a simple single field index collection.ensureIndex({a:1}, {safe:true}, function(err, result) { assert.equal(null, err); @@ -2581,8 +2581,8 @@ Retrieve all the indexes on the collection. // List all of the indexes on the collection collection.indexes(function(err, indexes) { assert.equal(3, indexes.length); - - db.close(); + + db.close(); }); }) }) @@ -2852,25 +2852,25 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db - db.open(function(err, db) { + // Establish connection to db + db.open(function(err, db) { // Crete the collection for the distinct example db.createCollection('collection_stats_test', function(err, collection) { - + // Insert some documents collection.insert([{a:1}, {hello:'world'}], {safe:true}, function(err, result) { - + // Retrieve the statistics for the collection collection.stats(function(err, stats) { assert.equal(2, stats.count); - - db.close(); - }); - }); + + db.close(); + }); + }); }); }); diff --git a/_sources/driver-articles/anintroductionto1_1and2_2.txt b/_sources/driver-articles/anintroductionto1_1and2_2.txt index fe5d0f851e6..9a085d883b0 100644 --- a/_sources/driver-articles/anintroductionto1_1and2_2.txt +++ b/_sources/driver-articles/anintroductionto1_1and2_2.txt @@ -179,6 +179,8 @@ Mongos if(!err) { console.log("We are connected"); } + + db.close(); }); @@ -186,6 +188,58 @@ Mongos Read preferences also work with Mongos from Mongo DB 2.2 or higher allowing you to create more complex deployment setups. +---------------------------- +Aggregation framework helper +---------------------------- + + The MongoDB aggregation framework provides a means to calculate aggregate values without having to use map-reduce. While map-reduce is powerful, using map-reduce is more difficult than necessary for many simple aggregation tasks, such as totaling or averaging field values. + + + + The driver supports the aggregation framework by adding a helper at the collection level to execute an aggregation pipeline against the documents in that collection. Below is a simple example of using the aggregation framework to perform a group by tags. + + + .. code-block:: javascript + + var mongo = require('mongodb'), + Server = mongo.Server, + Db = mongo.Db; + + // Some docs for insertion + var docs = [{ + title : "this is my title", author : "bob", posted : new Date() , + pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 }, + comments : [ + { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" } + ]}]; + + var db = new Db(new Server('localhost', 27017)); + db.open(function(err, db) { + // Create a collection + db.createCollection('test', function(err, collection) { + // Insert the docs + collection.insert(docs, {safe:true}, function(err, result) { + + // Execute aggregate, notice the pipeline is expressed as an Array + collection.aggregate([ + { $project : { + author : 1, + tags : 1 + }}, + { $unwind : "$tags" }, + { $group : { + _id : {tags : "$tags"}, + authors : { $addToSet : "$author" } + }} + ], function(err, result) { + console.dir(result); + db.close(); + }); + }); + }); + }); + + ----------------------------------- Replicaset improvements and changes ----------------------------------- diff --git a/_sources/github/github.txt b/_sources/github/github.txt index 3833e1710c1..dfc4b7f7520 100644 --- a/_sources/github/github.txt +++ b/_sources/github/github.txt @@ -62,7 +62,7 @@ Web frameworks using MongoDB * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 9:34:59 on 23/6/2012 + - 23:50:52 on 7/7/2012 * - **Homepage** - http://https://npmjs.org/package/bread * - **Url** @@ -134,7 +134,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 21:41:30 on 2/7/2012 + - 15:3:3 on 11/7/2012 * - **Homepage** - http:// * - **Url** @@ -142,9 +142,9 @@ Object Document Modeling Libraries * - **Clone Url** - https://github.com/LearnBoost/mongoose.git * - **Forks** - - 229 + - 235 * - **Watchers** - - 2207 + - 2228 .. topic:: mongo-model @@ -165,9 +165,9 @@ Object Document Modeling Libraries * - **Clone Url** - https://github.com/alexeypetrushin/mongo-model.git * - **Forks** - - 4 + - 3 * - **Watchers** - - 47 + - 49 .. topic:: mongodb-expressions @@ -252,7 +252,7 @@ Content Management Systems * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 20:43:6 on 22/6/2012 + - 12:25:41 on 8/7/2012 * - **Homepage** - http://calip.so * - **Url** @@ -260,9 +260,9 @@ Content Management Systems * - **Clone Url** - https://github.com/cliftonc/calipso.git * - **Forks** - - 132 + - 135 * - **Watchers** - - 895 + - 900 Grid FS libraries or tools -------------------------- @@ -288,7 +288,7 @@ Grid FS libraries or tools * - **Forks** - 1 * - **Watchers** - - 7 + - 8 Wrapper libraries to ease the use of development or provide simple ODM like behaviours -------------------------------------------------------------------------------------- @@ -304,7 +304,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 6:19:38 on 15/4/2012 + - 3:50:53 on 4/7/2012 * - **Homepage** - http:// * - **Url** @@ -314,7 +314,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 5 * - **Watchers** - - 37 + - 42 .. topic:: mongoq @@ -337,7 +337,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 3 * - **Watchers** - - 50 + - 51 .. topic:: mongolia @@ -381,9 +381,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/gett/mongojs.git * - **Forks** - - 18 + - 20 * - **Watchers** - - 196 + - 205 .. topic:: mongode @@ -545,7 +545,7 @@ REST api's around MongoDB or resource based libraries * - **Clone Url** - https://github.com/tdegrunt/mongodb-rest.git * - **Forks** - - 34 + - 35 * - **Watchers** - 164 @@ -789,7 +789,7 @@ Logging libraries or applications * - **Forks** - 1 * - **Watchers** - - 19 + - 20 Monitoring applications or libraries ------------------------------------ @@ -913,7 +913,7 @@ Translation libraries or frameworks * - **Forks** - 19 * - **Watchers** - - 98 + - 96 Libraries or Applications for analytics --------------------------------------- @@ -937,9 +937,9 @@ Libraries or Applications for analytics * - **Clone Url** - https://github.com/square/cube.git * - **Forks** - - 180 + - 181 * - **Watchers** - - 2061 + - 2073 Libraries for the connect middleware ------------------------------------ @@ -986,7 +986,7 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/masylum/connect-mongodb.git * - **Forks** - - 40 + - 42 * - **Watchers** - 171 @@ -1011,7 +1011,7 @@ Libraries for the connect middleware * - **Forks** - 42 * - **Watchers** - - 140 + - 141 Libraries or applications for continous integration --------------------------------------------------- @@ -1035,9 +1035,9 @@ Libraries or applications for continous integration * - **Clone Url** - https://github.com/ryankee/concrete.git * - **Forks** - - 23 + - 24 * - **Watchers** - - 193 + - 194 Exampe applications ------------------- diff --git a/api-articles/index.html b/api-articles/index.html index 55c71ec0362..c9a68b5c300 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -8,7 +8,7 @@ - Articles — MongoDB Node.JS Driver 1.1.2 documentation + Articles — MongoDB Node.JS Driver 1.1.3 documentation @@ -16,7 +16,7 @@ - + @@ -36,7 +36,7 @@

    Navigation

  • | GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.2 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.3 documentation (index) »
  • @@ -234,7 +234,7 @@

    Navigation

    @@ -525,7 +525,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -1344,7 +1344,7 @@

    Navigation

    @@ -94,7 +94,7 @@

    insert
  • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
  • -
  • keepGoing {Boolean, default:false}, keep inserting documents even if one document has an error, mongodb 1.9.1 >.
  • +
  • continueOnError/keepGoing {Boolean, default:false}, keep inserting documents even if one document has an error, mongodb 1.9.1 >.
  • serializeFunctions {Boolean, default:false}, serialize functions on the document.
  • @@ -3288,7 +3288,7 @@

    Navigation

    @@ -1295,7 +1295,7 @@

    Navigation

    @@ -499,7 +499,7 @@

    Navigation

    @@ -2672,7 +2672,7 @@

    Navigation

    @@ -434,7 +434,7 @@

    Navigation

    @@ -2280,7 +2280,7 @@

    Navigation

    @@ -390,7 +390,7 @@

    Navigation

    @@ -247,7 +247,7 @@

    Navigation

    @@ -252,7 +252,7 @@

    Navigation

    @@ -480,7 +480,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -1077,7 +1077,7 @@

    Navigation

    @@ -222,7 +222,7 @@

    Navigation

    @@ -342,7 +342,7 @@

    Navigation

    @@ -241,7 +241,7 @@

    Navigation

    @@ -507,7 +507,7 @@

    Navigation

    @@ -202,6 +202,8 @@

    Mongosif(!err) { console.log("We are connected"); } + + db.close(); }); @@ -209,6 +211,54 @@

    Mongos +

    Aggregation framework helper

    +
    +

    The MongoDB aggregation framework provides a means to calculate aggregate values without having to use map-reduce. While map-reduce is powerful, using map-reduce is more difficult than necessary for many simple aggregation tasks, such as totaling or averaging field values.

    +

    The driver supports the aggregation framework by adding a helper at the collection level to execute an aggregation pipeline against the documents in that collection. Below is a simple example of using the aggregation framework to perform a group by tags.

    +
    +
    var mongo = require('mongodb'),
    +  Server = mongo.Server,
    +  Db = mongo.Db;
    +
    +// Some docs for insertion
    +var docs = [{
    +    title : "this is my title", author : "bob", posted : new Date() ,
    +    pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 },
    +    comments : [
    +      { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" }
    +    ]}];
    +
    +var db = new Db(new Server('localhost', 27017));
    +db.open(function(err, db) {
    +  // Create a collection
    +  db.createCollection('test', function(err, collection) {
    +    // Insert the docs
    +    collection.insert(docs, {safe:true}, function(err, result) {
    +
    +      // Execute aggregate, notice the pipeline is expressed as an Array
    +      collection.aggregate([
    +          { $project : {
    +            author : 1,
    +            tags : 1
    +          }},
    +          { $unwind : "$tags" },
    +          { $group : {
    +            _id : {tags : "$tags"},
    +            authors : { $addToSet : "$author" }
    +          }}
    +        ], function(err, result) {
    +          console.dir(result);
    +          db.close();
    +      });
    +    });
    +  });
    +});
    +
    +
    +
    +
    + @@ -52,6 +52,7 @@

    UpdatesMongo Driver and Mongo DB 2.2 Features @@ -169,7 +169,7 @@

    C

    -
    close() (built-in function), [1], [2] +
    close() (built-in function), [1], [2]
    @@ -211,7 +211,7 @@

    C

    -
    createIndex() (built-in function), [1] +
    createIndex() (built-in function), [1]
    @@ -299,7 +299,7 @@

    D

    -
    dropIndex() (built-in function), [1] +
    dropIndex() (built-in function), [1]

    @@ -313,7 +313,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -323,7 +323,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -457,7 +457,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -663,7 +663,7 @@

    P

    -
    put() (built-in function), [1] +
    put() (built-in function), [1]
    @@ -693,7 +693,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -795,7 +795,7 @@

    S

    -
    stats() (built-in function), [1] +
    stats() (built-in function), [1]
    @@ -1096,7 +1096,7 @@

    Navigation

    @@ -136,7 +136,7 @@

    Web frameworks using MongoDBLast push -9:34:59 on 23/6/2012 +23:50:52 on 7/7/2012 Homepage http://https://npmjs.org/package/bread @@ -247,7 +247,7 @@

    Object Document Modeling LibrariesLast push -21:41:30 on 2/7/2012 +15:3:3 on 11/7/2012 Homepage http:// @@ -259,10 +259,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git Forks -229 +235 Watchers -2207 +2228 @@ -295,10 +295,10 @@

    Object Document Modeling Librarieshttps://github.com/alexeypetrushin/mongo-model.git Forks -4 +3 Watchers -47 +49 @@ -430,7 +430,7 @@

    Content Management SystemsLast push -20:43:6 on 22/6/2012 +12:25:41 on 8/7/2012 Homepage http://calip.so @@ -442,10 +442,10 @@

    Content Management Systemshttps://github.com/cliftonc/calipso.git Forks -132 +135 Watchers -895 +900 @@ -484,7 +484,7 @@

    Grid FS libraries or toolsWatchers -7 +8 @@ -508,7 +508,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -6:19:38 on 15/4/2012 +3:50:53 on 4/7/2012 Homepage http:// @@ -523,7 +523,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 5 Watchers -37 +42 @@ -559,7 +559,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 3 Watchers -50 +51 @@ -628,10 +628,10 @@

    Wrapper libraries to ease the use of development or provide simple ODM like https://github.com/gett/mongojs.git Forks -18 +20 Watchers -196 +205 @@ -883,7 +883,7 @@

    REST api’s around MongoDB or resource based librarieshttps://github.com/tdegrunt/mongodb-rest.git Forks -34 +35 Watchers 164 @@ -1258,7 +1258,7 @@

    Logging libraries or applicationsWatchers -19 +20 @@ -1447,7 +1447,7 @@

    Translation libraries or frameworksWatchers -98 +96 @@ -1483,10 +1483,10 @@

    Libraries or Applications for analyticshttps://github.com/square/cube.git Forks -180 +181 Watchers -2061 +2073 @@ -1558,7 +1558,7 @@

    Libraries for the connect middlewarehttps://github.com/masylum/connect-mongodb.git Forks -40 +42 Watchers 171 @@ -1597,7 +1597,7 @@

    Libraries for the connect middlewareWatchers -140 +141 @@ -1633,10 +1633,10 @@

    Libraries or applications for continous integrationhttps://github.com/ryankee/concrete.git Forks -23 +24 Watchers -193 +194 @@ -1902,7 +1902,7 @@

    Navigation

    @@ -69,6 +69,7 @@

    Driver UpdatesMongo Driver and Mongo DB 2.2 Features @@ -390,7 +390,7 @@

    Navigation

    @@ -384,7 +384,7 @@

    Navigation

    @@ -412,7 +412,7 @@

    Navigation

    @@ -219,7 +219,7 @@

    Navigation

    @@ -322,7 +322,7 @@

    Navigation

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    @@ -313,7 +313,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -323,7 +323,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -457,7 +457,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -663,7 +663,7 @@

    P

    -
    put() (built-in function), [1] +
    put() (built-in function), [1]
    @@ -693,7 +693,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -795,7 +795,7 @@

    S

    -
    stats() (built-in function), [1] +
    stats() (built-in function), [1]
    diff --git a/github/github.html b/github/github.html index fcc9e4110ff..63f0155c5b1 100644 --- a/github/github.html +++ b/github/github.html @@ -259,10 +259,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git Forks -235 +236 Watchers -2228 +2229 @@ -445,7 +445,7 @@

    Content Management SystemsWatchers -900 +899 @@ -886,7 +886,7 @@

    REST api’s around MongoDB or resource based librariesWatchers -164 +165 @@ -1486,7 +1486,7 @@

    Libraries or Applications for analyticsWatchers -2073 +2071 diff --git a/objects.inv b/objects.inv index 32ce66d976d54dee6cb784148b9f452963fb1e6d..81b0e3b64faf54828e8101e279f49a8b01fb5fa2 100644 GIT binary patch delta 1158 zcmV;11bO?03V;fbiGRV8;x-Vy&sVrAxk73Wx$F&w*_}ydU<&V6s*=h0)2?~cm8~Txx2zW625ah>Mb{d%POvZl-UL-9z z1W)BpcPWS-qw}vPi)yL{qT*e9V)ff;T3AhZB`MskmRm@IZ-4q@%!$^)hk)d47HKJF zxHc$afc_Fo3YF>4!R+o?igcbRnJt;orDalx*f1&jjd?k}Hdc_yJ$%)mdMq0w8Z{=l zk_qEXq)#G|gI0uQOf-fmm~~;jTtpKbH7o;dNR~G%M8w3qko^mT+s1{`QZ-ibt`Kk5 zN)%ayC;jU)7=HumztDdCT`oq9Q7kG9{IFW87}Z9q3&dZT_#KWTLBgZI!Lc#YJC>L& zOLxZW=-(AH@QLx^qxU$AsDC*xH@>rsz5x!?#{M%d**$7|!)ER(n#WQITwyYsYTqn{ z*HwUg0J3>kQc`8a8v1$gB>du&E7&tx=m({w(vvs8w|`s>jRKNgN4a9OwzC@B1dqHB z6w4Azj>8!tIR`s*nfZcba9@v1cDW=(XgS82Hm-Cu@(~VrUaTKJY_w5+IN-+G`NWtB z&+_}UD%lg^X2~@IH$B7~dx)piNWJJet6oEjT;7A1zZ|swvLnJToAf=&bD+*3Qzi2S z=eF~Kdw+}&A7fK!GQ1i6^}XtPyApU4rEJI}!EQI<5;F_fS%Fs8XD_GIDCJ_c0jLd_@e2h#sL*M`k(Hfm~%CGHcp1q!o zZwP8%HNO51pzV0KZ;W+}3&}zb6C?{cv?NQdEPtoAn3diCV5xD{JKcU}m>063jR3EZ4X^7zKr4th)CjE5SOtlX@hCJp>9Z z8Y6aH$a-Q|y5JMGvfO*9=(fp~BHr6jZ@DAsKS4<^Qw2FkU4;rOG{h9z@#6o87hi8d z^wC7O}ggKHs)(>4i;0Dw&MJWkmJ% zG$kR8-Cy74!0>}lXV3C7vJvi(fzXAkYOEAy%Qe1@gt)!W@g z`StpKo!Ki{L>xvm3bm8^9*l1)!%W|EsmES&I+!j`1RGM*Eh-aAo&H2H()XeD=DR|> Y%DUEos*Af7t*Bs}y8c`8KMa^?M^Pp>5dZ)H delta 1165 zcmV;81akX;3Wf@hiGNLV+cprr`&V$Ly-J-NddW?)oY;*mdBkKo(@qZ{v7``#00V%E zl*y0p0+dCOrbGhD$s+=bkKMQX9@d4VOifaSJ@PYBmSMND2dj0e3a>F~zCv0tI=rHnffQX(by2O| ztj0FOE6)VQ(!{d;<*bmLgBv>awIBuD9!EwW`6J>ib~xiq8(&Boc@Mj>sCtV?7v;Mh zZmhj;jM?xgzmKbwJrSa-P^Sw7%G;Q2ZG(EV(T;Ku+f)3B>&oR zxVMvQgbtGU>4rJTC2AG#t!%kCU)gL7PGXOFypM1x=P*DFecLX{GpRvbs`Bt0WA zI_ub28D#C+K;oM0P0g4fhZfx|Bk2B{?5H$q(#7*i$59|Wu%qz7|Q|E~f=*g?} z&3~5g3Rc;$soocfR>(tMq=l^DAGq17?6q3t1M!FaUOye~W`m6vK0g+xV ziQO{SdahguV-JX8=aB)suG@OzXO9pPI!glqa=LADrnvX;s*z)hbg#Jk2b2slMHPLI zFWF#i^cEcbcgA?o@;L95DEx$ydwV}Z7Jv4vt6>ok)|1K@wDA+xS*g#vr*Pxv7~u+N zbZfD1{;%sd{H4H_9E(ItS>BU99wU7@bi=&g42Or#H5}9sfkhq)i2()LLk2<`x4*vb z0GHKrXV0d!^hIcv3kZ|J_BpW<{tpQdy7J9Php=FLxsKk*gzWKGd-Ln*PQcF8B!A*1 zAdUPB4-(i{I}ean;d9jL-$*<5cpqU4+{dy3$dVK=z6oY2VW Date: Sun, 12 Aug 2012 15:26:00 +0200 Subject: [PATCH 32/56] Docs updated --- .buildinfo | 2 +- api-articles/index.html | 10 +++---- api-articles/nodekoarticle1.html | 10 +++---- api-articles/nodekoarticle2.html | 10 +++---- api-bson-generated/binary.html | 10 +++---- api-bson-generated/bson.html | 10 +++---- api-bson-generated/code.html | 10 +++---- api-bson-generated/double.html | 10 +++---- api-bson-generated/index.html | 10 +++---- api-bson-generated/long.html | 10 +++---- api-bson-generated/maxkey.html | 10 +++---- api-bson-generated/minkey.html | 10 +++---- api-bson-generated/objectid.html | 10 +++---- api-bson-generated/symbol.html | 10 +++---- api-bson-generated/timestamp.html | 10 +++---- api-generated/admin.html | 10 +++---- api-generated/collection.html | 10 +++---- api-generated/cursor.html | 10 +++---- api-generated/cursorstream.html | 10 +++---- api-generated/db.html | 10 +++---- api-generated/grid.html | 10 +++---- api-generated/gridstore.html | 10 +++---- api-generated/index.html | 10 +++---- api-generated/mongos.html | 10 +++---- api-generated/readpreference.html | 10 +++---- api-generated/readstream.html | 10 +++---- api-generated/replset.html | 10 +++---- api-generated/server.html | 10 +++---- changelog/changelog.html | 10 +++---- content/awesomeappsvideo.html | 10 +++---- content/nodejsvideo.html | 10 +++---- content/tutorials.html | 10 +++---- contents.html | 10 +++---- .../anintroductionto1_1and2_2.html | 10 +++---- driver-articles/index.html | 10 +++---- genindex.html | 28 +++++++++--------- github/github.html | 10 +++---- index.html | 10 +++---- markdown-docs/collections.html | 10 +++---- markdown-docs/database.html | 10 +++---- markdown-docs/gridfs.html | 10 +++---- markdown-docs/index.html | 10 +++---- markdown-docs/indexes.html | 10 +++---- markdown-docs/insert.html | 10 +++---- markdown-docs/queries.html | 10 +++---- markdown-docs/replicaset.html | 10 +++---- objects.inv | Bin 1280 -> 1286 bytes search.html | 10 +++---- searchindex.js | 2 +- 49 files changed, 241 insertions(+), 241 deletions(-) diff --git a/.buildinfo b/.buildinfo index 53324be461b..8dd5dabe29b 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 2945147f5e6c615fd68cc5e53636c20e +config: 875c804002887b766f8d906f74ba5c92 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/api-articles/index.html b/api-articles/index.html index c9a68b5c300..f7d12d32b9d 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -8,7 +8,7 @@ - Articles — MongoDB Node.JS Driver 1.1.3 documentation + Articles — MongoDB Node.JS Driver 1.1.4 documentation @@ -16,7 +16,7 @@ - + @@ -36,7 +36,7 @@

    Navigation

  • | GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.3 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.4 documentation (index) »
  • @@ -234,7 +234,7 @@

    Navigation

    @@ -525,7 +525,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -1344,7 +1344,7 @@

    Navigation

    @@ -3288,7 +3288,7 @@

    Navigation

    @@ -1295,7 +1295,7 @@

    Navigation

    @@ -499,7 +499,7 @@

    Navigation

    @@ -2672,7 +2672,7 @@

    Navigation

    @@ -434,7 +434,7 @@

    Navigation

    @@ -2280,7 +2280,7 @@

    Navigation

    @@ -390,7 +390,7 @@

    Navigation

    @@ -247,7 +247,7 @@

    Navigation

    @@ -252,7 +252,7 @@

    Navigation

    @@ -480,7 +480,7 @@

    Navigation

    @@ -254,7 +254,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -1081,7 +1081,7 @@

    Navigation

    @@ -222,7 +222,7 @@

    Navigation

    @@ -342,7 +342,7 @@

    Navigation

    @@ -241,7 +241,7 @@

    Navigation

    @@ -507,7 +507,7 @@

    Navigation

    @@ -565,7 +565,7 @@

    Navigation

    @@ -230,7 +230,7 @@

    Navigation

    @@ -169,7 +169,7 @@

    C

    -
    close() (built-in function), [1], [2] +
    close() (built-in function), [1], [2]
    @@ -211,7 +211,7 @@

    C

    -
    createIndex() (built-in function), [1] +
    createIndex() (built-in function), [1]
    @@ -299,7 +299,7 @@

    D

    -
    dropIndex() (built-in function), [1] +
    dropIndex() (built-in function), [1]
    @@ -313,7 +313,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -323,7 +323,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -457,7 +457,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -663,7 +663,7 @@

    P

    -
    put() (built-in function), [1] +
    put() (built-in function), [1]
    @@ -693,7 +693,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -795,7 +795,7 @@

    S

    -
    stats() (built-in function), [1] +
    stats() (built-in function), [1]
    @@ -1096,7 +1096,7 @@

    Navigation

    @@ -1902,7 +1902,7 @@

    Navigation

    @@ -420,7 +420,7 @@

    Navigation

    @@ -390,7 +390,7 @@

    Navigation

    @@ -384,7 +384,7 @@

    Navigation

    @@ -412,7 +412,7 @@

    Navigation

    @@ -219,7 +219,7 @@

    Navigation

    @@ -322,7 +322,7 @@

    Navigation

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    @@ -313,7 +313,7 @@

    E

    -
    ensureIndex() (built-in function), [1] +
    ensureIndex() (built-in function), [1]
    @@ -323,7 +323,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -457,7 +457,7 @@

    I

    -
    indexInformation() (built-in function), [1] +
    indexInformation() (built-in function), [1]
    @@ -693,7 +693,7 @@

    R

    -
    reIndex() (built-in function), [1] +
    reIndex() (built-in function), [1]
    @@ -795,7 +795,7 @@

    S

    -
    stats() (built-in function), [1] +
    stats() (built-in function), [1]
    diff --git a/github/github.html b/github/github.html index 9d4555b06f5..577c7ff52f6 100644 --- a/github/github.html +++ b/github/github.html @@ -197,42 +197,6 @@

    Web frameworks using MongoDB

    Object Document Modeling Libraries

    -

    noid

    -

    ODM for MongoDB/Node.js with CoffeeScript

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - -
    Activity Level../_images/nonactive.png -
    Last push1:20:59 on 22/11/2010
    Homepagehttp://
    Urlhttps://github.com/chrisgibson/noid
    Clone Urlhttps://github.com/chrisgibson/noid.git
    Forks2
    Watchers8
    -
    -
    -

    Tools or applications to manage your MongoDB’s

    @@ -1336,7 +1264,7 @@

    General frameworks over MongoDBWatchers -22 +23 @@ -1483,10 +1411,10 @@

    Libraries or Applications for analyticshttps://github.com/square/cube.git Forks -181 +182 Watchers -2071 +2072 @@ -1546,7 +1474,7 @@

    Libraries for the connect middlewareLast push -7:46:51 on 11/5/2012 +17:45:52 on 12/7/2012 Homepage http:// @@ -1597,7 +1525,7 @@

    Libraries for the connect middlewareWatchers -141 +143 diff --git a/objects.inv b/objects.inv index 32ce66d976d54dee6cb784148b9f452963fb1e6d..f94b568a700903ba736fe081bfcae9bef5574bd2 100644 GIT binary patch delta 1161 zcmV;41a|v|3WExeihq;ZI1s(huW;4w6}EE7B{vu*nc1CzDM)Iob}I+jY8z!_$t%eO zQu*=Qk{KI223ulI6i6-g=j*2?my`(#`$!x5fs+_`Glhe>{1m~KtZe~X?ZEjdIF z_NSW+M32zxuSbb$s|KQyZF^(&+i}~b+VD&=xLM5CkVfD1hkt|9m~1BNR0(2W?1RG$+KwB-;)90T-`LN~NW0q>^nZUYwLD z^B67t_Y)Wc>VN0PeSEct5n~jKO9Q{0mMKQHk?O?bPfYv;hk+oW=`V0-g!GoBX3es# z2{Qe=Vg^1ke%bUMWzp-OUymEUS;pT0muVya36JcW+P<*ayNIWW6ar5eolUiFE`^s> zfI=MP>dvO5%83&U)8Ijb#ivlPW3tqDN=c%ttBlreS0kIE$umI_ zmRNeYToICUa7(9^FGvoz^~z|KZ9;5Zj&Y`qZ#o)z4|}v1@gpP~U6k+kc(L}j7%SmX zejkUDJrQn>T%zN~hj`_TcvuYJMUSm|2^r?{4ubUMp!Mf15n#8z{n0+VR}Vr7)}tLlpI&9!aqY- zI_KE0?Sy#MdVC>}VhyxR{PUq|LPPE6g#VEJ2!H-V_AUNX)6}s&zFi}=_^1ZmmepX^ znCQ<6Qoy!1;34F~J2jCMpb1TKVl+ul~{?!S`oAT8#b)pAM!BghEHI&FBEPqogOAZn-_Vz;R;OJE;B zqkmpW#WZoA_=ujoidXFjFJYAqi|RujOWqP>6jw$P$qvfap8uPf?YvB}KC!Kx%jJtv zP#DIFI@~kstb>124}`EMfi}(?19DxL^~BDq5E3@qC;}*aTjUJr_qO6|9%%X>P%=mq znfpDyoP!zJujt=zv!z2ty|054Z_wA>41eGe(y%9Hl`a9{K0(W%i=PmCr9SVr+^zRL zw7v+6_ z(N-aiyEv>)>ZWvg;M3_v_A#;&{E`5oM%ZcEOaFf811=M3``||5smVmvfz<>2qdDiRdnMSMQ8r*5t|t$+H}v*AbB0rz48j(V*jk&0?BcUW*A8lYKV?~c!~@}Gm% zo!PJF@9XSd$TH?IKoh9j)Hg7`3PqW|3ryq15Y71S3NStyk0a b_VmMh@Zox?A85rT>ltq!IL;}jmBLa($-M9N5)`g@@P}oJ<(D$4qz@y2#sN7GA!@zW73jSO4Bx%JV zda$2vau7X6uU`)q^;8W+rJMG|`rBbzTu*o=IovGfYsjLn`hR`OiPq7(h?H!SXelPR zHYj3%{*g)wwdwECFGOI*tm=yiS+)h6lD=6d^zGzTAmW>fj8k17V zjBzIN2a(B(R)iKzG=@2tW#vveOGX^jumZFpMcJ&75R-0V_5&_%n^sCo)mWvQO1wBL zQ56Z^^xuzQ41cJfvHSC%U5pr`SW+2yvs$hg)kdllk3TW-3HAd)!mGc)zA@4pmYFrn zHzw%n-xV|Pf$_^%?>Q`b{qyT`!#m65E8s9~?2U}kH6jl>^&*+3QV3jfG`tj)90P+P ziVZQ9_Cc7-Jqt@!5I2A9rbiFCM0yZmF)9^onXL4kQh!qE(VO2oyrP$Z6kSktQLWvq z#x}z%&jiKN#IpV6tdN|88#?v1AO+kWM@Ap{BjPM}IO9wkUq~8x54*9bdW%RG<+~kj zti5lH+3+a8kE@hD5w6|8hEyu5y^7GvUE^UfP&ImPtCx@?nzs;iVh&n=-VhOF%=9fO zOQ7CvrhiJ7GtM3Vfq#_HKgK1|Xh0V9&tFyD+qEDVDwdW9g59QK>oe!D(U(3X|Jrf5 zx07px4wCrkhB?S3Y8CITY`HjJ*=!6>Vvl*fAciDFgJ1F2D@ubxl@gv-97pRUJtHtW z>)4;|;Ju!Dv^!%^+gf<_J4UR3o#EDKJyMGZnh3r~7;mM>E45Ek=ZO#K$*c6u zmVfXHR@tzr-WQ4FEkj0eWTc?$)X$^m|7K=0ud)mjlFKj}Q_%O9KINx@~f%xcBg?kz3IPa7w{DhKwdp|-J_J6FaVG$74lgb#h@e|frsn5HoaO39~;R Date: Wed, 29 Aug 2012 17:16:31 +0200 Subject: [PATCH 34/56] Updated docs to 1.1.5 --- .buildinfo | 2 +- _sources/api-generated/collection.txt | 197 ++++---- _sources/api-generated/cursor.txt | 3 +- _sources/api-generated/db.txt | 8 +- _sources/changelog/changelog.txt | 11 + .../anintroductionto1_1and2_2.txt | 28 +- _sources/github/github.txt | 120 +++-- api-articles/index.html | 10 +- api-articles/nodekoarticle1.html | 10 +- api-articles/nodekoarticle2.html | 10 +- api-bson-generated/binary.html | 10 +- api-bson-generated/bson.html | 10 +- api-bson-generated/code.html | 10 +- api-bson-generated/double.html | 10 +- api-bson-generated/index.html | 10 +- api-bson-generated/long.html | 10 +- api-bson-generated/maxkey.html | 10 +- api-bson-generated/minkey.html | 10 +- api-bson-generated/objectid.html | 10 +- api-bson-generated/symbol.html | 10 +- api-bson-generated/timestamp.html | 10 +- api-generated/admin.html | 10 +- api-generated/collection.html | 19 +- api-generated/cursor.html | 13 +- api-generated/cursorstream.html | 10 +- api-generated/db.html | 18 +- api-generated/grid.html | 10 +- api-generated/gridstore.html | 10 +- api-generated/index.html | 10 +- api-generated/mongos.html | 10 +- api-generated/readpreference.html | 10 +- api-generated/readstream.html | 10 +- api-generated/replset.html | 10 +- api-generated/server.html | 10 +- changelog/changelog.html | 420 +++++++++--------- content/awesomeappsvideo.html | 10 +- content/nodejsvideo.html | 10 +- content/tutorials.html | 10 +- contents.html | 10 +- .../anintroductionto1_1and2_2.html | 38 +- driver-articles/index.html | 10 +- genindex.html | 30 +- github/github.html | 156 +++++-- index.html | 10 +- markdown-docs/collections.html | 10 +- markdown-docs/database.html | 10 +- markdown-docs/gridfs.html | 10 +- markdown-docs/index.html | 10 +- markdown-docs/indexes.html | 10 +- markdown-docs/insert.html | 10 +- markdown-docs/queries.html | 10 +- markdown-docs/replicaset.html | 10 +- objects.inv | Bin 1283 -> 1285 bytes search.html | 10 +- searchindex.js | 2 +- 55 files changed, 811 insertions(+), 644 deletions(-) diff --git a/.buildinfo b/.buildinfo index 8dd5dabe29b..ed1eee13d5b 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 875c804002887b766f8d906f74ba5c92 +config: 75ae2416d977341e17c013a1e7e79047 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/_sources/api-generated/collection.txt b/_sources/api-generated/collection.txt index d8e9ebfb0d1..d6adaeb142c 100644 --- a/_sources/api-generated/collection.txt +++ b/_sources/api-generated/collection.txt @@ -1025,31 +1025,31 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('simple_find_and_modify_operations_', function(err, collection) { + db.createCollection('simple_find_and_modify_operations_', function(err, collection) { assert.equal(null, err); - + // Insert some test documentations collection.insert([{a:1}, {b:1}, {c:1}], {safe:true}, function(err, result) { assert.equal(null, err); - + // Simple findAndModify command returning the new document collection.findAndModify({a:1}, [['a', 1]], {$set:{b1:1}}, {new:true}, function(err, doc) { assert.equal(null, err); assert.equal(1, doc.a); assert.equal(1, doc.b1); - - // Simple findAndModify command returning the new document and + + // Simple findAndModify command returning the new document and // removing it at the same time - collection.findAndModify({b:1}, [['b', 1]], + collection.findAndModify({b:1}, [['b', 1]], {$set:{b:2}}, {remove:true}, function(err, doc) { - + // Verify that the document is gone collection.findOne({b:1}, function(err, item) { assert.equal(null, err); @@ -1062,12 +1062,12 @@ Options assert.equal(null, err); assert.equal(1, doc.d); assert.equal(1, doc.f); - + db.close(); }) }); - }); - }); + }); + }); }); }); }); @@ -1112,26 +1112,26 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('simple_find_and_modify_operations_', function(err, collection) { + db.createCollection('simple_find_and_modify_operations_', function(err, collection) { assert.equal(null, err); - + // Insert some test documentations collection.insert([{a:1}, {b:1}, {c:1}], {safe:true}, function(err, result) { - assert.equal(null, err); - - // Simple findAndModify command returning the new document and + assert.equal(null, err); + + // Simple findAndModify command returning the new document and // removing it at the same time collection.findAndRemove({b:1}, [['b', 1]], function(err, doc) { assert.equal(null, err); assert.equal(1, doc.b); - + // Verify that the document is gone collection.findOne({b:1}, function(err, item) { assert.equal(null, err); @@ -1139,7 +1139,7 @@ Options db.close(); }); - }); + }); }); }); }); @@ -1175,7 +1175,9 @@ Options - **snapshot** {Boolean, default:false}, snapshot query. - **timeout** {Boolean, default:false}, specify if the cursor can timeout. - **tailable** {Boolean, default:false}, specify if the cursor is tailable. + - **tailableRetryInterval** {Number, default:100}, specify the miliseconds between getMores on tailable cursor. - **awaitdata** {Boolean, default:false} allow the cursor to wait for data, only applicable for tailable cursor. + - **exhaust** {Boolean, default:false} have the server send all the documents at once as getMore packets, not recommended. - **batchSize** {Number, default:0}, set the batchSize for the getMoreCommand when iterating over the query results. - **returnKey** {Boolean, default:false}, only return the index key. - **maxScan** {Number}, Limit the number of items to scan. @@ -1185,7 +1187,7 @@ Options - **comment** {String}, You can put a $comment field on a query to make looking in the profiler logs simpler. - **raw** {Boolean, default:false}, Return all BSON documents as Raw Buffer documents. - **readPreference** {String}, the preferred read preference ((Server.PRIMARY, Server.PRIMARY_PREFERRED, Server.SECONDARY, Server.SECONDARY_PREFERRED, Server.NEAREST). - - **numberOfRetries** {Number, default:1}, if using awaidata specifies the number of times to retry on timeout. + - **numberOfRetries** {Number, default:5}, if using awaidata specifies the number of times to retry on timeout. .. js:function:: find(query[, options], [callback]) @@ -1213,16 +1215,16 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('simple_query', function(err, collection) { + db.createCollection('simple_query', function(err, collection) { assert.equal(null, err); - + // Insert a bunch of documents for the testing collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, result) { assert.equal(null, err); @@ -1231,12 +1233,12 @@ Options collection.find().toArray(function(err, docs) { assert.equal(null, err); assert.equal(3, docs.length); - + db.close(); }); }); }); - }); + }); @@ -1254,16 +1256,16 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('simple_explain_query', function(err, collection) { + db.createCollection('simple_explain_query', function(err, collection) { assert.equal(null, err); - + // Insert a bunch of documents for the testing collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, result) { assert.equal(null, err); @@ -1272,12 +1274,12 @@ Options collection.find({}, {explain:true}).toArray(function(err, docs) { assert.equal(null, err); assert.equal(1, docs.length); - + db.close(); }); }); }); - }); + }); @@ -1295,16 +1297,16 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('simple_limit_skip_query', function(err, collection) { + db.createCollection('simple_limit_skip_query', function(err, collection) { assert.equal(null, err); - + // Insert a bunch of documents for the testing collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { assert.equal(null, err); @@ -1315,12 +1317,12 @@ Options assert.equal(1, docs.length); assert.equal(null, docs[0].a); assert.equal(2, docs[0].b); - + db.close(); }); }); }); - }); + }); ------- @@ -1389,16 +1391,16 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('simple_limit_skip_find_one_query', function(err, collection) { + db.createCollection('simple_limit_skip_find_one_query', function(err, collection) { assert.equal(null, err); - + // Insert a bunch of documents for the testing collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { assert.equal(null, err); @@ -1408,12 +1410,12 @@ Options assert.equal(null, err); assert.equal(null, doc.a); assert.equal(2, doc.b); - + db.close(); }); }); }); - }); + }); ----------- @@ -1433,6 +1435,9 @@ Options - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. + - **v** {Number}, specify the format version of the indexes. + - **expireAfterSeconds** {Number}, allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) + - **name** {String}, override the autogenerated index name (useful if the resulting name is larger than 128 bytes) .. js:function:: createIndex(fieldOrSpec[, options], callback) @@ -1460,28 +1465,28 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('simple_index_test', function(err, collection) { + db.createCollection('simple_index_test', function(err, collection) { assert.equal(null, err); - + // Insert a bunch of documents for the index collection.insert([{a:1}, {a:2}, {a:3}, {a:4}], {safe:true}, function(err, result) { assert.equal(null, err); - + // Create an index on the a field collection.createIndex('a', {safe:true}, function(err, indexName) { assert.equal("a_1", indexName); - + // Peform a query, with explain to show we hit the query collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { assert.deepEqual([[2, 2]], explanation[0].indexBounds.a); - + db.close(); }); }); @@ -1505,14 +1510,14 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { // Create a collection we want to drop later - db.createCollection('more_complex_index_test', function(err, collection) { + db.createCollection('more_complex_index_test', function(err, collection) { assert.equal(null, err); // Insert a bunch of documents for the index @@ -1523,12 +1528,12 @@ Options // Create an index on the a field collection.createIndex({a:1, b:1} , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { - + // Show that duplicate records got dropped collection.find({}).toArray(function(err, items) { assert.equal(null, err); assert.equal(4, items.length); - + // Peform a query, with explain to show we hit the query collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { assert.equal(null, err); @@ -1562,6 +1567,8 @@ Options - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. - **v** {Number}, specify the format version of the indexes. + - **expireAfterSeconds** {Number}, allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) + - **name** {String}, override the autogenerated index name (useful if the resulting name is larger than 128 bytes) .. js:function:: ensureIndex(fieldOrSpec[, options], callback) @@ -1589,30 +1596,30 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { // Create a collection we want to drop later - db.createCollection('more_complex_ensure_index_test', function(err, collection) { + db.createCollection('more_complex_ensure_index_test', function(err, collection) { assert.equal(null, err); // Insert a bunch of documents for the index collection.insert([{a:1, b:1}, {a:1, b:1} , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { assert.equal(null, err); - + // Create an index on the a field collection.ensureIndex({a:1, b:1} , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { - + // Show that duplicate records got dropped collection.find({}).toArray(function(err, items) { assert.equal(null, err); assert.equal(4, items.length); - + // Peform a query, with explain to show we hit the query collection.find({a:2}, {explain:true}).toArray(function(err, explanation) { assert.equal(null, err); @@ -1665,25 +1672,25 @@ Options BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('more_index_information_test', function(err, collection) { + db.createCollection('more_index_information_test', function(err, collection) { assert.equal(null, err); // Insert a bunch of documents for the index collection.insert([{a:1, b:1}, {a:1, b:1} , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { assert.equal(null, err); - + // Create an index on the a field collection.ensureIndex({a:1, b:1} , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { - + // Fetch basic indexInformation for collection collection.indexInformation(function(err, indexInformation) { assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); @@ -1694,7 +1701,7 @@ Options assert.deepEqual({ _id: 1 }, indexInformation[0].key); assert.deepEqual({ a: 1, b: 1 }, indexInformation[1].key); - db.close(); + db.close(); }); }); }); @@ -1735,35 +1742,35 @@ Drops an index from this collection. BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('create_and_drop_an_index', function(err, collection) { + db.createCollection('create_and_drop_an_index', function(err, collection) { assert.equal(null, err); // Insert a bunch of documents for the index collection.insert([{a:1, b:1}, {a:1, b:1} , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { assert.equal(null, err); - + // Create an index on the a field collection.ensureIndex({a:1, b:1} , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { - + // Drop the index collection.dropIndex("a_1_b_1", function(err, result) { assert.equal(null, err); - + // Verify that the index is gone - collection.indexInformation(function(err, indexInformation) { + collection.indexInformation(function(err, indexInformation) { assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); assert.equal(null, indexInformation.a_1_b_1); - db.close(); + db.close(); }); }); }); @@ -1817,21 +1824,21 @@ Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) BSON = require('mongodb').pure().BSON, assert = require('assert'); - var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + var db = new Db('integration_tests', new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4}), {native_parser: false}); - // Establish connection to db + // Establish connection to db db.open(function(err, db) { - + // Create a collection we want to drop later - db.createCollection('shouldCorrectlyForceReindexOnCollection', function(err, collection) { + db.createCollection('shouldCorrectlyForceReindexOnCollection', function(err, collection) { assert.equal(null, err); // Insert a bunch of documents for the index collection.insert([{a:1, b:1}, {a:1, b:1} , {a:2, b:2}, {a:3, b:3}, {a:4, b:4, c:4}], {safe:true}, function(err, result) { assert.equal(null, err); - + // Create an index on the a field collection.ensureIndex({a:1, b:1} , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { @@ -1840,13 +1847,13 @@ Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) collection.reIndex(function(err, result) { assert.equal(null, err); assert.equal(true, result); - + // Verify that the index is gone - collection.indexInformation(function(err, indexInformation) { + collection.indexInformation(function(err, indexInformation) { assert.deepEqual([ [ '_id', 1 ] ], indexInformation._id_); assert.deepEqual([ [ 'a', 1 ], [ 'b', 1 ] ], indexInformation.a_1_b_1); - db.close(); + db.close(); }); }); }); diff --git a/_sources/api-generated/cursor.txt b/_sources/api-generated/cursor.txt index 2f9b7f05c0b..89e252a4859 100644 --- a/_sources/api-generated/cursor.txt +++ b/_sources/api-generated/cursor.txt @@ -36,9 +36,10 @@ but use find to acquire a cursor. :param number max: set index bounds. :param boolean showDiskLoc: show disk location of results. :param string comment: you can put a $comment field on a query to make looking in the profiler logs simpler. - :param boolean awaitdata: allow the cursor to wait for data, only applicable for tailable cursor. :param number numberOfRetries: if using awaidata specifies the number of times to retry on timeout. :param string dbName: override the default dbName. + :param number tailableRetryInterval: specify the miliseconds between getMores on tailable cursor. + :param boolean have: the server send all the documents at once as getMore packets. diff --git a/_sources/api-generated/db.txt b/_sources/api-generated/db.txt index ce7c9b3cfec..ec48b6e4f73 100644 --- a/_sources/api-generated/db.txt +++ b/_sources/api-generated/db.txt @@ -1581,13 +1581,16 @@ Creates an index on the collection. Options - - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a - **unique** {Boolean, default:false}, creates an unique index. - **sparse** {Boolean, default:false}, creates a sparse index. - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible. - **dropDups** {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. + - **v** {Number}, specify the format version of the indexes. + - **expireAfterSeconds** {Number}, allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) + - **name** {String}, override the autogenerated index name (useful if the resulting name is larger than 128 bytes) .. js:function:: createIndex(collectionName, fieldOrSpec[, options], callback) @@ -1673,7 +1676,8 @@ Options - **min** {Number}, for geospatial indexes set the lower bound for the co-ordinates. - **max** {Number}, for geospatial indexes set the high bound for the co-ordinates. - **v** {Number}, specify the format version of the indexes. - - **expireAfterSeconds** {Number}, specify the number of seconds before a document expires (requires Mongo DB 2.2 or higher) + - **expireAfterSeconds** {Number}, allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) + - **name** {String}, override the autogenerated index name (useful if the resulting name is larger than 128 bytes) .. js:function:: ensureIndex(collectionName, fieldOrSpec[, options], callback) diff --git a/_sources/changelog/changelog.txt b/_sources/changelog/changelog.txt index 90372c99316..7f217333444 100644 --- a/_sources/changelog/changelog.txt +++ b/_sources/changelog/changelog.txt @@ -2,6 +2,17 @@ Changelog ========= +1.1.5 2012-08-29 +---------------- +- Fix for eval on replicaset Issue #684 +- Use helpful error msg when native parser not compiled (Issue #685, https://github.com/aheckmann) +- Arbiter connect hotfix (Issue #681, https://github.com/fengmk2) +- Upgraded bson parser to 0.1.2 using gyp, deprecated support for node 0.4.X +- Added name parameter to createIndex/ensureIndex to be able to override index names larger than 128 bytes +- Added exhaust option for find for feature completion (not recommended for normal use) +- Added tailableRetryInterval to find for tailable cursors to allow to control getMore retry time interval +- Fixes for read preferences when using MongoS to correctly handle no read preference set when iterating over a cursor (Issue #686) + 1.1.4 2012-08-12 ---------------- - Added Mongos connection type with a fallback list for mongos proxies, supports ha (on by default) and will attempt to reconnect to failed proxies. diff --git a/_sources/driver-articles/anintroductionto1_1and2_2.txt b/_sources/driver-articles/anintroductionto1_1and2_2.txt index 9a085d883b0..1b1064e5d3d 100644 --- a/_sources/driver-articles/anintroductionto1_1and2_2.txt +++ b/_sources/driver-articles/anintroductionto1_1and2_2.txt @@ -40,9 +40,9 @@ Read preferences // Replica configuration var replSet = new ReplSet( [ - new Server( "localhost", 27017, { auto_reconnect: true } ), - new Server( "localhost", 27018, { auto_reconnect: true } ), - new Server( "localhost", 27019, { auto_reconnect: true } ) + new Server( "localhost", 27017), + new Server( "localhost", 27018), + new Server( "localhost", 27019) ], {rs_name: "foo"} ); @@ -68,9 +68,9 @@ Read preferences // Replica configuration var replSet = new ReplSet( [ - new Server( "localhost", 27017, { auto_reconnect: true } ), - new Server( "localhost", 27018, { auto_reconnect: true } ), - new Server( "localhost", 27019, { auto_reconnect: true } ) + new Server( "localhost", 27017), + new Server( "localhost", 27018), + new Server( "localhost", 27019) ], {rs_name: "foo"} ); @@ -101,9 +101,9 @@ Read preferences // Replica configuration var replSet = new ReplSet( [ - new Server( "localhost", 27017, { auto_reconnect: true } ), - new Server( "localhost", 27018, { auto_reconnect: true } ), - new Server( "localhost", 27019, { auto_reconnect: true } ) + new Server( "localhost", 27017), + new Server( "localhost", 27018), + new Server( "localhost", 27019) ], {rs_name: "foo"} ); @@ -134,9 +134,9 @@ Read preferences // Replica configuration var replSet = new ReplSet( [ - new Server( "localhost", 27017, { auto_reconnect: true } ), - new Server( "localhost", 27018, { auto_reconnect: true } ), - new Server( "localhost", 27019, { auto_reconnect: true } ) + new Server( "localhost", 27017), + new Server( "localhost", 27018), + new Server( "localhost", 27019) ], {rs_name: "foo"} ); @@ -377,6 +377,6 @@ Much faster BSON C++ parser ------------------- Other minor changes ------------------- - * Connection pool is not set to 5 by default override if there is need for either a bigger or smaller pool pr node process. - * Gridfs now ensure an index on the chunks collection on file_id. + * Connection pool is now set to 5 by default. Override if there is need for either a bigger or smaller pool per node process. + * Gridfs now ensures an index on the chunks collection on file_id. diff --git a/_sources/github/github.txt b/_sources/github/github.txt index 63e375a8447..26742087fa5 100644 --- a/_sources/github/github.txt +++ b/_sources/github/github.txt @@ -70,7 +70,7 @@ Web frameworks using MongoDB * - **Clone Url** - https://github.com/pvorb/node-bread.git * - **Forks** - - 1 + - 2 * - **Watchers** - 2 @@ -100,6 +100,29 @@ Web frameworks using MongoDB Object Document Modeling Libraries ---------------------------------- +.. topic:: noid + + ODM for MongoDB/Node.js with CoffeeScript + + .. list-table:: + :widths: 25 85 + :header-rows: 0 + + * - **Activity Level** + - .. image:: ../static/nonactive.png + * - **Last push** + - 1:20:59 on 22/11/2010 + * - **Homepage** + - http:// + * - **Url** + - https://github.com/chrisgibson/noid + * - **Clone Url** + - https://github.com/chrisgibson/noid.git + * - **Forks** + - 2 + * - **Watchers** + - 8 + .. topic:: mongoose Node.JS MongoDB utility library with ORM-like functionality @@ -111,7 +134,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 17:26:18 on 13/7/2012 + - 18:57:24 on 27/7/2012 * - **Homepage** - http:// * - **Url** @@ -119,9 +142,9 @@ Object Document Modeling Libraries * - **Clone Url** - https://github.com/LearnBoost/mongoose.git * - **Forks** - - 237 + - 252 * - **Watchers** - - 2237 + - 2291 .. topic:: mongo-model @@ -144,7 +167,7 @@ Object Document Modeling Libraries * - **Forks** - 3 * - **Watchers** - - 49 + - 50 .. topic:: mongodb-expressions @@ -204,7 +227,7 @@ Content Management Systems :header-rows: 0 * - **Activity Level** - - .. image:: ../static/active.png + - .. image:: ../static/nonactive.png * - **Last push** - 6:25:45 on 18/3/2012 * - **Homepage** @@ -229,7 +252,7 @@ Content Management Systems * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 12:25:41 on 8/7/2012 + - 1:44:52 on 26/7/2012 * - **Homepage** - http://calip.so * - **Url** @@ -237,9 +260,9 @@ Content Management Systems * - **Clone Url** - https://github.com/cliftonc/calipso.git * - **Forks** - - 135 + - 138 * - **Watchers** - - 899 + - 910 Grid FS libraries or tools -------------------------- @@ -335,9 +358,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/masylum/mongolia.git * - **Forks** - - 11 + - 10 * - **Watchers** - - 98 + - 100 .. topic:: mongojs @@ -358,9 +381,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/gett/mongojs.git * - **Forks** - - 20 + - 23 * - **Watchers** - - 205 + - 212 .. topic:: mongode @@ -371,9 +394,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha :header-rows: 0 * - **Activity Level** - - .. image:: ../static/nonactive.png + - .. image:: ../static/active.png * - **Last push** - - 5:14:49 on 11/3/2012 + - 14:17:30 on 29/7/2012 * - **Homepage** - http:// * - **Url** @@ -383,7 +406,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 3 * - **Watchers** - - 46 + - 44 .. topic:: node-mongodb-wrapper @@ -396,7 +419,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 17:45:57 on 19/3/2012 + - 16:57:39 on 28/7/2012 * - **Homepage** - http://http://i.tv * - **Url** @@ -524,7 +547,7 @@ REST api's around MongoDB or resource based libraries * - **Forks** - 35 * - **Watchers** - - 166 + - 168 .. topic:: lazyBum @@ -558,9 +581,9 @@ REST api's around MongoDB or resource based libraries :header-rows: 0 * - **Activity Level** - - .. image:: ../static/nonactive.png + - .. image:: ../static/active.png * - **Last push** - - 22:55:44 on 11/7/2011 + - 17:22:29 on 23/7/2012 * - **Homepage** - http:// * - **Url** @@ -598,6 +621,29 @@ Test helpers and libraries * - **Watchers** - 3 +.. topic:: node-database-cleaner + + The simplest way to clean your database after tests + + .. list-table:: + :widths: 25 85 + :header-rows: 0 + + * - **Activity Level** + - .. image:: ../static/active.png + * - **Last push** + - 12:35:16 on 7/4/2012 + * - **Homepage** + - http:// + * - **Url** + - https://github.com/emerleite/node-database-cleaner + * - **Clone Url** + - https://github.com/emerleite/node-database-cleaner.git + * - **Forks** + - 7 + * - **Watchers** + - 32 + Tools or applications to manage your MongoDB's ---------------------------------------------- @@ -671,7 +717,7 @@ Queue libraries using MongoDB * - **Forks** - 8 * - **Watchers** - - 66 + - 67 Logging libraries or applications --------------------------------- @@ -720,7 +766,7 @@ Logging libraries or applications * - **Forks** - 0 * - **Watchers** - - 2 + - 4 .. topic:: devnull @@ -731,7 +777,7 @@ Logging libraries or applications :header-rows: 0 * - **Activity Level** - - .. image:: ../static/active.png + - .. image:: ../static/nonactive.png * - **Last push** - 11:52:6 on 19/3/2012 * - **Homepage** @@ -793,7 +839,7 @@ General frameworks over MongoDB * - **Clone Url** - https://github.com/khwang/DJS.git * - **Forks** - - 5 + - 4 * - **Watchers** - 23 @@ -844,7 +890,7 @@ Translation libraries or frameworks * - **Forks** - 7 * - **Watchers** - - 25 + - 26 .. topic:: dialect @@ -865,9 +911,9 @@ Translation libraries or frameworks * - **Clone Url** - https://github.com/masylum/dialect.git * - **Forks** - - 19 + - 18 * - **Watchers** - - 96 + - 98 Libraries or Applications for analytics --------------------------------------- @@ -891,9 +937,9 @@ Libraries or Applications for analytics * - **Clone Url** - https://github.com/square/cube.git * - **Forks** - - 182 + - 190 * - **Watchers** - - 2072 + - 2109 Libraries for the connect middleware ------------------------------------ @@ -917,9 +963,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/bartt/connect-session-mongo.git * - **Forks** - - 6 + - 5 * - **Watchers** - - 13 + - 14 .. topic:: connect-mongodb @@ -940,9 +986,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/masylum/connect-mongodb.git * - **Forks** - - 42 + - 47 * - **Watchers** - - 171 + - 174 .. topic:: connect-mongo @@ -963,9 +1009,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/kcbanner/connect-mongo.git * - **Forks** - - 42 + - 46 * - **Watchers** - - 143 + - 144 Libraries or applications for continous integration --------------------------------------------------- @@ -989,9 +1035,9 @@ Libraries or applications for continous integration * - **Clone Url** - https://github.com/ryankee/concrete.git * - **Forks** - - 24 + - 26 * - **Watchers** - - 194 + - 195 Exampe applications ------------------- diff --git a/api-articles/index.html b/api-articles/index.html index f7d12d32b9d..dd8d973f009 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -8,7 +8,7 @@ - Articles — MongoDB Node.JS Driver 1.1.4 documentation + Articles — MongoDB Node.JS Driver 1.1.5 documentation @@ -16,7 +16,7 @@ - + @@ -36,7 +36,7 @@

    Navigation

  • | GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.4 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.5 documentation (index) »
  • @@ -234,7 +234,7 @@

    Navigation

    @@ -525,7 +525,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -1344,7 +1344,7 @@

    Navigation

    @@ -1282,7 +1282,9 @@

    find
  • snapshot {Boolean, default:false}, snapshot query.
  • timeout {Boolean, default:false}, specify if the cursor can timeout.
  • tailable {Boolean, default:false}, specify if the cursor is tailable.
  • +
  • tailableRetryInterval {Number, default:100}, specify the miliseconds between getMores on tailable cursor.
  • awaitdata {Boolean, default:false} allow the cursor to wait for data, only applicable for tailable cursor.
  • +
  • exhaust {Boolean, default:false} have the server send all the documents at once as getMore packets, not recommended.
  • batchSize {Number, default:0}, set the batchSize for the getMoreCommand when iterating over the query results.
  • returnKey {Boolean, default:false}, only return the index key.
  • maxScan {Number}, Limit the number of items to scan.
  • @@ -1292,7 +1294,7 @@

    find
  • comment {String}, You can put a $comment field on a query to make looking in the profiler logs simpler.
  • raw {Boolean, default:false}, Return all BSON documents as Raw Buffer documents.
  • readPreference {String}, the preferred read preference ((Server.PRIMARY, Server.PRIMARY_PREFERRED, Server.SECONDARY, Server.SECONDARY_PREFERRED, Server.NEAREST).
  • -
  • numberOfRetries {Number, default:1}, if using awaidata specifies the number of times to retry on timeout.
  • +
  • numberOfRetries {Number, default:5}, if using awaidata specifies the number of times to retry on timeout.
  • @@ -1548,6 +1550,9 @@

    createIndex| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.4 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.5 documentation (index) »
  • @@ -85,9 +85,10 @@

    Constructor| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.4 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.5 documentation (index) »
  • @@ -499,7 +499,7 @@

    Navigation

    @@ -1777,13 +1777,16 @@

    createIndex
    Options
      -
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    • +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a
    • unique {Boolean, default:false}, creates an unique index.
    • sparse {Boolean, default:false}, creates a sparse index.
    • background {Boolean, default:false}, creates the index in the background, yielding whenever possible.
    • dropDups {Boolean, default:false}, a unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value
    • min {Number}, for geospatial indexes set the lower bound for the co-ordinates.
    • max {Number}, for geospatial indexes set the high bound for the co-ordinates.
    • +
    • v {Number}, specify the format version of the indexes.
    • +
    • expireAfterSeconds {Number}, allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher)
    • +
    • name {String}, override the autogenerated index name (useful if the resulting name is larger than 128 bytes)
    @@ -1877,7 +1880,8 @@

    ensureIndex| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.4 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.5 documentation (index) »
  • @@ -434,7 +434,7 @@

    Navigation

    @@ -2280,7 +2280,7 @@

    Navigation

    @@ -390,7 +390,7 @@

    Navigation

    @@ -247,7 +247,7 @@

    Navigation

    @@ -252,7 +252,7 @@

    Navigation

    @@ -480,7 +480,7 @@

    Navigation

    @@ -254,7 +254,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -48,7 +48,20 @@

    Navigation

    Changelog

    -

    1.1.4 2012-08-12

    +

    1.1.5 2012-08-29

    +
      +
    • Fix for eval on replicaset Issue #684
    • +
    • Use helpful error msg when native parser not compiled (Issue #685, https://github.com/aheckmann)
    • +
    • Arbiter connect hotfix (Issue #681, https://github.com/fengmk2)
    • +
    • Upgraded bson parser to 0.1.2 using gyp, deprecated support for node 0.4.X
    • +
    • Added name parameter to createIndex/ensureIndex to be able to override index names larger than 128 bytes
    • +
    • Added exhaust option for find for feature completion (not recommended for normal use)
    • +
    • Added tailableRetryInterval to find for tailable cursors to allow to control getMore retry time interval
    • +
    • Fixes for read preferences when using MongoS to correctly handle no read preference set when iterating over a cursor (Issue #686)
    • +
    +
    +
    +

    1.1.4 2012-08-12

    @@ -219,7 +219,7 @@

    Navigation

    @@ -322,7 +322,7 @@

    Navigation

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -525,7 +525,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -1344,7 +1344,7 @@

    Navigation

    @@ -3295,7 +3295,7 @@

    Navigation

    @@ -1296,7 +1296,7 @@

    Navigation

    @@ -499,7 +499,7 @@

    Navigation

    @@ -2676,7 +2676,7 @@

    Navigation

    @@ -434,7 +434,7 @@

    Navigation

    @@ -2280,7 +2280,7 @@

    Navigation

    @@ -390,7 +390,7 @@

    Navigation

    @@ -247,7 +247,7 @@

    Navigation

    @@ -252,7 +252,7 @@

    Navigation

    @@ -480,7 +480,7 @@

    Navigation

    @@ -254,7 +254,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -48,7 +48,14 @@

    Navigation

    Changelog

    -

    1.1.5 2012-08-29

    +

    1.1.6 2012-09-01

    + +
    +
    +

    1.1.5 2012-08-29

    @@ -322,7 +322,7 @@

    Navigation

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -525,7 +525,7 @@

    Navigation

    @@ -66,7 +66,7 @@

    A simple exampleif(!err) { var grid = new Grid(db, 'fs'); var buffer = new Buffer("Hello world"); - grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) { + grid.put(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) { if(!err) { console.log("Finished writing file to Mongo"); } @@ -83,10 +83,10 @@

    A simple example
    var buffer = new Buffer("Hello world");
    -grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) {
    +grid.put(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) {
       if(!err) {
         console.log("Finished writing file to Mongo");
       }
    @@ -129,7 +129,7 @@ 

    A simple example

    Advanced GridFS or how not to run out of memory

    -

    As we just said controlling memory consumption for you file writing and reading is key if you want to scale up the application. That means not reading in entire files before either writing or reading from Mongo DB. The good news it’s supported. Let’s throw some code out there straight away and look at how to do chunk sized streaming writes and reads.

    +

    As we just said controlling memory consumption for you file writing and reading is key if you want to scale up the application. That means not reading in entire files before either writing or reading from Mongo DB. The good news is, it’s supported. Let’s throw some code out there straight away and look at how to do chunk sized streaming writes and reads.

    the requires and and other initializing stuff omitted for brevity

    var fileId = new ObjectID();
    @@ -453,7 +453,7 @@ 

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -1344,7 +1344,7 @@

    Navigation

    @@ -1283,6 +1283,7 @@

    find
  • timeout {Boolean, default:false}, specify if the cursor can timeout.
  • tailable {Boolean, default:false}, specify if the cursor is tailable.
  • tailableRetryInterval {Number, default:100}, specify the miliseconds between getMores on tailable cursor.
  • +
  • numberOfRetries {Number, default:5}, specify the number of times to retry the tailable cursor.
  • awaitdata {Boolean, default:false} allow the cursor to wait for data, only applicable for tailable cursor.
  • exhaust {Boolean, default:false} have the server send all the documents at once as getMore packets, not recommended.
  • batchSize {Number, default:0}, set the batchSize for the getMoreCommand when iterating over the query results.
  • @@ -1295,6 +1296,7 @@

    find
  • raw {Boolean, default:false}, Return all BSON documents as Raw Buffer documents.
  • readPreference {String}, the preferred read preference ((Server.PRIMARY, Server.PRIMARY_PREFERRED, Server.SECONDARY, Server.SECONDARY_PREFERRED, Server.NEAREST).
  • numberOfRetries {Number, default:5}, if using awaidata specifies the number of times to retry on timeout.
  • +
  • partial {Boolean, default:false}, specify if the cursor should return partial results when querying against a sharded system
  • @@ -1471,6 +1473,7 @@

    findOne collection.insert([{'a':2}, {'b':5}, {'a':1}], {safe:true}, function(err, ids) { // Perform a group count - collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }" - , function(err, results) { + collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }", function(err, results) { assert.equal(3, results[0].count); // Pefrom a group count using the eval method - collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }" - , false, function(err, results) { + collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }", false, function(err, results) { + console.dir(err) assert.equal(3, results[0].count); // Group with a conditional - collection.group([], {'a':{'$gt':1}}, {"count":0}, "function (obj, prev) { prev.count++; }" - , function(err, results) { + collection.group([], {'a':{'$gt':1}}, {"count":0}, "function (obj, prev) { prev.count++; }", function(err, results) { // Results assert.equal(1, results[0].count); // Group with a conditional using the EVAL method - collection.group([], {'a':{'$gt':1}}, {"count":0}, "function (obj, prev) { prev.count++; }" - , false, function(err, results) { + collection.group([], {'a':{'$gt':1}}, {"count":0}, "function (obj, prev) { prev.count++; }" , false, function(err, results) { // Results assert.equal(1, results[0].count); @@ -2315,8 +2315,7 @@

    group collection.insert([{'a':2}, {'b':3}], {safe:true}, function(err, ids) { // Do a Group by field a - collection.group(['a'], {}, {"count":0}, "function (obj, prev) { prev.count++; }" - , function(err, results) { + collection.group(['a'], {}, {"count":0}, "function (obj, prev) { prev.count++; }", function(err, results) { // Results assert.equal(2, results[0].a); assert.equal(2, results[0].count); @@ -2326,8 +2325,7 @@

    group assert.equal(1, results[2].count); // Do a Group by field a - collection.group({'a':true}, {}, {"count":0}, function (obj, prev) { prev.count++; } - , true, function(err, results) { + collection.group({'a':true}, {}, {"count":0}, function (obj, prev) { prev.count++; }, true, function(err, results) { // Results assert.equal(2, results[0].a); assert.equal(2, results[0].count); @@ -2343,8 +2341,7 @@

    group // Use a function to select the keys used to group by var keyf = function(doc) { return {a: doc.a}; }; - collection.group(keyf, {a: {$gt: 0}}, {"count": 0, "value": 0} - , function(obj, prev) { prev.count++; prev.value += obj.a; }, true, function(err, results) { + collection.group(keyf, {a: {$gt: 0}}, {"count": 0, "value": 0}, function(obj, prev) { prev.count++; prev.value += obj.a; }, true, function(err, results) { // Results results.sort(function(a, b) { return b.count - a.count; }); assert.equal(2, results[0].count); @@ -2356,8 +2353,7 @@

    group // Use a Code object to select the keys used to group by var keyf = new Code(function(doc) { return {a: doc.a}; }); - collection.group(keyf, {a: {$gt: 0}}, {"count": 0, "value": 0} - , function(obj, prev) { prev.count++; prev.value += obj.a; }, true, function(err, results) { + collection.group(keyf, {a: {$gt: 0}}, {"count": 0, "value": 0}, function(obj, prev) { prev.count++; prev.value += obj.a; }, true, function(err, results) { // Results results.sort(function(a, b) { return b.count - a.count; }); assert.equal(2, results[0].count); @@ -2388,6 +2384,7 @@

    group }); }); }); +} @@ -3295,7 +3292,7 @@

    Navigation

    @@ -88,7 +88,8 @@

    Constructor -

    streamRecords

    -

    Returns a stream object that can be used to listen to and stream records -(Use the CursorStream object instead as this is deprected)

    -
    -
    Options
    -
      -
    • fetchSize {Number} the number of records to fetch in each batch (steam specific batchSize).
    • -
    -
    -
    Events
    -
      -
    • data {function(item) {}} the data event triggers when a document is ready.
    • -
    • error {function(err) {}} the error event triggers if an error happens.
    • -
    • end {function() {}} the end event triggers when there is no more documents available.
    • -
    -
    -
    -
    -
    -streamRecords([options])
    -
    --- - - - - - -
    Arguments:
      -
    • [options] (object) – additional options for streamRecords.
    • -
    -
    Returns:

    eventemitter returns a stream object.

    -
    -
    - -

    Examples

    -
    -

    A simple example showing the use of the cursor streamRecords function.

    -
    var Db = require('mongodb').Db,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    - {auto_reconnect: false, poolSize: 1}), {native_parser: false});
    -
    -// Establish connection to db
    -db.open(function(err, db) {
    -
    -  // Create a lot of documents to insert
    -  var docs = []
    -  for(var i = 0; i < 100; i++) {
    -    docs.push({'a':i})
    -  }
    -
    -  // Create a collection
    -  db.createCollection('test_streamingRecords_function', function(err, collection) {
    -    assert.equal(null, err);
    -
    -    // Insert documents into collection
    -    collection.insert(docs, {safe:true}, function(err, ids) {
    -      // Peform a find to get a cursor
    -      var stream = collection.find().streamRecords({fetchSize:1000});
    -
    -      // Execute find on all the documents
    -      stream.on('end', function() {
    -        db.close();
    -      });
    -
    -      stream.on('data', function(data) {
    -        assert.ok(data != null);
    -      });
    -    });
    -  });
    -});
    -
    -
    -
    -

    stream

    Returns a Node ReadStream interface for this cursor.

    @@ -1136,7 +1051,6 @@

    Contents

  • batchSize
  • nextObject
  • explain
  • -
  • streamRecords
  • stream
  • close
  • isClosed
  • @@ -1296,7 +1210,7 @@

    Navigation

    @@ -139,7 +139,9 @@

    pause setTimeout(function() { stream.resume(); // Check if cursor is paused - assert.equal(false, stream.paused); + process.nextTick(function() { + assert.equal(false, stream.paused); + }) }, 1); }); @@ -212,7 +214,9 @@

    resumestream.resume(); // Check if cursor is paused - assert.equal(false, stream.paused); + process.nextTick(function() { + assert.equal(false, stream.paused); + }); }, 1); }); @@ -499,7 +503,7 @@

    Navigation

    @@ -817,6 +817,7 @@

    eval// Establish connection to db db.open(function(err, db) { + var numberOfTests = // Evaluate a function on the server with the parameter 3 passed in db.eval('function (x) {return x;}', [3], function(err, result) { @@ -874,11 +875,44 @@

    evalassert.ok(err instanceof Error); assert.ok(err.message != null); // Let's close the db - test.done(); + db.close(); }); +}); + + +

    Defining and calling a system level javascript function (NOT recommended, <a href=’http://www.mongodb.org/display/DOCS/Server-side+Code+Execution’>http://www.mongodb.org/display/DOCS/Server-side+Code+Execution</a>)

    +
    var Db = require('mongodb').Db,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
     
    -  db.close();
    -  test.done();
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 1}), {native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +
    +  // Clean out the collection
    +  db.collection("system.js").remove({}, {safe:true}, function(err, result) {
    +    assert.equal(null, err);
    +
    +    // Define a system level function
    +    db.collection("system.js").insert({_id: "echo", value: new Code("function(x) { return x; }")}, {safe:true}, function(err, result) {
    +      assert.equal(null, err);
    +
    +      db.eval("echo(5)", function(err, result) {
    +        assert.equal(null, err);
    +        assert.equal(5, result);
    +
    +        db.close();
    +      });
    +    });
    +  });
     });
     
    @@ -2676,7 +2710,7 @@

    Navigation

    @@ -434,7 +434,7 @@

    Navigation

    @@ -2280,7 +2280,7 @@

    Navigation

    @@ -148,7 +148,6 @@

    Driver APIbatchSize
  • nextObject
  • explain
  • -
  • streamRecords
  • stream
  • close
  • isClosed
  • @@ -390,7 +389,7 @@

    Navigation

    @@ -247,7 +247,7 @@

    Navigation

    @@ -252,7 +252,7 @@

    Navigation

    @@ -480,7 +480,7 @@

    Navigation

    @@ -254,7 +254,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -48,14 +48,36 @@

    Navigation

    Changelog

    -

    1.1.6 2012-09-01

    +

    1.1.8

    +
      +
    • Fixed db.eval to correctly handle system.js global javascript functions (Issue #709)
    • +
    • Cleanup of non-closing connections (Issue #706)
    • +
    • More cleanup of connections under replicaset (Issue #707, https://github.com/elbert3)
    • +
    • Set keepalive on as default, override if not needed
    • +
    • Cleanup of jsbon install to correctly build without install.js script (https://github.com/shtylman)
    • +
    • Added domain socket support new Server(&quot;/tmp/mongodb.sock&quot;) style
    • +
    +
    +
    +

    1.1.7 2012-09-10

    +
      +
    • Protect against starting PingStrategy being called more than once (Issue #694, https://github.com/aheckmann)
    • +
    • Make PingStrategy interval configurable (was 1 second, relaxed to 5) (Issue #693, https://github.com/aheckmann)
    • +
    • Made PingStrategy api more consistant, callback to start/stop methods are optional (Issue #693, https://github.com/aheckmann)
    • +
    • Proper stopping of strategy on replicaset stop
    • +
    • Throw error when gridstore file is not found in read mode (Issue #702, https://github.com/jbrumwell)
    • +
    • Cursor stream resume now using nextTick to avoid duplicated records (Issue #696)
    • +
    +
    +
    +

    1.1.6 2012-09-01

    -
    -

    1.1.5 2012-08-29

    +
    +

    1.1.5 2012-08-29

    @@ -322,7 +322,7 @@

    Navigation

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -97,7 +97,7 @@

    Getting that connection to the database| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.1.8 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.1.9 documentation (index) »
  • @@ -453,7 +453,7 @@

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -1344,7 +1344,7 @@

    Navigation

    @@ -3292,7 +3292,7 @@

    Navigation

    @@ -1210,7 +1210,7 @@

    Navigation

    @@ -503,7 +503,7 @@

    Navigation

    @@ -2710,7 +2710,7 @@

    Navigation

    @@ -434,7 +434,7 @@

    Navigation

    @@ -2280,7 +2280,7 @@

    Navigation

    @@ -389,7 +389,7 @@

    Navigation

    @@ -247,7 +247,7 @@

    Navigation

    @@ -252,7 +252,7 @@

    Navigation

    @@ -480,7 +480,7 @@

    Navigation

    @@ -254,7 +254,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -48,7 +48,13 @@

    Navigation

    Changelog

    -

    1.1.8

    +

    1.1.9 2012-10-05

    +
      +
    • Updated bson to 0.1.5 to fix build problem on sunos/windows.
    • +
    +
    +
    +

    1.1.8 2012-10-01

    -
    -

    1.1.7 2012-09-10

    +
    +

    1.1.7 2012-09-10

    @@ -322,7 +322,7 @@

    Navigation

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -525,7 +525,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -111,7 +111,7 @@

    buildInfoassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -180,7 +180,7 @@

    serverStatusassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -258,7 +258,7 @@

    profilingLevelassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -335,7 +335,7 @@

    pingassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -406,7 +406,7 @@

    authenticateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -480,7 +480,7 @@

    logoutassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -560,7 +560,7 @@

    addUserassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -633,7 +633,7 @@

    removeUserassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -709,7 +709,7 @@

    setProfilingLevelassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -815,7 +815,7 @@

    profilingInfoassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -909,7 +909,7 @@

    commandassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -981,7 +981,7 @@

    validateCollectionassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1065,7 +1065,7 @@

    listDatabasesassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1122,7 +1122,7 @@

    replSetGetStatusassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1344,7 +1344,7 @@

    Navigation

    @@ -134,7 +134,7 @@

    insertassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -169,7 +169,7 @@

    insertassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -205,7 +205,7 @@

    insertassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -241,7 +241,7 @@

    insertassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -332,7 +332,7 @@

    removeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -374,7 +374,7 @@

    removeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -436,7 +436,7 @@

    renameassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -566,7 +566,7 @@

    saveassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -603,7 +603,7 @@

    saveassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -691,7 +691,7 @@

    updateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -733,7 +733,7 @@

    updateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -770,7 +770,7 @@

    updateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -850,7 +850,7 @@

    distinctassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -890,7 +890,7 @@

    distinctassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -960,7 +960,7 @@

    count assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1027,7 +1027,7 @@

    dropassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1124,7 +1124,7 @@

    findAndModifyassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1222,7 +1222,7 @@

    findAndRemoveassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1335,7 +1335,7 @@

    findassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1372,7 +1372,7 @@

    findassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1409,7 +1409,7 @@

    findassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1512,7 +1512,7 @@

    findOneassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1594,7 +1594,7 @@

    createIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1635,7 +1635,7 @@

    createIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1729,7 +1729,7 @@

    ensureIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1813,7 +1813,7 @@

    indexInformationassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1889,7 +1889,7 @@

    dropIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1987,7 +1987,7 @@

    reIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2081,7 +2081,7 @@

    mapReduceassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2127,7 +2127,7 @@

    mapReduceassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2180,7 +2180,7 @@

    mapReduceassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2277,7 +2277,7 @@

    group assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2425,7 +2425,7 @@

    optionsassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2485,7 +2485,7 @@

    isCappedassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2544,7 +2544,7 @@

    indexExistsassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2632,7 +2632,7 @@

    geoNearassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {safe:false, auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2709,7 +2709,7 @@

    geoHaystackSearchassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2773,7 +2773,7 @@

    indexesassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2848,7 +2848,7 @@

    aggregateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2911,7 +2911,7 @@

    aggregateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2974,7 +2974,7 @@

    aggregateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -3072,7 +3072,7 @@

    stats assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -3292,7 +3292,7 @@

    Navigation

    @@ -160,7 +160,7 @@

    rewindassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -241,7 +241,7 @@

    toArrayassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -307,7 +307,7 @@

    eachassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -381,7 +381,7 @@

    count assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -449,7 +449,7 @@

    sortassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -519,7 +519,7 @@

    limit assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -607,7 +607,7 @@

    skipassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -672,7 +672,7 @@

    batchSizeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -732,7 +732,7 @@

    nextObjectassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -793,7 +793,7 @@

    explainassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -849,7 +849,7 @@

    streamassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -920,7 +920,7 @@

    close assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -988,7 +988,7 @@

    isClosedassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1210,7 +1210,7 @@

    Navigation

    @@ -106,7 +106,7 @@

    pause assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -178,7 +178,7 @@

    resumeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -254,7 +254,7 @@

    destroyassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -297,7 +297,7 @@

    destroy} var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 5, ssl:useSSL}), {native_parser: native_parser}); + {auto_reconnect: false, poolSize: 5, ssl:useSSL}), {safe:false, native_parser: native_parser}); // Establish connection to db db.open(function(err, db) { @@ -503,7 +503,7 @@

    Navigation

    @@ -75,7 +75,7 @@

    Constructor
    Options
    @@ -112,7 +112,7 @@

    putassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -170,7 +170,7 @@

    getassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -233,7 +233,7 @@

    deleteassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -434,7 +434,7 @@

    Navigation

    @@ -185,7 +185,7 @@

    openassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -228,7 +228,7 @@

    openassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -274,7 +274,7 @@

    openassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -365,7 +365,7 @@

    writeFileassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -410,7 +410,7 @@

    writeFileassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -486,7 +486,7 @@

    close assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -551,7 +551,7 @@

    chunkCollectionassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -613,7 +613,7 @@

    unlinkassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -693,7 +693,7 @@

    collectionassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -756,7 +756,7 @@

    readlinesassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -839,7 +839,7 @@

    rewindassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -931,7 +931,7 @@

    readassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1005,7 +1005,7 @@

    tellassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1090,7 +1090,7 @@

    seekassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1219,7 +1219,7 @@

    eofassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1281,7 +1281,7 @@

    getcassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1350,7 +1350,7 @@

    putsassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1424,7 +1424,7 @@

    streamassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1488,7 +1488,7 @@

    streamassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1564,7 +1564,7 @@

    GridStore.existassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1647,7 +1647,7 @@

    GridStore.listassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1789,7 +1789,7 @@

    GridStore.readassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1859,7 +1859,7 @@

    GridStore.readlinesassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1938,7 +1938,7 @@

    GridStore.unlinkassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2032,7 +2032,7 @@

    write assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2280,7 +2280,7 @@

    Navigation

    @@ -389,7 +389,7 @@

    Navigation

    @@ -247,7 +247,7 @@

    Navigation

    @@ -252,7 +252,7 @@

    Navigation

    @@ -108,7 +108,7 @@

    pause assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -181,7 +181,7 @@

    destroyassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -242,7 +242,7 @@

    resumeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -480,7 +480,7 @@

    Navigation

    @@ -254,7 +254,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -48,13 +48,21 @@

    Navigation

    Changelog

    -

    1.1.9 2012-10-05

    +

    1.1.10 2012-10-08

    -

    1.1.8 2012-10-01

    +

    1.1.9 2012-10-05

    +
      +
    • Updated bson to 0.1.5 to fix build problem on sunos/windows.
    • +
    +
    +
    +

    1.1.8 2012-10-01

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -525,7 +525,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -402,7 +402,7 @@

    Navigation

    @@ -1001,7 +1001,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -352,7 +352,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    Navigation

    @@ -234,7 +234,7 @@

    Navigation

    @@ -467,7 +467,7 @@

    Navigation

    @@ -259,7 +259,7 @@

    Navigation

    @@ -1027,7 +1027,7 @@

    Navigation

    @@ -1344,7 +1344,7 @@

    Navigation

    @@ -109,7 +109,7 @@

    insertArguments:
    • docs (array) –
    • [options] (object) – optional options for insert command
    • -
    • [callback] (function) – optional callback for the function, must be provided when using safe or strict mode
    • +
    • [callback] (function) – optional callback for the function, must be provided when using safe mode
    @@ -3292,7 +3292,7 @@

    Navigation

    @@ -1210,7 +1210,7 @@

    Navigation

    @@ -503,7 +503,7 @@

    Navigation

    @@ -2709,7 +2709,7 @@

    Navigation

    @@ -434,7 +434,7 @@

    Navigation

    @@ -2280,7 +2280,7 @@

    Navigation

    @@ -389,7 +389,7 @@

    Navigation

    @@ -247,7 +247,7 @@

    Navigation

    @@ -252,7 +252,7 @@

    Navigation

    @@ -480,7 +480,7 @@

    Navigation

    @@ -254,7 +254,7 @@

    Navigation

    @@ -263,7 +263,7 @@

    Navigation

    @@ -48,21 +48,27 @@

    Navigation

    Changelog

    -

    1.1.10 2012-10-08

    +

    1.1.11 2012-10-10

    +
      +
    • Removed strict mode and introduced normal handling of safe at DB level.
    • +
    +
    +
    +

    1.1.10 2012-10-08

    -
    -

    1.1.9 2012-10-05

    +
    +

    1.1.9 2012-10-05

    • Updated bson to 0.1.5 to fix build problem on sunos/windows.
    -
    -

    1.1.8 2012-10-01

    +
    +

    1.1.8 2012-10-01

    @@ -371,7 +371,7 @@

    Navigation

    @@ -539,7 +539,7 @@

    Navigation

    @@ -294,7 +294,7 @@

    Navigation

    @@ -218,7 +218,7 @@

    Navigation

    @@ -88,14 +88,7 @@

    Contents

    Manual

    @@ -82,14 +82,11 @@

    Getting that connection to the database
    var mongo = require('mongodb'),
    -  Server = mongo.Server,
    -  Db = mongo.Db;
    +

    Mongo DB and Collections

    @@ -107,16 +120,21 @@

    Mongo DB and Collections
    db.open(function(err, db) {
    -  if(!err) {
    -    db.collection('test', function(err, collection) {});
    +
    // Retrieve
    +var MongoClient = require('mongodb').MongoClient;
     
    -    db.collection('test', {safe:true}, function(err, collection) {});
    +// Connect to the db
    +MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
    +  if(err) { return console.dir(err); }
     
    -    db.createCollection('test', function(err, collection) {});
    +  db.collection('test', function(err, collection) {});
    +
    +  db.collection('test', {w:1}, function(err, collection) {});
    +
    +  db.createCollection('test', function(err, collection) {});
    +
    +  db.createCollection('test', {w:1}, function(err, collection) {});
     
    -    db.createCollection('test', {safe:true}, function(err, collection) {});
    -  }
     });
     
    @@ -155,20 +173,24 @@

    And then there was CRUD

    So let’s get dirty with the basic operations for Mongo DB. The Mongo DB wire protocol is built around 4 main operations insert/update/remove/query . Most operations on the database are actually queries with special json objects defining the operation on the database. But I’m getting ahead of myself. Let’s go back and look at insert first and do it with some code.

    the requires and and other initializing stuff omitted for brevity

    -
    db.open(function(err, db) {
    -  if(!err) {
    -    db.collection('test', function(err, collection) {
    -      var doc1 = {'hello':'doc1'};
    -      var doc2 = {'hello':'doc2'};
    -      var lotsOfDocs = [{'hello':'doc3'}, {'hello':'doc4'}];
    +
    // Retrieve
    +var MongoClient = require('mongodb').MongoClient;
     
    -      collection.insert(doc1);
    +// Connect to the db
    +MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
    +  if(err) { return console.dir(err); }
     
    -      collection.insert(doc2, {safe:true}, function(err, result) {});
    +  var collection = db.collection('test');
    +  var doc1 = {'hello':'doc1'};
    +  var doc2 = {'hello':'doc2'};
    +  var lotsOfDocs = [{'hello':'doc3'}, {'hello':'doc4'}];
    +
    +  collection.insert(doc1);
    +
    +  collection.insert(doc2, {w:1}, function(err, result) {});
    +
    +  collection.insert(lotsOfDocs, {w:1}, function(err, result) {});
     
    -      collection.insert(lotsOfDocs, {safe:true}, function(err, result) {});
    -    });
    -  }
     });
     
    @@ -197,22 +219,25 @@

    And then there was CRUDRight that’s the basics of insert’s ironed out. We got some documents in there but want to update them as we need to change the content of a field. Let’s have a look at a simple example and then we will dive into how Mongo DB updates work and how to do them efficiently.

    the requires and and other initializing stuff omitted for brevity

    -
    db.open(function(err, db) {
    -  if(!err) {
    -    db.collection('test', function(err, collection) {
    -      var doc = {mykey:1, fieldtoupdate:1};
    +
    // Retrieve
    +var MongoClient = require('mongodb').MongoClient;
     
    -      collection.insert(doc, {safe:true}, function(err, result) {
    -        collection.update({mykey:1}, {$set:{fieldtoupdate:2}}, {safe:true}, function(err, result) {});
    -      });
    +// Connect to the db
    +MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
    +  if(err) { return console.dir(err); }
     
    -      var doc2 = {mykey:2, docs:[{doc1:1}]};
    +  var collection = db.collection('test');
    +  var doc = {mykey:1, fieldtoupdate:1};
     
    -      collection.insert(doc2, {safe:true}, function(err, result) {
    -        collection.update({mykey:2}, {$push:{docs:{doc2:1}}, {safe:true}, function(err, result) {});
    -      });
    -    });
    -  };
    +  collection.insert(doc, {w:1}, function(err, result) {
    +    collection.update({mykey:1}, {$set:{fieldtoupdate:2}}, {w:1}, function(err, result) {});
    +  });
    +
    +  var doc2 = {mykey:2, docs:[{doc1:1}]};
    +
    +  collection.insert(doc2, {w:1}, function(err, result) {
    +    collection.update({mykey:2}, {$push:{docs:{doc2:1}}, {w:1}, function(err, result) {});
    +  });
     });
     
    @@ -249,21 +274,24 @@

    And then there was CRUDLet’s have a look at the remove operation for the driver. As before let’s start with a piece of code.

    the requires and and other initializing stuff omitted for brevity

    -
    db.open(function(err, db) {
    -  if(!err) {
    -    db.collection('test', function(err, collection) {
    -      var docs = [{mykey:1}, {mykey:2}, {mykey:3}];
    +
    // Retrieve
    +var MongoClient = require('mongodb').MongoClient;
     
    -      collection.insert(docs, {safe:true}, function(err, result) {
    +// Connect to the db
    +MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
    +  if(err) { return console.dir(err); }
     
    -        collection.remove({mykey:1});
    +  var collection = db.collection('test');
    +  var docs = [{mykey:1}, {mykey:2}, {mykey:3}];
     
    -        collection.remove({mykey:2}, {safe:true}, function(err, result) {});
    +  collection.insert(docs, {w:1}, function(err, result) {
     
    -        collection.remove();
    -      });
    -    });
    -  };
    +    collection.remove({mykey:1});
    +
    +    collection.remove({mykey:2}, {w:1}, function(err, result) {});
    +
    +    collection.remove();
    +  });
     });
     
    @@ -295,24 +323,27 @@

    Time to QueryMongo DB advanced queries . There are literarily tons of ways to search and ways to limit the query. Let’s look at some simple code for dealing with queries in different ways.

    the requires and and other initializing stuff omitted for brevity

    -
    db.open(function(err, db) {
    -  if(!err) {
    -    db.collection('test', function(err, collection) {
    -      var docs = [{mykey:1}, {mykey:2}, {mykey:3}];
    +
    // Retrieve
    +var MongoClient = require('mongodb').MongoClient;
    +
    +// Connect to the db
    +MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
    +  if(err) { return console.dir(err); }
    +
    +  var collection = db.collection('test');
    +  var docs = [{mykey:1}, {mykey:2}, {mykey:3}];
     
    -      collection.insert(docs, {safe:true}, function(err, result) {
    +  collection.insert(docs, {w:1}, function(err, result) {
     
    -        collection.find().toArray(function(err, items) {});
    +    collection.find().toArray(function(err, items) {});
     
    -        var stream = collection.find({mykey:{$ne:2}}).streamRecords();
    -        stream.on("data", function(item) {});
    -        stream.on("end", function() {});
    +    var stream = collection.find({mykey:{$ne:2}}).streamRecords();
    +    stream.on("data", function(item) {});
    +    stream.on("end", function() {});
     
    -        collection.findOne({mykey:1}, function(err, item) {});
    +    collection.findOne({mykey:1}, function(err, item) {});
     
    -      });
    -    });
    -  };
    +  });
     });
     
    @@ -379,14 +410,7 @@

    Contents

    Manual

    @@ -54,24 +54,20 @@

    A simple example
    var mongo = require('mongodb'),
    -  Server = mongo.Server,
    -  Db = mongo.Db,
    -Grid = mongo.Grid;
    +
    var MongoClient = require('mongodb').MongoClient,
    +  Grid = mongo.Grid;
     
    -var server = new Server('localhost', 27017, {auto_reconnect: true});
    -var db = new Db('exampleDb', server);
    +// Connect to the db
    +MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
    +  if(err) return console.dir(err);
     
    -db.open(function(err, db) {
    -  if(!err) {
    -    var grid = new Grid(db, 'fs');
    -    var buffer = new Buffer("Hello world");
    -    grid.put(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) {
    -      if(!err) {
    -        console.log("Finished writing file to Mongo");
    -      }
    -    });
    -  }
    +  var grid = new Grid(db, 'fs');
    +  var buffer = new Buffer("Hello world");
    +  grid.put(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) {
    +    if(!err) {
    +      console.log("Finished writing file to Mongo");
    +    }
    +  });
     });
     
    @@ -99,18 +95,22 @@

    A simple example
    db.open(function(err, db) {
    -  if(!err) {
    -    var grid = new Grid(db, 'fs');
    -    var buffer = new Buffer("Hello world");
    -    grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) {
    -      grid.get(fileInfo._id, function(err, data) {
    -        console.log("Retrieved data: " + data.toString());
    -        grid.delete(fileInfo._id, function(err, result) {
    -        });
    +
    var MongoClient = require('mongodb').MongoClient,
    +  Grid = mongo.Grid;
    +
    +// Connect to the db
    +MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
    +  if(err) return console.dir(err);
    +
    +  var grid = new Grid(db, 'fs');
    +  var buffer = new Buffer("Hello world");
    +  grid.put.(buffer, {metadata:{category:'text'}, content_type: 'text'}, function(err, fileInfo) {
    +    grid.get(fileInfo._id, function(err, data) {
    +      console.log("Retrieved data: " + data.toString());
    +      grid.delete(fileInfo._id, function(err, result) {
           });
         });
    -  }
    +  });
     });
     
    @@ -180,8 +180,7 @@

    Advanced GridFS or how not to run out of memory
    var gridStore = new GridStore(db, fileId, "r");
    -gridStore.open(function(err, gridStore) {
    +
    @@ -256,14 +256,7 @@

    Contents

    Manual

    @@ -209,6 +208,7 @@

    BSON.calculateObjectSize
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -261,6 +261,7 @@ 

    BSON.serializeWithBufferAndIndex
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -325,6 +326,7 @@ 

    BSON.serialize
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -389,6 +391,7 @@ 

    BSON.deserializeStream

    A simple example showing the usage of BSON.deserializeStream function returning deserialized Javascript objects.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -466,6 +469,7 @@ 

    BSON.deserialize
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -534,6 +538,7 @@ 

    deserialize
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -607,6 +612,7 @@ 

    deserializeStream
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -678,6 +684,7 @@ 

    serialize
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -731,6 +738,7 @@ 

    calculateObjectSize @@ -98,14 +98,7 @@

    Contents

    Manual

    @@ -114,14 +114,7 @@

    Contents

    Manual

    @@ -206,14 +206,7 @@

    Contents

    Manual

    @@ -881,14 +881,7 @@

    Contents

    Manual

    @@ -90,14 +90,7 @@

    Contents

    Manual

    @@ -88,14 +88,7 @@

    Contents

    Manual

    @@ -94,6 +94,7 @@

    toHexString
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -137,6 +138,7 @@ 

    equals
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -181,6 +183,7 @@ 

    getTimestamp
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -230,6 +233,7 @@ 

    ObjectID.createFromTime

    Show the usage of the Objectid createFromTime function

    @@ -113,14 +113,7 @@

    Contents

    Manual

    @@ -881,14 +881,7 @@

    Contents

    Manual

    @@ -86,7 +86,7 @@

    buildInfo Arguments:
      -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from buildInfo or null if an error occured.
    @@ -101,6 +101,7 @@

    buildInfo
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -111,7 +112,7 @@ 

    buildInfoassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -155,7 +156,7 @@

    serverStatus Arguments:
      -
    • callback (function) – returns the server status.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from serverStatus or null if an error occured.
    @@ -170,6 +171,7 @@

    serverStatus
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -180,7 +182,7 @@ 

    serverStatusassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -193,7 +195,7 @@

    serverStatus// Force the creation of the collection by inserting a document // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { + collection.insert({'a':1}, {w: 1}, function(err, doc) { // Use the admin database for the operation db.admin(function(err, adminDb) { @@ -233,7 +235,7 @@

    profilingLevel Arguments:
      -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from profilingLevel or null if an error occured.
    @@ -248,6 +250,7 @@

    profilingLevel
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -258,7 +261,7 @@ 

    profilingLevelassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -271,7 +274,7 @@

    profilingLevel// Force the creation of the collection by inserting a document // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { + collection.insert({'a':1}, {w: 1}, function(err, doc) { // Use the admin database for the operation db.admin(function(err, adminDb) { @@ -310,7 +313,7 @@

    ping¶ Arguments:
      -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from ping or null if an error occured.
    @@ -325,6 +328,7 @@

    ping

    An example of how to add a user to the admin database

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -335,7 +339,7 @@ 

    pingassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -381,7 +385,7 @@

    authenticateArguments:
    • username (string) – The user name for the authentication.
    • password (string) – The password for the authentication.
    • -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from authenticate or null if an error occured.
    @@ -396,6 +400,7 @@

    authenticate
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -406,7 +411,7 @@ 

    authenticateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -419,7 +424,7 @@

    authenticate// Force the creation of the collection by inserting a document // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { + collection.insert({'a':1}, {w:1}, function(err, doc) { // Use the admin database for the operation db.admin(function(err, adminDb) { @@ -455,7 +460,7 @@

    logout Arguments:
    • [options] (object) – Optional parameters to the command.
    • -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from logout or null if an error occured.
    @@ -470,6 +475,7 @@

    logout
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -480,7 +486,7 @@ 

    logoutassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -535,7 +541,7 @@

    addUser
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -560,7 +567,7 @@ 

    addUserassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -608,7 +615,7 @@

    removeUserArguments:
    • username (string) – The user name for the authentication.
    • [options] (object) – additional options during update.
    • -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from removeUser or null if an error occured.
    @@ -623,6 +630,7 @@

    removeUser
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -633,7 +641,7 @@ 

    removeUserassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -683,7 +691,7 @@

    setProfilingLevel Arguments:
    • level (string) – The new profiling level (off, slow_only, all)
    • -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from setProfilingLevel or null if an error occured.
    @@ -699,6 +707,7 @@

    setProfilingLevel
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -709,7 +718,7 @@ 

    setProfilingLevelassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -722,7 +731,7 @@

    setProfilingLevel// Force the creation of the collection by inserting a document // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { + collection.insert({'a':1}, {w: 1}, function(err, doc) { // Use the admin database for the operation db.admin(function(err, adminDb) { @@ -789,7 +798,7 @@

    profilingInfo Arguments:
      -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from profilingInfo or null if an error occured.
    @@ -805,6 +814,7 @@

    profilingInfo
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -815,7 +825,7 @@ 

    profilingInfoassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -828,7 +838,7 @@

    profilingInfo// Force the creation of the collection by inserting a document // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(doc) { + collection.insert({'a':1}, {w: 1}, function(doc) { // Use the admin database for the operation db.admin(function(err, adminDb) { @@ -884,7 +894,7 @@

    commandArguments:
    • command (object) – A command object {ping:1}.
    • [options] (object) – Optional parameters to the command.
    • -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The command always return the whole result of the command as the second parameter.
    @@ -899,6 +909,7 @@

    command
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -909,7 +920,7 @@ 

    commandassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -955,7 +966,7 @@

    validateCollectionArguments:
    • collectionName (string) – The name of the collection to validate.
    • [options] (object) – Optional parameters to the command.
    • -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from validateCollection or null if an error occured.
    @@ -971,6 +982,7 @@

    validateCollection
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -981,7 +993,7 @@ 

    validateCollectionassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -994,7 +1006,7 @@

    validateCollection// Force the creation of the collection by inserting a document // Collections are not created until the first document is inserted - collection.insert({'a':1}, {safe:true}, function(err, doc) { + collection.insert({'a':1}, {w: 1}, function(err, doc) { // Use the admin database for the operation db.admin(function(err, adminDb) { @@ -1040,7 +1052,7 @@

    listDatabases Arguments:
      -
    • callback (function) – Callback function of format function(err, result) {}.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from listDatabases or null if an error occured.
    @@ -1055,6 +1067,7 @@

    listDatabases
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1065,7 +1078,7 @@ 

    listDatabasesassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1097,7 +1110,7 @@

    replSetGetStatus Arguments:
      -
    • callback (function) – returns the replica set status (if available).
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from replSetGetStatus or null if an error occured.
    @@ -1112,6 +1125,7 @@

    replSetGetStatus

    @@ -93,11 +93,19 @@

    insert
    Options
    +
    Deprecated Options
    +
      +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    • +
    +
    @@ -109,7 +117,7 @@

    insertArguments:
    • docs (array) –
    • [options] (object) – optional options for insert command
    • -
    • [callback] (function) – optional callback for the function, must be provided when using safe mode
    • +
    • [callback] (function) – optional callback for the function, must be provided when using a writeconcern
    @@ -124,6 +132,7 @@

    insert
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -134,7 +143,7 @@ 

    insertassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -159,6 +168,7 @@

    insert
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -169,7 +179,7 @@ 

    insertassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -179,7 +189,7 @@

    insert// Insert a single document collection.insert([{hello:'world_safe1'} - , {hello:'world_safe2'}], {safe:true}, function(err, result) { + , {hello:'world_safe2'}], {w:1}, function(err, result) { assert.equal(null, err); // Fetch the document @@ -195,6 +205,7 @@

    insert
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -205,7 +216,7 @@ 

    insertassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -215,7 +226,7 @@

    insert// Insert a single document collection.insert({hello:'world' - , func:function() {}}, {safe:true, serializeFunctions:true}, function(err, result) { + , func:function() {}}, {w:1, serializeFunctions:true}, function(err, result) { assert.equal(null, err); // Fetch the document @@ -231,6 +242,7 @@

    insert
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -241,7 +253,7 @@ 

    insertassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -260,12 +272,12 @@

    insert// Insert some intial data into the collection collection.insert([{name:"Jim"} - , {name:"Sarah", title:"Princess"}], {safe:true}, function(err, result) { + , {name:"Sarah", title:"Princess"}], {w:1}, function(err, result) { // Force keep going flag, ignoring unique index issue collection.insert([{name:"Jim"} , {name:"Sarah", title:"Princess"} - , {name:'Gump', title:"Gump"}], {safe:true, keepGoing:true}, function(err, result) { + , {name:'Gump', title:"Gump"}], {w:1, keepGoing:true}, function(err, result) { // Count the number of documents left (should not include the duplicates) collection.count(function(err, count) { @@ -292,10 +304,18 @@

    remove
    Options
    +
    Deprecated Options
    +
      +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    • +
    +

    @@ -307,7 +327,7 @@

    removeArguments:
    • [selector] (object) – optional select, no selector is equivalent to removing all documents.
    • [options] (object) – additional options during remove.
    • -
    • [callback] (function) – must be provided if you performing a safe remove
    • +
    • [callback] (function) – must be provided if you performing a remove with a writeconcern
    @@ -322,6 +342,7 @@

    remove
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -332,7 +353,7 @@ 

    removeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -341,7 +362,7 @@

    removedb.collection("remove_all_documents_no_safe", function(err, collection) { // Insert a bunch of documents - collection.insert([{a:1}, {b:2}], {safe:true}, function(err, result) { + collection.insert([{a:1}, {b:2}], {w:1}, function(err, result) { assert.equal(null, err); // Remove all the document @@ -364,6 +385,7 @@

    remove
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -374,7 +396,7 @@ 

    removeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -383,11 +405,11 @@

    removedb.collection("remove_subset_of_documents_safe", function(err, collection) { // Insert a bunch of documents - collection.insert([{a:1}, {b:2}], {safe:true}, function(err, result) { + collection.insert([{a:1}, {b:2}], {w:1}, function(err, result) { assert.equal(null, err); // Remove all the document - collection.remove({a:1}, {safe:true}, function(err, numberOfRemovedDocs) { + collection.remove({a:1}, {w:1}, function(err, numberOfRemovedDocs) { assert.equal(null, err); assert.equal(1, numberOfRemovedDocs); db.close(); @@ -426,6 +448,7 @@

    rename
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -436,7 +459,7 @@ 

    renameassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -493,7 +516,7 @@

    rename} // Insert a couple of documents - collection1.insert([{'x':1}, {'x':2}], {safe:true}, function(err, docs) { + collection1.insert([{'x':1}, {'x':2}], {w:1}, function(err, docs) { // Attemp to rename the first collection to the second one, this will fail collection1.rename('test_rename_collection2', function(err, collection) { @@ -527,6 +550,14 @@

    save
    Options
    +
    +
    Deprecated Options
    +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    @@ -556,6 +587,7 @@

    save

    Example of a simple document save with safe set to false

    Example of a simple document save and then resave with safe set to true

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -603,7 +635,7 @@ 

    saveassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -612,7 +644,7 @@

    savedb.collection("save_a_simple_document_modify_it_and_resave_it", function(err, collection) { // Save a document with no safe option - collection.save({hello:'world'}, {safe:true}, function(err, result) { + collection.save({hello:'world'}, {w: 0}, function(err, result) { // Find the saved document collection.findOne({hello:'world'}, function(err, item) { @@ -623,7 +655,7 @@

    saveitem['hello2'] = 'world2'; // Save the item with the additional field - collection.save(item, {safe:true}, function(err, result) { + collection.save(item, {w: 1}, function(err, result) { // Find the changed document collection.findOne({hello:'world'}, function(err, item) { @@ -648,12 +680,20 @@

    update
    Options
    +
    Deprecated Options
    +
      +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    • +
    +

    @@ -666,7 +706,7 @@

    update
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -691,7 +732,7 @@ 

    updateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -700,7 +741,7 @@

    updatedb.collection('update_a_simple_document', function(err, collection) { // Insert a document, then update it - collection.insert({a:1}, {safe:true}, function(err, doc) { + collection.insert({a:1}, {w: 1}, function(err, doc) { // Update the document with an atomic operator collection.update({a:1}, {$set:{b:2}}); @@ -723,6 +764,7 @@

    update
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -733,7 +775,7 @@ 

    updateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -742,7 +784,7 @@

    updatedb.collection('update_a_simple_document_upsert', function(err, collection) { // Update the document using an upsert operation, ensuring creation if it does not exist - collection.update({a:1}, {b:2, a:1}, {upsert:true, safe:true}, function(err, result) { + collection.update({a:1}, {b:2, a:1}, {upsert:true, w: 1}, function(err, result) { assert.equal(null, err); assert.equal(1, result); @@ -760,6 +802,7 @@

    update
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -770,7 +813,7 @@ 

    updateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -779,10 +822,10 @@

    updatedb.collection('update_a_simple_document_multi', function(err, collection) { // Insert a couple of documentations - collection.insert([{a:1, b:1}, {a:1, b:2}], {safe:true}, function(err, result) { + collection.insert([{a:1, b:1}, {a:1, b:2}], {w: 1}, function(err, result) { // Update multiple documents using the multi option - collection.update({a:1}, {$set:{b:0}}, {safe:true, multi:true}, function(err, numberUpdated) { + collection.update({a:1}, {$set:{b:0}}, {w: 1, multi:true}, function(err, numberUpdated) { assert.equal(null, err); assert.equal(2, numberUpdated); @@ -825,7 +868,7 @@

    distinct
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -850,7 +894,7 @@ 

    distinctassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -860,7 +904,7 @@

    distinct// Insert documents to perform distinct against collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}}, - {a:2, b:{c:'a'}}, {a:3}, {a:3}], {safe:true}, function(err, ids) { + {a:2, b:{c:'a'}}, {a:3}, {a:3}], {w: 1}, function(err, ids) { // Peform a distinct query against the a field collection.distinct('a', function(err, docs) { @@ -880,6 +924,7 @@

    distinct
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -890,7 +935,7 @@ 

    distinctassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -900,7 +945,7 @@

    distinct// Insert documents to perform distinct against collection.insert([{a:0, b:{c:'a'}}, {a:1, b:{c:'b'}}, {a:1, b:{c:'c'}}, - {a:2, b:{c:'a'}}, {a:3}, {a:3}, {a:5, c:1}], {safe:true}, function(err, ids) { + {a:2, b:{c:'a'}}, {a:3}, {a:3}, {a:5, c:1}], {w: 1}, function(err, ids) { // Peform a distinct query with a filter against the documents collection.distinct('a', {c:1}, function(err, docs) { @@ -935,7 +980,7 @@

    count Arguments:
    • [query] (object) – query to filter by before performing count.
    • [options] (object) – additional options during count.
    • -
    • callback (function) – must be provided.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the count method or null if an error occured.
    @@ -950,6 +995,7 @@

    count

    Example of running simple count commands against a collection.

    @@ -1017,6 +1063,7 @@

    drop

    Example of a simple document save and then resave with safe set to true

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1027,7 +1074,7 @@ 

    dropassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1071,16 +1118,24 @@

    findAndModify
    Options
    +
    Deprecated Options
    +
      +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    • +
    +
    -findAndModify(query, sort, doc[, options][, callback])
    +findAndModify(query, sort, doc[, options], callback)

    Arguments:
      -
    • [callback] (function) – provide a callback to be notified when command finished executing
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the drop method or null if an error occured.
    @@ -1096,7 +1151,7 @@

    findAndModify
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1124,7 +1180,7 @@ 

    findAndModifyassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1134,7 +1190,7 @@

    findAndModifyassert.equal(null, err); // Insert some test documentations - collection.insert([{a:1}, {b:1}, {c:1}], {safe:true}, function(err, result) { + collection.insert([{a:1}, {b:1}, {c:1}], {w:1}, function(err, result) { assert.equal(null, err); // Simple findAndModify command returning the new document @@ -1156,7 +1212,7 @@

    findAndModify// Simple findAndModify command performing an upsert and returning the new document // executing the command safely collection.findAndModify({d:1}, [['b', 1]], - {d:1, f:1}, {new:true, upsert:true, safe:true}, function(err, doc) { + {d:1, f:1}, {new:true, upsert:true, w:1}, function(err, doc) { assert.equal(null, err); assert.equal(1, doc.d); assert.equal(1, doc.f); @@ -1179,13 +1235,21 @@

    findAndRemove
    Options
    +
    +
    Deprecated Options
    +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    -findAndRemove(query, sort[, options][, callback])
    +findAndRemove(query, sort[, options], callback)

    @@ -1197,7 +1261,7 @@

    findAndRemove

    @@ -1310,7 +1375,7 @@

    find

    @@ -1325,6 +1390,7 @@

    find

    A simple query using the find method on the collection.

    A simple query showing the explain for a query

    A simple query showing skip and limit

    Arguments:
    • query (object) – query object to locate the object to modify
    • [options] (object) – additional options during update.
    • -
    • [callback] (function) – optional callback for cursor.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the find method or null if an error occured.
    @@ -1487,7 +1555,7 @@

    findOne

    @@ -1502,6 +1570,7 @@

    findOne
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1512,7 +1581,7 @@ 

    findOneassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1522,7 +1591,7 @@

    findOneassert.equal(null, err); // Insert a bunch of documents for the testing - collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {safe:true}, function(err, result) { + collection.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {w:1}, function(err, result) { assert.equal(null, err); // Peform a simple find and return all the documents @@ -1546,7 +1615,10 @@

    createIndex
    Options
    +
    @@ -1569,7 +1646,7 @@

    createIndex

    @@ -1584,6 +1661,7 @@

    createIndex
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1594,7 +1672,7 @@ 

    createIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1604,11 +1682,11 @@

    createIndexassert.equal(null, err); // Insert a bunch of documents for the index - collection.insert([{a:1}, {a:2}, {a:3}, {a:4}], {safe:true}, function(err, result) { + collection.insert([{a:1}, {a:2}, {a:3}, {a:4}], {w:1}, function(err, result) { assert.equal(null, err); // Create an index on the a field - collection.createIndex('a', {safe:true}, function(err, indexName) { + collection.createIndex('a', {w:1}, function(err, indexName) { assert.equal("a_1", indexName); // Peform a query, with explain to show we hit the query @@ -1625,6 +1703,7 @@

    createIndex
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1635,7 +1714,7 @@ 

    createIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1646,12 +1725,12 @@

    createIndex// Insert a bunch of documents for the index collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {w:1}, function(err, result) { assert.equal(null, err); // Create an index on the a field collection.createIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, w:1}, function(err, indexName) { // Show that duplicate records got dropped collection.find({}).toArray(function(err, items) { @@ -1681,7 +1760,10 @@

    ensureIndex
    Options
    +
    @@ -1704,7 +1791,7 @@

    ensureIndex

    @@ -1719,6 +1806,7 @@

    ensureIndex

    @@ -1803,6 +1891,7 @@

    indexInformation

    @@ -1879,6 +1968,7 @@

    dropIndex

    @@ -1962,7 +2052,7 @@

    reIndex

    @@ -1977,6 +2067,7 @@

    reIndex
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1987,7 +2078,7 @@ 

    reIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1998,12 +2089,12 @@

    reIndex// Insert a bunch of documents for the index collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4, c:4}], {safe:true}, function(err, result) { + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4, c:4}], {w:1}, function(err, result) { assert.equal(null, err); // Create an index on the a field collection.ensureIndex({a:1, b:1} - , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, w:1}, function(err, indexName) { // Force a reindex of the collection collection.reIndex(function(err, result) { @@ -2056,7 +2147,7 @@

    mapReduce
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -2081,7 +2173,7 @@ 

    mapReduceassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2090,7 +2182,7 @@

    mapReducedb.createCollection('test_map_reduce_functions', function(err, collection) { // Insert some documents to perform map reduce over - collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { + collection.insert([{'user_id':1}, {'user_id':2}], {w:1}, function(err, r) { // Map function var map = function() { emit(this.user_id, 1); }; @@ -2117,6 +2209,7 @@

    mapReduce
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -2127,7 +2220,7 @@ 

    mapReduceassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2142,7 +2235,7 @@

    mapReducedb.createCollection('test_map_reduce_functions_inline', function(err, collection) { // Insert some test documents - collection.insert([{'user_id':1}, {'user_id':2}], {safe:true}, function(err, r) { + collection.insert([{'user_id':1}, {'user_id':2}], {w:1}, function(err, r) { // Map function var map = function() { emit(this.user_id, 1); }; @@ -2170,6 +2263,7 @@

    mapReduce
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -2180,7 +2274,7 @@ 

    mapReduceassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2190,7 +2284,7 @@

    mapReduce// Insert some test documents collection.insert([{'user_id':1, 'timestamp':new Date()} - , {'user_id':2, 'timestamp':new Date()}], {safe:true}, function(err, r) { + , {'user_id':2, 'timestamp':new Date()}], {w:1}, function(err, r) { // Map function var map = function(){ @@ -2252,7 +2346,7 @@

    group
  • finalize (function) – an optional function to be run on each item in the result set just before the item is returned.
  • command (boolean) – specify if you wish to run using the internal group command or using eval, default is true.
  • [options] (object) – additional options during update.
  • -
  • callback (function) – returns the results.
  • +
  • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the group method or null if an error occured.
  • @@ -2267,6 +2361,7 @@

    group

    A whole lot of different wayt to execute the group command

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -2277,7 +2372,7 @@ 

    group assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2290,7 +2385,7 @@

    group assert.deepEqual([], results); // Trigger some inserts on the collection - collection.insert([{'a':2}, {'b':5}, {'a':1}], {safe:true}, function(err, ids) { + collection.insert([{'a':2}, {'b':5}, {'a':1}], {w:1}, function(err, ids) { // Perform a group count collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }", function(err, results) { @@ -2298,7 +2393,6 @@

    group // Pefrom a group count using the eval method collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }", false, function(err, results) { - console.dir(err) assert.equal(3, results[0].count); // Group with a conditional @@ -2312,7 +2406,7 @@

    group assert.equal(1, results[0].count); // Insert some more test data - collection.insert([{'a':2}, {'b':3}], {safe:true}, function(err, ids) { + collection.insert([{'a':2}, {'b':3}], {w:1}, function(err, ids) { // Do a Group by field a collection.group(['a'], {}, {"count":0}, "function (obj, prev) { prev.count++; }", function(err, results) { @@ -2400,7 +2494,7 @@

    options

    @@ -2415,6 +2509,7 @@

    options

    @@ -2475,6 +2570,7 @@

    isCapped

    @@ -2534,6 +2630,7 @@

    indexExists
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -2544,17 +2641,17 @@ 

    indexExistsassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { // Create a test collection that we are getting the options back from - db.createCollection('test_collection_index_exists', {safe:true}, function(err, collection) { + db.createCollection('test_collection_index_exists', {w: 1}, function(err, collection) { assert.equal(null, err); // Create an index on the collection - collection.createIndex('a', {safe:true}, function(err, indexName) { + collection.createIndex('a', {w: 1}, function(err, indexName) { // Let's test to check if a single index exists collection.indexExists("a_1", function(err, result) { @@ -2607,7 +2704,7 @@

    geoNear
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -2632,7 +2730,7 @@ 

    geoNearassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {safe:false, auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {w:0, auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2644,7 +2742,7 @@

    geoNearcollection.ensureIndex({loc:"2d"}, function(err, result) { // Save a new location tagged document - collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {safe:true}, function(err, result) { + collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {w:1}, function(err, result) { // Use geoNear command to find document collection.geoNear(50, 50, {query:{a:1}, num:1}, function(err, docs) { @@ -2684,7 +2782,7 @@

    geoHaystackSearch

    @@ -2763,6 +2862,7 @@

    indexes

    @@ -2838,6 +2938,7 @@

    aggregate
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -2848,7 +2949,7 @@ 

    aggregateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2867,7 +2968,7 @@

    aggregate// Create a collection db.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArray', function(err, collection) { // Insert the docs - collection.insert(docs, {safe:true}, function(err, result) { + collection.insert(docs, {w: 1}, function(err, result) { // Execute aggregate, notice the pipeline is expressed as an Array collection.aggregate([ @@ -2901,6 +3002,7 @@

    aggregate
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -2911,7 +3013,7 @@ 

    aggregateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2930,7 +3032,7 @@

    aggregate// Create a collection client.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArguments', function(err, collection) { // Insert the docs - collection.insert(docs, {safe:true}, function(err, result) { + collection.insert(docs, {w: 1}, function(err, result) { // Execute aggregate, notice the pipeline is expressed as function call parameters // instead of an Array. collection.aggregate( @@ -2964,6 +3066,7 @@

    aggregate

    @@ -3062,6 +3165,7 @@

    stats

    Example of retrieving a collections stats

    @@ -67,29 +67,7 @@

    Constructor +
    Options
    +
      +
    • skip {Number} skip number of documents to skip.
    • +
    • limit {Number}, limit the number of results to return. -1 has a special meaning and is used by Db.eval. A value of 1 will also be treated as if it were -1.
    • +
    • sort {Array | Object}, set to sort the documents coming back from the query. Array of indexes, [[‘a’, 1]] etc.
    • +
    • hint {Object}, hint force the query to use a specific index.
    • +
    • explain {Boolean}, explain return the explaination of the query.
    • +
    • snapshot {Boolean}, snapshot Snapshot mode assures no duplicates are returned.
    • +
    • timeout {Boolean}, timeout allow the query to timeout.
    • +
    • tailable {Boolean}, tailable allow the cursor to be tailable.
    • +
    • awaitdata {Boolean}, awaitdata allow the cursor to wait for data, only applicable for tailable cursor.
    • +
    • batchSize {Number}, batchSize the number of the subset of results to request the database to return for every request. This should initially be greater than 1 otherwise the database will automatically close the cursor. The batch size can be set to 1 with cursorInstance.batchSize after performing the initial query to the database.
    • +
    • raw {Boolean}, raw return all query documents as raw buffers (default false).
    • +
    • read {Boolean}, read specify override of read from source (primary/secondary).
    • +
    • slaveOk {Boolean}, slaveOk, sets the slaveOk flag on the query wire protocol for secondaries.
    • +
    • returnKey {Boolean}, returnKey only return the index key.
    • +
    • maxScan {Number}, maxScan limit the number of items to scan.
    • +
    • min {Number}, min set index bounds.
    • +
    • max {Number}, max set index bounds.
    • +
    • showDiskLoc {Boolean}, showDiskLoc show disk location of results.
    • +
    • comment {String}, comment you can put a $comment field on a query to make looking in the profiler logs simpler.
    • +
    • numberOfRetries {Number}, numberOfRetries if using awaidata specifies the number of times to retry on timeout.
    • +
    • dbName {String}, dbName override the default dbName.
    • +
    • tailableRetryInterval {Number}, tailableRetryInterval specify the miliseconds between getMores on tailable cursor.
    • +
    • exhaust {Boolean}, exhaust have the server send all the documents at once as getMore packets.
    • +
    • partial {Boolean}, partial have the sharded system return a partial result from mongos.
    • +
    +
    +

    @@ -231,6 +240,7 @@

    toArray

    @@ -297,6 +307,7 @@

    each

    A simple example iterating over a query using the each function of the cursor.

    @@ -371,6 +382,7 @@

    count

    A simple example showing the count function of the cursor.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -381,7 +393,7 @@ 

    count assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -391,7 +403,7 @@

    count assert.equal(null, err); // Insert some docs - collection.insert([{a:1}, {a:2}], {safe:true}, function(err, docs) { + collection.insert([{a:1}, {a:2}], {w:1}, function(err, docs) { assert.equal(null, err); // Do a find and get the cursor count @@ -439,6 +451,7 @@

    sort

    A simple example showing the use of sort on the cursor.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -449,7 +462,7 @@ 

    sortassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -459,7 +472,7 @@

    sortassert.equal(null, err); // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + collection.insert([{a:1}, {a:2}, {a:3}], {w:1}, function(err, docs) { assert.equal(null, err); // Do normal ascending sort @@ -509,6 +522,7 @@

    limit

    A simple example showing the use of limit on the cursor

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -519,7 +533,7 @@ 

    limit assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -529,7 +543,7 @@

    limit assert.equal(null, err); // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + collection.insert([{a:1}, {a:2}, {a:3}], {w:1}, function(err, docs) { assert.equal(null, err); // Limit to only one document returned @@ -597,6 +611,7 @@

    skip

    A simple example showing the use of skip on the cursor

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -607,7 +622,7 @@ 

    skipassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -617,7 +632,7 @@

    skipassert.equal(null, err); // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + collection.insert([{a:1}, {a:2}, {a:3}], {w:1}, function(err, docs) { assert.equal(null, err); // Skip one document @@ -662,6 +677,7 @@

    batchSize
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -672,7 +688,7 @@ 

    batchSizeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -682,7 +698,7 @@

    batchSizeassert.equal(null, err); // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + collection.insert([{a:1}, {a:2}, {a:3}], {w:1}, function(err, docs) { assert.equal(null, err); // Do normal ascending sort @@ -722,6 +738,7 @@

    nextObject
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -732,7 +749,7 @@ 

    nextObjectassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -742,7 +759,7 @@

    nextObjectassert.equal(null, err); // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + collection.insert([{a:1}, {a:2}, {a:3}], {w:1}, function(err, docs) { assert.equal(null, err); // Do normal ascending sort @@ -783,6 +800,7 @@

    explain
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -793,7 +811,7 @@ 

    explainassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -803,7 +821,7 @@

    explainassert.equal(null, err); // Insert some documents we can sort on - collection.insert([{a:1}, {a:2}, {a:3}], {safe:true}, function(err, docs) { + collection.insert([{a:1}, {a:2}, {a:3}], {w:1}, function(err, docs) { assert.equal(null, err); // Do normal ascending sort @@ -839,6 +857,7 @@

    stream
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -849,7 +868,7 @@ 

    streamassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -865,7 +884,7 @@

    streamassert.equal(null, err); // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { + collection.insert(docs, {w:1}, function(err, ids) { // Peform a find to get a cursor var stream = collection.find().stream(); @@ -910,6 +929,7 @@

    close

    A simple example showing the use of the cursor close function.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -920,7 +940,7 @@ 

    close assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -936,7 +956,7 @@

    close assert.equal(null, err); // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { + collection.insert(docs, {w:1}, function(err, ids) { // Peform a find to get a cursor var cursor = collection.find(); @@ -978,6 +998,7 @@

    isClosed

    @@ -96,6 +96,7 @@

    pause

    A simple example showing the use of the cursorstream pause function.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -106,7 +107,7 @@ 

    pause assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -122,7 +123,7 @@

    pause assert.equal(null, err); // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { + collection.insert(docs, {w:1}, function(err, ids) { // Peform a find to get a cursor var stream = collection.find().stream(); @@ -168,6 +169,7 @@

    resume
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -178,7 +180,7 @@ 

    resumeassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -194,7 +196,7 @@

    resumeassert.equal(null, err); // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { + collection.insert(docs, {w:1}, function(err, ids) { // Peform a find to get a cursor var stream = collection.find().stream(); @@ -244,6 +246,7 @@

    destroy
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -254,7 +257,7 @@ 

    destroyassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -270,7 +273,7 @@

    destroyassert.equal(null, err); // Insert documents into collection - collection.insert(docs, {safe:true}, function(err, ids) { + collection.insert(docs, {w:1}, function(err, ids) { // Peform a find to get a cursor var stream = collection.find().stream(); @@ -297,14 +300,14 @@

    destroy} var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 5, ssl:useSSL}), {safe:false, native_parser: native_parser}); + {auto_reconnect: false, poolSize: 5, ssl:useSSL}), {w:0, native_parser: native_parser}); // Establish connection to db db.open(function(err, db) { db.createCollection('test_streaming_function_with_limit_for_fetching', function(err, collection) { assert.ok(collection instanceof Collection); - collection.insert(docs, {safe:true}, function(err, ids) { + collection.insert(docs, {w:1}, function(err, ids) { // Peform a find to get a cursor var stream = collection.find({}).stream(); var data = []; @@ -357,6 +360,7 @@

    Contents

    Manual

    @@ -75,7 +75,10 @@

    Constructor
    Options
    +

    @@ -140,6 +145,7 @@

    open

    An example of a simple single server db connection

    Simple replicaset connection setup, requires a running replicaset on the correct ports

    Example of Read Preference usage at the query level.

    A Simple example off connecting to Mongos with a list of alternative proxies.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -249,7 +258,7 @@ 

    open]) // Connect using the mongos connections -var db = new Db('integration_test_', mongos, {safe:false}); +var db = new Db('integration_test_', mongos, {w:0}); db.open(function(err, db) { assert.equal(null, err); assert.ok(db != null); @@ -257,7 +266,7 @@

    open// Perform a simple insert into a collection var collection = db.collection("shard_test"); // Insert a simple doc - collection.insert({test:1}, {safe:true}, function(err, result) { + collection.insert({test:1}, {w:1}, function(err, result) { assert.equal(null, err); collection.findOne({test:1}, {}, {readPreference:new ReadPreference(ReadPreference.SECONDARY)}, function(err, item) { @@ -298,6 +307,7 @@

    db

    Simple example connecting to two different databases sharing the socket connections below.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -308,7 +318,7 @@ 

    dbassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -323,8 +333,8 @@

    dbvar multipleColl2 = secondDb.collection("multiple_db_instances"); // Write a record into each and then count the records stored - multipleColl1.insert({a:1}, {safe:true}, function(err, result) { - multipleColl2.insert({a:1}, {safe:true}, function(err, result) { + multipleColl1.insert({a:1}, {w:1}, function(err, result) { + multipleColl2.insert({a:1}, {w:1}, function(err, result) { // Count over the results ensuring only on record in each collection multipleColl1.count(function(err, count) { @@ -348,14 +358,14 @@

    close

    Close the current db connection, including all the child db instances. Emits close event if no callback is provided.

    -close([forceClose][, callback])
    +close([forceClose], callback)

    Arguments:
    • query (object) – query object to locate the object to modify
    • [options] (object) – additional options during update.
    • -
    • [callback] (function) – optional callback for cursor.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the findOne method or null if an error occured.
    Arguments:
    • fieldOrSpec (object) – fieldOrSpec that defines the index.
    • [options] (object) – additional options during update.
    • -
    • callback (function) – for results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the createIndex method or null if an error occured.
    Arguments:
    • fieldOrSpec (object) – fieldOrSpec that defines the index.
    • [options] (object) – additional options during update.
    • -
    • callback (function) – for results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the ensureIndex method or null if an error occured.
    Arguments:
    • [options] (object) – additional options during update.
    • -
    • callback (function) – returns the index information.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the indexInformation method or null if an error occured.
    Arguments:
    • name (string) –
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the dropIndex method or null if an error occured.
    Arguments:
      -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the dropAllIndexes method or null if an error occured.
    Arguments:
      -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the reIndex method or null if an error occured.
    Arguments:
      -
    • callback (function) – returns option results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the options method or null if an error occured.
    Arguments:
      -
    • callback (function) – returns if collection is capped.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the isCapped method or null if an error occured.
    Arguments:
    • indexNames (string) – check if one or more indexes exist on the collection.
    • -
    • callback (function) – returns if the indexes exist.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the indexExists method or null if an error occured.
    Arguments:
      -
    • callback (function) – returns index information.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the indexes method or null if an error occured.
    Arguments:
    • array (array) – containing all the aggregation framework commands for the execution.
    • [options] (object) – additional options during update.
    • -
    • callback (function) – returns matching documents.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the aggregate method or null if an error occured.
    Arguments:
    • [options] (objects) – options for the stats command.
    • -
    • callback (function) – returns statistical information for the collection.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from the stats method or null if an error occured.
    Arguments:
      -
    • callback (function) – This will be called after executing this method successfully. The first paramter will contain the Error object if an error occured, or null otherwise. The second paramter will contain an array of BSON deserialized objects as a result of the query.
    • +
    • callback (function) – This will be called after executing this method successfully. The first parameter will contain the Error object if an error occured, or null otherwise. The second parameter will contain an array of BSON deserialized objects as a result of the query.
    Arguments:
      -
    • callback (function) – this will be called for while iterating every document of the query result. The first paramter will contain the Error object if an error occured, or null otherwise. While the second paramter will contain the document.
    • +
    • callback (function) – this will be called for while iterating every document of the query result. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the document.
    Arguments:
      -
    • callback (function) – this will be after executing this method. The first paramter will contain the Error object if an error occured, or null otherwise. While the second paramter will contain the number of results or null if an error occured.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the number of results or null if an error occured.
    Arguments:
      -
    • callback (function) – returns index information.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the index information or null if an error occured.
    @@ -370,6 +380,7 @@

    close

    An example that shows how to force close a db connection so it cannot be reused.

    An example of a simple single server db connection and close function

    @@ -512,6 +525,7 @@

    collectionsInfo

    @@ -588,6 +602,7 @@

    collectionNames
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -598,7 +613,7 @@ 

    collectionNamesassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -631,17 +646,26 @@

    collection
    Options
    +
    +
    Deprecated Options
    +
      +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    -collection(collectionName[, options][, callback])
    +collection(collectionName[, options], callback)

    Arguments:
    • [forceClose] (boolean) – connection can never be reused.
    • -
    • [callback] (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results or null if an error occured.
    Arguments:
    • [collectionName] (string) – the collection name we wish to retrieve the information from.
    • -
    • callback (function) – returns option results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the options or null if an error occured.
    Arguments:
    • [collectionName] (string) – the collection name we wish to filter by.
    • [options] (object) – additional options during update.
    • -
    • callback (function) – returns option results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the collection names or null if an error occured.
    @@ -649,7 +673,7 @@

    collection

    @@ -664,6 +688,7 @@

    collection

    @@ -734,6 +759,7 @@

    collections
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -744,7 +770,7 @@ 

    collectionsassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -787,7 +813,7 @@

    eval
  • code (code) – javascript to execute on server.
  • [parameters] (object) – the parameters for the call.
  • [options] (object) – the options
  • -
  • callback (function) – returns the results.
  • +
  • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from eval or null if an error occured.
  • @@ -802,6 +828,7 @@

    eval

    A whole bunch of examples on how to use eval on the server.

    Defining and calling a system level javascript function (NOT recommended, <a href=’http://www.mongodb.org/display/DOCS/Server-side+Code+Execution’>http://www.mongodb.org/display/DOCS/Server-side+Code+Execution</a>)

    @@ -944,6 +972,7 @@

    dereference

    @@ -1019,6 +1048,7 @@

    logout
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1029,7 +1059,7 @@ 

    logoutassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1078,7 +1108,7 @@

    authenticate
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1103,7 +1134,7 @@ 

    authenticateassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1131,6 +1162,14 @@

    addUser
    Options
    +
    +
    Deprecated Options
    +
    • safe {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
    @@ -1146,7 +1185,7 @@

    addUser

    @@ -1223,6 +1271,7 @@

    removeUser
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1233,7 +1282,7 @@ 

    removeUserassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1275,7 +1324,10 @@

    createCollection
    Options
    @@ -1297,7 +1355,7 @@

    createCollection

    @@ -1312,6 +1370,7 @@

    createCollection

    @@ -1371,6 +1430,7 @@

    command

    @@ -1425,6 +1485,7 @@

    dropCollection

    @@ -1500,6 +1561,7 @@

    renameCollection

    @@ -1595,6 +1657,7 @@

    lastError

    @@ -1675,6 +1738,7 @@

    previousErrors

    @@ -1755,6 +1819,7 @@

    resetErrorHistory
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1765,18 +1830,18 @@ 

    resetErrorHistoryassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { assert.equal(null, err); // Create a collection - db.createCollection("simple_reset_error_history_coll", {safe:true}, function(err, collection) { + db.createCollection("simple_reset_error_history_coll", {w:1}, function(err, collection) { assert.equal(null, err); // Force a unique index - collection.ensureIndex({a:1}, {unique:true, safe:true}, function(err, result) { + collection.ensureIndex({a:1}, {unique:true, w:1}, function(err, result) { assert.equal(null, err); // Force some errors @@ -1810,7 +1875,10 @@

    createIndex
    Options
    +
    @@ -1834,7 +1907,7 @@

    createIndex
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1859,7 +1933,7 @@ 

    createIndexassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1870,12 +1944,12 @@

    createIndex// Insert a bunch of documents for the index collection.insert([{a:1, b:1}, {a:1, b:1} - , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {safe:true}, function(err, result) { + , {a:2, b:2}, {a:3, b:3}, {a:4, b:4}], {w:1}, function(err, result) { assert.equal(null, err); // Create an index on the a field db.createIndex('more_complex_index_test', {a:1, b:1} - , {unique:true, background:true, dropDups:true, safe:true}, function(err, indexName) { + , {unique:true, background:true, dropDups:true, w:1}, function(err, indexName) { // Show that duplicate records got dropped collection.find({}).toArray(function(err, items) { @@ -1905,7 +1979,10 @@

    ensureIndex
    Options
    +

    @@ -1929,7 +2011,7 @@

    ensureIndex

    @@ -2028,6 +2111,7 @@

    cursorInfo

    @@ -2104,6 +2188,7 @@

    dropIndex

    @@ -2177,6 +2262,7 @@

    reIndex

    @@ -2262,6 +2348,7 @@

    indexInformation

    @@ -2337,6 +2424,7 @@

    dropDatabase

    @@ -2428,6 +2516,7 @@

    stats

    An example showing how to retrieve the db statistics

    @@ -2489,8 +2582,9 @@

    Db.connect @@ -80,7 +80,7 @@

    putPuts binary data to the grid

    -put(data[, options])
    +put(data[, options], callback)

    Arguments:
    • collectionName (string) – the collection name we wish to access.
    • [options] (object) – returns option results.
    • -
    • [callback] (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the collection or null if an error occured.
    Arguments:
      -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the collections or null if an error occured.
    Arguments:
    • dbRef (dbref) – db reference object we wish to resolve.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from dereference or null if an error occured.
    Arguments:
      -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from logout or null if an error occured.
    Arguments:
    • username (string) – username.
    • [options] (object) – additional options during update.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from removeUser or null if an error occured.
    Arguments:
    • collectionName (string) – the collection name we wish to access.
    • [options] (object) – returns option results.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from createCollection or null if an error occured.
    Arguments:
    • selector (object) – the command hash to send to the server, ex: {ping:1}.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The command always return the whole result of the command as the second parameter.
    Arguments:
    • collectionName (string) – the name of the collection we wish to drop.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from dropCollection or null if an error occured.
    Arguments:
    • fromCollection (string) – the name of the current collection we wish to rename.
    • toCollection (string) – the new name of the collection.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from renameCollection or null if an error occured.
    Arguments:
    • [options] (object) – returns option results.
    • [connectionOptions] (object) – returns option results.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from lastError or null if an error occured.
    Arguments:
    • [options] (object) – returns option results.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from previousErrors or null if an error occured.
    Arguments:
    • [options] (object) – returns option results.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from resetErrorHistory or null if an error occured.
    Arguments:
    • [options] (object) – additional options during update.
    • -
    • callback (function) – for results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from cursorInfo or null if an error occured.
    Arguments:
    • collectionName (string) – the name of the collection where the command will drop an index.
    • indexName (string) – name of the index to drop.
    • -
    • callback (function) – for results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from dropIndex or null if an error occured.
    Arguments:
    • collectionName (string) – the name of the collection.
    • -
    • callback (function) – returns the results.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from reIndex or null if an error occured.
    Arguments:
    • collectionName (string) – the name of the collection.
    • [options] (object) – additional options during update.
    • -
    • callback (function) – returns the index information.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from indexInformation or null if an error occured.
    Arguments:
      -
    • callback (function) – returns the index information.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from dropDatabase or null if an error occured.
    Arguments:
    • [options] (objects) – options for the stats command
    • -
    • callback (function) – returns statistical information for the db.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from stats or null if an error occured.
    Arguments:
    • url (string) – connection url for MongoDB.
    • [options] (object) – optional options for insert command
    • -
    • callback (function) – callback returns the initialized db.
    • +
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the db instance or null if an error occured.
    @@ -88,6 +88,7 @@

    put

    @@ -102,6 +103,7 @@

    put

    Arguments:
    • data (buffer) – buffer with Binary Data.
    • [options] (object) – the options for the files.
    • +
    • callback (function) – this will be called after this method is executed. The first parameter will contain an Error object if an error occured or null otherwise. The second parameter will contain a reference to this object.
    @@ -160,6 +163,7 @@

    get

    Arguments:
    • id (objectid) – ObjectID for file.
    • +
    • callback (function) – this will be called after this method is executed. The first parameter will contain an Error object if an error occured or null otherwise. The second parameter will contain a reference to this object.
    @@ -223,6 +228,7 @@

    delete @@ -175,6 +175,7 @@

    open

    A simple example showing opening a file using a filename, writing to it and saving it.

    A simple example showing opening a file using an ObjectID, writing to it and saving it.

    A simple example showing how to save a file with a filename allowing for multiple files with the same name

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -274,7 +277,7 @@ 

    openassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -355,6 +358,7 @@

    writeFile
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -365,7 +369,7 @@ 

    writeFileassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -400,6 +404,7 @@

    writeFile
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -410,7 +415,7 @@ 

    writeFileassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -476,6 +481,7 @@

    close

    A simple example showing how to use the write command with strings and Buffers.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -486,7 +492,7 @@ 

    close assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -541,6 +547,7 @@

    chunkCollection
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -551,7 +558,7 @@ 

    chunkCollectionassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -603,6 +610,7 @@

    unlink
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -613,7 +621,7 @@ 

    unlinkassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -683,6 +691,7 @@

    collection
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -693,7 +702,7 @@ 

    collectionassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -746,6 +755,7 @@

    readlines
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -756,7 +766,7 @@ 

    readlinesassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -829,6 +839,7 @@

    rewind
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -839,7 +850,7 @@ 

    rewindassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -921,6 +932,7 @@

    read

    A simple example showing the usage of the read method.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -931,7 +943,7 @@ 

    readassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -995,6 +1007,7 @@

    tell

    A simple example showing the usage of the tell method.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1005,7 +1018,7 @@ 

    tellassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1080,6 +1093,7 @@

    seek

    A simple example showing the usage of the seek method.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1090,7 +1104,7 @@ 

    seekassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1209,6 +1223,7 @@

    eof

    A simple example showing the usage of the eof method.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1219,7 +1234,7 @@ 

    eofassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1271,6 +1286,7 @@

    getc

    A simple example showing the usage of the seek method.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1281,7 +1297,7 @@ 

    getcassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1340,6 +1356,7 @@

    puts

    A simple example showing the usage of the puts method.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1350,7 +1367,7 @@ 

    putsassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1414,6 +1431,7 @@

    stream
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1424,7 +1442,7 @@ 

    streamassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1478,6 +1496,7 @@

    stream
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1488,7 +1507,7 @@ 

    streamassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1554,6 +1573,7 @@

    GridStore.exist
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1564,7 +1584,7 @@ 

    GridStore.existassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1637,6 +1657,7 @@

    GridStore.list
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1647,7 +1668,7 @@ 

    GridStore.listassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1779,6 +1800,7 @@

    GridStore.read
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1789,7 +1811,7 @@ 

    GridStore.readassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1849,6 +1871,7 @@

    GridStore.readlines
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1859,7 +1882,7 @@ 

    GridStore.readlinesassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -1928,6 +1951,7 @@

    GridStore.unlink
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -1938,7 +1962,7 @@ 

    GridStore.unlinkassert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -2022,6 +2046,7 @@

    write

    A simple example showing how to use the write command with strings and Buffers.

    @@ -49,175 +49,12 @@

    Navigation

    Driver API

    Manual

    @@ -78,6 +78,15 @@

    Constructor +

    setReadPreference

    +

    Always ourselves

    +
    +
    +setReadPreference()
    +
    +

    @@ -91,6 +100,7 @@

    Contents

    @@ -101,6 +111,7 @@

    Contents

    Manual

    @@ -106,6 +106,7 @@

    Contents

    Manual

    @@ -98,6 +98,7 @@

    pause

    A simple example showing the use of the readstream pause function.

    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
         ReplSetServers = require('mongodb').ReplSetServers,
         ObjectID = require('mongodb').ObjectID,
    @@ -108,7 +109,7 @@ 

    pause assert = require('assert'); var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {safe:false, native_parser: false}); + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); // Establish connection to db db.open(function(err, db) { @@ -171,6 +172,7 @@

    destroy @@ -85,6 +85,53 @@

    Constructor +

    _enableHA

    +

    Enables high availability pings.

    +
    +
    +_enableHA()
    +
    + +

    +
    +

    ReplSet.State

    +

    Interval state object constructor

    +
    +
    +ReplSet.State()
    +
    + +
    +
    +

    _handleOnFullSetup

    +

    Handles the first <code>fullsetup</code> event of this ReplSet.

    +
    +
    +_handleOnFullSetup(parent)
    +

    Arguments:
    • id (objectid) – ObjectID for file.
    • +
    • callback (function) – this will be called after this method is executed. The first parameter will contain an Error object if an error occured or null otherwise. The second parameter will contain a reference to this object.
    +++ + + + +
    Arguments:
      +
    • parent (db) –
    • +
    +
    +
    + +

    +
    +

    _disableHA

    +

    Disables high availability pings.

    +
    +
    +_disableHA()
    +
    +

    @@ -98,6 +145,10 @@

    Contents

    @@ -108,6 +159,7 @@

    Contents

    Manual

    @@ -93,6 +93,56 @@

    setReadPreferencesetReadPreference()
    +

    +
    +

    assignReplicaSet

    +

    Assigns a replica set to this <code>server</code>.

    +
    +
    +assignReplicaSet(replset)
    +
    +++ + + + +
    Arguments:
      +
    • replset (replset) –
    • +
    +
    +
    + +
    +
    +

    inheritReplSetOptionsFrom

    +

    Takes needed options from <code>replset</code> and overwrites +our own options.

    +
    +
    +inheritReplSetOptionsFrom(replset)
    +
    +++ + + + +
    Arguments:
      +
    • replset (replset) –
    • +
    +
    +
    + +
    +
    +

    connect

    +

    Opens this server connection.

    +
    +
    +connect()
    +
    +

    @@ -107,6 +157,9 @@

    Contents

  • Server()
  • @@ -117,6 +170,7 @@

    Contents

    Manual

    @@ -48,27 +48,46 @@

    Navigation

    Changelog

    -

    1.1.11 2012-10-10

    +

    1.2.0 2012-11-27

    +
      +
    • Honor connectTimeoutMS option for replicasets (Issue #750, https://github.com/aheckmann)
    • +
    • Fix ping strategy regression (Issue #738, https://github.com/aheckmann)
    • +
    • Small cleanup of code (Issue #753, https://github.com/sokra/node-mongodb-native)
    • +
    • Fixed index declaration using objects/arrays from other contexts (Issue #755, https://github.com/sokra/node-mongodb-native)
    • +
    • Intermittent (and rare) null callback exception when using ReplicaSets (Issue #752)
    • +
    • Force correct setting of read_secondary based on the read preference (Issue #741)
    • +
    • If using read preferences with secondaries queries will not fail if primary is down (Issue #744)
    • +
    • noOpen connection for Db.connect removed as not compatible with autodetection of Mongo type
    • +
    • Mongos connection with auth not working (Issue #737)
    • +
    • Use the connect method directly from the require. require(‘mongodb’)(&quot;mongodb://localhost:27017/db&quot;)
    • +
    • new MongoClient introduced as the point of connecting to MongoDB’s instead of the Db +- open/close/db/connect methods implemented
    • +
    • Implemented common URL connection format using MongoClient.connect allowing for simialar interface across all drivers.
    • +
    • Fixed a bug with aggregation helper not properly accepting readPreference
    • +
    +
    +
    +

    1.1.11 2012-10-10

    • Removed strict mode and introduced normal handling of safe at DB level.
    -
    -

    1.1.10 2012-10-08

    +
    +

    1.1.10 2012-10-08

    -
    -

    1.1.9 2012-10-05

    +
    +

    1.1.9 2012-10-05

    • Updated bson to 0.1.5 to fix build problem on sunos/windows.
    -
    -

    1.1.8 2012-10-01

    +
    +

    1.1.8 2012-10-01

    @@ -109,6 +109,7 @@

    DB optionsreaperInterval - specify the number of milliseconds between each reaper attempt default:10000
  • reaperTimeout - specify the number of milliseconds for timing out callbacks that don’t return default:30000
  • raw - driver expects Buffer raw bson document, default:false
  • +
  • logger - object specifying error(), debug() and log() functions
  • @@ -210,6 +211,36 @@

    Custom primary keys +

    debug commands

    +
    +

    In order to debug the commands sent to the database you can add a logger object to the DB options . Make sure also the property doDebug is set.

    +

    Example

    +
    +
    options = {}
    +options.logger = {};
    +options.logger.doDebug = true;
    +options.logger.debug = function (message, object) {
    +    // print the mongo command:
    +    // "writing command to mongodb"
    +    console.log(message);
    +
    +    // print the collection name
    +    console.log(object.json.collectionName)
    +
    +    // print the json query sent to MongoDB
    +    console.log(object.json.query)
    +
    +    // print the binary object
    +    console.log(object.binary)
    +}
    +
    +var db = new Db('some_database', new Server(...), options);
    +
    +
    +
    +
    +

    @@ -228,6 +259,7 @@

    Contents

  • Sharing the connections over multiple dbs
  • Deleting a database
  • Custom primary keys
  • +
  • debug commands
  • @@ -238,14 +270,7 @@

    Contents

    Manual

    @@ -266,14 +266,7 @@

    Contents

    Manual

    @@ -73,14 +73,7 @@

    Contents

    Manual

    @@ -176,14 +176,7 @@

    Contents

    Manual

    @@ -225,14 +225,7 @@

    Contents

    Manual

    @@ -393,14 +393,7 @@

    Contents

    Manual

    @@ -148,14 +148,7 @@

    Contents

    Manual

      -
    • Db()
    • -
    • Collection()
    • -
    • Admin()
    • -
    • Cursor()
    • -
    • CursorStream()
    • -
    • Grid()
    • -
    • GridStore()
    • -
    • ReadStream()
    • +
    • MongoClient()
    • BSON()
    • ObjectID()
    • Binary()
    • @@ -294,7 +287,7 @@

      Navigation

    @@ -85,14 +85,7 @@

    Search

    Manual

      -
    • Db()
    • -
    • Collection()
    • -
    • Admin()
    • -
    • Cursor()
    • -
    • CursorStream()
    • -
    • Grid()
    • -
    • GridStore()
    • -
    • ReadStream()
    • +
    • MongoClient()
    • BSON()
    • ObjectID()
    • Binary()
    • @@ -218,7 +211,7 @@

      Navigation

      @@ -81,6 +260,14 @@

      Contents

      Manual

      • MongoClient()
      • +
      • Db()
      • +
      • Collection()
      • +
      • Admin()
      • +
      • Cursor()
      • +
      • CursorStream()
      • +
      • Grid()
      • +
      • GridStore()
      • +
      • ReadStream()
      • BSON()
      • ObjectID()
      • Binary()
      • diff --git a/api-generated/mongoclient.html b/api-generated/mongoclient.html index a1696e5e89d..bc98eeb13f6 100644 --- a/api-generated/mongoclient.html +++ b/api-generated/mongoclient.html @@ -26,6 +26,7 @@ + @@ -341,11 +342,19 @@

        Contents

        -
        • Previous: Node.JS MongoDB Driver Manual Contents
        • +

          Manual

          +
        • Db() +
        • +
        • Collection() +
        • +
        • Admin() +
        • +
        • Cursor() +
        • +
        • CursorStream() +
        • +
        • Grid() +
        • +
        • GridStore() +
        • +
        • ReadStream() +
        • BSON()
          • Constructor
          • Constants
          • @@ -215,6 +369,14 @@

            Contents

            Manual

            • MongoClient()
            • +
            • Db()
            • +
            • Collection()
            • +
            • Admin()
            • +
            • Cursor()
            • +
            • CursorStream()
            • +
            • Grid()
            • +
            • GridStore()
            • +
            • ReadStream()
            • BSON()
            • ObjectID()
            • Binary()
            • diff --git a/driver-articles/anintroductionto1_1and2_2.html b/driver-articles/anintroductionto1_1and2_2.html index 07b59a53f15..1ee89bd8ef5 100644 --- a/driver-articles/anintroductionto1_1and2_2.html +++ b/driver-articles/anintroductionto1_1and2_2.html @@ -399,6 +399,14 @@

              Contents

              Manual

              • MongoClient()
              • +
              • Db()
              • +
              • Collection()
              • +
              • Admin()
              • +
              • Cursor()
              • +
              • CursorStream()
              • +
              • Grid()
              • +
              • GridStore()
              • +
              • ReadStream()
              • BSON()
              • ObjectID()
              • Binary()
              • diff --git a/driver-articles/index.html b/driver-articles/index.html index 24065b52421..bc14eb45b4e 100644 --- a/driver-articles/index.html +++ b/driver-articles/index.html @@ -91,6 +91,14 @@

                Contents

                Manual

                • MongoClient()
                • +
                • Db()
                • +
                • Collection()
                • +
                • Admin()
                • +
                • Cursor()
                • +
                • CursorStream()
                • +
                • Grid()
                • +
                • GridStore()
                • +
                • ReadStream()
                • BSON()
                • ObjectID()
                • Binary()
                • diff --git a/driver-articles/mongoclient.html b/driver-articles/mongoclient.html index efd54836c00..3805f7ccdb6 100644 --- a/driver-articles/mongoclient.html +++ b/driver-articles/mongoclient.html @@ -361,6 +361,14 @@

                  Contents

                  Manual

                  • MongoClient()
                  • +
                  • Db()
                  • +
                  • Collection()
                  • +
                  • Admin()
                  • +
                  • Cursor()
                  • +
                  • CursorStream()
                  • +
                  • Grid()
                  • +
                  • GridStore()
                  • +
                  • ReadStream()
                  • BSON()
                  • ObjectID()
                  • Binary()
                  • diff --git a/genindex.html b/genindex.html index 7656d64543d..555f9f5559e 100644 --- a/genindex.html +++ b/genindex.html @@ -51,11 +51,13 @@

                    Navigation

                    Index

                    - A + _ + | A | B | C | D | E + | F | G | I | L @@ -66,11 +68,32 @@

                    Index

                    | R | S | T + | U | V | W | X
                    +

                    _

                    + + + +
                    + +
                    _disableHA() (built-in function) +
                    + + +
                    _enableHA() (built-in function) +
                    + +
                    + +
                    _handleOnFullSetup() (built-in function) +
                    + +
                    +

                    A

                    @@ -78,12 +101,36 @@

                    A

                    add() (built-in function), [1]
                    + +
                    addUser() (built-in function), [1] +
                    + + +
                    admin() (built-in function) +
                    + + +
                    Admin() (class) +
                    +
                    +
                    aggregate() (built-in function) +
                    + +
                    and() (built-in function), [1]
                    + +
                    assignReplicaSet() (built-in function) +
                    + + +
                    authenticate() (built-in function), [1] +
                    +
                    @@ -91,6 +138,10 @@

                    B

                    +
                    batchSize() (built-in function) +
                    + +
                    Binary() (class)
                    @@ -120,6 +171,10 @@

                    B

                    BSON.serializeWithBufferAndIndex() (BSON method)
                    + +
                    buildInfo() (built-in function) +
                    +
                    @@ -131,15 +186,75 @@

                    C

                    -
                    close() (built-in function) +
                    chunkCollection() (built-in function) +
                    + + +
                    chunkSize number [Getter|Setter] (None attribute) +
                    + + +
                    close() (built-in function), [1], [2], [3] +
                    + + +
                    collection() (built-in function), [1] +
                    + + +
                    Collection() (class) +
                    + + +
                    collectionNames() (built-in function) +
                    + + +
                    collections() (built-in function) +
                    + + +
                    collectionsInfo() (built-in function)
                    +
                    command() (built-in function), [1] +
                    + +
                    compare() (built-in function), [1]
                    + +
                    connect() (built-in function) +
                    + + +
                    count() (built-in function), [1] +
                    + + +
                    createCollection() (built-in function) +
                    + + +
                    createIndex() (built-in function), [1] +
                    + + +
                    Cursor() (class) +
                    + + +
                    cursorInfo() (built-in function) +
                    + + +
                    CursorStream() (class) +
                    +
                    @@ -147,7 +262,15 @@

                    D

                    -
                    db() (built-in function) +
                    db() (built-in function), [1] +
                    + + +
                    Db() (class) +
                    + + +
                    Db.connect() (Db method)
                    @@ -155,13 +278,29 @@

                    D

                    +
                    delete() (built-in function) +
                    + + +
                    dereference() (built-in function) +
                    + +
                    deserialize() (built-in function)
                    + +
                    deserializeStream() (built-in function) +
                    + + +
                    destroy() (built-in function), [1] +
                    +
                    -
                    deserializeStream() (built-in function) +
                    distinct() (built-in function)
                    @@ -172,6 +311,26 @@

                    D

                    Double() (class)
                    + +
                    drop() (built-in function) +
                    + + +
                    dropAllIndexes() (built-in function) +
                    + + +
                    dropCollection() (built-in function) +
                    + + +
                    dropDatabase() (built-in function) +
                    + + +
                    dropIndex() (built-in function), [1] +
                    +
                    @@ -179,9 +338,55 @@

                    E

                    + +
                    +
                    each() (built-in function) +
                    + + +
                    ensureIndex() (built-in function), [1] +
                    + + +
                    eof() (built-in function) +
                    + +
                    +
                    equals() (built-in function), [1], [2]
                    + +
                    eval() (built-in function) +
                    + + +
                    explain() (built-in function) +
                    + +
                    + +

                    F

                    + + +
                    + +
                    find() (built-in function) +
                    + + +
                    findAndModify() (built-in function) +
                    + +
                    + +
                    findAndRemove() (built-in function) +
                    + + +
                    findOne() (built-in function) +
                    +
                    @@ -189,6 +394,22 @@

                    G

                    - +
                    +
                    geoHaystackSearch() (built-in function) +
                    + + +
                    geoNear() (built-in function) +
                    + + +
                    get() (built-in function) +
                    + + +
                    getc() (built-in function) +
                    + +
                    getHighBits() (built-in function), [1]
                    @@ -204,8 +425,6 @@

                    G

                    getNumBitsAbs() (built-in function), [1]
                    -
                    getTimestamp() (built-in function)
                    @@ -214,10 +433,44 @@

                    G

                    greaterThan() (built-in function), [1]
                    +
                    greaterThanOrEqual() (built-in function), [1]
                    + +
                    Grid() (class) +
                    + + +
                    GridStore() (class) +
                    + + +
                    GridStore.exist() (GridStore method) +
                    + + +
                    GridStore.list() (GridStore method) +
                    + + +
                    GridStore.read() (GridStore method) +
                    + + +
                    GridStore.readlines() (GridStore method) +
                    + + +
                    GridStore.unlink() (GridStore method) +
                    + + +
                    group() (built-in function) +
                    +
                    @@ -225,16 +478,44 @@

                    I

                    - +
                    -
                    isNegative() (built-in function), [1] +
                    indexes() (built-in function)
                    -
                    isOdd() (built-in function), [1] +
                    indexExists() (built-in function) +
                    + + +
                    indexInformation() (built-in function), [1] +
                    + + +
                    inheritReplSetOptionsFrom() (built-in function) +
                    + + +
                    insert() (built-in function)
                    +
                    isCapped() (built-in function) +
                    + + +
                    isClosed() (built-in function) +
                    + + +
                    isNegative() (built-in function), [1] +
                    + + +
                    isOdd() (built-in function), [1] +
                    + +
                    isZero() (built-in function), [1]
                    @@ -245,6 +526,10 @@

                    L

                    - + - +
                    +
                    lastError() (built-in function) +
                    + +
                    length() (built-in function)
                    @@ -257,12 +542,24 @@

                    L

                    -
                    Long() (class) +
                    limit() (built-in function) +
                    + + +
                    listDatabases() (built-in function)
                    +
                    logout() (built-in function), [1] +
                    + + +
                    Long() (class) +
                    + +
                    Long.fromBits() (Long method)
                    @@ -285,10 +582,18 @@

                    M

                    - +
                    +
                    mapReduce() (built-in function) +
                    + +
                    MaxKey() (class)
                    +
                    md5 number [Getter|Setter] (None attribute) +
                    + +
                    MinKey() (class)
                    @@ -307,6 +612,10 @@

                    M

                    +
                    Mongos() (class) +
                    + +
                    multiply() (built-in function), [1]
                    @@ -321,12 +630,16 @@

                    N

                    -
                    not() (built-in function), [1] +
                    nextObject() (built-in function)
                    +
                    not() (built-in function), [1] +
                    + +
                    notEquals() (built-in function), [1]
                    @@ -351,7 +664,11 @@

                    O

                    -
                    open() (built-in function) +
                    open() (built-in function), [1], [2] +
                    + + +
                    options() (built-in function)
                    @@ -365,7 +682,33 @@

                    P

                    + @@ -375,7 +718,65 @@

                    R

                    -
                    put() (built-in function) +
                    pause() (built-in function), [1], [2] +
                    + + +
                    ping() (built-in function) +
                    + + +
                    previousErrors() (built-in function) +
                    + + +
                    profilingInfo() (built-in function) +
                    + +
                    + +
                    profilingLevel() (built-in function) +
                    + + +
                    put() (built-in function), [1] +
                    + + +
                    puts() (built-in function)
                    + @@ -385,6 +786,14 @@

                    S

                    -
                    read() (built-in function) +
                    read() (built-in function), [1] +
                    + + +
                    readlines() (built-in function) +
                    + + +
                    ReadPreference() (class) +
                    + + +
                    ReadStream() (class) +
                    + + +
                    reIndex() (built-in function), [1] +
                    + + +
                    remove() (built-in function) +
                    + + +
                    removeUser() (built-in function), [1] +
                    + + +
                    rename() (built-in function) +
                    + +
                    + +
                    renameCollection() (built-in function) +
                    + + +
                    ReplSet() (class) +
                    + + +
                    ReplSet.State() (ReplSet method) +
                    + + +
                    replSetGetStatus() (built-in function) +
                    + + +
                    resetErrorHistory() (built-in function) +
                    + + +
                    resume() (built-in function), [1], [2] +
                    + + +
                    rewind() (built-in function), [1]
                    - + @@ -247,7 +247,7 @@

                    Object Document Modeling Libraries

                    - + @@ -259,10 +259,10 @@

                    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git

                    - + - +
                    +
                    save() (built-in function) +
                    + + +
                    seek() (built-in function) +
                    + +
                    serialize() (built-in function)
                    @@ -393,20 +802,52 @@

                    S

                    -
                    shiftLeft() (built-in function), [1] +
                    Server() (class)
                    -
                    shiftRight() (built-in function), [1] +
                    serverStatus() (built-in function) +
                    + + +
                    setProfilingLevel() (built-in function) +
                    + + +
                    setReadPreference() (built-in function), [1], [2] +
                    + + +
                    shiftLeft() (built-in function), [1]
                    +
                    shiftRight() (built-in function), [1] +
                    + +
                    shiftRightUnsigned() (built-in function), [1]
                    +
                    skip() (built-in function) +
                    + + +
                    sort() (built-in function) +
                    + + +
                    stats() (built-in function), [1] +
                    + + +
                    stream() (built-in function), [1] +
                    + +
                    subtract() (built-in function), [1]
                    @@ -421,6 +862,10 @@

                    T

                    +
                    tell() (built-in function) +
                    + +
                    Timestamp() (class)
                    @@ -443,6 +888,10 @@

                    T

                    +
                    toArray() (built-in function) +
                    + +
                    toHexString() (built-in function)
                    @@ -465,10 +914,30 @@

                    T

                    +

                    U

                    + + + +
                    + +
                    unlink() (built-in function) +
                    + +
                    + +
                    update() (built-in function) +
                    + +
                    +

                    V

                    - +
                    +
                    validateCollection() (built-in function) +
                    + +
                    value() (built-in function)
                    @@ -485,7 +954,13 @@

                    W

                    + @@ -517,6 +992,14 @@

                    Contents

                    Manual

                    - +
                    -
                    write() (built-in function) +
                    write() (built-in function), [1] +
                    + +
                    + +
                    writeFile() (built-in function)
                    Watchers25302531
                    @@ -1450,7 +1450,7 @@

                    Libraries or Applications for analytics

                    Watchers22802281
                    @@ -1721,6 +1721,14 @@

                    Contents

                    Manual

                    • MongoClient()
                    • +
                    • Db()
                    • +
                    • Collection()
                    • +
                    • Admin()
                    • +
                    • Cursor()
                    • +
                    • CursorStream()
                    • +
                    • Grid()
                    • +
                    • GridStore()
                    • +
                    • ReadStream()
                    • BSON()
                    • ObjectID()
                    • Binary()
                    • diff --git a/index.html b/index.html index 09bc9e7d10d..59dd32618b1 100644 --- a/index.html +++ b/index.html @@ -120,7 +120,19 @@

                      API Documentation
                      • Driver API
                      • Binary JSON API
                          @@ -270,6 +282,14 @@

                          Contents

                          Manual

                          • MongoClient()
                          • +
                          • Db()
                          • +
                          • Collection()
                          • +
                          • Admin()
                          • +
                          • Cursor()
                          • +
                          • CursorStream()
                          • +
                          • Grid()
                          • +
                          • GridStore()
                          • +
                          • ReadStream()
                          • BSON()
                          • ObjectID()
                          • Binary()
                          • diff --git a/markdown-docs/collections.html b/markdown-docs/collections.html index 38bdf74022c..a0cb1508b09 100644 --- a/markdown-docs/collections.html +++ b/markdown-docs/collections.html @@ -245,6 +245,14 @@

                            Contents

                            Manual

                            • MongoClient()
                            • +
                            • Db()
                            • +
                            • Collection()
                            • +
                            • Admin()
                            • +
                            • Cursor()
                            • +
                            • CursorStream()
                            • +
                            • Grid()
                            • +
                            • GridStore()
                            • +
                            • ReadStream()
                            • BSON()
                            • ObjectID()
                            • Binary()
                            • diff --git a/markdown-docs/database.html b/markdown-docs/database.html index 0cf21fab08c..66ad6426535 100644 --- a/markdown-docs/database.html +++ b/markdown-docs/database.html @@ -271,6 +271,14 @@

                              Contents

                              Manual

                              • MongoClient()
                              • +
                              • Db()
                              • +
                              • Collection()
                              • +
                              • Admin()
                              • +
                              • Cursor()
                              • +
                              • CursorStream()
                              • +
                              • Grid()
                              • +
                              • GridStore()
                              • +
                              • ReadStream()
                              • BSON()
                              • ObjectID()
                              • Binary()
                              • diff --git a/markdown-docs/gridfs.html b/markdown-docs/gridfs.html index 816f93a7a8f..ab84f61ddea 100644 --- a/markdown-docs/gridfs.html +++ b/markdown-docs/gridfs.html @@ -267,6 +267,14 @@

                                Contents

                                Manual

                                • MongoClient()
                                • +
                                • Db()
                                • +
                                • Collection()
                                • +
                                • Admin()
                                • +
                                • Cursor()
                                • +
                                • CursorStream()
                                • +
                                • Grid()
                                • +
                                • GridStore()
                                • +
                                • ReadStream()
                                • BSON()
                                • ObjectID()
                                • Binary()
                                • diff --git a/markdown-docs/index.html b/markdown-docs/index.html index 9f2d6c5a805..a8924a8139e 100644 --- a/markdown-docs/index.html +++ b/markdown-docs/index.html @@ -74,6 +74,14 @@

                                  Contents

                                  Manual

                                  • MongoClient()
                                  • +
                                  • Db()
                                  • +
                                  • Collection()
                                  • +
                                  • Admin()
                                  • +
                                  • Cursor()
                                  • +
                                  • CursorStream()
                                  • +
                                  • Grid()
                                  • +
                                  • GridStore()
                                  • +
                                  • ReadStream()
                                  • BSON()
                                  • ObjectID()
                                  • Binary()
                                  • diff --git a/markdown-docs/indexes.html b/markdown-docs/indexes.html index af507e9fe62..dcc443333a7 100644 --- a/markdown-docs/indexes.html +++ b/markdown-docs/indexes.html @@ -177,6 +177,14 @@

                                    Contents

                                    Manual

                                    • MongoClient()
                                    • +
                                    • Db()
                                    • +
                                    • Collection()
                                    • +
                                    • Admin()
                                    • +
                                    • Cursor()
                                    • +
                                    • CursorStream()
                                    • +
                                    • Grid()
                                    • +
                                    • GridStore()
                                    • +
                                    • ReadStream()
                                    • BSON()
                                    • ObjectID()
                                    • Binary()
                                    • diff --git a/markdown-docs/insert.html b/markdown-docs/insert.html index dd4bb8576d3..a922a8e8eea 100644 --- a/markdown-docs/insert.html +++ b/markdown-docs/insert.html @@ -226,6 +226,14 @@

                                      Contents

                                      Manual

                                      • MongoClient()
                                      • +
                                      • Db()
                                      • +
                                      • Collection()
                                      • +
                                      • Admin()
                                      • +
                                      • Cursor()
                                      • +
                                      • CursorStream()
                                      • +
                                      • Grid()
                                      • +
                                      • GridStore()
                                      • +
                                      • ReadStream()
                                      • BSON()
                                      • ObjectID()
                                      • Binary()
                                      • diff --git a/markdown-docs/queries.html b/markdown-docs/queries.html index 9d08125b1d6..10781f86d99 100644 --- a/markdown-docs/queries.html +++ b/markdown-docs/queries.html @@ -394,6 +394,14 @@

                                        Contents

                                        Manual

                                        • MongoClient()
                                        • +
                                        • Db()
                                        • +
                                        • Collection()
                                        • +
                                        • Admin()
                                        • +
                                        • Cursor()
                                        • +
                                        • CursorStream()
                                        • +
                                        • Grid()
                                        • +
                                        • GridStore()
                                        • +
                                        • ReadStream()
                                        • BSON()
                                        • ObjectID()
                                        • Binary()
                                        • diff --git a/markdown-docs/replicaset.html b/markdown-docs/replicaset.html index ddc1ec5e65e..561db419d39 100644 --- a/markdown-docs/replicaset.html +++ b/markdown-docs/replicaset.html @@ -149,6 +149,14 @@

                                          Contents

                                          Manual

                                          • MongoClient()
                                          • +
                                          • Db()
                                          • +
                                          • Collection()
                                          • +
                                          • Admin()
                                          • +
                                          • Cursor()
                                          • +
                                          • CursorStream()
                                          • +
                                          • Grid()
                                          • +
                                          • GridStore()
                                          • +
                                          • ReadStream()
                                          • BSON()
                                          • ObjectID()
                                          • Binary()
                                          • diff --git a/objects.inv b/objects.inv index 8c22064746cc090f3544dc7b827d474caad74f38..6c86c30eab299db5b07f317622f024448eb2812e 100644 GIT binary patch delta 1253 zcmVFjeh<{m2kJ~m7zVELv&|d8#hhB2?V>jM*V=wFk1yU3NC5~ifDN-dV z#}4}AJEXLhrO1{@@5zufLk{Qh&Bt*jDH9Y9BW>t=P9or=@w-ue9B0*s$c26a`BMzu<=WWqQT>7z*GRV_j@CThhL%&KsQn??i9XIKW>kSwoPh=_@I zTlNF4ZW|X$OMg{s#k)ehI4x0R5uWt#4`2+a|F-VuAG;VaMzN?c@Y8CkVpJQc&I0w3 zi9g}k6I(p`3mj`Dy<>^luykjFj{aRS0}qT}KYE9;==D#p%k}Rpqi=wpX|4YOmuw%k zxnV84h$gWV0#_KEO*SJj4j7TGA*Rqi3FRu(W}(W6lYbw&>B%9k+#W?(NOA>xCJTM9 zlvH}~=5v>xTcdzvmmOOsv363mZh}Xi3W@;6lH>Ivkeq}2bna_GGMJyf3^tjG9bo=# z%2=&)tDqmybyrtFP}zfOX42LrCuiFD=CP4WIH1=MctXD0ZS+5|)%-%!Lz8tjvv?C%&ndv#nbD-YNqDtmd&Rxd@e_x}2j4PcwLnUH5B`LPtZEtR$^5z z9XJnK3UY;H$=g~ZheAMCL16VSh#?Wt;MZvMnt#%uEn~vtg5%c`1TJuw);jjFSx~Q5 z4=)OmZ-5rDe?FA$sjo4eks)#zK!(VnL55CLcU2ayC)uqU(Zo^)@FTpZod9R4H=wqRI*!ZVyhgI)SuT`8R>~hLS#o zbARX>&4{LmdDtmzmt3p+e+$Bcte9=rs|f{+AVVbo0X4bvDfAf=MD44Ze)Uji85{yw*(BG>5(@BZHfRaI~c!OBt)jya~{@ixD&ul4Nev)ee)EjUS zH^g{?B<#Xmrb|G$&tN)eV+RiUvfCUO=&lRjXQ5dtfWApv@bz{@bFPKEh2}`Bmw)7l zX2dVmEYkb_Rb3iyX@|}3enZ8bfqGBy+DI;>arTFm+o>sDAAGfXp}mK#g+Jp4p$lK) z$ZGw7L21oln5Ql$hj2R*n1v4G9YHBDx&eb2opbOoxosOD^v}(LBx8 zpI{H%N3%|>70F=uG}3mKzFDO0DqihLBp&xU*x0Fkyu4padLfI5Lk~xxPN-|#eiMW< zJ?B#Qjlo)pIjhq08jWuh0E(fB7VcS0D#RaruOyUu{eNR*=)n8t8%}f9l84|$-D8H73hn~5qkmzh1P_gKkVpghkXfS^ z{XPg6%lHX$2L=lQJz_0*5#>@;G1aO;<~7Hf3O){Ijd=&=LVx;QBQ^o3X$4B7YS*Km zyQAs%kGLVAKvKl$Ur4nCRJpx0pS^=u#A--#H%uL>Ot2mpr^zfs@qsVqk}N1&pA-?fH8s5A+ z=rDv8_Y(j{4A;#3ZL1;mP{C5v83TuIi8UJ2?RTzd!ND(y*3BAnzu-4$KcV8#eo%4U z?47EbVfXLglNcLf<70DvYquCsV>GrFe;SF+%CZ)-22}qF{~mR=FI=lni@$-+PxHdT z!2j`6wMK;kY5EGD+4n7O21-4bh$qr6e4Y*NCrELF4mD#`oZ|2+@_sg7GUph`h20CJ b_sw0YPYr!o?Pu4|A@H(%{MPM%5_rJsL>DAZ diff --git a/search.html b/search.html index 6d053966fac..caaf74ed003 100644 --- a/search.html +++ b/search.html @@ -86,6 +86,14 @@

                                            Search

                                            Manual

                                            • MongoClient()
                                            • +
                                            • Db()
                                            • +
                                            • Collection()
                                            • +
                                            • Admin()
                                            • +
                                            • Cursor()
                                            • +
                                            • CursorStream()
                                            • +
                                            • Grid()
                                            • +
                                            • GridStore()
                                            • +
                                            • ReadStream()
                                            • BSON()
                                            • ObjectID()
                                            • Binary()
                                            • diff --git a/searchindex.js b/searchindex.js index 8ae84ab1145..e9e17093ffe 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{Binary:[24,0,1,""],DBRef:[4,0,1,""],notEquals:[28,1,1,""],lessThanOrEqual:[28,1,1,""],valueOf:[27,1,1,""],Long:[12,0,1,""],serializeWithBufferAndIndex:[2,1,1,""],toJSON:[28,1,1,""],getNumBitsAbs:[28,1,1,""],Timestamp:[28,0,1,""],Symbol:[27,0,1,""],MinKey:[5,0,1,""],shiftRight:[28,1,1,""],toString:[28,1,1,""],getTimestamp:[17,1,1,""],toNumber:[28,1,1,""],isOdd:[28,1,1,""],getHighBits:[28,1,1,""],calculateObjectSize:[2,1,1,""],Double:[14,0,1,""],shiftRightUnsigned:[28,1,1,""],shiftLeft:[28,1,1,""],MaxKey:[8,0,1,""],greaterThan:[28,1,1,""],BSON:[2,0,1,""],getLowBitsUnsigned:[28,1,1,""],toHexString:[17,1,1,""],getLowBits:[28,1,1,""],ObjectID:[17,0,1,""],isNegative:[28,1,1,""],toInt:[28,1,1,""],deserializeStream:[2,1,1,""],isZero:[28,1,1,""],lessThan:[28,1,1,""],greaterThanOrEqual:[28,1,1,""],MongoClient:[23,0,1,""]},ObjectID:{createFromTime:[17,1,1,""],createFromHexString:[17,1,1,""]},Timestamp:{fromBits:[28,1,1,""],fromNumber:[28,1,1,""],fromInt:[28,1,1,""],fromString:[28,1,1,""]},Long:{fromBits:[12,1,1,""],fromNumber:[12,1,1,""],fromInt:[12,1,1,""],fromString:[12,1,1,""]},BSON:{serializeWithBufferAndIndex:[2,1,1,""],serialize:[2,1,1,""],deserializeStream:[2,1,1,""],calculateObjectSize:[2,1,1,""],deserialize:[2,1,1,""]},MongoClient:{connect:[23,1,1,""]}},terms:{nwt:11,returnkei:16,maxscan:16,readfilesync:26,prefix:[25,16,30],conncet:25,crete:[],createindex:[6,16],world_safe2:[],world_safe1:[],pedro:9,test_map_reduce_functions_inlin:[],deviat:16,under:16,jamuhl:11,everi:[0,13,18],test_gs_seek_with_buff:[],arrj:11,affect:26,disabledriverbsonsizecheck:[25,16],simple_next_object_collect:[],upload:18,correct:[31,16,2,17],test_stream_writ:26,gotik:[11,15],suno:16,"10k":16,throught:26,seper:26,direct:[6,31,25],second:[17,3,16,10,13,30,32,23],street:11,aggreg:[9,1,16,26],even:[0,29],attemp:16,neg:[16,12,28],calcul:[2,26],"new":[0,1,2,26,9,3,12,16,10,13,28,6,32,30,18,25,17,23],net:[],metadata:[18,32],"_event":16,rootcollect:[],never:[25,16],here:[31,32],comparedata:26,epce4qkoh5:29,io_seek_set:[],anymor:16,loos:[11,31],getlowbit:[19,12,28,7],findandmodifi:[16,10],expireaftersecond:[],vincentcr:16,pvorb:11,schemaless:31,unix:25,replicatset:26,m_tddbw6qnuu4iuxlyo:29,middlewar:[11,29],sarah:[],describ:29,would:[25,0,16,12,6,32,28],aaron:16,concret:11,overhead:31,recommend:[31,16,29],type:[8,9,2,26,27,18,4,29,24,5,14,31,32,16,33],tell:[31,32],relax:16,relat:6,notic:[25,32,26,31],warn:[25,10],exce:[],jpg:[],hold:[31,2],must:[0,28,12,26,25],join:29,err:[0,26,10,3,18,16,13,30,25,31,32,23],aheckmann:16,setup:[3,32,26],work:[0,26,25,16,29,31,21,32],test_gs_tel:[],rework:16,root:32,overrid:[25,16,23,26],give:29,autodetect:16,simple_geo_haystack_command:[],indic:[0,10,9,30,6,18,31,13],unavail:26,want:[25,26,0,30,13,6,14,31,32,23],david:10,unsign:[28,12],port2:25,end:[25,18,16,29,31,32,30],replicaset:[9,1,26,25,3,16,31,22,23],quot:16,playerid:29,how:[9,1,26,25,29,31,21,32,33],"_id_":[],recoveri:3,env:[],rewind:[0,16],verifi:[25,17],config:[3,16,23],updat:[24,9,1,10,16,29,25,31,32,22,23],maxdist:[],recogn:[],lte:0,after:[25,2,10,11,18,16,29,31,32,23],listdatabas:16,befor:[0,26,25,3,16,13,6,31,32,23],wrong:16,gs2:[],beauti:[9,29],parallel:31,demonstr:29,attempt:[25,16,13,31,26],third:[],credenti:[],zzdhidden:11,exclud:[],perform:[0,26,25,28,12,16],maintain:29,errorobject:16,order:[25,0,10,13,6],origin:10,cursorinfo:[],over:[11,16,29,13,26],fall:25,becaus:[11,25,28,12],readbuff:[16,32],flexibl:11,vari:16,digest:[16,32],uuid:[24,2],fit:31,fix:[16,32],mongolia:11,better:[25,1,26,9,16,31,13],offic:25,complex:[31,26],loggerinst:16,persist:[31,15],mydb:25,split:[28,12],them:31,thei:[25,26,28,12,31,32,16],authdb:[],safe:[26,10,16,30,31,23],"break":25,update_a_simple_docu:[],test_gs_weird_bug_stream:[],"0x7f":2,bread:11,"instanceof":16,choic:16,guileen:11,changelog:[9,16],bonu:31,timeout:[25,26,3,16,13,23],each:[0,26,25,3,16,12,28,32,13],debug:[25,16,13],went:[],a_simple_collect:[],mean:[25,26,3,16,29,31,32,13],resum:16,customobject:26,nin:0,eventstor:11,extract:16,network:25,newli:[6,30],monitor:11,content:[24,0,26,10,11,18,29,31,32,7],daniel:[0,13,18],reader:[16,26],got:31,unrecogn:25,more_index_information_test:[],navig:32,worthwhil:32,rail:11,default_port:13,situat:16,standard:[11,25,16],sharded_test_db:23,md5:[24,16,2],filter:29,mvc:11,pagin:[],regress:16,onto:16,rang:[0,16,25],instruct:3,alreadi:[25,10,18,30,6,31,13],wrapper:11,unlin:[],getnumbitsab:[19,12,28,7],cceac:11,primari:[0,26,25,3,16,13,31,23],hexstr:17,rewritten:[16,26],top:[11,28,12],startindex:2,tonumb:[19,12,28,7],ton:[31,32],tom:29,kamikazepanda:[11,15],listen:16,consol:[0,2,26,10,18,30,31,32,13],namespac:4,eventlisten:16,took:[],"_id":[0,26,10,16,13,6,25,32,23],incur:31,gyp:16,removeus:16,silli:31,target:32,provid:[25,26,11,28,12,31,32,23],cursorstream:[],project:[11,9,21,29,26],matter:[25,31],iron:31,myexperience620186085001:29,beginn:9,websocket:[11,31],abov:[25,32,26,31,10],modern:11,mind:31,raw:[25,26,0,16,10,13,30,32,23],seed:25,manner:[16,32],increment:[31,29],seem:25,incompat:25,seek:[18,16,32],dbref:[9,4,19,31,16,7],ensureindex:[6,16],simple_limit_collect:[],data2:[],simplifi:[11,16,32],evangelist:29,insur:16,plenti:32,usernam:[6,25],object:[24,0,2,26,9,3,18,16,10,13,6,29,32,30,11,25,31,17,23,33],deleg:13,regular:[0,16,18],tradit:31,simplic:[25,32],don:[25,16,13,26],doc:[0,2,26,10,11,16,25,31,23],flow:16,doe:[25,29,26,10,28,12,30,31,32,16],masylum:11,bson_data_d:2,radix:[28,12],random:26,speedup:16,syntax:[25,16],test_stream_funct:[],identifi:[25,30,32,26,31],involv:16,absolut:[28,12,32],acquir:[],field2:0,explain:[0,16],field1:0,secondarypref:[25,26],theme:31,busi:31,rich:31,ppf_qxbkwm4g:29,io_seek_cur:[],cachefunct:2,nasti:16,test_cursorstream_destroi:[],stop:16,collectionsinfo:[],bson_data_numb:2,report:31,youtub:[21,29,15],databank:11,bar:[],emb:[21,29,15],patch:16,book:[0,9],bad:26,previouli:[],fieldnam:0,fair:32,indexnam:[],num:[],structur:[0,32,31],previouserror:[],respons:[0,29,26],fail:[25,16,26,31],themselv:16,best:25,awar:[],said:[32,26],databas:[0,10,11,9,16,33,13,30,18,25,31,32,22,23],test_gs_empty_file_eof:[],discoveri:29,gridstor:[9,2,26,17,18,16,33,32,22,23],simplest:[11,0,32],awai:32,lotsofdoc:31,accord:3,newnam:[],getlasterror:[25,16,23],howev:[],against:[25,26,0,16,12,17,28],logic:[0,16],login:25,seri:11,com:[9,11,16,29,15,31,21],con:29,assur:[],can:[0,26,10,3,18,16,12,25,28,6,32,30,31,17,13],simple_explain_collect:[],height:[21,29,15],foobar2:[],path:[18,16],guid:9,assum:[28,12],duplic:[6,16],three:[31,32],been:[16,32,13,26],much:[25,1,29,26,9,16,10,31,32],basic:[9,33,25,31,32,23],arbit:[25,16],regul:[],nodeeventstor:11,search:[9,31],argument:[24,28,2,17,4,12,27,14,16,32,23],child:23,"catch":16,laurie71:16,another_root:[],mapreduce_integration_test:[],peform:[25,23],dissect:32,properti:[0,16,13,18],weren:0,marriag:[9,29],"typeof":[16,2],aid:26,maxbsons:16,succes:[],toolkit:11,sever:[10,3,30,6,31,13],grown:31,usessl:[],test_is_close_function_on_cursor:[],receiv:[25,32],make:[25,26,0,16,10,6,31,32,13],transpar:29,meetup:[9,29],filestream:26,drawback:32,descend:6,isneg:[19,12,28,7],complet:[25,16],reset_error_histori:[],pick:[25,16,32,26,31],hang:16,hand:13,fairli:[16,26],rais:25,tune:32,scenario:13,geohaystack:[],test_close_function_on_cursor:[],client:[25,26,10,11,16,31,23],thi:[24,0,29,26,10,11,18,16,12,13,28,6,32,25,31,17,21,23],everyth:10,settimeout:[16,26],left:[25,28,12,13,26],protocol:[31,16],just:[0,32,26,31,25],laptop:16,ordin:[],farther:[],yet:13,languag:[11,31,29],previous:[25,16],wmode:29,easi:[11,26],collectionn:13,had:[],board:29,hap:26,els:[13,10],ffffff:29,save:[18,16,13,10],dynamicstream:29,applic:[9,26,25,11,16,29,15,31,32],which:[0,29,3,18,16,12,28,30,32,13],preserv:[],background:[],test_ev:[],apart:[31,32],measur:16,specif:[25,29,26,0,9,16,17,31,30],arbitrari:16,negat:[19,12,28,7],collection2:[],collection1:[],underli:[],www:[9,25,29,15,21,23],right:[29,28,12,32,31],old:[],creek:29,deal:31,manual:[9,7],interv:16,deserializestream:[19,2,7],dead:16,intern:[0,28,12,18],sockettimeoutm:[25,16,26],successfulli:[],thu:[25,10],txt:[],nwtj:11,readpreferencetag:25,timestampd:17,multipli:[19,12,28,7],originalhex:17,christkv:[31,16],condit:[0,16],foo:26,localhost:[25,26,11,16,30,31,32,23],a_simple_create_drop_collect:[],collection_stats_test:[],who:[16,26],promot:31,repositori:[11,31,16],post:[0,28,12,26,30],shtylman:16,plug:31,obj:[],unpars:16,bson_deseri:16,slightli:31,simul:[28,12,32],commit:[],produc:26,simple_previous_error_col:[],pingstrategi:16,bson_data_symbol:2,"float":[31,28,12],encod:[3,31,16,13],bound:26,down:[25,16,26],pair:25,gridstorewrit:[],wrap:[0,16,14,27],storag:[11,31,32],git:[11,16],rrusso2007:16,wai:[0,1,10,11,9,16,12,25,31,32,28],homepag:11,support:[25,1,26,0,18,16,9,31,32],serverinfo:[],avail:[9,1,26,25,3,16,29,31,32],width:[21,29,15],test_rename_collection3:[],test_rename_collection2:[],constantli:31,bulqmxg0vdc:29,lowest:[25,16],head:32,medium:[],form:[16,29],forc:[25,16,23],"true":[0,2,26,10,3,18,16,29,13,6,30,25,31,32,23],reset:[0,16],absent:25,awaidata:[],new_nam:30,bugfix:16,geospati:[],maximum:[25,16,31],until:[31,26],fundament:31,sampl:31,emit:[31,16,23,26],shouldcorrectlyfailonretryduetoappcloseofdb:[],featur:[9,1,32,16,26],"abstract":11,fromstr:[28,16,12,19,7],exist:[0,10,18,16,13,6,30,25,31,32,23],videoplay:29,check:[0,2,26,25,18,16,12,6,31,28],test_collection_opt:[],bson_binary_subtype_md5:[24,2],test_to_a_after_each:[],floor:17,when:[0,2,26,10,3,18,16,29,25,30,31,32,13],refactor:16,simple_limit_skip_find_one_queri:[],test:[25,26,10,11,18,16,15,31,32,30],forceclos:[],miliscecond:[],node:[9,26,25,3,16,29,11,15,31,21,7],insensit:[],consid:25,sql:31,cachefunctionscrc32:2,dropdup:16,teixeira:9,longer:16,sock:16,ignor:[25,2,31],time:[9,26,17,3,16,29,25,11,31,13,33],push:[11,31,16],backward:16,daili:29,concept:[31,16],skip:0,global:16,read_secondary_onli:[],row:[],millisecond:13,decid:16,middl:[],depend:16,readabl:26,"_disableha":[],fog:29,dropindex:6,overriden:25,sourc:[29,15],string:[24,0,2,17,18,4,12,30,27,25,28,6,16,31,32,23],alinsilvian:16,feasibl:32,word:25,wvalu:25,cool:26,logmeup:11,contenttyp:18,level:[11,25,16,26],did:16,dig:31,eventemitt:16,iter:16,item:[31,16,26],unsupport:25,team:29,quick:[31,32,29],div:[29,19,12,28,7],round:[25,31],databasenam:13,wtimeout:[25,16,23],prevent:16,addtoset:[31,26],sign:[28,12,30],slow_onli:[],cost:16,port:[31,16,13],comparis:[],checkoutwrit:[],repli:31,muq2w2u5x9m:21,current:[25,29,26,18,4,12,28,16,31,32,23],subtype_uuid:24,shared:25,boost:11,deriv:[28,12],autogener:[],gener:[9,17,11,16,13,25,32,23],address:25,wait:[25,23,26],box:31,bson_data_regexp:2,shift:[16,12,28],simpleemitt:16,queue:[11,31],behav:16,examp:11,numberofretri:[25,16,23,13],extrem:16,weird:16,werehamst:11,ourselv:[],orient:9,regardless:26,checkkei:2,extra:[0,26],tweak:25,modul:[11,16],prefer:[25,1,26,0,9,16,31,23],toarrai:[11,0,16,26,31],bxhflrwemeg:15,instal:[31,16],includeloc:[],aaaaipotmrk:29,perf:16,memori:[0,33,9,16,31,32],regep:31,ryanke:11,serverstatu:16,connector:[9,29],live:[31,16,32],handler:32,value2:0,value1:0,criteria:10,msg:16,scope:[31,16,2],prev:[],maxkei:[8,9,2,16,19,7],multiplecoll1:[],python:9,peopl:[16,26],finit:[28,12],visual:11,prototyp:25,examin:31,content_typ:[18,32],fly:11,cap:[31,16],uniqu:[0,13,6],primer:[9,32,29,33],test_correctly_access_collect:[],whatev:13,bson_binary_subtype_funct:[24,2],nearest:[25,16,23,26],connecttimeoutm:[25,16,26],mongo:[9,1,26,10,11,16,29,13,25,31,32,23,33],stream:[9,1,2,26,18,16,31,32],predict:16,bson_data_long:2,fuck:[],sake:25,createcollect:[31,16,26,30],topic:[9,29],nocr:11,cube:11,kaflr8pi5nk:21,occur:[0,10,18,16,13,6,30,23],alwai:[31,16,12,28],multipl:[25,26,3,16,12,28,13],ping:[25,16,26],fieldvalu:0,write:[24,25,2,26,3,18,16,13,19,31,32,23,7],foreach:[],pure:[16,2,23,17],nyc:[9,29],map:[31,16,26],product:[29,28,12],max:16,dive:[31,32],date:[2,26,17,16,6,31],docstartindex:2,data:[24,9,2,26,33,18,16,29,15,31,32],grow:31,db1:25,sbrekken:16,inform:[25,3,18,6,11,31,13],"switch":16,reaper:[16,13],combin:[25,29,23,26],keepgoingexampl:[],filedata:26,talk:29,increas:16,still:[25,0,16,10],pointer:[0,30,13,18],dynam:29,test_map_reduce_funct:[],group:[9,26,16,29,32,21],gte:0,indexexist:16,secondaryacceptablelatencym:[25,26],jim:[],nodelai:[3,25,16,13],mongocli:[9,1,2,26,17,16,25,20,31,32,23,7],platform:31,mbostock:16,requir:[25,2,26,17,16,10,13,30,31,32,23],main:[9,32,29,31,25],non:[11,16],"6pjmp23z0lw":21,simple_skip_collect:[],col2:[],col3:[],initi:[25,16,32,23,31],col1:[],milisecond:[25,16,23],now:[31,16,32,26],discuss:[9,29],nor:30,introduct:[9,33,3,29,25,31],mapreduc:16,name:[24,0,2,26,10,3,18,4,29,30,13,6,16,25,32,23],readfil:[],drop:[6,16,13,30],revert:0,crypto:16,separ:[0,16,25],mongoerror:16,recreat:13,jprichardson:11,compil:16,failov:[3,16,26],domain:[25,16],replai:16,dialect:11,replac:[0,16,31,10],individu:[0,16,26],firej:[],a_1_b_1:[],contributor:29,poolreadi:16,serverclust:16,happen:16,shown:[31,32,26],accomplish:32,"3rd":16,space:[25,2],streetsaheadllc:11,profil:[],stuff:[3,9,32,33,31],factori:[0,13],resultset:31,million:29,orm:[11,29],mime:[],sethml:16,replacethiscollect:[],org:[11,9,23,25],"byte":[24,0,2,17,18,16,31,32,13],care:[3,0,31,25],validatecollect:16,bradberri:29,synchron:31,thing:[31,32,13],place:[9,28,12],year2013:16,frequent:[28,12],first:[0,29,17,18,16,10,13,30,31,32,23],oper:[0,26,10,18,16,12,13,28,6,30,25,31,32,23],bson_binary_:16,directli:[0,16,31,25],onc:[6,16,26,31],arrai:[24,0,2,26,10,3,18,16,31,30],fullsetup:[16,26],yourself:29,reopen:13,fast:11,happi:[11,9,29],open:[25,26,10,3,18,16,29,30,13,20,31,32,23,7],predefin:2,size:[0,2,26,18,16,12,32,28],given:[24,25,16,12,32,28],breviti:[31,32],workaround:16,paramt:[],collectionnam:[6,30,32,13],secondary_pref:[16,23,26],conveni:[0,28,12],subtype_md5:24,especi:31,copi:3,shouldcorrectlyexecutesimpleaggregationpipelineusingargu:[],specifi:[24,0,25,18,16,31,32,13],test_arrai:[],keepgo:16,than:[0,26,10,3,18,16,12,28,32,13],png:18,serv:29,firebas:[],tedeh:16,were:10,posit:[24,18,28,12,32],browser:11,pre:2,fork:11,sai:32,sam:26,pro:29,ani:[0,26,25,11,10,31,32],subroutin:16,simple_rename_collection_2:[],test_gs_read_stream_pip:[],deliv:29,bitwis:[31,28,12],squar:11,alias:0,destroi:[],note:[25,28,12],continueonerror:[],take:[0,2,25,3,16,29,31,32],createfromhexstr:[0,16,19,7,17],maxpools:25,begin:[0,25],sure:[32,13],normal:16,buffer:[24,0,2,10,18,16,13,30,25,32,23],connectarbit:[25,16],clearer:16,getyear:[],hotfix:16,renam:[31,30],byte_valu:24,later:32,mongoclient_test:23,indexbound:[],test_gs_read_stream:[],runtim:16,parseint:[],axi:[],wtimeoutm:25,show:[25,2,31,17],enumer:25,atom:[31,16],objectid3:17,objectid2:17,concurr:16,limitrequest:16,corner:16,fuckhttp:[],onli:[0,26,10,3,16,25,6,31,32,13],slow:16,dice:31,fenc:25,setprofilinginfo:[],activ:[11,16,26],written:[11,24,28,12,32],analyt:[11,9,29,31],offici:25,overwritten:32,min_valu:[28,12],variou:11,get:[9,29,10,11,18,16,17,13,6,30,31,32,23,33],secondari:[3,25,16,23,26],ssl:[25,16],cannot:[28,16,12,26,31],shiftrightunsign:[19,12,28,7],geo:[],gen:29,nolock:16,doabl:0,test_n:[],seldom:16,intermitt:[16,26],yield:[16,30,10],isarrai:2,caboos:11,nettl:11,where:[24,0,2,26,10,3,18,16,25,6,30,31,32,23],highbit:[28,12],desced:[],wiki:31,khwang:11,figur:25,jbrumwel:16,testcas:16,fireandforget:25,concern:[25,23],infinit:[16,12,28],detect:[3,16],heckmann:16,fs_chunk:32,integration_tests_2:[],timestamplib:28,wayt:[],enough:[],between:[25,26,16,29,13,31,23],"import":[31,32,26],across:[25,16,13,26],elbert3:16,spars:6,jsbon:16,august:[9,29],parent:[],tut:9,test_group:[],let:[25,16,32,26,31],come:[18,28,12],simple_find_and_modify_operations_:[],region:[],gwt:[28,12],tour:25,tutori:[9,21,32],mani:[31,26],fromnumb:[19,12,28,7],among:26,reindex:16,iscap:16,db_option:13,period:[0,30],dispatch:31,createcreateindexcommand:16,fs_file:32,lessthan:[19,12,28,7],colon:25,typic:25,reaperinterv:[16,13],cursor_information_collect:[],cursorinst:[],coupl:31,aciev:0,simplereach:29,rebuilt:[],derefer:16,emphas:26,lowbit:[28,12],geonear:16,functionalii:25,"1mb":32,those:[28,12],"case":[16,12,6,31,32,28],myself:31,bson_seri:16,tostr:[17,28,12,19,32,7],trick:[9,32],invok:32,idhex:0,firstext:[],simple_sort_collect:[],trello:[9,29],advantag:31,createexperi:29,eras:[18,30],dynamicgui:11,hash:[25,0,16,13,31,32,23],mod:[0,28,12],ascii:[3,16,13],acess:[],develop:[9,26,25,11,29,31],author:[0,26,18,10],media:11,same:[25,0,16,12,6,17,28],binari:[24,0,2,26,10,9,16,17,13,19,30,18,31,23,7],html:9,document:[0,2,26,9,3,18,16,10,13,6,29,30,11,31,32,23],howtonod:9,createpk:13,exhaust:16,ifram:[21,29,15],finish:[25,32,23],closest:[28,12],utf8:[3,31,16,13],nest:[0,6],oid:4,driver:[0,1,26,10,3,9,16,29,30,25,11,20,31,32,13,7,33],gotend:[],capabl:29,newobjectid:17,improv:[9,1,16,26],extern:[9,16],defo:0,bson_data_boolean:2,appropri:29,moder:29,framework:[11,9,1,26],brightcov:29,without:[25,2,26,16,12,28,30,13],model:[11,29],dereferenc:[],upsert:[25,23,10],ourexamplefiletowrit:[],execut:[25,26,10,16,31,23],tip:9,fengmk2:16,rest:[11,16,17],hint:[],db_connector:[30,13],except:[25,16,26,31,10],param:29,desktop:9,blog:[11,0,30,9],framebord:[21,29,15],bigger:26,default_chunk_s:[],haystack:[],vimeo:9,found2:[],around:[11,9,16,31],read:[24,9,1,26,25,3,18,16,19,31,32,23,7],grid:[11,24,16,32],pop:31,world:[32,2,10],lasterror:16,reap:16,subtype_user_defin:24,saniti:16,poolsiz:[25,16,13,31],realtim:[9,29],integ:[0,2,17,28,12,31,16],server:[25,2,26,10,3,16,17,13,11,29,30,31,23],firebaseco:[],either:[25,26,18,16,31,32],output:0,greaterthanorequ:[19,12,28,7],manag:[11,18,16,31],kvalheim:29,bson_binary_subtype_byte_arrai:[24,2],eventloop:32,ascend:[0,6],intact:10,setnodelai:16,slice:31,writedata:32,node_ev:16,confirm:31,definit:9,legal:[],shouldstreamdocumentswithpauseandresumeforfetch:[],evolv:31,profilinginfo:[],bson_data_binari:2,power:[11,29,26],broken:16,aquir:[],bson_binary_subtype_default:[24,16,2],regexp:[31,16,2],"throw":[26,10,16,31,32,13],comparison:17,deflat:26,pointer_to_collect:0,firstnam:[0,6],nocooki:[21,29,15],side:11,bson_data_code_w_scop:2,gump:[],act:32,luck:32,readstream:16,addus:16,test_collections_info:[],strip:25,your:[25,26,3,29,11,31,32],opencal:16,loc:[],log:[0,2,26,10,11,18,16,25,30,31,32,13],hex:[0,17],overwrit:[],errormessag:16,strict:[16,13,30],interfac:[11,25,16,31],low:[31,28,12,32],lot:[6,16,32,31,9],isvid:29,tupl:6,shamelessli:31,replsetsrv:3,faster:[6,1,26,16,9],pull:[31,16],dirti:31,possibl:[0,10,11,16,25,6,31],"default":[24,0,1,2,26,9,3,18,16,10,13,6,32,30,25,31,17,23],remove_subset_of_documents_saf:[],auto_reconnect:[3,25,13,31],expect:[0,13],gone:[],creat:[0,2,26,17,3,18,16,29,13,6,30,25,31,32,23],certain:[6,31],watcher:11,intro:31,file:[11,18,16,32,26],bob:26,russel:29,calculateobjects:[19,2,7],again:[16,26],kaba:11,compel:29,writestream:16,shard_test:[],field:[25,29,26,0,16,10,6,31,23],valid:[30,2,17],longlib:12,you:[0,2,26,10,3,18,16,29,25,6,30,31,32,13],thousand:25,scttnlsn:11,pefrom:[],sequenc:16,symbol:[9,2,27,16,19,31,7],briefli:29,opt_radix:[28,12],pool:[25,16,13,26],reduc:[28,25,16,12,26],lessthanorequ:[19,12,28,7],coreh:11,directori:16,descript:[24,2],tricki:31,potenti:16,alright:31,simplifii:25,cpu:[16,32],unset:31,represent:[8,24,29,17,4,12,5,25,14,27,28],all:[0,2,26,9,3,18,16,10,13,6,30,25,31,32,23],forget:31,numberupd:[],dollar:30,month:29,simple_rename_collect:[],erhangundogan:11,follow:[0,26,10,3,6,31,32],disk:[25,32,26],nodej:[11,29,15],subtype_default:24,nextobject:0,init:[],introduc:[25,16,29],namesonli:[],setprofilinglevel:[],evaul:[],util:[11,16,26],candid:26,test_rename_collect:[],failur:[31,16],veri:[9,26,25,16,31,32],base698:11,list:[25,16,32,30,31],resav:[],adjust:[25,16,32],findandremov:16,small:[25,16,32,21],retun:2,eas:11,sync:[25,23],integration_tests2:23,zero:[16,12,28,17],design:[9,29],pass:[25,2,17,3,16,30,31,32,13],simialar:16,excit:29,what:[9,26,30,29,31,32],abc:[0,10],xor:[19,12,28,7],sub:[24,29],sum:[28,12],abl:[16,26],brief:21,delet:[18,16,32,13,31],version:[25,16,32,23,13],cruso:0,method:[0,1,26,17,9,16,33,13,30,25,31,32,23],contrast:25,full:16,christian:29,variat:31,behaviour:11,getmorecommand:[],foobar3:[],strong:21,modifi:[31,16,10],valu:[24,0,2,26,10,18,16,12,27,25,28,6,19,29,14,32,30,31,17,13,7],bartt:11,isodd:[19,12,28,7],ahead:[11,31,32],showdiskloc:16,reason:25,replicaset_mongo_client_collect:[25,23],amount:[31,28,12],croucher:29,noopen:16,action:9,mongoos:[11,9,21,29],narrow:[],evalfunct:2,via:31,shorthand:10,lazybum:11,c_1:[],deprec:[16,23],href:[],default_root_collect:[],establish:[16,26],select:[25,26,10,16,30,13],test_collection_is_cap:[],distinct:16,regist:[],two:[0,29,26,10,3,9,28,12,11,32,18,6,31,17,30],coverag:16,bson_binary_subtype_user_defin:[24,2],taken:31,minor:[9,1,16,26],more:[0,29,26,10,25,3,16,12,31,32,28],flag:[],stick:31,particular:31,cach:2,none:[3,25,29],outlin:[25,32,26,31],dev:11,histori:[],remain:32,"static":11,learn:[11,9,29],scan:[],dodebug:13,share:[11,16,29,23,13],shard:[18,26,23,25],accept:16,simple_document_insert_collection_no_saf:[],default_url:[],uri_decode_auth:23,robinson:0,cours:31,newlin:[],divid:[25,28,12],rather:[],anoth:[0,23,31,17],hugh:29,simpl:[0,2,26,9,11,16,33,25,6,30,31,32,23],perman:[],griddata:26,resourc:[11,13],variant:31,reflect:16,unlink:[18,32],associ:32,keyorlist:[],"_handleonfullsetup":[],github:[11,9,16,15,31],defineproperti:16,save_a_simple_document_modify_it_and_resave_it:[],suppport:25,caus:[31,16],callback:[0,10,18,16,13,6,30,31,32,23],spheric:[],doc_id:0,help:16,bson_data_oid:2,trade:32,through:[31,16,29,26],reconnect:[25,16,13,31],paramet:[0,10,3,18,16,13,6,30,31,32,23],style:[11,31,16,29],mongorepli:16,call:[0,26,11,16,13,32,23],asbuff:2,dbname:[16,23],stylu:15,rapidli:31,bypass:31,simple_limit_skip_queri:[],test_cursorstream_resum:[],might:[6,32,26,31,25],alter:[0,30],port1:25,good:[9,32,26,31],"return":[8,0,2,26,10,18,4,12,32,24,5,13,27,30,14,28,16,25,31,17,23],timestamp:[9,2,17,16,19,28,7],more_complex_index_test:[],distancemultipli:[],compound:[],karaco:11,readlen:[],portn:25,emerleit:11,uploadd:18,unlik:26,authent:[16,23,26],easili:[16,12,28],achiev:0,skipvalu:[],portx:25,found:[25,0,16,10],truncat:[16,32,30],hard:31,realli:31,connect:[9,1,26,25,3,16,33,13,11,32,20,31,21,23,7],slave:[3,25],event:[26,18,16,13,31,32,23],mojo:11,b4ajeu13u6u:21,print:13,read_primari:16,pullal:31,foreground:[],core2duo:16,proxi:[25,16,26],advanc:[9,30,33,32,31],pageview:26,asc:[0,10],"_enableha":[],base:[17,11,18,16,31,32],connectionopt:[],put:[24,16,32,19,7],seconddb:[],gethighbit:[19,12,28,7],test_streaming_function_with_limit_for_fetch:[],tailabl:16,omit:[31,4,32,16],dir:[31,32,26,10],assign:[3,16],major:[25,23],notifi:[31,32],articl:[9,32,33],lastnam:[0,6],number:[24,0,2,26,17,16,12,13,28,6,14,25,31,32,23],asiletto:16,done:[25,26,0,18,16,10,31,32,13],construct:[28,12],autoclos:[18,32],create_and_drop_an_index:[],miss:[25,16],differ:[25,26,17,9,16,12,6,31,32,28],script:[18,16,29],interact:[31,32],least:[0,26],custompkfactori:13,contra:16,statement:[31,32],illeg:16,master:[3,16],store:[11,18,32,2,31],schema:[9,29],otherid:17,option:[24,0,1,2,9,3,18,4,10,30,13,6,16,25,31,32,23],reseterrorhistori:[],similarli:31,selector:16,getter:[],pars:[16,2],fileid2:[],literarili:31,std:16,kind:32,bson_data_nul:2,whenev:[],createwritestream:26,remov:[6,16,30,31,10],reus:[16,2],str:[28,12],consumpt:32,toward:29,cleaner:11,comput:9,luckili:[31,32],packag:11,expir:[],"null":[0,2,25,3,16,13,11,30,23],built:[11,31],equival:31,valueof:[19,14,7,27],fromcollect:[],also:[0,26,10,9,16,25,6,30,31,32,13],build:[31,16,29,32],tool:[11,29],pipelin:26,distribut:26,lubow:29,blackboard:[11,9,15],choos:[25,26,31],reach:32,most:[0,32,29,26,31],plai:29,plan:32,native_pars:[25,23,13],"16mb":18,clear:16,part:[25,16,21,31,17],clean:[11,16],frombit:[19,12,28,7],ridicul:11,brightcoveexperi:29,session:[11,29],find:[0,26,10,11,18,16,25,6,31],firewal:16,nosql:[11,9],pretti:[25,31],jacobbubu:16,test_gs_weird_bug:[],numberofdocu:2,queu:11,batch_document_insert_collection_saf:[],hit:[],unus:16,express:[0,26,9,11,18,15,31],fieldtoupd:31,barrier:16,nativ:[11,31,16,13],ferret:11,restart:[],assignreplicaset:[],singapor:[16,26],statist:[25,16,23],wrote:31,set:[0,2,26,10,3,18,16,29,13,6,30,25,31,32,23],jade:15,getmor:16,see:[0,26,10,18,28,12,13,6,30,31,32,23],easymongo:11,close:[25,26,11,18,16,13,20,31,32,23,7],my_f:[],chose:29,misalign:16,jenkin:[],someth:13,particip:[],configur:[3,25,16,30],some_databas:13,mismatch:16,altern:11,signatur:[],primary_pref:[23,26],numer:25,complement:[28,12],javascript:[2,11,16,12,29,31,28],salzman:16,succeed:6,both:[16,26],last:[11,18,31,25],create_and_drop_all_index:[],alow:25,context:[16,29,13],pdf:26,whole:[31,26],createdat:[],load:[0,16],simpli:[0,26],jsmode:[],point:[31,16,12,32,28],instanti:[31,16],littl:31,shutdown:16,suppli:[16,32],averag:26,backend:31,identif:16,faithfulli:[28,12],user_id:[],due:[25,16,31],empti:[0,16,25],bgcolor:29,strategi:[25,16,26,31],fire:[18,32,13,31,10],admindb:[],imag:[18,32],ecosystem:29,understand:31,func:2,reconnectwait:25,look:[18,16,29,6,31,32],mdoq:11,straight:[31,32],batch:[31,16],"while":[0,16,26,23,18],getownpropertynam:16,behavior:[25,0,10,16,12,31,28],error:[0,26,10,11,18,16,13,6,30,25,31,23],fun:[32,26],fixtur:11,robin:[25,31],loop:16,real:[11,9,29],test_gs_unlink:[],readi:[31,26],key2:0,key1:0,"_state":[],rip:[],itself:[9,25],test_deref_exampl:[],inheritreplsetoptionsfrom:[],rid:16,simple_key_based_distinct_sub_query_filt:[],chase:16,decor:16,simple_document_insert_with_function_saf:[],minim:25,geohaystacksearch:16,coffeescript:[11,9,21],decod:23,p_db:3,conflict:25,higher:[3,16,32,13,26],"10gen":[9,25],optim:16,crud:[9,33,31],more_complex_ensure_index_test:[],iya_logo_final_bw:[],temporari:[],user:[24,0,2,26,10,11,9,16,29,6,23],hello2:[],keyf:16,recent:29,travers:[],task:26,entri:32,joyent:29,readprefer:[25,16,23,26],explan:[],getlowbitsunsign:[19,12,28,7],a_1:[],collabor:29,shape:16,update_a_simple_document_multi:[],bson_data_timestamp:2,cur:32,colladow:11,tdegrunt:11,keeptemp:[],read_secondari:[3,16],sessionstorag:11,input:[28,12],subsequ:[],format:[25,1,26,0,9,16,10],big:[25,16,32,31],checksum:[],intuit:25,shiftright:[19,12,28,7],rs_name:[3,25,16],replsetserv:[3,16,2,23,17],backbon:29,success:18,resolv:[],collect:[0,26,10,3,9,4,29,30,18,13,6,16,11,25,31,32,22,23,33],bson_data_cod:2,popular:[9,29,31],bamboo:16,brett:29,serverpair:16,often:[28,12],acknowledg:[25,23],creation:[31,16,29],some:[25,26,0,9,16,29,6,18,31,32],back:[0,26,25,11,16,12,31,17,28],understood:31,dropallindex:[],somecollect:26,scale:[9,32,29,31],slaveok:[25,16],chunksiz:[18,16,32],per:26,retri:[25,16,23,31,13],larg:[0,26,18,16,31,32],recogniz:25,intial:26,previou:[25,32,13],run:[9,26,10,3,16,33,31,32],lublow:29,simple_reset_error_history_col:[],step:32,simple_explain_queri:[],zir:11,subtract:[19,12,28,7],k1mnspb8wvq:21,allowfullscreen:[21,29,15],recordquerystat:[25,23],block:32,cygwin:16,within:[28,12],simple_index_test:[],ensur:[25,26,16,6,31,32],test_collection_index_exist:[],question:[29,28,12],"long":[9,2,17,16,12,25,19,31,7],custom:[0,16,32,13,26],includ:[0,26,9,16,29,13,6,30,25,31,23],forward:[],files:16,properli:16,isbuff:16,uniquedoc:[],"_bsontyp":16,hainterv:[25,26],link:[9,32,33,31],translat:11,simple_count_exampl:[],line:[11,32],info:[16,32],concaten:[28,12],consist:[16,26],caller:[],forceserverobjectid:[25,16,23,13],contin:11,readlin:[],similar:[18,23,25],constant:[24,19,2,7],multiplecoll2:[],parser:[9,1,2,26,25,16,13,23],doesn:[0,13,10],repres:[25,27,28,12,14,31,17],isconnect:16,unifi:25,titl:[0,22,26,10],declar:16,unidirect:[],wakup:[],nice:[31,29],deseri:[2,26,16,19,31,7],bcoe:11,jannehietamaki:16,mongodb:[0,2,26,9,3,18,16,10,13,6,29,15,32,30,11,25,31,17,21,23,7],eval:[16,2],profilinglevel:[],sokra:16,algorithm:[3,28,16,12,13],cursorinform:[],evenli:26,tradeoff:32,awesom:[9,21,15,26],filebodi:[],leak:16,far:[],hello:[31,32,2,10],code:[25,2,26,17,16,31,32,23],partial:[],worldbuff:[],queri:[0,26,10,9,16,29,13,6,30,25,31,22,23,33],idvalu:0,mongoskin:11,replicasetcheckinterv:16,base64:[3,16,13],update_a_simple_document_upsert:[],send:[3,25,16,13,31],lower:[],io_seek_end:[],"256k":32,sens:10,reapertimeout:[16,13],sent:13,passiv:16,tailableretryinterv:16,shouldcorrectlyforcereindexoncollect:[],result2:[],degrunt:[],writebuff:16,untouch:13,relev:[25,31],tri:25,magic:11,gettim:17,roll:9,fieldorspec:[],fewer:[],"try":[31,16,32,10],race:16,marri:29,refer:[31,4,16],rack:[25,26],impli:25,smaller:[18,26],fortun:31,natur:[25,29,31],jump:[31,16,29,32],tobson:[9,1,16,26],video:[9,32],odm:[11,9,21],download:31,odd:[28,12],append:[18,31],compat:16,index:[9,2,26,16,6,22,30,7],compar:[26,17,28,12,6,19,7],descriptor:[18,32],access:[18,27,14,25],experiment:16,asced:[],lee:16,primarypref:25,bson_data_int:2,batchsizevalu:[],cursor_count_collect:[],calipso:11,logout:[],filedescriptor:32,becom:31,sinc:[31,28,12,32,10],subtype_byte_arrai:24,nexttick:16,convert:[0,31,17],convers:31,larger:[18,16,32],technolog:29,chang:[9,1,26,25,16,12,31,32,28],honor:16,tempcollect:[],appli:[0,16,31,25],app:[3,9,16,29,25],mattinsl:11,api:[9,26,25,11,16,29,19,20,32],redi:29,cloud:9,chrisgibson:11,from:[24,0,2,26,10,3,9,16,12,25,28,29,32,30,18,31,17,23],batchsiz:[],doubl:[9,16,19,14,31,7],upgrad:16,next:[0,32,2,13,29],websit:[11,29],chr:[],latenc:[25,26],panel:[9,29],sort:[0,16,10,17,6],acknowleg:[25,23],src:[21,29,15],repl_set:16,benchmark:16,name2:0,actual:[0,32,13,31],socketopt:[3,25,16,13],sollect:30,account:[],retriev:[0,10,18,16,31,32],scalabl:18,multiple_db_inst:[],annot:32,unopen:16,thin:11,fetch:[0,31,6],queryfailur:16,control:[31,16,32,13,26],objectid:[0,2,9,4,17,13,19,16,25,31,32,23,7],process:[9,26,25,11,16,12,28],lock:[16,32],username_:6,high:[9,1,26,25,16,12,31,28],tag:[25,16,23,26],serial:[25,2,26,16,19,23,7],numbit:[28,12],readprefr:25,pingresult:[],integration_test_:[3,25,23],instead:[0,25,3,16,13,6,32,23],npm:[31,16],pois:29,await:[],formattedorderclaus:16,awaitdata:16,test_map_reduce_functions_scop:[],alloc:[16,2],bind:11,remove_all_documents_no_saf:[],correspond:[6,28,12,30],element:[0,31],issu:[31,16],chief:29,writ:[],allow:[25,26,16,30,31,32,13],subtyp:24,fallback:[25,16],deoptim:16,doc2:31,doc3:31,doc1:31,alexeypetrushin:11,doc4:31,spank:16,autoindexid:[],comma:25,server_opt:13,createreadstream:26,effici:[31,32],numberoftest:[],bunch:16,perfect:31,chosen:26,total:[0,26],crash:16,greater:[0,28,12],handl:[29,26,28,12,31,32,16],auto:31,databs:[30,13],dai:[9,29],auth:16,renamecollect:[],precess:31,numberofremoveddoc:[],writefil:[18,32,26],convin:0,anyth:16,edit:32,npmj:11,slide:[9,29],deserializeddoc:2,exampledb:[31,32,26],subset:[],unwind:26,opensync:[],chunk:[18,16,32,26],bson_binary_subtype_uuid:[24,2],default_content_typ:[],pushal:[31,16],our:[25,32,29,31],special:[25,28,12,32,31],out:[9,26,25,3,16,17,31,32,13,33],variabl:[31,16],calip:11,trickier:[0,31],categori:32,suitabl:32,leverag:[31,29],ref:16,clone:11,math:17,common:16,jessica:[0,10],insid:[0,32,18,6],dropcollect:30,manipul:[],releas:16,likelihood:25,princess:[],replsetgetstatu:16,unwant:0,could:[31,16],shiftleft:[19,12,28,7],keep:[18,16,31],length:[24,2,17,18,19,32,7],outsid:26,primarki:0,minkei:[9,16,2,19,5],evanp:11,debugmessag:16,echo:[],iszero:[19,12,28,7],should_correctly_rewind_and_restart_cursor:[],gridstore3:[],gridstore2:[],gridstore7:[],gridstore6:[],gridstore5:[],totalopen:[],prioriti:16,start:[24,0,2,26,9,3,16,31,32,30],system:[25,26,11,16,32,30],messag:[25,16,13,10],createfromtim:[16,19,7,17],bson_data_max_kei:2,termin:[],"final":[31,16,29],idottv:11,deconstruct:32,test_gs_getc_fil:[],exactli:30,gridstorew:[],bson_data_object:2,replset:[3,25,16,23,26],pgebheim:16,bother:29,mongoserv:[30,13],tocollect:[],charact:[24,16,17],test_gs_puts_and_readlin:[],seriou:16,result:[0,26,17,10,18,16,12,13,28,25,31,32,23],deliveri:29,counter:13,terribl:16,corrupt:16,have:[0,26,25,3,16,29,6,31,32,30],tabl:[31,21,30],need:[0,2,26,10,18,16,12,25,28,6,30,31,32,13],turn:[0,16,26,25],border:21,buildinfo:[],min:16,rout:11,shankar0306:16,mix:[0,6],andrewjston:16,milli:[],test_other_drop:[],orgiin:[],singl:[24,0,10,18,16,29,25,23],fileid:32,deploy:26,statsync:[],whi:0,discov:[16,26],serverconfig:[16,23,13],test_gs_working_field_read:26,why:[11,31,29],overwriten:[],url:[9,1,26,25,11,16,31,23],integration_tests_to_drop:[],request:[16,29],uri:[25,23,31],face:31,pipe:26,test_collect:10,snapshot:[],"400m":29,determin:31,constrain:[],streamrecord:[31,16],fact:[31,10],text:[29,28,12,32,26],serializefunct:[25,16,2,23],verbos:[],filebuff:[],nagl:[3,16,13],anywai:[],setter:[],textual:[28,12],locat:[31,26],playerkei:29,should:[25,0,28,12,32,17,30],noid:11,test_cursorstream_paus:[],local:[4,23],devnul:11,move:[18,16,26,31],ritch:[11,16],kiefer:29,gettimestamp:[16,19,7,17],db2:23,donewithwrit:32,enabl:[16,13,26],organ:29,simple_batch_size_collect:[],tohexstr:[0,16,19,7,17],integr:[11,31,32],contain:[24,25,2,3,30,31,32,23],grab:[],mon4mongo:11,view:11,legaci:25,modulo:[0,19,12,28,7],packet:16,meritt:11,writeconcern:[],fromint:[19,12,28,7],statu:[11,25,16,26,31],wire:[31,16],correctli:[31,16],pattern:9,boundari:16,state:[31,16,13],crude:31,world2:[],kei:[0,2,25,16,13,6,31,32,23],buckets:[],simple_queri:[],isol:16,job:11,entir:32,joe:26,bson_data_min_kei:2,crc32:2,addit:[0,2,28,12,32,23],mongod:[11,25,26],plugin:29,admin:[25,16,29],mongoj:[11,9],equal:[0,2,17,28,12,25,19,31,23,7],etc:[0,13],instanc:[25,2,26,17,3,16,13,31,32,23],greaterthan:[19,12,28,7],mongoq:11,futher:25,uncaught:16,subtype_funct:24,comment:[16,26],toint:[19,12,28,7],walk:29,removealllisten:16,save_a_simple_docu:[],attende:29,addition:[30,26],window:16,compon:16,json:[9,29,28,12,19,31,13],treat:[0,16],pkfactori:[25,23],immedi:10,bit:[0,2,18,28,12,31,32,16],protect:16,assert:[2,23,17],ador:11,present:[25,6,30,29,9],replic:3,multi:[16,10],plain:16,align:16,cursor:[0,16,31],defin:[24,0,2,10,16,12,25,28,31,13],setreadprefer:[16,26],bson_data_arrai:2,observ:11,layer:[11,31,29,26],helper:[11,9,1,16,26],streameddata:[],site:3,lightweight:11,tojson:[28,16,12,19,7],nodetut:9,getc:[],cross:16,member:[3,25,16,26],world_no_saf:[],speaker:29,probabl:0,gett:11,difficult:[32,26],incorrect:16,http:[9,25,11,16,29,15,31,21],hostnam:[25,13],keepal:[3,25,16,13],upon:[],proxlet:29,retriv:[],student:21,test_stream_write_2:26,serializewithbufferandindex:[19,2,7],php:9,chunk_siz:18,off:[25,3,16,13,30,31,23],center:26,nevertheless:13,builder:29,well:[0,16,32,26,31],exampl:[0,2,26,10,9,30,17,13,6,18,25,31,32,23,33],command:[25,11,16,13,31,23],simple_geo_near_command:[],filesystem:18,undefin:16,latest:31,distanc:[],paus:[],less:[31,28,12],"boolean":[25,2,26,18,28,12,6,32,23],additon:6,tcp:31,mojodna:16,indexinform:[6,16],front:25,episod:9,web:[11,9,31],rapid:[9,29],seekloc:32,add:[25,16,12,28,6,19,31,13,7],originaldata:26,tjanczuk:11,host2:25,host1:25,logger:[25,16,13],match:[25,26,0,10,28,12,31,30],karait:11,agnost:16,simple_key_based_distinct:[],piec:[31,28,12,32],know:30,password:[25,16,23],recurs:[12,28,2],isclos:[],desc:0,bson_data_str:2,insert:[0,2,26,10,9,16,13,30,31,22,23],resid:31,like:[0,29,25,11,28,12,6,32],fsync:[25,16,23],commandfuck:[],hostn:25,isui:29,chunkcollect:[],necessari:[0,26],"0xff":2,async:[11,31],page:[0,29,31,9],read_preference_replicaset_test_0:[],milewis:11,linux:16,gridf:[9,1,26,33,18,16,32],"export":[],flush:32,proper:16,rayno:16,fileinfo:32,newhex:17,librari:[11,9,16,29,32],dc1:26,tmp:[16,26],leaf:11,lead:[16,12,28],aaronasachimp:16,dropdatabas:[16,13],avoid:[6,16,31],octet:[],thank:[16,26],overlap:25,leav:[16,10],kcbanner:11,speak:[25,29],mode:[26,18,16,30,32,13],encourag:25,slight:31,journal:[25,23],"enum":25,usag:[9,2,17,3,18,16,30,31,32,13],exclicitli:25,collection_nam:30,host:[25,13,31],file_id:[16,26],although:32,offset:[24,16,32],java:[28,12],cliftonc:11,simpler:[11,31,16],continu:[11,25],about:[25,10,9,29,6,31,32,13],rare:16,socket:[9,25,3,16,29,13,11,15,31,23],dbinstanc:32,notequ:[19,12,28,7],constructor:[8,24,2,20,17,3,4,12,5,13,28,19,14,16,25,27,23,7],fals:[0,2,10,18,16,13,30,25,32,23],qard:11,disabl:[3,16,13,26],own:16,automat:[3,18,16,31,32,13],dataset:[0,31],bson:[8,0,1,2,26,9,4,10,24,5,13,27,19,14,16,25,17,23,7,30],merg:16,val:[],pictur:32,transfer:[],mykei:31,trigger:16,concat:0,"var":[0,2,26,17,3,18,30,10,13,25,31,32,23],fsname:[],"function":[24,0,2,26,10,3,18,16,12,13,28,11,32,30,25,31,17,23],shouldcorrectlyexecutesimpleaggregationpipelineusingarrai:[],brand:16,learnboost:[11,29],waitforconnect:16,gain:16,overflow:[28,12],inlin:16,bug:[16,32],count:[0,16,30,10],made:[16,29,32],wise:0,cleanup:[16,32],temp:26,whether:[28,25,16,12,26],wish:[24,31,16,2,32],displai:[25,29,23],asynchron:[3,31,16],record:[0,10,18,16,13,6,30,25,31,23],below:[25,26,9,10,28,12,31],lucasfilm:[16,26],limit:[0,16,31,18],otherwis:[2,26,28,12,31,32,23],problem:16,quickli:29,myexperience1123429378001:29,evalu:2,"int":[25,28,12],dure:[25,16,23,31],year:0,filenam:[18,16,32],replica:[3,25,16],implement:[25,26,11,16,12,31,28],ing:[9,29],eric:29,retrymilisecond:[25,16,23,13],inc:[31,16],tick:16,detail:[25,6,18],deepequ:26,other:[0,1,29,26,9,3,16,12,25,31,32,28,33],bool:17,futur:[11,25,16,31],branch:16,stat:16,findon:[0,16,31],"class":[8,24,2,26,17,4,12,5,25,28,29,14,32,16,31,27,23],geck:11,stai:[],experienc:29,eof:[18,32],rule:26,integration_test:[25,23],kaij:16,"0_gnhwzhc":21},objtypes:{"0":"js:class","1":"js:function"},titles:["Queries","Updates","BSON()","Replicasets","DBRef()","MinKey()","Indexes","Node.JS MongoDB Driver Manual Contents","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","Database","Double()","Awesome Node.js + MongoDB Applications","Changelog","ObjectID()","GridStore","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","MongoClient()","Binary()","MongoClient or how to connect in a new and better way","Mongo Driver and Mongo DB 2.2 Features","Symbol()","Timestamp()","Node.JS Specific Presentations","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver","Articles"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"]},filenames:["markdown-docs/queries","driver-articles/index","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-bson-generated/minkey","markdown-docs/indexes","contents","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","markdown-docs/database","api-bson-generated/double","content/awesomeappsvideo","changelog/changelog","api-bson-generated/objectid","markdown-docs/gridfs","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","api-generated/mongoclient","api-bson-generated/binary","driver-articles/mongoclient","driver-articles/anintroductionto1_1and2_2","api-bson-generated/symbol","api-bson-generated/timestamp","content/nodejsvideo","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2","api-articles/index"]}) \ No newline at end of file +Search.setIndex({objects:{"":{DBRef:[4,0,1,""],"_enableHA":[40,1,1,""],removeUser:[22,1,1,""],profilingInfo:[26,1,1,""],getNumBitsAbs:[38,1,1,""],batchSize:[12,1,1,""],"chunkSize number [Getter|Setter]":[5,2,1,""],MinKey:[6,0,1,""],shiftRight:[38,1,1,""],writeFile:[5,1,1,""],getTimestamp:[9,1,1,""],toString:[38,1,1,""],replSetGetStatus:[26,1,1,""],indexInformation:[22,1,1,""],previousErrors:[22,1,1,""],CursorStream:[41,0,1,""],findAndModify:[23,1,1,""],renameCollection:[22,1,1,""],inheritReplSetOptionsFrom:[27,1,1,""],toHexString:[9,1,1,""],indexExists:[23,1,1,""],getLowBits:[38,1,1,""],ObjectID:[9,0,1,""],isNegative:[38,1,1,""],lessThan:[38,1,1,""],isCapped:[23,1,1,""],dropAllIndexes:[23,1,1,""],lastError:[22,1,1,""],"md5 number [Getter|Setter]":[5,2,1,""],Long:[17,0,1,""],validateCollection:[26,1,1,""],findAndRemove:[23,1,1,""],cursorInfo:[22,1,1,""],geoNear:[23,1,1,""],Grid:[36,0,1,""],listDatabases:[26,1,1,""],isOdd:[38,1,1,""],calculateObjectSize:[2,1,1,""],dropDatabase:[22,1,1,""],Server:[27,0,1,""],Cursor:[12,0,1,""],MaxKey:[13,0,1,""],resetErrorHistory:[22,1,1,""],toArray:[12,1,1,""],reIndex:[22,1,1,""],collectionsInfo:[22,1,1,""],greaterThanOrEqual:[38,1,1,""],Binary:[34,0,1,""],"_handleOnFullSetup":[40,1,1,""],valueOf:[37,1,1,""],dropIndex:[22,1,1,""],serializeWithBufferAndIndex:[2,1,1,""],setReadPreference:[27,1,1,""],Timestamp:[38,0,1,""],Symbol:[37,0,1,""],dropCollection:[22,1,1,""],Collection:[23,0,1,""],toNumber:[38,1,1,""],isZero:[38,1,1,""],getHighBits:[38,1,1,""],ReadPreference:[25,0,1,""],shiftLeft:[38,1,1,""],createCollection:[22,1,1,""],greaterThan:[38,1,1,""],Mongos:[10,0,1,""],getLowBitsUnsigned:[38,1,1,""],ReplSet:[40,0,1,""],geoHaystackSearch:[23,1,1,""],lessThanOrEqual:[38,1,1,""],MongoClient:[18,0,1,""],notEquals:[38,1,1,""],GridStore:[5,0,1,""],shiftRightUnsigned:[38,1,1,""],findOne:[23,1,1,""],ensureIndex:[22,1,1,""],chunkCollection:[5,1,1,""],nextObject:[12,1,1,""],toJSON:[38,1,1,""],Db:[22,0,1,""],"_disableHA":[40,1,1,""],serverStatus:[26,1,1,""],profilingLevel:[26,1,1,""],collectionNames:[22,1,1,""],ReadStream:[8,0,1,""],setProfilingLevel:[26,1,1,""],Admin:[26,0,1,""],Double:[19,0,1,""],mapReduce:[23,1,1,""],isClosed:[12,1,1,""],BSON:[2,0,1,""],assignReplicaSet:[27,1,1,""],addUser:[22,1,1,""],toInt:[38,1,1,""],deserializeStream:[2,1,1,""],createIndex:[22,1,1,""],buildInfo:[26,1,1,""]},GridStore:{read:[5,1,1,""],readlines:[5,1,1,""],exist:[5,1,1,""],unlink:[5,1,1,""],list:[5,1,1,""]},ObjectID:{createFromTime:[9,1,1,""],createFromHexString:[9,1,1,""]},ReplSet:{State:[40,1,1,""]},Timestamp:{fromBits:[38,1,1,""],fromString:[38,1,1,""],fromInt:[38,1,1,""],fromNumber:[38,1,1,""]},Db:{connect:[22,1,1,""]},Long:{fromBits:[17,1,1,""],fromNumber:[17,1,1,""],fromInt:[17,1,1,""],fromString:[17,1,1,""]},BSON:{serializeWithBufferAndIndex:[2,1,1,""],serialize:[2,1,1,""],deserializeStream:[2,1,1,""],calculateObjectSize:[2,1,1,""],deserialize:[2,1,1,""]},MongoClient:{connect:[18,1,1,""]}},terms:{nwt:16,returnkei:[21,12,23],maxscan:[21,12,23],readfilesync:[5,33],prefix:[35,21,42],conncet:35,crete:23,createindex:[22,23,21,7,29,11],world_safe2:23,world_safe1:23,pedro:14,test_map_reduce_functions_inlin:23,deviat:21,under:21,jamuhl:16,everi:[0,32,24,12],test_gs_seek_with_buff:5,affect:33,disabledriverbsonsizecheck:[35,21,27],simple_next_object_collect:12,upload:24,correct:[2,22,9,21,5,43],math:9,gotik:[16,20],simple_rename_collect:22,"10k":21,throught:33,seper:[5,33],direct:[7,12,43,35],second:[26,22,23,3,21,15,5,18,44,42,36,9,32,12],street:16,aggreg:[14,1,33,23,21,29,11],even:[0,39,23],attemp:[21,22,23],neg:[21,17,38],calcul:[2,33],"new":[0,1,2,3,21,5,7,8,9,12,14,15,17,32,42,22,23,24,26,18,33,35,36,38,41,44],net:[],metadata:[24,44,5],"_event":21,rootcollect:5,never:[35,21,22],here:[43,44,8,5],comparedata:33,epce4qkoh5:39,path:[24,21,5],integration_tests_to_drop:22,anymor:21,robin:[35,40,43],getlowbit:[28,17,38,11],findandmodifi:[21,23,29,11,15],expireaftersecond:[22,23],vincentcr:21,pvorb:16,schemaless:43,unix:35,replicatset:33,m_tddbw6qnuu4iuxlyo:39,middlewar:[16,39],sarah:23,describ:39,would:[0,22,23,21,17,35,7,44,38],init:12,concret:16,overhead:43,recommend:[43,21,39,22,23],type:[13,14,2,33,23,24,4,26,25,5,6,39,19,44,43,34,37,21,45],tell:[22,23,5,29,43,44,11],relax:21,relat:7,notic:[35,44,33,43,23],warn:[35,23,22,15],exce:5,rip:22,hold:[43,2,5,12],must:[35,33,0,38,17,23],join:39,err:[0,26,8,22,15,3,24,21,23,5,18,41,42,36,35,43,44,33,32,12],aheckmann:21,setup:[3,44,22,33],work:[0,12,35,21,39,5,33,43,30,44,22],test_gs_tel:5,rework:21,root:[44,5,36],overrid:[35,22,23,21,33,18,12],give:39,autodetect:21,simple_geo_haystack_command:23,indic:[0,15,14,42,7,24,43,32],unavail:[25,33],want:[0,22,23,42,5,27,18,7,19,40,35,43,44,32,33],keep:[24,21,22,43,23],unsign:[38,17],port2:35,end:[35,8,23,24,21,39,5,41,43,44,42],replicaset:[14,1,22,35,3,21,26,40,43,31,10,18,33],quot:[21,12],playerid:39,how:[14,1,39,12,23,26,5,35,45,33,43,30,44,22],"_id_":[22,23],recoveri:3,env:22,rewind:[0,12,21,5,29,11],verifi:[35,26,22,9,23,5],chase:21,config:[3,21,22,18],updat:[34,14,1,26,22,23,21,15,35,39,29,43,44,31,18,11],maxdist:23,recogn:5,outsid:33,after:[35,26,8,22,15,16,24,21,23,5,39,41,2,36,43,44,18,12],listdatabas:[29,21,26,22,11],befor:[0,22,23,3,21,5,18,7,40,35,43,44,32,33],wrong:21,simple_document_insert_with_function_saf:23,beauti:[14,39],parallel:43,demonstr:39,attempt:[35,22,21,26,5,40,43,10,32,33],third:5,credenti:22,zzdhidden:16,exclud:[12,23],perform:[0,26,22,23,21,17,35,33,38,12],maintain:39,errorobject:21,order:[0,12,15,23,35,7,32],origin:[23,5,15],cursorinfo:[29,22,11],over:[22,23,16,21,39,33,32,12],failur:[43,21],becaus:[16,35,38,17],readbuff:[21,44],flexibl:16,vari:21,digest:[21,44],uuid:[34,2],fit:[43,12],fix:[21,44],mongolia:16,better:[14,1,33,35,21,43,32],offic:35,complex:[43,33,22,23],loggerinst:21,persist:[43,20,23],mydb:35,split:[38,17,5],them:43,thei:[35,33,38,17,43,44,21],authdb:22,safe:[15,22,23,21,26,42,43,18,33],"break":35,update_a_simple_docu:23,test_gs_weird_bug_stream:5,"0x7f":2,bread:16,"instanceof":[12,23,21,26,5,41,22],choic:21,guileen:16,changelog:[14,21],overflow:[38,17],bonu:43,timeout:[35,22,23,3,21,18,33,32,12],each:[0,8,22,40,23,3,21,17,5,35,38,41,29,33,44,10,32,11,12],debug:[35,22,21,27,32,40],went:23,a_simple_collect:22,mean:[35,33,3,21,39,43,44,32,12],resum:[8,21,5,41,29,11],customobject:33,nin:0,eventstor:16,extract:21,network:35,newli:[7,42,26],content:[34,0,8,36,15,16,24,39,5,43,44,11,33],daniel:[0,32,24],reader:[21,33],got:[43,22,23],unrecogn:35,more_index_information_test:[22,23],navig:44,worthwhil:44,rail:16,findandremov:[21,29,11,23],situat:21,standard:[16,35,21],sharded_test_db:18,md5:[34,21,2,5],flush:[44,8,5],filter:[39,22,23],mvc:16,pagin:23,regress:21,onto:21,rang:[35,0,21,40,23],instruct:3,alreadi:[35,12,15,24,42,5,7,43,32,22],messag:[35,26,22,23,21,15,5,27,40,32],unlin:5,getnumbitsab:[28,17,38,11],mojo:16,hexstr:9,rewritten:[21,33],top:[16,38,17,23],keyf:[21,23],startindex:2,tonumb:[28,17,38,11],ton:[43,44],tom:39,recent:39,kamikazepanda:[16,20],listen:21,consol:[0,2,33,15,24,42,43,44,32],namespac:[4,22],eventlisten:21,took:12,incur:43,gyp:21,removeus:[29,21,26,22,11],silli:43,target:[44,23],provid:[35,22,23,16,38,17,5,40,43,44,10,18,33],zero:[21,17,38,9],project:[14,33,23,16,39,30],matter:[35,43],iron:43,myexperience620186085001:39,beginn:14,websocket:[16,43],behavior:[35,0,15,21,17,43,38],modern:16,mind:43,raw:[0,22,23,21,15,18,42,33,35,44,32,12],seed:35,manner:[21,44],increment:[43,39],seem:35,incompat:35,seek:[24,21,5,29,44,11],dbref:[14,22,4,28,43,21,11],ensureindex:[22,23,21,7,29,11],simple_limit_collect:12,data2:5,simplifi:[16,21,44],evangelist:39,insur:21,plenti:44,usernam:[7,26,22,35],object:[0,2,3,21,5,7,8,9,10,12,14,15,16,26,32,40,22,23,24,25,27,18,33,34,35,36,45,39,41,42,43,44],what:[14,12,42,39,43,44,33],regular:[0,21,24],tradit:43,simplic:[35,44],don:[35,33,23,21,32,22],doc:[0,26,2,22,15,16,21,23,5,35,41,33,43,18,12],flow:21,doe:[35,39,22,15,21,17,5,42,23,43,44,38,33],masylum:16,bson_data_d:2,radix:[38,17],random:[25,5,33],speedup:21,syntax:[35,21],test_stream_funct:12,identifi:[35,42,44,33,43],erhangundogan:16,involv:21,absolut:[38,17,44,5],acquir:12,field2:0,explain:[0,12,23,21,29,11,22],field1:0,secondarypref:[35,33],theme:43,busi:43,rich:43,ppf_qxbkwm4g:39,io_seek_cur:5,cachefunct:2,nasti:21,test_cursorstream_destroi:41,stop:21,collectionsinfo:[29,22,11],bson_data_numb:2,report:43,youtub:[30,39,20],databank:16,bar:5,emb:[30,39,20],patch:21,bad:[33,23],previouli:12,fieldnam:0,fair:44,indexnam:[22,23],num:23,tocollect:22,previouserror:[29,22,11],respons:[0,39,12,33],fail:[35,36,23,21,26,33,43,22],christian:39,writestream:21,awar:23,said:[44,33],databas:[0,36,26,22,15,16,14,21,23,5,18,45,42,24,35,43,44,31,32,12],test_gs_empty_file_eof:5,discoveri:39,gridstor:[14,26,8,22,23,33,24,21,9,5,41,45,2,29,36,44,31,18,11,12],simplest:[16,0,44],awai:44,lotsofdoc:43,accord:3,newnam:23,getlasterror:[35,22,23,21,26,18],howev:12,against:[0,26,22,23,21,17,5,35,33,9,38,12],logic:[0,21],login:35,browser:16,com:[14,16,21,39,20,43,30],con:39,assur:12,asced:12,simple_explain_collect:12,height:[30,39,20],getmorecommand:[12,23],io_seek_set:5,guid:14,assum:[38,17],duplic:[7,21,22,12,23],three:[43,44,5],been:[33,12,21,44,32,22],much:[35,1,39,33,14,21,15,43,44],basic:[35,22,14,23,43,44,18,45],arbit:[35,21,40],regul:12,nodeeventstor:16,isodd:[28,17,38,11],ani:[0,22,35,16,15,33,43,44,12],child:[22,18],"catch":[21,23],laurie71:21,another_root:5,subsequ:[22,23],mapreduce_integration_test:23,dissect:44,properti:[0,24,21,5,29,32,11],weren:0,marriag:[14,39],"typeof":[21,2,5],aid:33,maxbsons:21,succes:23,toolkit:16,sever:[15,3,42,7,43,32],grown:43,usessl:[41,22],test_is_close_function_on_cursor:12,receiv:[35,44,8],make:[0,12,15,21,23,35,7,43,44,32,33],format:[0,1,22,15,14,21,23,35,33,12],meetup:[14,39],filestream:[5,33],drawback:44,descend:[7,12],isneg:[28,17,38,11],complet:[35,21,23],reset_error_histori:22,noopen:21,hang:21,hand:32,fairli:[21,33],rais:35,tune:44,scenario:32,geohaystack:23,test_close_function_on_cursor:12,client:[35,26,22,15,16,21,23,5,36,43,33,18,12],thi:[0,8,21,5,7,9,12,15,16,17,26,32,40,22,23,24,25,27,30,18,33,34,35,36,38,39,43,44],everyth:15,settimeout:[8,33,23,21,41,22],left:[35,33,23,38,17,32,22],protocol:[43,21,12],just:[35,33,0,23,43,44],laptop:21,ordin:[22,23],farther:8,yet:32,languag:[16,43,39],previous:[35,21],doc1:43,wmode:39,easi:[16,33],collectionn:32,had:12,board:39,hap:33,els:[26,23,32,15],ffffff:39,save:[8,22,15,24,21,23,5,29,32,11],dynamicstream:39,applic:[14,22,23,16,21,39,25,35,20,33,43,44,12],milli:26,preserv:12,background:[22,23],test_ev:22,apart:[43,44],measur:21,specif:[0,39,22,23,14,21,9,5,35,33,43,42,12],arbitrari:[21,5],negat:[28,17,38,11],collection2:[22,23],collection1:23,underli:41,www:[35,22,14,39,20,30,18],right:[39,38,17,44,43],old:5,creek:39,deal:43,manual:[14,11],interv:[21,40],deserializestream:[28,2,11],dead:21,intern:[0,38,17,24,23],sockettimeoutm:[35,33,21,27,10,40],successfulli:12,thu:[35,15],txt:5,nwtj:16,readpreferencetag:35,timestampd:9,multipli:[28,17,38,11,23],fog:39,christkv:[43,21],condit:[0,21,23],foo:[33,23],localhost:[35,33,16,21,42,43,44,18,22],a_simple_create_drop_collect:22,collection_stats_test:23,statsync:5,promot:43,repositori:[16,43,21],post:[0,33,23,38,17,42],ryanke:16,plug:43,obj:23,bson_deseri:21,slightli:43,simul:[38,17,44],commit:22,produc:[25,33],simple_previous_error_col:22,pingstrategi:21,bson_data_symbol:2,"float":[43,38,17],simple_skip_collect:12,bound:[33,22,12,23],down:[35,21,10,22,33],getyear:23,gridstorewrit:5,wrap:[0,8,37,21,41,19],storag:[16,43,44],git:[16,21],rrusso2007:21,wai:[0,1,15,16,14,21,17,35,23,43,44,38],hotfix:21,support:[0,1,22,14,24,21,27,35,43,44,40,33],happi:[16,14,39],avail:[14,1,8,22,23,3,41,21,26,25,5,35,39,43,44,10,40,33],width:[30,39,20],test_rename_collection3:23,call:[0,22,23,16,21,26,5,18,36,44,33,32,12],constantli:43,bulqmxg0vdc:39,fork:16,head:[44,5],medium:26,form:[21,39,5],forc:[35,22,23,21,26,27,18,12],"true":[0,2,3,21,5,7,8,10,12,15,26,32,40,22,23,24,18,33,35,36,39,41,42,43,44],reset:[0,21,5,12,22],absent:35,awaidata:[12,23],new_nam:42,bugfix:21,highbit:[38,17],maximum:[35,21,22,43,12],until:[43,26,22,33],fundament:43,dropallindex:[29,11,23],emit:[33,23,21,41,43,18,22],shouldcorrectlyfailonretryduetoappcloseofdb:22,featur:[14,1,44,21,33],"abstract":16,fromstr:[38,21,17,28,11],exist:[0,26,22,15,24,21,23,5,18,7,42,29,35,43,44,32,11],videoplay:39,check:[0,26,8,22,23,24,21,17,5,35,41,7,2,40,33,43,10,38,12],test_collection_opt:23,bson_binary_subtype_md5:[34,2],test_to_a_after_each:12,floor:9,tip:14,refactor:21,simple_limit_skip_find_one_queri:23,test:[35,26,22,15,16,24,21,23,5,41,20,33,43,44,42,12],forceclos:22,miliscecond:[41,8],node:[14,12,35,3,21,39,16,20,43,30,11,33],insensit:12,consid:[35,23],sql:43,cachefunctionscrc32:2,errormessag:21,teixeira:14,faster:[7,1,33,21,14],ignor:[35,2,43,23],time:[14,39,22,23,3,21,9,35,16,45,40,33,43,10,32,12],push:[22,16,21,41,43,12],backward:[21,12],daili:39,concept:[43,21],skip:[29,0,12,11,23],global:21,gettimestamp:[21,28,11,9],read_secondary_onli:12,row:23,millisecond:32,decid:21,middl:23,depend:21,readabl:33,"_disableha":[40,29],originalhex:9,dropindex:[29,7,22,11,23],sourc:[39,20,12],string:[0,2,4,5,7,9,12,17,26,40,22,23,24,25,27,18,34,35,36,37,38,42,21,43,44],alinsilvian:21,feasibl:44,word:35,wvalu:35,cool:[33,23],logmeup:16,contenttyp:24,level:[35,22,23,16,21,26,5,33],did:[21,22],dig:43,eventemitt:21,iter:[21,12,23],item:[8,12,23,21,26,5,41,33,43,22],unsupport:35,team:39,quick:[43,44,39],div:[39,28,17,38,11],round:[35,40,43],databasenam:[22,32],wtimeout:[35,22,23,21,26,18],prevent:21,addtoset:[43,33,23],sign:[38,17,42],slow_onli:26,cost:21,port:[43,21,22,27,32],comparis:5,checkoutwrit:22,repli:[43,26,23],muq2w2u5x9m:30,current:[35,26,22,24,4,17,5,18,38,39,43,44,21,33],subtype_uuid:34,shared:35,boost:16,deriv:[38,17],autogener:[22,23],gener:[14,22,23,16,21,9,18,35,44,32],address:35,wait:[35,33,12,23,40,18,22],box:43,bson_data_regexp:2,shift:[21,17,38],step:44,queue:[16,43],behav:21,examp:16,numberofretri:[35,22,23,21,32,18,12],extrem:21,weird:21,werehamst:16,ourselv:[10,27],regardless:33,checkkei:2,extra:[0,33],tweak:35,modul:[16,21],prefer:[0,1,22,23,14,21,25,27,35,40,33,43,18,12],playerkei:39,toarrai:[0,22,23,16,21,26,29,33,43,11,12],bxhflrwemeg:20,instal:[43,21],includeloc:23,aaaaipotmrk:39,perf:21,memori:[0,12,14,21,45,43,44],regep:43,shtylman:21,serverstatu:[21,26,29,11],connector:[14,39],live:[43,21,44],handler:44,value2:0,value1:0,criteria:15,msg:21,scope:[43,21,2,22,23],prev:23,maxkei:[13,14,2,21,28,11],multiplecoll1:22,peopl:[21,33],finit:[38,17],visual:16,prototyp:35,examin:43,content_typ:[24,44,5],fly:16,cap:[43,21,22,23],uniqu:[0,22,23,5,7,32],primer:[14,44,39,45],test_correctly_access_collect:22,whatev:32,bson_binary_subtype_funct:[34,2],nearest:[35,22,23,21,25,27,40,18,33],connecttimeoutm:[35,33,21,27,10,40],mongo:[14,1,22,15,16,21,39,18,45,29,33,35,43,44,10,32,12],stream:[14,1,8,12,24,21,41,5,2,29,43,44,11,33],predict:21,bson_data_long:2,fuck:[],createcollect:[12,23,21,41,29,33,43,42,11,22],topic:[14,39],nocr:16,kaflr8pi5nk:30,occur:[0,26,22,15,24,21,23,5,18,7,42,36,32,12],alwai:[26,22,23,21,17,27,43,10,38,12],multipl:[35,33,23,3,21,17,5,38,32],k1mnspb8wvq:30,ping:[35,22,21,26,29,40,11,33],fieldvalu:0,write:[34,35,2,22,23,3,24,21,5,18,28,8,29,33,43,44,32,11,36],foreach:[5,23],pure:[26,8,22,23,41,21,9,5,2,36,18,12],nyc:[14,39],map:[43,21,33,23],product:[39,38,17],max:[21,22,12,23],dive:[43,44],date:[2,12,9,21,23,26,7,43,33],docstartindex:2,data:[34,14,8,22,23,24,21,39,5,41,45,2,20,36,43,44,33,12],grow:43,sbrekken:21,inform:[35,22,23,3,24,26,5,7,16,43,32,12],"switch":21,reaper:[21,32],combin:[35,22,23,39,25,5,18,33],anoth:[0,43,5,18,9],filedata:[5,33],talk:39,increas:21,still:[35,0,21,15],pointer:[0,42,5,24,32],dynam:39,test_map_reduce_funct:23,group:[14,33,23,21,39,29,30,44,11],gte:0,indexexist:[21,29,11,23],secondaryacceptablelatencym:[35,33,40],jim:23,nodelai:[35,3,21,27,40,10,32],mongocli:[14,1,8,22,23,41,21,9,26,5,35,2,29,36,43,44,33,18,11,12],platform:43,mbostock:21,requir:[35,26,8,22,15,41,21,23,5,18,2,44,42,36,43,9,33,32,12],main:[14,44,39,43,35],non:[16,21,23],"6pjmp23z0lw":30,encod:[3,43,21,32],col2:22,col3:22,initi:[35,8,12,23,21,5,43,44,18,22],col1:22,milisecond:[35,22,23,21,40,18,12],now:[43,21,44,22,33],discuss:[14,39],nor:42,introduct:[14,45,3,39,35,43],mapreduc:[21,29,11,23],name:[0,2,3,4,5,7,12,15,26,32,40,22,23,24,18,34,35,33,39,21,42,44],readfil:5,drop:[22,23,21,26,42,7,29,32,11],revert:0,crypto:21,separ:[0,21,5,35],mongoerror:21,jprichardson:16,compil:21,failov:[3,21,10,33],domain:[35,21],replai:21,dialect:16,replac:[0,23,21,15,5,43],individu:[0,21,33],firej:[],a_1_b_1:[22,23],ensur:[35,22,23,21,5,7,43,44,33],poolreadi:21,serverclust:21,happen:[41,21,8,5],shown:[43,44,33],accomplish:44,"3rd":21,space:[35,2,22],streetsaheadllc:16,profil:[26,12,23],tohexstr:[0,21,28,11,9],factori:[0,32,23],variant:43,million:39,orm:[16,39],mime:5,sethml:21,replacethiscollect:23,org:[16,14,35,22,18],"byte":[34,0,2,22,23,24,21,9,43,44,32],care:[3,0,22,43,35],question:[39,38,17],bradberri:39,synchron:43,thing:[43,44,32],place:[14,38,17],year2013:21,frequent:[38,17],first:[0,26,22,15,24,21,23,5,18,42,39,44,40,36,43,9,32,12],oper:[0,26,22,15,24,21,17,25,42,18,38,7,23,33,35,43,44,32,12],bson_binary_:21,directli:[0,21,12,43,35],onc:[33,12,23,21,7,43,22],arrai:[34,0,26,2,22,15,3,24,21,23,5,42,33,43,10,40,12],fullsetup:[21,22,40,33],yourself:39,reopen:[5,32],"long":[14,2,12,9,21,17,35,28,43,11],serverinfo:23,open:[8,3,21,5,11,12,15,26,32,42,22,23,24,27,29,18,33,35,36,39,41,43,44],predefin:2,size:[0,2,22,23,24,21,17,5,33,44,38,12],given:[34,35,12,23,21,17,5,44,38,22],breviti:[43,44],workaround:21,paramt:[],collectionnam:[22,23,42,26,7,29,44,32,11],secondary_pref:[22,23,21,25,27,40,18,33],conveni:[0,38,17],subtype_md5:34,especi:43,copi:3,"_handleonfullsetup":[40,29],specifi:[34,0,22,23,24,21,5,35,43,44,32,12],test_rename_collection2:23,test_arrai:12,keepgo:[21,23],than:[0,22,15,3,24,21,17,38,23,33,44,32,12],png:[24,5],serv:39,firebas:[],tedeh:21,were:[12,15],posit:[34,24,38,17,5,44],seri:16,pre:[26,2,22,23],lowest:[35,21,40],sai:44,sam:[33,23],pro:39,argument:[8,4,5,2,9,10,12,17,26,19,40,22,23,25,27,18,34,36,37,38,41,21,44],subroutin:21,simple_rename_collection_2:22,test_gs_read_stream_pip:5,deliv:39,bitwis:[43,38,17],squar:16,alias:0,destroi:[41,8,29,11],note:[35,38,17,22,12],continueonerror:23,take:[0,2,35,3,21,39,27,43,44],createfromhexstr:[0,21,28,11,9],maxpools:35,begin:[0,5,35],sure:[44,32,12],normal:[21,12],buffer:[34,0,2,22,15,24,21,23,5,18,42,36,35,44,32,12],connectarbit:[35,21,40],clearer:21,pair:35,homepag:16,deepequ:[33,12,23,5,22,36],renam:[22,23,42,29,43,11],byte_valu:34,later:[44,22,23],mongoclient_test:18,indexbound:[22,23],test_gs_read_stream:5,runtim:21,parseint:23,axi:23,wtimeoutm:35,show:[35,8,12,23,41,9,5,2,36,43,22],enumer:35,simple_count_exampl:23,objectid3:9,objectid2:9,concurr:21,limitrequest:21,corner:21,fuckhttp:[],onli:[0,26,22,15,3,21,23,25,5,35,7,33,43,44,32,12],slow:[21,26,22,23],dice:43,fenc:[35,40],setprofilinginfo:26,activ:[16,21,33],state:[12,21,32,29,43,40],analyt:[16,14,39,43],offici:35,overwritten:44,min_valu:[38,17],variou:[16,26,23],get:[8,21,5,7,9,11,12,14,15,16,26,32,42,22,23,24,29,18,36,45,39,41,43,44],secondari:[35,22,23,3,21,25,27,40,33,18,12],ssl:[35,21,41,22,27],cannot:[22,23,21,17,25,33,43,38,12],shiftrightunsign:[28,17,38,11],geo:23,gen:39,nolock:[21,22],doabl:0,test_n:22,seldom:21,intermitt:[21,33],yield:[21,23,22,42,15],isarrai:2,caboos:16,nettl:16,where:[34,0,2,22,15,3,24,21,23,25,5,35,7,42,43,44,18,33],geospati:[22,23],desced:12,wiki:43,khwang:16,jbrumwel:21,testcas:21,fireandforget:35,concern:[35,22,18,23],infinit:[21,17,38],detect:[3,21],heckmann:21,fs_chunk:44,integration_tests_2:22,wayt:23,enough:12,between:[35,22,23,21,39,18,40,33,43,10,32,12],"import":[43,44,33],across:[35,33,23,21,32,22],elbert3:21,spars:[7,22,23],simple_queri:23,august:[14,39],parent:40,tut:14,test_group:23,let:[35,8,12,23,21,5,33,43,44,22],come:[24,38,17,12,23],simple_find_and_modify_operations_:23,region:23,gwt:[38,17],tour:35,tutori:[14,30,44],mani:[43,12,33],fromnumb:[28,17,38,11],among:[25,33],reindex:[29,21,22,11,23],iscap:[21,29,11,23],period:[0,42],dispatch:43,createcreateindexcommand:21,fs_file:44,lessthan:[28,17,38,11],colon:35,constant:[34,2,12,5,28,29,11,22],reaperinterv:[21,32],cursor_information_collect:22,cursorinst:12,coupl:[43,23],aciev:0,rebuilt:[22,23],addit:[0,2,22,23,38,17,26,40,44,10,18,12],derefer:[29,21,22,11],emphas:33,lowbit:[38,17],thousand:35,functionalii:35,"1mb":44,those:[38,17],"case":[12,23,38,17,7,43,44,21],myself:43,bson_seri:21,tostr:[8,36,9,38,17,5,28,23,44,11],trick:[14,44],invok:44,isconnect:21,firstext:26,simple_sort_collect:12,trello:[14,39],advantag:43,eras:[24,42],dynamicgui:16,ascii:[3,21,32],acess:22,develop:[14,33,35,16,39,43],author:[0,23,33,24,15],media:16,same:[0,8,22,23,21,17,5,35,7,9,38,12],binari:[0,8,21,5,2,9,11,12,14,15,26,32,42,22,23,24,28,18,33,34,36,41,43],html:14,document:[0,2,3,21,5,7,8,12,14,15,16,26,32,42,22,23,24,18,33,39,41,43,44],howtonod:14,createpk:32,exhaust:[21,12,23],ifram:[30,39,20],finish:[35,22,23,5,44,18],closest:[38,17,23],utf8:[8,3,21,5,43,32],nest:[0,7],oid:4,driver:[0,1,33,15,3,14,21,39,42,35,16,29,40,43,44,32,11,45],my_f:5,capabl:39,newobjectid:9,improv:[14,1,21,33],extern:[14,21],defo:0,bson_data_boolean:2,appropri:39,moder:39,distancemultipli:23,brightcov:39,without:[35,2,22,21,17,38,42,32,33],model:[16,39,23],dereferenc:22,upsert:[35,23,18,15],ourexamplefiletowrit:5,execut:[35,26,12,15,21,23,5,36,43,33,18,22],when:[0,39,2,12,15,3,24,21,23,5,35,41,42,8,40,43,44,32,33],fengmk2:21,rest:[16,21,9,23],hint:[12,23],db_connector:[42,32],except:[35,33,15,21,25,5,43],param:39,desktop:14,blog:[16,0,42,14],framebord:[30,39,20],bigger:33,default_chunk_s:5,haystack:23,found2:5,around:[16,14,21,43],read:[1,8,3,21,5,11,12,14,40,22,23,24,25,27,28,29,18,34,35,33,43,44],streamrecord:[43,21],grid:[34,14,36,16,21,29,44,11],pop:43,world:[8,22,15,23,5,2,44,36],lasterror:[29,21,22,11],reap:21,subtype_user_defin:34,saniti:21,poolsiz:[35,8,22,23,21,26,5,27,41,36,43,32,12],realtim:[14,39],integ:[0,2,9,38,17,43,21],server:[2,3,21,5,8,9,10,12,14,15,16,26,32,40,22,23,27,29,18,33,35,36,39,41,42,43],firebaseco:[],either:[35,33,24,21,43,44],output:[0,23],greaterthanorequ:[28,17,38,11],manag:[16,24,21,43],kvalheim:39,bson_binary_subtype_byte_arrai:[34,2],eventloop:44,ascend:[0,12,7],intact:15,setnodelai:21,slice:43,writedata:44,node_ev:21,confirm:43,definit:14,legal:23,shouldstreamdocumentswithpauseandresumeforfetch:41,evolv:43,profilinginfo:[26,29,11],bson_data_binari:2,power:[16,39,33],broken:21,aquir:22,bson_binary_subtype_default:[34,21,2],regexp:[43,21,2],"throw":[33,15,21,25,43,44,32,22],comparison:9,deflat:33,pointer_to_collect:0,firstnam:[0,7],nocooki:[30,39,20],side:[16,22],bson_data_code_w_scop:2,gump:23,act:44,luck:44,other:[0,1,39,33,14,3,21,17,25,5,35,23,43,44,38,45],readstream:[14,8,12,21,29,11],addus:[29,21,26,22,11],test_collections_info:22,strip:35,your:[35,33,23,3,39,5,16,43,44],loc:23,log:[0,2,22,15,16,24,21,23,26,27,35,42,40,33,43,44,32,12],hex:[0,9],overwrit:[26,5,27],dropdup:[21,22,23],strict:[21,22,42,32],interfac:[35,8,12,16,21,41,43,36],low:[43,38,17,44],lot:[14,12,23,21,7,41,43,44],more_complex_ensure_index_test:[22,23],isvid:39,tupl:7,shamelessli:43,replsetsrv:3,longer:[21,5],pull:[43,21,26],dirti:43,possibl:[0,22,15,16,21,23,35,7,43],"default":[0,1,2,3,21,5,7,10,12,14,15,9,32,40,22,23,24,25,26,27,18,34,35,33,42,43,44],remove_subset_of_documents_saf:23,dropdatabas:[22,21,26,29,32,11],auto_reconnect:[35,8,22,23,3,26,5,27,41,36,43,32,12],connect:[1,8,3,21,5,10,11,12,14,16,26,32,40,22,23,27,29,30,18,33,35,36,45,41,43,44],gone:[36,23,5,22],creat:[0,2,3,21,5,7,8,9,12,26,32,42,22,23,24,18,33,35,36,39,41,43,44],certain:[7,43],watcher:16,intro:43,file:[8,22,16,24,21,5,33,44,36],russel:39,calculateobjects:[28,2,11],again:[21,33,5,12],kaba:16,compel:39,event:[8,22,24,21,5,18,41,40,43,44,32,33],field:[0,39,22,15,21,23,5,35,7,33,43,18,12],valid:[2,22,9,42,26,23,12],longlib:17,you:[0,2,22,15,3,24,21,23,42,27,35,7,39,40,33,43,44,32,12],geonear:[21,29,11,23],scttnlsn:16,pefrom:23,sequenc:21,symbol:[14,2,37,21,28,43,11],briefli:39,opt_radix:[38,17],pool:[35,33,21,27,32,22],reduc:[35,33,23,38,17,21],lessthanorequ:[28,17,38,11],coreh:16,directori:21,descript:[34,2,5,12,22],tricki:43,potenti:21,alright:43,simplifii:35,cpu:[21,44],unset:43,represent:[13,34,39,36,9,4,17,25,5,6,35,19,37,38],all:[0,26,2,22,14,3,24,21,15,25,5,18,7,42,23,33,35,43,44,32,12],forget:43,numberupd:23,dollar:42,month:39,suno:21,cceac:16,follow:[0,12,15,3,5,7,43,44,33],disk:[35,8,33,23,5,44,12],nodej:[16,39,20],subtype_default:34,nextobject:[29,0,22,11,12],aaron:21,introduc:[35,21,39],namesonli:22,setprofilinglevel:[26,29,11],evaul:22,util:[16,21,33],candid:[25,33],test_rename_collect:23,fall:35,veri:[14,33,35,21,43,44],base698:16,list:[35,22,23,21,26,5,42,29,43,44,10,40,11],resav:23,adjust:[35,21,44],default_port:32,small:[35,21,44,30],retun:2,sync:[35,22,18,23],integration_tests2:18,cursorstream:[29,14,41,12,11],design:[14,39],pass:[35,2,22,23,3,21,9,5,42,43,44,32,12],simialar:21,excit:39,deleg:32,abc:[0,5,15],xor:[28,17,38,11],sub:[34,39,23],sum:[38,17],abl:[21,33],brief:30,delet:[22,23,24,21,5,29,43,44,32,11,36],version:[35,22,23,21,32,44,18],cruso:0,method:[0,1,26,22,14,21,23,5,18,45,44,42,36,35,43,9,33,32,12],contrast:35,full:[21,22,23],themselv:21,variat:43,behaviour:16,foobar2:5,foobar3:5,strong:30,modifi:[43,21,23,15],valu:[0,2,21,5,7,9,11,12,15,17,26,19,42,22,23,24,28,32,34,35,33,37,38,39,43,44],search:[14,43,23],ahead:[16,43,44,23],showdiskloc:[21,12,23],reason:[35,5,27],replicaset_mongo_client_collect:[35,18],amount:[43,38,17],base:[9,16,24,21,23,5,43,44],pick:[35,22,21,43,44,40,33],action:14,mongoos:[16,14,30,39],narrow:23,evalfunct:2,via:43,shorthand:15,lazybum:16,c_1:23,deprec:[21,22,18,23],href:22,default_root_collect:5,establish:[8,12,23,21,26,5,41,36,33,22],select:[35,33,23,21,15,25,40,42,32],test_collection_is_cap:23,distinct:[21,29,11,23],regist:5,two:[0,17,22,14,3,24,38,15,5,7,39,44,16,43,9,42,33],coverag:21,bson_binary_subtype_user_defin:[34,2],taken:43,minor:[14,1,21,33],more:[0,8,22,15,3,41,21,17,5,35,39,23,33,43,44,38,12],flag:[12,23],stick:43,particular:43,cach:2,none:[3,35,39],outlin:[35,44,33,43],dev:16,histori:22,remain:[44,5],learn:[16,14,39],scan:[12,23],dodebug:32,share:[22,16,21,39,32,18],shard:[35,33,23,24,18,12],accept:[21,23],simple_document_insert_collection_no_saf:23,default_url:22,uri_decode_auth:[22,18],learnboost:[16,39],robinson:0,cours:43,newlin:5,divid:[35,38,17,22,23],rather:23,keepgoingexampl:23,hugh:39,simpl:[0,8,22,14,16,41,21,23,5,35,7,45,2,42,36,43,44,33,18,12],perman:22,griddata:33,resourc:[16,32],resultset:43,reflect:21,unlink:[29,24,44,5,11],associ:[44,5],keyorlist:12,shouldcorrectlyexecutesimpleaggregationpipelineusingargu:23,github:[16,14,21,20,43],defineproperti:21,save_a_simple_document_modify_it_and_resave_it:23,assign:[3,21,27],caus:[43,21],callback:[0,26,22,15,24,21,23,5,18,7,42,36,43,44,32,12],spheric:23,doc_id:0,help:21,bson_data_oid:2,trade:44,through:[33,23,21,39,5,43,22],reconnect:[35,21,27,40,43,10,32],paramet:[0,26,22,15,3,24,21,23,5,18,7,42,36,43,44,32,12],style:[16,43,21,39],mongorepli:21,world_no_saf:23,batchsizevalu:12,asbuff:2,relev:[35,43],stylu:20,rapidli:43,bypass:43,simple_limit_skip_queri:23,test_cursorstream_resum:41,might:[35,33,7,43,44,22],alter:[0,42],port1:35,good:[14,44,33,43,23],"return":[0,8,4,5,6,2,9,12,13,15,17,26,32,19,21,22,23,24,25,18,33,34,35,36,37,38,41,42,43,44],timestamp:[14,2,9,21,23,28,38,11],more_complex_index_test:[22,23],framework:[16,14,1,33,23],compound:[22,23],karaco:16,readlen:5,portn:35,emerleit:16,uploadd:24,unlik:[25,12,33],authent:[22,21,26,29,18,11,33],easili:[21,17,38],achiev:0,skipvalu:12,portx:35,found:[0,22,15,21,23,5,35],truncat:[21,44,5,42],hard:43,realli:43,expect:[0,32],http:[14,22,35,16,21,39,20,43,30],orient:14,primari:[0,22,23,3,21,25,27,18,40,33,35,43,32,12],b4ajeu13u6u:30,print:32,read_primari:[21,12],pullal:43,foreground:[22,23],core2duo:21,proxi:[35,21,10,22,33],advanc:[14,45,42,5,43,44],differ:[14,22,23,21,17,5,35,7,44,33,43,9,38,36],asc:[0,12,15],"_enableha":[40,29],croucher:39,connectionopt:22,put:[34,12,23,21,5,28,29,44,11,36],gotend:5,seconddb:22,gethighbit:[28,17,38,11],test_streaming_function_with_limit_for_fetch:41,tailabl:[21,12,23],omit:[43,4,44,21],dir:[43,44,33,15],suppport:35,shard_test:22,major:[35,22,18,23],notifi:[43,44],articl:[14,44,45],lastnam:[0,7],number:[0,2,21,5,7,9,10,12,17,26,32,19,40,22,23,27,18,34,35,33,38,43,44],asiletto:21,done:[0,8,33,23,24,21,15,26,35,41,43,44,32],construct:[38,17],autoclos:[24,44,8,5],create_and_drop_an_index:[22,23],miss:[35,21],pageview:[33,23],script:[24,21,39],interact:[43,44,5,36],least:[0,33,23],custompkfactori:32,contra:21,statement:[43,44,22],illeg:[36,21,26,22,23],master:[3,21],store:[2,12,16,24,5,43,44,22],schema:[14,39],otherid:9,option:[0,1,2,3,4,5,7,10,11,12,14,15,26,32,21,22,23,24,27,29,18,34,35,36,40,42,43,44],reseterrorhistori:[29,22,11],similarli:43,selector:[21,22,12,23],getter:5,pars:[21,2,23],fileid2:5,literarili:43,std:21,kind:44,bson_data_nul:2,whenev:[22,23],createwritestream:[5,33],remov:[26,22,15,21,23,5,7,29,43,42,11],reus:[21,2,22],str:[38,17],consumpt:44,toward:39,cleaner:16,comput:14,luckili:[43,44],packag:16,expir:[22,23],"null":[0,2,22,23,3,21,26,5,27,18,16,42,41,40,36,35,10,32,12],built:[16,43],equival:[43,23],valueof:[28,19,11,37],fromcollect:22,walk:39,also:[0,12,15,14,21,5,35,7,42,43,44,32,33],build:[26,22,21,39,43,44],tool:[16,39],pipelin:[33,23],distribut:33,lubow:39,blackboard:[16,14,20],choos:[35,43,33,40,23],reach:[44,8],most:[0,44,39,33,43],plai:39,plan:44,native_pars:[35,8,12,23,26,5,18,41,36,32,22],"16mb":24,filesystem:24,clear:21,part:[35,9,21,26,43,30],clean:[16,21,22],frombit:[28,17,38,11],ridicul:16,brightcoveexperi:39,session:[16,39],find:[0,8,22,15,16,24,21,23,26,35,7,41,29,33,43,11,12],firewal:21,nosql:[16,14],pretti:[35,43],jacobbubu:21,manipul:23,test_gs_weird_bug:5,numberofdocu:2,queu:16,batch_document_insert_collection_saf:23,hit:[22,23],unus:21,express:[0,33,14,23,16,24,20,43],fieldtoupd:43,barrier:21,nativ:[16,43,21,32],ferret:16,restart:[41,8],assignreplicaset:[29,27],singapor:[21,33],statist:[35,22,23,21,26,40,18],wrote:43,set:[0,2,3,21,5,7,12,15,26,32,42,22,23,24,27,18,35,33,39,40,43,44],jade:20,getmor:[21,12,23],see:[0,22,15,24,38,17,18,7,42,43,44,32,33],easymongo:16,close:[35,8,22,23,16,24,21,26,5,18,41,29,36,43,44,33,32,11,12],andrewjston:21,lee:21,misalign:21,jenkin:22,someth:[5,32],particip:40,some_databas:32,mismatch:21,altern:[16,22,23],signatur:[5,12],primary_pref:[33,23,25,27,40,18,22],numer:35,complement:[38,17],javascript:[2,22,23,16,21,17,39,43,38],salzman:21,succeed:7,both:[21,25,33,23],last:[16,24,22,43,35],create_and_drop_all_index:22,alow:35,context:[21,39,32],pdf:33,corrupt:[21,26],whole:[33,23,26,5,43,22],createdat:12,load:[0,21],simpli:[0,33],jsmode:23,point:[12,23,38,17,43,44,21],instanti:[43,21],littl:43,shutdown:21,suppli:[21,44],averag:33,backend:43,identif:21,faithfulli:[38,17],user_id:23,due:[35,21,22,43,36],empti:[35,12,0,21,23,5],otherwis:[26,2,12,23,38,17,25,5,36,43,44,33,18,22],bgcolor:39,strategi:[35,21,33,43,40],wish:[34,2,22,23,21,26,5,43,44],fire:[8,22,15,24,5,43,44,32],admindb:[26,22],imag:[24,44],understand:43,func:[2,23],convers:[43,23],look:[12,23,24,21,39,5,7,43,44],mdoq:16,straight:[43,44],batch:[43,21,12,23],"while":[0,12,23,24,21,26,5,33,18,22],getownpropertynam:21,abov:[35,44,33,43,15],error:[0,8,21,5,7,12,15,16,26,32,42,22,23,24,25,27,18,33,35,36,40,41,43],fun:[44,33,23],fixtur:16,loos:[16,43],loop:21,real:[16,14,39],test_gs_unlink:5,readi:[41,8,5,43,33],key2:0,key1:0,"_state":22,jpg:5,itself:[14,12,35],test_deref_exampl:22,inheritreplsetoptionsfrom:[29,27],rid:21,simple_key_based_distinct_sub_query_filt:23,createexperi:39,decor:21,gs2:5,minim:35,geohaystacksearch:[21,29,11,23],coffeescript:[16,14,30],decod:[22,18],p_db:[3,22],conflict:35,higher:[33,23,3,21,44,32,22],"10gen":[14,35],optim:[21,23],simple_key_based_distinct:23,overriden:35,piec:[43,38,17,44],temporari:[5,23],user:[34,0,2,22,14,16,21,15,5,7,39,33,18,26],hello2:23,bob:[33,23],recreat:32,travers:12,task:33,entri:[44,23,5,22],joyent:39,readprefer:[14,22,23,21,25,27,35,29,40,18,33],explan:[22,23],getlowbitsunsign:[28,17,38,11],a_1:23,collabor:39,shape:21,tempcollect:23,update_a_simple_document_multi:23,move:[24,21,5,43,33],password:[35,21,26,22,18],cur:44,colladow:16,tdegrunt:16,keeptemp:23,appli:[35,22,0,21,23,43,12],sessionstorag:16,input:[38,17,23],mod:[0,38,17],transpar:39,big:[35,21,44,27,43],checksum:5,intuit:35,shiftright:[28,17,38,11],rs_name:[3,35,21,22,40],replsetserv:[26,2,22,23,3,41,21,9,5,8,36,18,12],like:[0,39,22,23,16,38,17,35,7,44,12],fsync:[35,22,23,21,26,18],resolv:22,collect:[0,3,4,5,7,11,12,14,15,16,26,32,21,22,23,24,29,31,18,33,35,36,45,39,41,42,43,44],bson_data_cod:2,popular:[14,39,43],bamboo:21,brett:39,serverpair:21,often:[38,17],acknowledg:[35,22,18,23],creation:[26,22,23,21,39,43],some:[0,8,22,14,24,21,23,5,35,7,39,36,43,44,33,12],back:[0,8,12,23,16,21,17,5,35,33,43,9,38,26],understood:43,sampl:43,somecollect:33,scale:[14,22,23,39,43,44],slaveok:[35,21,12,27,23],chunksiz:[24,21,44,5],per:33,bson_data_min_kei:2,retri:[35,22,23,21,32,40,43,18,12],larg:[0,33,23,24,21,43,44,22],recogniz:35,intial:[33,23],previou:[35,44,32],run:[14,26,22,23,3,21,15,45,43,44,33],lublow:39,simple_reset_error_history_col:22,simpleemitt:21,simple_explain_queri:23,from:[0,2,3,21,5,9,12,14,15,17,26,42,22,23,24,25,27,18,33,34,35,36,38,39,43,44],subtract:[28,17,38,11],sake:35,allowfullscreen:[30,39,20],recordquerystat:[35,22,18],block:[44,22,23],cygwin:21,within:[38,17],simple_index_test:23,contributor:39,chang:[35,1,33,14,21,17,23,43,44,38],test_collection_index_exist:23,sock:21,fast:16,custom:[0,33,23,21,44,32],plain:21,includ:[0,39,22,14,21,23,25,5,18,7,42,33,35,43,10,32,12],forward:5,files:[21,5],properli:[21,5],isbuff:21,uniquedoc:23,"_bsontyp":21,hainterv:[35,10,33,40],link:[14,44,45,43],translat:16,atom:[43,21,23],line:[16,44,5],info:[21,26,44,22,23],concaten:[38,17,5],consist:[21,33],caller:12,forceserverobjectid:[35,21,22,18,32],gridf:[14,1,36,45,24,21,5,44,33],readlin:[29,5,11],similar:[24,18,35],hash:[35,22,0,21,32,43,44,18],multiplecoll2:22,parser:[14,1,2,22,35,21,18,32,33],doesn:[0,32,15],repres:[35,12,9,38,17,5,27,19,43,37,40,22],idhex:0,unifi:35,titl:[0,23,33,31,15],declar:21,unidirect:12,wakup:[],nice:[43,39],deseri:[2,12,21,28,43,11,33],bcoe:16,jannehietamaki:21,mongodb:[0,2,3,21,5,7,8,9,11,12,14,15,16,26,32,20,42,22,23,24,27,30,18,33,35,36,39,41,43,44],eval:[2,12,23,21,29,11,22],profilinglevel:[26,29,11],sokra:21,algorithm:[3,38,21,17,32],cursorinform:22,evenli:33,tradeoff:44,awesom:[14,30,20,33],filebodi:8,far:5,hello:[8,22,15,23,5,2,43,44,36],code:[35,26,8,22,23,41,21,9,5,27,40,2,36,43,44,33,18,12],partial:[12,23],worldbuff:5,queri:[0,26,22,15,14,21,23,5,18,7,45,39,42,33,35,43,31,32,12],idvalu:0,mongoskin:16,octet:5,replicasetcheckinterv:21,base64:[3,36,21,5,32],update_a_simple_document_upsert:23,send:[35,22,23,3,21,43,32,12],lower:[22,23],io_seek_end:5,"256k":44,sens:15,reapertimeout:[21,32],sent:32,passiv:21,tailableretryinterv:[21,12,23],shouldcorrectlyforcereindexoncollect:23,result2:36,account:23,writebuff:21,untouch:32,dbname:[21,22,18,12],tri:35,magic:16,gettim:[12,9],roll:14,fieldorspec:[22,23],fewer:23,"try":[43,21,23,44,15],race:21,marri:39,refer:[12,4,5,43,22,21,36],rack:[35,33],impli:35,smaller:[24,33],fortun:43,natur:[35,39,43],jump:[43,21,39,44],tobson:[14,1,21,33],video:[14,44],odm:[16,14,30],download:43,odd:[38,17],append:[24,5,43],compat:21,index:[14,2,22,23,21,7,29,33,31,42,11,12],compar:[33,9,38,17,5,7,28,11],descriptor:[24,44],access:[35,12,23,24,26,5,37,19,22],experiment:21,can:[0,22,15,3,24,21,17,42,35,38,7,44,23,33,43,9,32,12],chose:39,primarypref:35,bson_data_int:2,simplereach:39,cursor_count_collect:12,calipso:16,logout:[29,26,22,11],filedescriptor:44,becom:43,sinc:[43,38,17,44,15],subtype_byte_arrai:34,nexttick:[21,41],convert:[0,43,9],reconnectwait:[35,40],larger:[24,21,44,22,23],technolog:39,typic:35,honor:21,configur:[3,35,21,22,42],read_secondari:[3,21,12],app:[3,14,21,39,35],mattinsl:16,api:[14,22,35,16,21,39,28,29,44,33],redi:39,cloud:14,chrisgibson:16,zir:16,batchsiz:[29,12,22,11,23],doubl:[14,21,28,19,43,11],upgrad:21,next:[0,2,12,39,44,32],websit:[16,39],chr:5,latenc:[35,33,40],simpler:[16,43,21,12,23],sort:[0,12,15,21,23,7,29,9,11],acknowleg:[35,22,18,23],src:[30,39,20],detail:[35,7,12,24],repl_set:21,benchmark:21,name2:0,rare:21,socketopt:[35,3,21,27,40,10,32],sollect:42,degrunt:[],retriev:[0,26,22,15,24,21,23,5,43,44,12],scalabl:24,multiple_db_inst:22,annot:44,tag:[35,22,23,21,25,18,33],thin:16,fetch:[0,36,12,23,7,43,22],queryfailur:21,control:[43,21,44,32,33],objectid:[0,26,8,22,14,41,4,23,5,18,28,2,44,21,36,35,43,9,32,11,12],process:[14,22,35,16,21,17,41,33,38,12],lock:[21,44,22],username_:7,high:[14,1,22,23,21,17,35,40,43,10,38,33],unopen:21,serial:[35,2,22,23,21,28,18,11,33],numbit:[38,17],readprefr:[35,27],pingresult:26,integration_test_:[3,35,22,18],instead:[0,22,23,3,21,27,18,7,35,44,32],npm:[43,21],pois:39,await:22,formattedorderclaus:21,awaitdata:[21,12,23],test_map_reduce_functions_scop:23,alloc:[21,2,22],bind:16,remove_all_documents_no_saf:23,correspond:[7,38,17,42],element:[0,5,43,12],issu:[43,21,23],chief:39,writ:5,allow:[35,12,23,21,26,5,27,42,33,43,44,32,22],subtyp:34,fallback:[35,21],deoptim:21,doc2:43,doc3:43,opencal:21,alexeypetrushin:16,doc4:43,spank:21,own:[21,5,27],comma:35,server_opt:32,createreadstream:33,effici:[43,44,23],numberoftest:22,bunch:[21,22,23],perfect:43,chosen:33,total:[0,33,23],crash:21,greater:[0,38,17,12],handl:[39,33,23,21,17,5,40,43,44,38,12],auto:43,databs:[42,32],dai:[14,39],auth:[21,22],renamecollect:[29,22,11],precess:43,numberofremoveddoc:23,writefil:[33,24,5,29,44,11],convin:0,anyth:21,edit:[44,5],npmj:16,slide:[14,39],deserializeddoc:2,exampledb:[43,44,33],subset:[12,23],unwind:[33,23],opensync:5,chunk:[24,21,44,5,33],bson_binary_subtype_uuid:[34,2],default_content_typ:5,pushal:[43,21],our:[35,12,39,5,27,43,44],special:[35,12,38,17,43,44],out:[14,22,23,3,21,9,5,35,45,43,44,32,33],variabl:[43,21,23],calip:16,trickier:[0,43],categori:44,suitabl:44,merg:[21,23],ref:21,clone:16,test_stream_writ:33,common:21,jessica:[0,15],insid:[0,44,24,7],dropcollect:[29,42,22,11],unpars:21,releas:21,likelihood:35,princess:23,replsetgetstatu:[21,26,29,11],unwant:0,could:[43,21],shiftleft:[28,17,38,11],david:15,length:[34,26,2,12,23,24,9,5,28,41,44,11,22],lte:0,transfer:22,minkei:[14,21,2,28,6],evanp:16,debugmessag:21,echo:22,iszero:[28,17,38,11],should_correctly_rewind_and_restart_cursor:12,gridstore3:5,gridstore2:5,gridstore7:5,gridstore6:5,gridstore5:5,totalopen:22,prioriti:21,start:[34,0,2,12,23,3,14,21,5,43,44,42,33],system:[35,12,23,16,21,5,33,44,42,22],wrapper:16,createfromtim:[21,28,11,9],bson_data_max_kei:2,termin:5,"final":[43,21,39,23],idottv:16,deconstruct:44,test_gs_getc_fil:5,exactli:42,gridstorew:5,bson_data_object:2,replset:[14,22,35,3,21,27,40,29,18,33],pgebheim:21,bother:39,mongoserv:[42,32],structur:[0,44,43],charact:[34,21,9,5,23],test_gs_puts_and_readlin:5,seriou:21,result:[0,26,8,22,15,24,21,17,5,18,38,41,44,23,36,35,43,9,33,32,12],"function":[0,2,3,21,5,8,9,12,15,16,17,26,32,40,22,23,24,27,18,33,34,35,36,38,41,42,43,44],counter:[32,23],terribl:21,peform:[35,8,22,23,41,18,12],have:[0,8,22,23,3,21,39,5,27,35,7,33,43,44,42,12],tabl:[43,30,42],need:[0,2,22,15,24,21,17,42,27,35,38,7,23,40,43,44,32,33],turn:[0,22,35,21,26,10,40,33],border:30,buildinfo:[26,29,11],min:[21,22,12,23],rout:16,shankar0306:21,mix:[0,7],best:35,which:[0,39,3,24,21,17,5,38,42,44,32],test_other_drop:23,orgiin:5,singl:[34,0,39,22,15,24,21,23,5,27,35,18],fileid:[44,8,5],deploy:33,who:[21,33],whi:0,discov:[21,33],serverconfig:[21,22,18,32],test_gs_working_field_read:33,why:[16,43,39],overwriten:5,url:[14,1,22,35,16,21,43,18,33],timestamplib:38,request:[21,39,12],uri:[35,22,43,18],face:43,pipe:[5,33],test_collect:15,snapshot:[12,23],"400m":39,determin:[43,12],constrain:5,"_id":[0,22,15,21,23,5,18,7,33,35,44,32,36],fact:[43,15],text:[17,33,23,38,39,5,44],serializefunct:[35,2,22,23,21,18],verbos:23,filebuff:8,nagl:[3,21,32],anywai:[22,23],setter:5,textual:[38,17],locat:[33,23,5,43,22,12],figur:35,should:[0,26,22,9,38,17,42,35,23,36,44,40,12],noid:16,test_cursorstream_paus:41,local:[4,22,18],devnul:16,cube:16,ritch:[16,21],kiefer:39,db1:35,db2:18,donewithwrit:44,enabl:[21,32,40,33],organ:39,simple_batch_size_collect:12,stuff:[3,14,44,45,43],integr:[16,43,44],contain:[34,35,2,22,23,3,42,26,5,27,40,36,43,44,10,18,12],grab:[26,5,12,22],mon4mongo:16,view:16,legaci:[35,27],modulo:[0,28,17,38,11],packet:[21,12,23],meritt:16,statu:[35,33,16,21,26,43,10,40],wire:[43,21,12],correctli:[43,21,23],pattern:14,boundari:21,written:[34,23,16,38,17,5,44],crude:43,world2:23,kei:[0,2,22,23,21,5,18,7,35,43,44,32,12],buckets:23,jsbon:21,isol:21,job:[16,23],entir:[44,5,12],joe:[33,23],db_option:32,crc32:2,monitor:16,mongod:[16,35,33,27],plugin:39,admin:[14,39,22,23,21,26,35,29,11],mongoj:[16,14],equal:[0,26,8,22,23,41,38,17,5,35,28,2,36,43,9,18,11,12],etc:[0,32,12,23],instanc:[35,26,2,22,23,3,21,9,5,18,36,43,44,33,32,12],greaterthan:[28,17,38,11],mongoq:16,futher:35,uncaught:21,subtype_funct:34,comment:[21,33,12,23],toint:[28,17,38,11],writeconcern:23,removealllisten:21,save_a_simple_docu:23,attende:39,addition:[42,33],window:21,compon:21,json:[14,39,38,17,28,43,32],treat:[0,21,12],pkfactori:[35,22,18,23],immedi:15,bit:[0,2,24,38,17,43,44,21],protect:21,assert:[26,8,12,23,41,9,5,2,36,18,22],ador:16,present:[35,7,42,39,14],replic:[3,22],multi:[21,23,15],vimeo:14,align:21,cursor:[0,8,22,23,14,21,41,29,43,11,12],defin:[34,0,2,22,15,21,17,5,35,38,23,43,32],setreadprefer:[22,21,27,29,33,10,11,12],bson_data_arrai:2,observ:16,layer:[16,43,39,33],helper:[16,14,1,21,33],site:3,lightweight:16,tojson:[38,21,17,28,11],nodetut:14,getc:[29,5,11],cross:21,member:[3,35,21,33],python:14,speaker:39,inc:[43,21],gett:16,difficult:[44,33],incorrect:21,slave:[3,35],hostnam:[35,32],keepal:[35,3,21,27,40,10,32],upon:12,proxlet:39,retriv:26,student:30,test_stream_write_2:33,serializewithbufferandindex:[28,2,11],php:14,chunk_siz:[24,8,5],off:[35,12,3,21,26,5,18,42,43,32,22],center:[33,23],nevertheless:32,builder:39,well:[0,21,44,33,43],exampl:[0,8,42,5,7,2,9,12,14,15,26,32,22,23,24,18,33,35,36,45,41,43,44],command:[35,22,23,16,21,26,5,27,18,29,43,32,11,12],simple_geo_near_command:23,validatecollect:[21,26,29,11],undefin:21,latest:43,distanc:23,paus:[29,41,8,5,11],less:[43,38,17],"boolean":[35,8,22,23,24,38,17,5,27,40,7,2,33,44,10,18,12],additon:7,tcp:43,mojodna:21,indexinform:[12,23,21,7,29,11,22],front:35,episod:14,web:[16,14,43],rapid:[14,39],seekloc:[44,5],add:[35,26,22,23,21,17,38,7,28,43,32,11],originaldata:[33,5,36],tjanczuk:16,host2:35,host1:35,logger:[35,22,21,27,32,40],match:[35,26,33,0,15,38,17,23,43,42],branch:21,agnost:21,crud:[14,45,43],iya_logo_final_bw:5,know:42,bson_data_timestamp:2,recurs:[17,38,2,5],isclos:[29,12,11],desc:[0,12],bson_data_str:2,insert:[0,26,2,22,14,21,15,5,27,18,29,42,41,23,33,43,31,32,11,12],resid:43,backbon:39,success:[24,5,12],commandfuck:[],hostn:35,isui:39,chunkcollect:[29,5,11],necessari:[0,33],"0xff":2,async:[16,43],page:[0,39,43,14],read_preference_replicaset_test_0:22,milewis:16,linux:21,contin:16,"export":41,streameddata:5,proper:21,findon:[0,22,23,21,41,29,43,11],fileinfo:44,newhex:9,librari:[16,14,21,39,44],dc1:33,tmp:[21,5,33],leaf:16,lead:[21,17,38],aaronasachimp:21,leak:21,avoid:[7,21,26,43],fromint:[28,17,38,11],thank:[21,33],overlap:35,leav:[21,15],kcbanner:16,speak:[35,39],mode:[12,23,24,21,25,5,42,33,44,32,22],encourag:35,slight:43,journal:[35,22,18,23],"enum":35,usag:[14,2,22,9,3,24,21,5,42,43,44,32,36],exclicitli:35,collection_nam:42,host:[35,43,22,27,32],file_id:[21,33],although:44,offset:[34,21,44,5],java:[38,17],cliftonc:16,panel:[14,39],about:[14,12,15,39,35,7,43,44,32,22],actual:[0,44,22,43,32],socket:[14,22,35,3,21,39,27,18,16,20,40,43,10,32],dbinstanc:44,notequ:[28,17,38,11],constructor:[2,3,4,5,6,8,9,10,11,12,13,17,26,18,19,21,22,23,25,27,28,29,32,34,35,36,37,38,40,41],fals:[0,26,8,22,15,24,21,23,5,27,18,41,42,2,40,36,35,44,32,12],qard:16,disabl:[3,21,32,40,33],autoindexid:22,automat:[8,22,3,24,21,43,44,32,12],dataset:[0,43],bson:[0,1,2,4,5,6,8,9,11,12,13,14,15,26,32,19,21,22,23,27,28,18,33,34,35,36,37,41,42],leverag:[43,39],val:23,pictur:44,primarki:0,mykei:43,trigger:[8,12,23,21,5,41,22],concat:0,"var":[0,26,2,22,15,3,24,42,23,5,18,41,8,44,36,35,43,9,33,32,12],fsname:36,deliveri:39,shouldcorrectlyexecutesimpleaggregationpipelineusingarrai:23,brand:21,continu:[16,35],waitforconnect:21,gain:21,eas:16,inlin:[21,23],bug:[21,44],count:[0,22,15,21,23,5,29,42,11,12],made:[21,39,44],wise:0,cleanup:[21,44],temp:33,whether:[38,35,21,17,33],ecosystem:39,displai:[35,39,22,18],asynchron:[3,43,21],record:[0,22,15,24,21,23,5,18,7,42,35,43,32],below:[35,33,14,15,38,17,43,22],lucasfilm:[21,33],limit:[0,12,23,24,21,29,43,11],"static":16,problem:[21,26],quickli:39,myexperience1123429378001:39,evalu:[2,22],"int":[35,38,17],dure:[35,22,23,21,26,43,18],year:0,filenam:[24,21,44,5],replica:[3,35,21,22,27],implement:[35,33,16,21,17,43,38],ing:[14,39],eric:39,retrymilisecond:[35,21,22,18,32],probabl:0,tick:21,arrj:16,bartt:16,book:[0,14],bool:9,futur:[16,35,21,22,43],karait:16,stat:[29,21,22,11,23],rayno:21,"class":[8,4,5,6,2,9,10,12,13,17,26,19,21,22,23,25,27,18,33,34,35,36,37,38,39,40,41,43,44],geck:16,stai:23,experienc:39,eof:[29,24,44,5,11],rule:33,integration_test:[35,8,12,23,26,5,41,36,18,22],kaij:21,"0_gnhwzhc":30},objtypes:{"0":"js:class","1":"js:function","2":"js:attribute"},titles:["Queries","Updates","BSON()","Replicasets","DBRef()","GridStore()","MinKey()","Indexes","ReadStream()","ObjectID()","Mongos()","Node.JS MongoDB Driver Manual Contents","Cursor()","MaxKey()","The Node.JS MongoDB Driver Manual","Inserting and updating","Github libraries and projects using the driver","Long()","MongoClient()","Double()","Awesome Node.js + MongoDB Applications","Changelog","Db()","Collection()","GridStore","ReadPreference()","Admin()","Server()","Binary JSON API","Driver API","Tutorials using Node.JS and MongoDB","<no title>","Database","Mongo Driver and Mongo DB 2.2 Features","Binary()","MongoClient or how to connect in a new and better way","Grid()","Symbol()","Timestamp()","Node.JS Specific Presentations","ReplSet","CursorStream()","Collections","A Basic introduction to Mongo DB","A primer for GridFS using the Mongo DB driver","Articles"],objnames:{"0":["js","class","JavaScript class"],"1":["js","function","JavaScript function"],"2":["js","attribute","JavaScript attribute"]},filenames:["markdown-docs/queries","driver-articles/index","api-bson-generated/bson","markdown-docs/replicaset","api-bson-generated/code","api-generated/gridstore","api-bson-generated/minkey","markdown-docs/indexes","api-generated/readstream","api-bson-generated/objectid","api-generated/mongos","contents","api-generated/cursor","api-bson-generated/maxkey","index","markdown-docs/insert","github/github","api-bson-generated/long","api-generated/mongoclient","api-bson-generated/double","content/awesomeappsvideo","changelog/changelog","api-generated/db","api-generated/collection","markdown-docs/gridfs","api-generated/readpreference","api-generated/admin","api-generated/server","api-bson-generated/index","api-generated/index","content/tutorials","markdown-docs/index","markdown-docs/database","driver-articles/anintroductionto1_1and2_2","api-bson-generated/binary","driver-articles/mongoclient","api-generated/grid","api-bson-generated/symbol","api-bson-generated/timestamp","content/nodejsvideo","api-generated/replset","api-generated/cursorstream","markdown-docs/collections","api-articles/nodekoarticle1","api-articles/nodekoarticle2","api-articles/index"]}) \ No newline at end of file From e5636b6e818e7108080865f96c6a441ebe57e7d8 Mon Sep 17 00:00:00 2001 From: Christian Kvalheim Date: Thu, 29 Nov 2012 11:25:19 +0000 Subject: [PATCH 43/56] Updated docs --- _sources/driver-articles/mongoclient.txt | 100 ++++++++++------ _sources/github/github.txt | 22 ++-- driver-articles/index.html | 4 + driver-articles/mongoclient.html | 139 ++++++++++++----------- github/github.html | 22 ++-- index.html | 7 +- objects.inv | Bin 1373 -> 1374 bytes searchindex.js | 2 +- 8 files changed, 174 insertions(+), 122 deletions(-) diff --git a/_sources/driver-articles/mongoclient.txt b/_sources/driver-articles/mongoclient.txt index d11a11a713b..f2baaa08cbf 100644 --- a/_sources/driver-articles/mongoclient.txt +++ b/_sources/driver-articles/mongoclient.txt @@ -2,14 +2,11 @@ MongoClient or how to connect in a new and better way ===================================================== - From driver version **1.2** we are introduction a new connection Class that has the same name across all out offical drivers. -This is to ensure that we present a recognizable front for all our API's. This does not mean you existing application will break -but that we encourage you to use the new connection api to simplifiy your application development. + From driver version **1.2** we are introduction a new connection Class that has the same name across all out official drivers. This is to ensure that we present a recognizable front for all our API's. This does not mean you existing application will break but that we encourage you to use the new connection api to simplify your application development. - Futher more we are making the new connection class **MongoClient** acknowledge all write to MongoDB in contrast to the existing -conncetion class Db that has acknowledgements turned off. Let's take a tour of the MongoClient functions. + Further more we are making the new connection class **MongoClient** acknowledge all write to MongoDB in contrast to the existing connection class Db that has acknowledgements turned off. Let's take a tour of the MongoClient functions. .. code-block:: javascript @@ -26,9 +23,7 @@ conncetion class Db that has acknowledgements turned off. Let's take a tour of t - Outlined above is the complete MongoClient interface. The methods **open** , **close** and **db** work very similar to the existing - methods on the **Db** class. The main difference if you noticed is that the constructor is missing the **database name** from Db. - Let's show a simple connection using **open** as a code example speaks a thousand words. + Outlined above is the complete MongoClient interface. The methods **open** , **close** and **db** work very similar to the existing methods on the **Db** class. The main difference if you noticed is that the constructor is missing the **database name** from Db. Let's show a simple connection using **open** as a code example speaks a thousand words. .. code-block:: javascript @@ -45,14 +40,11 @@ conncetion class Db that has acknowledgements turned off. Let's take a tour of t - Notice that you configure the MongoClient just as you would have done the Db object. The main difference is that you access the db instances -using the **db** method on the MongoClient object instead of using the Db instance directly as you would previously. Don't that seem more -intuitive then the previous API. Also MongoClient supports the same options as the previous Db instance you would have created. + Notice that you configure the MongoClient just as you would have done the Db object. The main difference is that you access the db instances using the **db** method on the MongoClient object instead of using the Db instance directly as you would previously. Don't that seem more intuitive then the previous API. Also MongoClient supports the same options as the previous Db instance you would have created. - So with a minimal change in our app we can apply the new MongoClient connection code. But there is more and one direction you might consider -int the future. That is the mongodb connection string. + So with a minimal change in our app we can apply the new MongoClient connection code. But there is more and one direction you might consider int the future. That is the mongodb connection string. ------------------------- @@ -64,8 +56,7 @@ The URL connection format - The URL format is unified across official drivers from 10gen with some options not supported on some driver due to natural reasons. The ones -not supported by the Node.js driver are left out for simplicities sake. + The URL format is unified across official drivers from 10gen with some options not supported on some driver due to natural reasons. The ones not supported by the Node.js driver are left out for simplicities sake. * **mongodb://** is a required prefix to identify that this is a string in the standard connection format. @@ -73,7 +64,7 @@ not supported by the Node.js driver are left out for simplicities sake. * **host1** is the only required part of the URI. It identifies either a hostname, IP address, or unix domain socket * **:portX** is optional and defaults to :27017 if not provided. * **/database** is the name of the database to login to and thus is only relevant if the username:password@ syntax is used. If not specified the "admin" database will be used by default. - * **?options** are connection options. Note that if database is absent there is still a / required between the last host and the ? introducing the options. Options are name=value pairs and the pairs are separated by "&". For any unrecognized or unsupported option, a driver should log a warning and continue processing. A driver should not support any options that are not exclicitly defined in this specification. This is in order to reduce the likelihood that different drivers will support overlapping that differ in small but incompatible ways (like different name, different values, or different default value). + * **?options** are connection options. Note that if database is absent there is still a / required between the last host and the ? introducing the options. Options are name=value pairs and the pairs are separated by "&". For any unrecognized or unsupported option, a driver should log a warning and continue processing. A driver should not support any options that are not explicitly defined in this specification. This is in order to reduce the likelihood that different drivers will support overlapping that differ in small but incompatible ways (like different name, different values, or different default value). * **replicaSet=name** * The driver verifies that the name of the replica set it connects to matches this name. Implies that the hosts given are a seed list, and the driver will attempt to find all members of the set. * No default value. @@ -117,9 +108,7 @@ not supported by the Node.js driver are left out for simplicities sake. MongoClient.connect ------------------- - The url format can be used with MongoClient.connect. Where possible MongoClient will pick the best possible default values for options but they -can be overriden. This includes setting **auto_reconnect to true** and **native_parser to true if it's available** . Below are some example on how -to connect to a single server a replicaset and a sharded system using **MongoClient.connect** + The url format can be used with MongoClient.connect. Where possible MongoClient will pick the best possible default values for options but they can be overridden. This includes setting **auto_reconnect to true** and **native_parser to true if it's available** . Below are some example on how to connect to a single server a replicaset and a sharded system using **MongoClient.connect** .. code-block:: javascript @@ -177,17 +166,14 @@ to connect to a single server a replicaset and a sharded system using **MongoCl - Notice that when connecting to the shareded system it's pretty much the same url as for connecting to the replicaset. This is because the driver -itself figures out if it's a replicaset or a set of Mongos proxies it's connecting to. No special care is needed to specify if it's one or the other. -This is in contrast to having to use the **ReplSet** or **Mongos** instances when using the **open** command. + Notice that when connecting to the sharded system it's pretty much the same url as for connecting to the replicaset. This is because the driver itself figures out if it's a replicaset or a set of Mongos proxies it's connecting to. No special care is needed to specify if it's one or the other. This is in contrast to having to use the **ReplSet** or **Mongos** instances when using the **open** command. --------------------------- MongoClient.connect options --------------------------- - The connect function also takes a hash of options divided into db/server/replset/mongos alowing you to tweak options not directly supported by the -unified url string format. To use these options you do pass in a has like this. + The connect function also takes a hash of options divided into db/server/replset/mongos allowing you to tweak options not directly supported by the unified url string format. To use these options you do pass in a has like this. .. code-block:: javascript @@ -223,12 +209,62 @@ unified url string format. To use these options you do pass in a has like this. Below are all the options supported for db/server/replset/mongos. - * **db** A hash of options at the db level overriding or adjusting functionaliy not suppported by the url - * **w** , {Number/String, > -1 || 'majority'} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1 or w = 'majority' acknowledges the write * **wtimeout** , {Number, 0} set the timeout for waiting for write concern to finish (combines with w option) * **fsync** , (Boolean, default:false) write waits for fsync before returning * **journal** , (Boolean, default:false) write waits for journal sync before returning * **readPreference** {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY *PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY* PREFERRED, ReadPreference.NEAREST). * **native_parser** {Boolean, default:false}, use c++ bson parser. * **forceServerObjectId** {Boolean, default:false}, force server to create _id fields instead of client. * **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. * **serializeFunctions** {Boolean, default:false}, serialize functions. * **raw** {Boolean, default:false}, peform operations using raw bson buffers. * **recordQueryStats** {Boolean, default:false}, record query statistics during execution. * **retryMiliSeconds** {Number, default:5000}, number of miliseconds between retries. * **numberOfRetries** {Number, default:5}, number of retries off connection. - * **server** A hash of options at the server level not supported by the url. - * **readPreference** {String, default:null}, set's the read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY *PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY* PREFERRED, ReadPreference.NEAREST) * **ssl** {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support) * **slaveOk** {Boolean, default:false}, legacy option allowing reads from secondary, use **readPrefrence** instead. * **poolSize** {Number, default:1}, number of connections in the connection pool, set to 1 as default for legacy reasons. * **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) * **logger** {Object, default:null}, an object representing a logger that you want to use, needs to support functions debug, log, error **({error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}})** . * **auto_reconnect** {Boolean, default:false}, reconnect on error. * **disableDriverBSONSizeCheck** {Boolean, default:false}, force the server to error if the BSON message is to big - * **replSet** A hash of options at the replSet level not supported by the url. - * **ha** {Boolean, default:true}, turn on high availability. * **haInterval** {Number, default:2000}, time between each replicaset status check. * **reconnectWait** {Number, default:1000}, time to wait in miliseconds before attempting reconnect. * **retries** {Number, default:30}, number of times to attempt a replicaset reconnect. * **rs_name** {String}, the name of the replicaset to connect to. * **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) * **readPreference** {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY *PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY* PREFERRED, ReadPreference.NEAREST). * **strategy** {String, default:null}, selection strategy for reads choose between (ping and statistical, default is round-robin) * **secondaryAcceptableLatencyMS** {Number, default:15}, sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms) * **connectArbiter** {Boolean, default:false}, sets if the driver should connect to arbiters or not. - * **mongos** A hash of options at the mongos level not supported by the url. - * **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) * **ha** {Boolean, default:true}, turn on high availability, attempts to reconnect to down proxies * **haInterval** {Number, default:2000}, time between each replicaset status check. +---------------------------------------------------------------------------------------------------- +db: A hash of options at the db level overriding or adjusting functionality not supported by the url +---------------------------------------------------------------------------------------------------- + * **w** , {Number/String, > -1 || 'majority'} the write concern for the operation where < 1 is no acknowledgment of write and w >= 1 or w = 'majority' acknowledges the write + * **wtimeout** , {Number, 0} set the timeout for waiting for write concern to finish (combines with w option) + * **fsync** , (Boolean, default:false) write waits for fsync before returning + * **journal** , (Boolean, default:false) write waits for journal sync before returning + * **readPreference** {String}, the preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY *PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY* PREFERRED, ReadPreference.NEAREST). + * **native_parser** {Boolean, default:false}, use c++ bson parser. + * **forceServerObjectId** {Boolean, default:false}, force server to create _id fields instead of client. + * **pkFactory** {Object}, object overriding the basic ObjectID primary key generation. + * **serializeFunctions** {Boolean, default:false}, serialize functions. + * **raw** {Boolean, default:false}, perform operations using raw bson buffers. + * **recordQueryStats** {Boolean, default:false}, record query statistics during execution. + * **retryMiliSeconds** {Number, default:5000}, number of milliseconds between retries. + * **numberOfRetries** {Number, default:5}, number of retries off connection. + + +----------------------------------------------------------------------- +server: A hash of options at the server level not supported by the url. +----------------------------------------------------------------------- + .. code-block:: javascript + + * **readPreference** {String, default:null}, set's the read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST) + * **ssl** {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support) + * **slaveOk** {Boolean, default:false}, legacy option allowing reads from secondary, use **readPrefrence** instead. + * **poolSize** {Number, default:1}, number of connections in the connection pool, set to 1 as default for legacy reasons. + * **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) + * **logger** {Object, default:null}, an object representing a logger that you want to use, needs to support functions debug, log, error **({error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}})**. + * **auto_reconnect** {Boolean, default:false}, reconnect on error. + * **disableDriverBSONSizeCheck** {Boolean, default:false}, force the server to error if the BSON message is to big + + +------------------------------------------------------------------------- +replSet: A hash of options at the replSet level not supported by the url. +------------------------------------------------------------------------- + .. code-block:: javascript + + * **ha** {Boolean, default:true}, turn on high availability. + * **haInterval** {Number, default:2000}, time between each replicaset status check. + * **reconnectWait** {Number, default:1000}, time to wait in milliseconds before attempting reconnect. + * **retries** {Number, default:30}, number of times to attempt a replicaset reconnect. + * **rs_name** {String}, the name of the replicaset to connect to. + * **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) + * **readPreference** {String}, the preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). + * **strategy** {String, default:null}, selection strategy for reads choose between (ping and statistical, default is round-robin) + * **secondaryAcceptableLatencyMS** {Number, default:15}, sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms) + * **connectArbiter** {Boolean, default:false}, sets if the driver should connect to arbiters or not. + + +----------------------------------------------------------------------- +mongos: A hash of options at the mongos level not supported by the url. +----------------------------------------------------------------------- + .. code-block:: javascript + + * **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) + * **ha** {Boolean, default:true}, turn on high availability, attempts to reconnect to down proxies + * **haInterval** {Number, default:2000}, time between each replicaset status check. diff --git a/_sources/github/github.txt b/_sources/github/github.txt index 4aa66ceda10..b9bd38301aa 100644 --- a/_sources/github/github.txt +++ b/_sources/github/github.txt @@ -39,7 +39,7 @@ Web frameworks using MongoDB * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 1:5:57 on 29/9/2012 + - 4:4:14 on 28/10/2012 * - **Homepage** - http:// * - **Url** @@ -134,7 +134,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 21:50:58 on 26/10/2012 + - 0:58:5 on 29/10/2012 * - **Homepage** - http:// * - **Url** @@ -142,9 +142,9 @@ Object Document Modeling Libraries * - **Clone Url** - https://github.com/LearnBoost/mongoose.git * - **Forks** - - 306 + - 305 * - **Watchers** - - 2531 + - 2538 .. topic:: mongo-model @@ -360,7 +360,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 32 * - **Watchers** - - 253 + - 256 .. topic:: mongode @@ -522,9 +522,9 @@ REST api's around MongoDB or resource based libraries * - **Clone Url** - https://github.com/tdegrunt/mongodb-rest.git * - **Forks** - - 40 + - 41 * - **Watchers** - - 184 + - 185 .. topic:: lazyBum @@ -841,7 +841,7 @@ General frameworks over MongoDB * - **Forks** - 0 * - **Watchers** - - 24 + - 25 Translation libraries or frameworks ----------------------------------- @@ -914,9 +914,9 @@ Libraries or Applications for analytics * - **Clone Url** - https://github.com/square/cube.git * - **Forks** - - 208 + - 209 * - **Watchers** - - 2281 + - 2285 Libraries for the connect middleware ------------------------------------ @@ -1038,7 +1038,7 @@ Exampe applications * - **Clone Url** - https://github.com/gotik/nodejs-blackboard.git * - **Forks** - - 5 + - 6 * - **Watchers** - 21 diff --git a/driver-articles/index.html b/driver-articles/index.html index bc14eb45b4e..d7531c6f0ce 100644 --- a/driver-articles/index.html +++ b/driver-articles/index.html @@ -53,6 +53,10 @@

                                              UpdatesThe URL connection format
                                            • MongoClient.connect
                                            • MongoClient.connect options
                                            • +
                                            • db: A hash of options at the db level overriding or adjusting functionality not supported by the url
                                            • +
                                            • server: A hash of options at the server level not supported by the url.
                                            • +
                                            • replSet: A hash of options at the replSet level not supported by the url.
                                            • +
                                            • mongos: A hash of options at the mongos level not supported by the url.
                                          • Mongo Driver and Mongo DB 2.2 Features @@ -205,11 +190,8 @@

                                            The URL connection format

                                            MongoClient.connect

                                            -
                                            The url format can be used with MongoClient.connect. Where possible MongoClient will pick the best possible default values for options but they
                                            -

                                            can be overriden. This includes setting auto_reconnect to true and native_parser to true if it’s available . Below are some example on how -to connect to a single server a replicaset and a sharded system using MongoClient.connect

                                            +

                                            The url format can be used with MongoClient.connect. Where possible MongoClient will pick the best possible default values for options but they can be overridden. This includes setting auto_reconnect to true and native_parser to true if it’s available . Below are some example on how to connect to a single server a replicaset and a sharded system using MongoClient.connect

                                            -
                                            var MongoClient = require('mongodb').MongoClient;
                                             
                                             MongoClient.connect("mongodb://localhost:27017/integration_test", function(err, db) {
                                            @@ -259,18 +241,14 @@ 

                                            MongoClient.connect

                                            MongoClient.connect options

                                            -
                                            The connect function also takes a hash of options divided into db/server/replset/mongos alowing you to tweak options not directly supported by the
                                            -

                                            unified url string format. To use these options you do pass in a has like this.

                                            +

                                            The connect function also takes a hash of options divided into db/server/replset/mongos allowing you to tweak options not directly supported by the unified url string format. To use these options you do pass in a has like this.

                                            -
                                            var MongoClient = require('mongodb').MongoClient;
                                             
                                             MongoClient.connect("mongodb://localhost:27017/integration_test_?", {
                                            @@ -300,40 +278,67 @@ 

                                            MongoClient.connect options -
                                          • db A hash of options at the db level overriding or adjusting functionaliy not suppported by the url
                                          • -

                                          -
                                          -
                                            -
                                          • w , {Number/String, > -1 || ‘majority’} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1 or w = ‘majority’ acknowledges the write * wtimeout , {Number, 0} set the timeout for waiting for write concern to finish (combines with w option) * fsync , (Boolean, default:false) write waits for fsync before returning * journal , (Boolean, default:false) write waits for journal sync before returning * readPreference {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY PREFERRED, ReadPreference.NEAREST). * native_parser {Boolean, default:false}, use c++ bson parser. * forceServerObjectId {Boolean, default:false}, force server to create _id fields instead of client. * pkFactory {Object}, object overriding the basic ObjectID primary key generation. * serializeFunctions {Boolean, default:false}, serialize functions. * raw {Boolean, default:false}, peform operations using raw bson buffers. * recordQueryStats {Boolean, default:false}, record query statistics during execution. * retryMiliSeconds {Number, default:5000}, number of miliseconds between retries. * numberOfRetries {Number, default:5}, number of retries off connection.
                                          • -
                                          -
                                            -
                                          • server A hash of options at the server level not supported by the url.
                                          • -
                                          + +
                                          +

                                          db: A hash of options at the db level overriding or adjusting functionality not supported by the url

                                            -
                                          • readPreference {String, default:null}, set’s the read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY PREFERRED, ReadPreference.NEAREST) * ssl {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support) * slaveOk {Boolean, default:false}, legacy option allowing reads from secondary, use readPrefrence instead. * poolSize {Number, default:1}, number of connections in the connection pool, set to 1 as default for legacy reasons. * socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) * logger {Object, default:null}, an object representing a logger that you want to use, needs to support functions debug, log, error ({error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}}) . * auto_reconnect {Boolean, default:false}, reconnect on error. * disableDriverBSONSizeCheck {Boolean, default:false}, force the server to error if the BSON message is to big
                                          • +
                                          • w , {Number/String, > -1 || ‘majority’} the write concern for the operation where < 1 is no acknowledgment of write and w >= 1 or w = ‘majority’ acknowledges the write
                                          • +
                                          • wtimeout , {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
                                          • +
                                          • fsync , (Boolean, default:false) write waits for fsync before returning
                                          • +
                                          • journal , (Boolean, default:false) write waits for journal sync before returning
                                          • +
                                          • readPreference {String}, the preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY PREFERRED, ReadPreference.NEAREST).
                                          • +
                                          • native_parser {Boolean, default:false}, use c++ bson parser.
                                          • +
                                          • forceServerObjectId {Boolean, default:false}, force server to create _id fields instead of client.
                                          • +
                                          • pkFactory {Object}, object overriding the basic ObjectID primary key generation.
                                          • +
                                          • serializeFunctions {Boolean, default:false}, serialize functions.
                                          • +
                                          • raw {Boolean, default:false}, perform operations using raw bson buffers.
                                          • +
                                          • recordQueryStats {Boolean, default:false}, record query statistics during execution.
                                          • +
                                          • retryMiliSeconds {Number, default:5000}, number of milliseconds between retries.
                                          • +
                                          • numberOfRetries {Number, default:5}, number of retries off connection.
                                          -
                                            -
                                          • replSet A hash of options at the replSet level not supported by the url.
                                          • -
                                          +
                                          +
                                          +

                                          server: A hash of options at the server level not supported by the url.

                                          -
                                            -
                                          • ha {Boolean, default:true}, turn on high availability. * haInterval {Number, default:2000}, time between each replicaset status check. * reconnectWait {Number, default:1000}, time to wait in miliseconds before attempting reconnect. * retries {Number, default:30}, number of times to attempt a replicaset reconnect. * rs_name {String}, the name of the replicaset to connect to. * socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) * readPreference {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY PREFERRED, ReadPreference.NEAREST). * strategy {String, default:null}, selection strategy for reads choose between (ping and statistical, default is round-robin) * secondaryAcceptableLatencyMS {Number, default:15}, sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms) * connectArbiter {Boolean, default:false}, sets if the driver should connect to arbiters or not.
                                          • -
                                          +
                                          *  **readPreference** {String, default:null}, set's the read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST)
                                          +*  **ssl** {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support)
                                          +*  **slaveOk** {Boolean, default:false}, legacy option allowing reads from secondary, use **readPrefrence** instead.
                                          +*  **poolSize** {Number, default:1}, number of connections in the connection pool, set to 1 as default for legacy reasons.
                                          +*  **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
                                          +*  **logger** {Object, default:null}, an object representing a logger that you want to use, needs to support functions debug, log, error **({error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}})**.
                                          +*  **auto_reconnect** {Boolean, default:false}, reconnect on error.
                                          +*  **disableDriverBSONSizeCheck** {Boolean, default:false}, force the server to error if the BSON message is to big
                                          +
                                          -
                                            -
                                          • mongos A hash of options at the mongos level not supported by the url.
                                          • -
                                          +
                                          +
                                          +

                                          replSet: A hash of options at the replSet level not supported by the url.

                                          -
                                            -
                                          • socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) * ha {Boolean, default:true}, turn on high availability, attempts to reconnect to down proxies * haInterval {Number, default:2000}, time between each replicaset status check.
                                          • -
                                          -
                                          +
                                          *  **ha** {Boolean, default:true}, turn on high availability.
                                          +*  **haInterval** {Number, default:2000}, time between each replicaset status check.
                                          +*  **reconnectWait** {Number, default:1000}, time to wait in milliseconds before attempting reconnect.
                                          +*  **retries** {Number, default:30}, number of times to attempt a replicaset reconnect.
                                          +*  **rs_name** {String}, the name of the replicaset to connect to.
                                          +*  **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
                                          +*  **readPreference** {String}, the preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
                                          +*  **strategy** {String, default:null}, selection strategy for reads choose between (ping and statistical, default is round-robin)
                                          +*  **secondaryAcceptableLatencyMS** {Number, default:15}, sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms)
                                          +*  **connectArbiter** {Boolean, default:false}, sets if the driver should connect to arbiters or not.
                                          +
                                          +
                                          +
                                          +
                                          +

                                          mongos: A hash of options at the mongos level not supported by the url.

                                          +
                                          +
                                          *  **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
                                          +*  **ha** {Boolean, default:true}, turn on high availability, attempts to reconnect to down proxies
                                          +*  **haInterval** {Number, default:2000}, time between each replicaset status check.
                                          +
                                          +
                                          @@ -350,6 +355,10 @@

                                          Contents

                                        • The URL connection format
                                        • MongoClient.connect
                                        • MongoClient.connect options
                                        • +
                                        • db: A hash of options at the db level overriding or adjusting functionality not supported by the url
                                        • +
                                        • server: A hash of options at the server level not supported by the url.
                                        • +
                                        • replSet: A hash of options at the replSet level not supported by the url.
                                        • +
                                        • mongos: A hash of options at the mongos level not supported by the url.
                                      diff --git a/github/github.html b/github/github.html index 32f5a6e1e05..9c2e74b5246 100644 --- a/github/github.html +++ b/github/github.html @@ -100,7 +100,7 @@

                                      Web frameworks using MongoDB

                    Last push1:5:57 on 29/9/20124:4:14 on 28/10/2012
                    Homepage http://Last push21:50:58 on 26/10/20120:58:5 on 29/10/2012
                    Homepage http://
                    Forks306305
                    Watchers25312538
                    @@ -595,7 +595,7 @@

                    Wrapper libraries to ease the use of development or provide simple ODM like

                    32
                    Watchers253256
                    @@ -847,10 +847,10 @@

                    REST api’s around MongoDB or resource based librarieshttps://github.com/tdegrunt/mongodb-rest.git

                    Forks4041
                    Watchers184185
                    @@ -1336,7 +1336,7 @@

                    General frameworks over MongoDB

                    Watchers2425
                    @@ -1447,10 +1447,10 @@

                    Libraries or Applications for analyticshttps://github.com/square/cube.git Forks -208 +209 Watchers -2281 +2285 @@ -1636,7 +1636,7 @@

                    Exampe applicationshttps://github.com/gotik/nodejs-blackboard.git Forks -5 +6 Watchers 21 diff --git a/index.html b/index.html index 59dd32618b1..62b86ec5f17 100644 --- a/index.html +++ b/index.html @@ -70,6 +70,10 @@

                    Driver UpdatesThe URL connection format
                  • MongoClient.connect
                  • MongoClient.connect options
                  • +
                  • db: A hash of options at the db level overriding or adjusting functionality not supported by the url
                  • +
                  • server: A hash of options at the server level not supported by the url.
                  • +
                  • replSet: A hash of options at the replSet level not supported by the url.
                  • +
                  • mongos: A hash of options at the mongos level not supported by the url.
                • Mongo Driver and Mongo DB 2.2 Features
                    @@ -191,8 +195,7 @@

                    Video Presentations about different topics around the MongoDB and Node.js

                    Projects and Libraries using the driver

                    diff --git a/objects.inv b/objects.inv index 6c86c30eab299db5b07f317622f024448eb2812e..9d3dc5767e584220314ba0f70759885bfee46174 100644 GIT binary patch delta 1253 zcmVBkiGNLx+cprr@2@b>UhN`>UUIY7yYaRgdtoOikfI1EaU?TKkt#_! zcF-T+A!SRJB3mN8r^VVc{FsmT9>rGKiu;%y;botG%G2ygoL2QUWIe;fDbAG;VaMzN?c@Y8CkVpJQc&Jy*J zi9g}clUuy{D;#Pky=946vvg~MuKryy1CNYfzk0`EG3uXA%k}Rpqi=v;)7t+7F4?|n zbHmzp9!+8?1g6^FX7G`j*aFty zy3Exow+{LdLw9ur1eG1AW+iQ0adM`OZyg)CfIUVHfhVMlU9CLqabxWrH*BG2`F$8F zcht$s9e?I&-UApNXVyzdv9fm%v@Zv(KW&K!a%TFT(h<-@(OFH=6cp;wD_)(3n+vhOW`fP>RTf zczc9FEo?k2H?d{)3J>37wKERy^TRxq#fo-+_;&`Tn-_Hk+708GCI zs8aqHGuv5_V51|UURvX7`W4nsDPR`NMt}L>-%UNW(^0t_7sejHcC0&+ZjTU>ZyWJ| zXGPQH0`YW;fT0A^DQv%hl0mNc4p`s=K3Et2Oe5WQwn8kg>{)G~MXqF0~Z$b;c(LTzSYw2#GIf~;2Ip8tk*W*OdSAQmF zBwqt9V*lsB>Ct!#kv4U~4ZV6s2R&(TbAXV>oj}VC_-e7JeTS`tf5<`T!dJ4n zq6{ucHxV7!!5tTEZhkvw3fP+x&Aeo;k$>Ppf)YHBE@$>U%wH+fA!GIO72rS7tY+)a zumkSnSr^ulWH5XhX*sEH7HRpYJzj~#>%IgZc545vZPc7Kd5@W#e(=M| Ps9>D>{!sNl;cf!lb#!8_ delta 1252 zcmVUhN`>UUKteH{Nz*FYE*bQWOCtj$~#jQY9(J z4*KIeq_mc$$d*X&$&fTd4(IXB$8jbp6BG_3ZRmSWBH*L(yHS1|XVr(v&Sdl=>MjM*q4fH;(kMkW5Ebv5g5|qPY+DLElN9b2vkfGpZ-4rI%!$^ccO#Osaipaf zdOSQlyha$!x}qwwg&HV#B29R_0dxr2G{Gi8w5$9g4M%f}CqG zwVHxV?%}frbybf>wMwpJ!Z;J@qe$dcEkZLUYQ+@Hs&I#!Mgz`gSO(gVEU#CHh>3Sw z_5-eN8y8ATRex*6yF$D;Em33v8XWc(`u<=R2!+z0`-xJ zKjGLDTRi#;9BU=LV~N?YbZ3H&{#`Kx4~$p~{GpAAh>($sw-X9z|G4as_)P3w^JY zRC@5{bC;f5qkv?W9a|=`c2c!&f=8YTiU7uvXWIDYv5`wSpw|$1Lekjf%KZU1*4}=@5_*!~hoN#u zo~)fQkAI6E!0519uOP+D-b2v79JKzlBO*wd={d=Bpx(}+O6F6}UB?7}U!#AFE2zQA znbF_h3fP;t5FBvZ$a{j_Y~Fjq8O8SlOS1)o6)0?6EBAJIU6lwm6#IHl&^p{!VpT64 zI1gG1a)o5c+gc-sLO@qRVD&GEAraBw*J$*b(tn^WW5VNtRTi!%*{vGU#8L+EBfO`b2X+1Cwz$v+ zYvfr$0@zD?oZD`HTlaj~v6tIrA+Ri8{2S&}DRT6p$_gBA4^Fc>fwWioH-Ywsl0JoV z=zki`h^B~n*ePt6T&w$k3&Mk}m~Gdq2?dNGLnQwJHM#RC^cfRG^;J^jgwF1LXgcMv z77qotHBsb#^-yOS90FL`E4P`%&XblC-bB-|6Be*e`c?HYizGjTA&je>a|Xf;x`Sj^ zJ}%`OQ0rF!r;z`}%x+dB2n^VYFRgJk{C^7br=&hhX1#p$ucn^d>B!uzb7PNQ+t(dI zw0ULef;Z(5O1;!_bD)Nr}IJl0m9?gIMC#KbTSe+;+OpY$;rRl4}9f8*mXf z#CU=v?8028OF+2KU^-}H2M+qO+Z-6^t_$C1p;;<`zDZl~^>#&bu7$gW=18lT()<2ZT^es`ht2MOL&cqedQb4$NG_yt_J@_*sVQC`e6@O^y@#!ZKjQ|W3t!^p zQY$#I+(dL>9d;bFx%us#Pr$*HnB+xPjr;=*2@3Ecx*XYaH-Du}hm6%rF7H3lJk8dh zU=Q3!vreoP$zb?2(sq` Date: Mon, 10 Dec 2012 14:55:57 +0100 Subject: [PATCH 44/56] Updated docs to 1.2.3 --- .buildinfo | 2 +- _sources/api-bson-generated/code.txt | 17 +- _sources/api-bson-generated/db_ref.txt | 20 + _sources/api-bson-generated/index.txt | 1 + _sources/api-generated/admin.txt | 2 + _sources/api-generated/db.txt | 2 +- _sources/api-generated/gridstore.txt | 2 +- _sources/api-generated/server.txt | 2 +- _sources/changelog/changelog.txt | 15 + _sources/driver-articles/mongoclient.txt | 2 +- _sources/github/github.txt | 68 +-- api-articles/index.html | 14 +- api-articles/nodekoarticle1.html | 14 +- api-articles/nodekoarticle2.html | 14 +- api-bson-generated/binary.html | 18 +- api-bson-generated/bson.html | 14 +- api-bson-generated/code.html | 33 +- api-bson-generated/db_ref.html | 275 ++++++++++ api-bson-generated/double.html | 18 +- api-bson-generated/index.html | 20 +- api-bson-generated/long.html | 14 +- api-bson-generated/maxkey.html | 14 +- api-bson-generated/minkey.html | 14 +- api-bson-generated/objectid.html | 14 +- api-bson-generated/symbol.html | 14 +- api-bson-generated/timestamp.html | 14 +- api-generated/admin.html | 16 +- api-generated/collection.html | 14 +- api-generated/cursor.html | 14 +- api-generated/cursorstream.html | 14 +- api-generated/db.html | 16 +- api-generated/grid.html | 14 +- api-generated/gridstore.html | 16 +- api-generated/index.html | 14 +- api-generated/mongoclient.html | 14 +- api-generated/mongos.html | 14 +- api-generated/readpreference.html | 14 +- api-generated/readstream.html | 14 +- api-generated/replset.html | 14 +- api-generated/server.html | 16 +- changelog/changelog.html | 482 +++++++++--------- content/awesomeappsvideo.html | 14 +- content/nodejsvideo.html | 14 +- content/tutorials.html | 14 +- contents.html | 16 +- .../anintroductionto1_1and2_2.html | 14 +- driver-articles/index.html | 14 +- driver-articles/mongoclient.html | 16 +- genindex.html | 32 +- github/github.html | 72 +-- index.html | 17 +- markdown-docs/collections.html | 14 +- markdown-docs/database.html | 14 +- markdown-docs/gridfs.html | 14 +- markdown-docs/index.html | 14 +- markdown-docs/indexes.html | 14 +- markdown-docs/insert.html | 14 +- markdown-docs/queries.html | 14 +- markdown-docs/replicaset.html | 14 +- objects.inv | Bin 1374 -> 1387 bytes search.html | 14 +- searchindex.js | 2 +- 62 files changed, 1010 insertions(+), 664 deletions(-) create mode 100644 _sources/api-bson-generated/db_ref.txt create mode 100644 api-bson-generated/db_ref.html diff --git a/.buildinfo b/.buildinfo index 8a4aef03b46..55077d22909 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: e54c79873cefa79d9d8d3fbf71d3ab21 +config: 508919cd1003e9d9ad401fd0eb276aa0 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/_sources/api-bson-generated/code.txt b/_sources/api-bson-generated/code.txt index 0fd9f15e124..7302232a2a3 100644 --- a/_sources/api-bson-generated/code.txt +++ b/_sources/api-bson-generated/code.txt @@ -1,20 +1,19 @@ -======= -DBRef() -======= +====== +Code() +====== ------------------ Constructor ------------------ -A class representation of the BSON DBRef type. +A class representation of the BSON Code type. - .. js:class:: DBRef() + .. js:class:: Code() - :param string namespace: the collection name. - :param objectid oid: the reference ObjectID. - :param string [db]: optional db name, if omitted the reference is local to the current db. - :returns: dbref + :param string code: a string or function. + :param object [scope]: an optional scope for the function. + :returns: code diff --git a/_sources/api-bson-generated/db_ref.txt b/_sources/api-bson-generated/db_ref.txt new file mode 100644 index 00000000000..0fd9f15e124 --- /dev/null +++ b/_sources/api-bson-generated/db_ref.txt @@ -0,0 +1,20 @@ +======= +DBRef() +======= + +------------------ +Constructor +------------------ + + +A class representation of the BSON DBRef type. + + + .. js:class:: DBRef() + + :param string namespace: the collection name. + :param objectid oid: the reference ObjectID. + :param string [db]: optional db name, if omitted the reference is local to the current db. + :returns: dbref + + diff --git a/_sources/api-bson-generated/index.txt b/_sources/api-bson-generated/index.txt index 264a61efc7d..3cedf0394a4 100644 --- a/_sources/api-bson-generated/index.txt +++ b/_sources/api-bson-generated/index.txt @@ -8,6 +8,7 @@ Binary JSON API objectid binary code + db_ref double minkey maxkey diff --git a/_sources/api-generated/admin.txt b/_sources/api-generated/admin.txt index 2ea7236d1ae..061bb2f23df 100644 --- a/_sources/api-generated/admin.txt +++ b/_sources/api-generated/admin.txt @@ -554,6 +554,8 @@ Options // Remove the user adminDb.removeUser('admin', function(err, result) { + assert.equal(null, err); + assert.equal(true, result); // Authenticate using the removed user should fail adminDb.authenticate('admin', 'admin', function(err, result) { diff --git a/_sources/api-generated/db.txt b/_sources/api-generated/db.txt index c5421e09c6a..c798354e5da 100644 --- a/_sources/api-generated/db.txt +++ b/_sources/api-generated/db.txt @@ -1192,7 +1192,7 @@ Options - **capped** {Boolean, default:false}, create a capped collection. - **size** {Number}, the size of the capped collection in bytes. - **max** {Number}, the maximum number of documents in the capped collection. - - **autoIndexId** {Boolean, default:false}, create an index on the _id field of the document, not created automatically on capped collections. + - **autoIndexId** {Boolean, default:true}, create an index on the _id field of the document, True by default on MongoDB 2.2 or higher off for version < 2.2. - **readPreference** {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - **strict**, (Boolean, default:false) throws and error if collection already exists diff --git a/_sources/api-generated/gridstore.txt b/_sources/api-generated/gridstore.txt index 3ad9440d47d..c00cba266ea 100644 --- a/_sources/api-generated/gridstore.txt +++ b/_sources/api-generated/gridstore.txt @@ -16,7 +16,7 @@ A class representation of a file stored in GridFS. :param objectid id: an unique ObjectID for this file :param string [filename]: optional a filename for this file, no unique constrain on the field :param string mode: set the mode for this file. - :param object options: optional properties to specify. Recognized keys: + :param object options: optional properties to specify. :returns: gridstore diff --git a/_sources/api-generated/server.txt b/_sources/api-generated/server.txt index a7239f6667b..42819d953a7 100644 --- a/_sources/api-generated/server.txt +++ b/_sources/api-generated/server.txt @@ -21,7 +21,7 @@ Options - **readPreference** {String, default:null}, set's the read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST) - **ssl** {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support) - **slaveOk** {Boolean, default:false}, legacy option allowing reads from secondary, use **readPrefrence** instead. - - **poolSize** {Number, default:1}, number of connections in the connection pool, set to 1 as default for legacy reasons. + - **poolSize** {Number, default:5}, number of connections in the connection pool, set to 5 as default for legacy reasons. - **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number)) - **logger** {Object, default:null}, an object representing a logger that you want to use, needs to support functions debug, log, error **({error:function(message, object) {}, log:function(message, object) {}, debug:function(message, object) {}})**. - **auto_reconnect** {Boolean, default:false}, reconnect on error. diff --git a/_sources/changelog/changelog.txt b/_sources/changelog/changelog.txt index 9e6688bd9a6..eff933c0541 100644 --- a/_sources/changelog/changelog.txt +++ b/_sources/changelog/changelog.txt @@ -2,6 +2,21 @@ Changelog ========= +1.2.3 +---------------- +- Fix for new replicaset members correctly authenticating when being added (Issue #791, https://github.com/m4tty) +- Fixed seek issue in gridstore when using stream (Issue #790) + +1.2.2 2012-12-03 +---------------- +- Fix for journal write concern not correctly being passed under some circumstances. +- Fixed correct behavior and re-auth for servers that get stepped down (Issue #779). + +1.2.1 2012-11-30 +---------------- +- Fix for double callback on insert with w:0 specified (Issue #783) +- Small cleanup of urlparser. + 1.2.0 2012-11-27 ---------------- - Honor connectTimeoutMS option for replicasets (Issue #750, https://github.com/aheckmann) diff --git a/_sources/driver-articles/mongoclient.txt b/_sources/driver-articles/mongoclient.txt index f2baaa08cbf..0393f1e9772 100644 --- a/_sources/driver-articles/mongoclient.txt +++ b/_sources/driver-articles/mongoclient.txt @@ -78,7 +78,7 @@ The URL connection format * How long a send or receive on a socket can take before timing out. * Current driver behavior already differs on this, so default must be left to each driver. For new implementations, the default should be to never timeout. - * **maxPoolSize=n:** The maximum number of connections in the connection pool * Default value is 100 + * **maxPoolSize=n:** The maximum number of connections in the connection pool * Default value is 5 diff --git a/_sources/github/github.txt b/_sources/github/github.txt index b9bd38301aa..4b845d09fb4 100644 --- a/_sources/github/github.txt +++ b/_sources/github/github.txt @@ -26,7 +26,7 @@ Web frameworks using MongoDB * - **Forks** - 2 * - **Watchers** - - 10 + - 11 .. topic:: caboose @@ -49,7 +49,7 @@ Web frameworks using MongoDB * - **Forks** - 2 * - **Watchers** - - 9 + - 10 .. topic:: node-bread @@ -60,7 +60,7 @@ Web frameworks using MongoDB :header-rows: 0 * - **Activity Level** - - .. image:: ../static/active.png + - .. image:: ../static/nonactive.png * - **Last push** - 23:50:52 on 7/7/2012 * - **Homepage** @@ -134,7 +134,7 @@ Object Document Modeling Libraries * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 0:58:5 on 29/10/2012 + - 0:22:59 on 8/11/2012 * - **Homepage** - http:// * - **Url** @@ -142,9 +142,9 @@ Object Document Modeling Libraries * - **Clone Url** - https://github.com/LearnBoost/mongoose.git * - **Forks** - - 305 + - 309 * - **Watchers** - - 2538 + - 2559 .. topic:: mongo-model @@ -229,7 +229,7 @@ Content Management Systems * - **Activity Level** - .. image:: ../static/active.png * - **Last push** - - 20:24:33 on 21/10/2012 + - 18:55:17 on 2/11/2012 * - **Homepage** - http://calip.so * - **Url** @@ -237,9 +237,9 @@ Content Management Systems * - **Clone Url** - https://github.com/cliftonc/calipso.git * - **Forks** - - 156 + - 158 * - **Watchers** - - 976 + - 982 Grid FS libraries or tools -------------------------- @@ -279,7 +279,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha :header-rows: 0 * - **Activity Level** - - .. image:: ../static/active.png + - .. image:: ../static/nonactive.png * - **Last push** - 3:50:53 on 4/7/2012 * - **Homepage** @@ -325,9 +325,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha :header-rows: 0 * - **Activity Level** - - .. image:: ../static/nonactive.png + - .. image:: ../static/active.png * - **Last push** - - 16:3:8 on 23/5/2012 + - 14:3:17 on 3/11/2012 * - **Homepage** - http:// * - **Url** @@ -335,9 +335,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/masylum/mongolia.git * - **Forks** - - 11 + - 12 * - **Watchers** - - 102 + - 101 .. topic:: mongojs @@ -358,9 +358,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/gett/mongojs.git * - **Forks** - - 32 + - 35 * - **Watchers** - - 256 + - 265 .. topic:: mongode @@ -381,9 +381,9 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/milewise/mongode.git * - **Forks** - - 4 + - 5 * - **Watchers** - - 50 + - 51 .. topic:: node-mongodb-wrapper @@ -429,7 +429,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Forks** - 0 * - **Watchers** - - 1 + - 2 .. topic:: mdoq-mongodb @@ -496,7 +496,7 @@ Wrapper libraries to ease the use of development or provide simple ODM like beha * - **Clone Url** - https://github.com/meritt/easymongo.git * - **Forks** - - 1 + - 2 * - **Watchers** - 11 @@ -524,7 +524,7 @@ REST api's around MongoDB or resource based libraries * - **Forks** - 41 * - **Watchers** - - 185 + - 184 .. topic:: lazyBum @@ -596,7 +596,7 @@ Test helpers and libraries * - **Forks** - 1 * - **Watchers** - - 4 + - 5 .. topic:: node-database-cleaner @@ -754,9 +754,9 @@ Logging libraries or applications :header-rows: 0 * - **Activity Level** - - .. image:: ../static/nonactive.png + - .. image:: ../static/active.png * - **Last push** - - 11:52:6 on 19/3/2012 + - 21:10:54 on 6/11/2012 * - **Homepage** - http://dev/null * - **Url** @@ -841,7 +841,7 @@ General frameworks over MongoDB * - **Forks** - 0 * - **Watchers** - - 25 + - 26 Translation libraries or frameworks ----------------------------------- @@ -888,7 +888,7 @@ Translation libraries or frameworks * - **Clone Url** - https://github.com/masylum/dialect.git * - **Forks** - - 19 + - 20 * - **Watchers** - 101 @@ -916,7 +916,7 @@ Libraries or Applications for analytics * - **Forks** - 209 * - **Watchers** - - 2285 + - 2306 Libraries for the connect middleware ------------------------------------ @@ -963,9 +963,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/masylum/connect-mongodb.git * - **Forks** - - 58 + - 59 * - **Watchers** - - 180 + - 182 .. topic:: connect-mongo @@ -986,9 +986,9 @@ Libraries for the connect middleware * - **Clone Url** - https://github.com/kcbanner/connect-mongo.git * - **Forks** - - 51 + - 52 * - **Watchers** - - 161 + - 162 Libraries or applications for continous integration --------------------------------------------------- @@ -1012,9 +1012,9 @@ Libraries or applications for continous integration * - **Clone Url** - https://github.com/ryankee/concrete.git * - **Forks** - - 31 + - 32 * - **Watchers** - - 223 + - 227 Exampe applications ------------------- @@ -1040,7 +1040,7 @@ Exampe applications * - **Forks** - 6 * - **Watchers** - - 21 + - 22 .. topic:: node-mongo-cms diff --git a/api-articles/index.html b/api-articles/index.html index b3b07b7d4d7..05e338656bb 100644 --- a/api-articles/index.html +++ b/api-articles/index.html @@ -8,7 +8,7 @@ - Articles — MongoDB Node.JS Driver 1.2.0 documentation + Articles — MongoDB Node.JS Driver 1.2.3 documentation @@ -16,7 +16,7 @@ - + @@ -36,7 +36,7 @@

                    Navigation

                  • | GitHub
                  • Jira
                  • -
                  • MongoDB Node.JS Driver 1.2.0 documentation (index) »
                  • +
                  • MongoDB Node.JS Driver 1.2.3 documentation (index) »
                  @@ -100,7 +100,7 @@

                  Manual

                • BSON()
                • ObjectID()
                • Binary()
                • -
                • DBRef()
                • +
                • Code()
                • Double()
                • Long()
                • Timestamp()
                • @@ -200,7 +200,7 @@

                  Search

                • PHP (wiki, docs)
                • Perl (wiki, docs)
                • Java (wiki, docs)
                • -
                • Scala (wiki, docs)
                • +
                • Scala (wiki, docs)
                • C# (wiki, docs)
                • C (wiki, docs)
                • C++ (wiki, docs)
                • @@ -235,7 +235,7 @@

                  Navigation

                @@ -422,7 +422,7 @@

                Manual

              • BSON()
              • ObjectID()
              • Binary()
              • -
              • DBRef()
              • +
              • Code()
              • Double()
              • Long()
              • Timestamp()
              • @@ -522,7 +522,7 @@

                Search

              • PHP (wiki, docs)
              • Perl (wiki, docs)
              • Java (wiki, docs)
              • -
              • Scala (wiki, docs)
              • +
              • Scala (wiki, docs)
              • C# (wiki, docs)
              • C (wiki, docs)
              • C++ (wiki, docs)
              • @@ -557,7 +557,7 @@

                Navigation

              @@ -318,7 +318,7 @@

              Manual

            • BSON()
            • ObjectID()
            • Binary()
            • -
            • DBRef()
            • +
            • Code()
            • Double()
            • Long()
            • Timestamp()
            • @@ -418,7 +418,7 @@

              Search

            • PHP (wiki, docs)
            • Perl (wiki, docs)
            • Java (wiki, docs)
            • -
            • Scala (wiki, docs)
            • +
            • Scala (wiki, docs)
            • C# (wiki, docs)
            • C (wiki, docs)
            • C++ (wiki, docs)
            • @@ -453,7 +453,7 @@

              Navigation

            @@ -252,7 +252,7 @@

            Contents

            - @@ -47,27 +47,26 @@

            Navigation

            -
            -

            DBRef()

            +
            +

            Code()

            Constructor

            -

            A class representation of the BSON DBRef type.

            +

            A class representation of the BSON Code type.

            -
            -class DBRef()
            +
            +class Code()
            - @@ -86,7 +85,7 @@

            Constructor

            Contents

            Arguments:
              -
            • namespace (string) – the collection name.
            • -
            • oid (objectid) – the reference ObjectID.
            • -
            • [db] (string) – optional db name, if omitted the reference is local to the current db.
            • +
            • code (string) – a string or function.
            • +
            • [scope] (object) – an optional scope for the function.
            Returns:

            dbref

            +
            Returns:

            code

            +++ + + + + + +
            Arguments:
              +
            • namespace (string) – the collection name.
            • +
            • oid (objectid) – the reference ObjectID.
            • +
            • [db] (string) – optional db name, if omitted the reference is local to the current db.
            • +
            +
            Returns:

            dbref

            +
            +
            + +
            +
            +
            + + +
            +
            +
            +
            +
            +

            Contents

            + + + + +
              +
            +

            Manual

            + + + + +

            MongoDB Wiki

            + + + + +
            +
            +
            + + + + + + + + + + + \ No newline at end of file diff --git a/api-bson-generated/double.html b/api-bson-generated/double.html index 5208b1a0561..181f15d1bb2 100644 --- a/api-bson-generated/double.html +++ b/api-bson-generated/double.html @@ -8,7 +8,7 @@ - Double() — MongoDB Node.JS Driver 1.2.0 documentation + Double() — MongoDB Node.JS Driver 1.2.3 documentation @@ -16,7 +16,7 @@ - + - + @@ -38,7 +38,7 @@

            Navigation

          • | GitHub
          • Jira
          • -
          • MongoDB Node.JS Driver 1.2.0 documentation (index) »
          • +
          • MongoDB Node.JS Driver 1.2.3 documentation (index) »
          @@ -110,7 +110,7 @@

          Contents

          -
        • -
        • DBRef() @@ -102,7 +102,7 @@

          Manual

        • BSON()
        • ObjectID()
        • Binary()
        • -
        • DBRef()
        • +
        • Code()
        • Double()
        • Long()
        • Timestamp()
        • @@ -202,7 +202,7 @@

          Search

        • PHP (wiki, docs)
        • Perl (wiki, docs)
        • Java (wiki, docs)
        • -
        • Scala (wiki, docs)
        • +
        • Scala (wiki, docs)
        • C# (wiki, docs)
        • C (wiki, docs)
        • C++ (wiki, docs)
        • @@ -237,7 +237,7 @@

          Navigation

        @@ -100,7 +100,7 @@

        Manual

      • BSON()
      • ObjectID()
      • Binary()
      • -
      • DBRef()
      • +
      • Code()
      • Double()
      • Long()
      • Timestamp()
      • @@ -200,7 +200,7 @@

        Search

      • PHP (wiki, docs)
      • Perl (wiki, docs)
      • Java (wiki, docs)
      • -
      • Scala (wiki, docs)
      • +
      • Scala (wiki, docs)
      • C# (wiki, docs)
      • C (wiki, docs)
      • C++ (wiki, docs)
      • @@ -235,7 +235,7 @@

        Navigation

      @@ -338,7 +338,7 @@

      Manual

    • BSON()
    • ObjectID()
    • Binary()
    • -
    • DBRef()
    • +
    • Code()
    • Double()
    • Long()
    • Timestamp()
    • @@ -438,7 +438,7 @@

      Search

    • PHP (wiki, docs)
    • Perl (wiki, docs)
    • Java (wiki, docs)
    • -
    • Scala (wiki, docs)
    • +
    • Scala (wiki, docs)
    • C# (wiki, docs)
    • C (wiki, docs)
    • C++ (wiki, docs)
    • @@ -473,7 +473,7 @@

      Navigation

    @@ -125,7 +125,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -225,7 +225,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -260,7 +260,7 @@

    Navigation

    @@ -893,7 +893,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -993,7 +993,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -1028,7 +1028,7 @@

    Navigation

    @@ -661,6 +661,8 @@

    removeUser// Remove the user adminDb.removeUser('admin', function(err, result) { + assert.equal(null, err); + assert.equal(true, result); // Authenticate using the removed user should fail adminDb.authenticate('admin', 'admin', function(err, result) { @@ -1224,7 +1226,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -1324,7 +1326,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -1359,7 +1361,7 @@

    Navigation

    @@ -3262,7 +3262,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -3362,7 +3362,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -3397,7 +3397,7 @@

    Navigation

    @@ -1097,7 +1097,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -1197,7 +1197,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -1232,7 +1232,7 @@

    Navigation

    @@ -372,7 +372,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -472,7 +472,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -507,7 +507,7 @@

    Navigation

    @@ -1335,7 +1335,7 @@

    createCollectionBSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -2770,7 +2770,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -2805,7 +2805,7 @@

    Navigation

    @@ -306,7 +306,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -406,7 +406,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -441,7 +441,7 @@

    Navigation

    @@ -65,7 +65,7 @@

    ConstructorBSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -2271,7 +2271,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -2306,7 +2306,7 @@

    Navigation

    @@ -271,7 +271,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -371,7 +371,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -406,7 +406,7 @@

    Navigation

    @@ -358,7 +358,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -458,7 +458,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -493,7 +493,7 @@

    Navigation

    @@ -123,7 +123,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -223,7 +223,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -258,7 +258,7 @@

    Navigation

    @@ -118,7 +118,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -218,7 +218,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -253,7 +253,7 @@

    Navigation

    @@ -349,7 +349,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -449,7 +449,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -484,7 +484,7 @@

    Navigation

    @@ -172,7 +172,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -272,7 +272,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -307,7 +307,7 @@

    Navigation

    @@ -76,7 +76,7 @@

    ConstructorBSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -282,7 +282,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -317,7 +317,7 @@

    Navigation

    @@ -48,7 +48,28 @@

    Navigation

    Changelog

    -

    1.2.0 2012-11-27

    +

    1.2.3

    +
      +
    • Fix for new replicaset members correctly authenticating when being added (Issue #791, https://github.com/m4tty)
    • +
    • Fixed seek issue in gridstore when using stream (Issue #790)
    • +
    +
    +
    +

    1.2.2 2012-12-03

    +
      +
    • Fix for journal write concern not correctly being passed under some circumstances.
    • +
    • Fixed correct behavior and re-auth for servers that get stepped down (Issue #779).
    • +
    +
    +
    +

    1.2.1 2012-11-30

    +
      +
    • Fix for double callback on insert with w:0 specified (Issue #783)
    • +
    • Small cleanup of urlparser.
    • +
    +
    +
    +

    1.2.0 2012-11-27

    @@ -188,7 +188,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -288,7 +288,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -323,7 +323,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -337,7 +337,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -372,7 +372,7 @@

    Navigation

    @@ -405,7 +405,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -505,7 +505,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -540,7 +540,7 @@

    Navigation

    @@ -160,7 +160,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -260,7 +260,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -295,7 +295,7 @@

    Navigation

    @@ -97,7 +97,7 @@

    Manual

  • BSON()
  • ObjectID()
  • Binary()
  • -
  • DBRef()
  • +
  • Code()
  • Double()
  • Long()
  • Timestamp()
  • @@ -197,7 +197,7 @@

    Search

  • PHP (wiki, docs)
  • Perl (wiki, docs)
  • Java (wiki, docs)
  • -
  • Scala (wiki, docs)
  • +
  • Scala (wiki, docs)
  • C# (wiki, docs)
  • C (wiki, docs)
  • C++ (wiki, docs)
  • @@ -219,7 +219,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -557,7 +557,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -403,7 +403,7 @@

    Navigation

    @@ -1012,7 +1012,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -243,7 +243,7 @@

    Navigation

    @@ -261,7 +261,7 @@

    Navigation

    @@ -357,7 +357,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -473,7 +473,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -1361,7 +1361,7 @@

    Navigation

    @@ -3397,7 +3397,7 @@

    Navigation

    @@ -1232,7 +1232,7 @@

    Navigation

    @@ -507,7 +507,7 @@

    Navigation

    @@ -2805,7 +2805,7 @@

    Navigation

    @@ -441,7 +441,7 @@

    Navigation

    @@ -2306,7 +2306,7 @@

    Navigation

    @@ -406,7 +406,7 @@

    Navigation

    @@ -493,7 +493,7 @@

    Navigation

    @@ -258,7 +258,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -484,7 +484,7 @@

    Navigation

    @@ -307,7 +307,7 @@

    Navigation

    @@ -317,7 +317,7 @@

    Navigation

    @@ -48,28 +48,34 @@

    Navigation

    Changelog

    -

    1.2.3

    +

    1.2.4 2012-12-11

    +
      +
    • Fix to ensure authentication is correctly applied across all secondaries when using MongoClient.
    • +
    +
    +
    +

    1.2.3 2012-12-10

    • Fix for new replicaset members correctly authenticating when being added (Issue #791, https://github.com/m4tty)
    • Fixed seek issue in gridstore when using stream (Issue #790)
    -
    -

    1.2.2 2012-12-03

    +
    +

    1.2.2 2012-12-03

    • Fix for journal write concern not correctly being passed under some circumstances.
    • Fixed correct behavior and re-auth for servers that get stepped down (Issue #779).
    -
    -

    1.2.1 2012-11-30

    +
    +

    1.2.1 2012-11-30

    • Fix for double callback on insert with w:0 specified (Issue #783)
    • Small cleanup of urlparser.
    -
    -

    1.2.0 2012-11-27

    +
    +

    1.2.0 2012-11-27

    @@ -540,7 +540,7 @@

    Navigation

    @@ -295,7 +295,7 @@

    Navigation

    @@ -219,7 +219,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -236,7 +236,7 @@

    And then there was CRUDvar doc2 = {mykey:2, docs:[{doc1:1}]}; collection.insert(doc2, {w:1}, function(err, result) { - collection.update({mykey:2}, {$push:{docs:{doc2:1}}, {w:1}, function(err, result) {}); + collection.update({mykey:2}, {$push:{docs:{doc2:1}}}, {w:1}, function(err, result) {}); }); }); @@ -266,7 +266,7 @@

    And then there was CRUD

    Right so this update will look for the document that has a field mykey equal to 1 and apply an update to the field fieldtoupdate setting the value to 2 . Since we are using the {safe:true} option the result parameter in the callback will return the value 1 indicating that 1 document was modified by the update statement.

    -
    collection.update({mykey:2}, {$push:{docs:{doc2:1}}, {safe:true}, function(err, result) {});
    +
    collection.update({mykey:2}, {$push:{docs:{doc2:1}}}, {safe:true}, function(err, result) {});
     
    @@ -557,7 +557,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -403,7 +403,7 @@

    Navigation

    @@ -1012,7 +1012,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -243,7 +243,7 @@

    Navigation

    @@ -261,7 +261,7 @@

    Navigation

    @@ -357,7 +357,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -473,7 +473,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -1361,7 +1361,7 @@

    Navigation

    @@ -3397,7 +3397,7 @@

    Navigation

    @@ -1232,7 +1232,7 @@

    Navigation

    @@ -331,6 +331,47 @@

    destroy}); }); }); +} + +exports.shouldStream10KDocuments = function(test) { +var docs = [] + +for(var i = 0; i < 10000; i++) { + docs.push({'a':i, bin: new Binary(new Buffer(256))}) +} + +var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 5, ssl:useSSL}), {w:0, native_parser: native_parser}); + +// Establish connection to db +db.open(function(err, db) { + db.createCollection('test_streaming_function_with_limit_for_fetching_2', function(err, collection) { + assert.ok(collection instanceof Collection); + + collection.insert(docs, {w:1}, function(err, ids) { + // Peform a find to get a cursor + var stream = collection.find({}).stream(); + var data = []; + + // For each data item + stream.on("data", function(item) { + stream.pause() + + collection.findOne({}, function(err, result) { + data.push(1); + stream.resume(); + }) + }); + + // When the stream is done + stream.on("close", function() { + assert.equal(10000, data.length); + db.close(); + test.done(); + }); + }); + }); +}); @@ -507,7 +548,7 @@

    Navigation

    @@ -2805,7 +2805,7 @@

    Navigation

    @@ -441,7 +441,7 @@

    Navigation

    @@ -2306,7 +2306,7 @@

    Navigation

    @@ -406,7 +406,7 @@

    Navigation

    @@ -493,7 +493,7 @@

    Navigation

    @@ -258,7 +258,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -484,7 +484,7 @@

    Navigation

    @@ -307,7 +307,7 @@

    Navigation

    @@ -317,7 +317,7 @@

    Navigation

    @@ -48,34 +48,50 @@

    Navigation

    Changelog

    -

    1.2.4 2012-12-11

    +

    1.2.6 2012-12-21

      -
    • Fix to ensure authentication is correctly applied across all secondaries when using MongoClient.
    • +
    • domain sockets shouldn’t require a port arg (Issue #815, https://github.com/aheckmann)
    • +
    • Cannot read property ‘info’ of null (Issue #809, https://github.com/thesmart)
    • +
    • Cursor.each should work in batches (Issue #804, https://github.com/Swatinem)
    • +
    • Cursor readPreference bug for non-supported read prefrences (Issue #817)
    -

    1.2.3 2012-12-10

    +

    1.2.5 2012-12-12

    +
      +
    • Fixed ssl regression, added more test coverage (Issue #800)
    • +
    • Added better error reporting to the Db.connect if no valid serverConfig setup found (Issue #798)
    • +
    +
    +
    +

    1.2.4 2012-12-11

    +
      +
    • Fix to ensure authentication is correctly applied across all secondaries when using MongoClient.
    • +
    +
    +
    +

    1.2.3 2012-12-10

    • Fix for new replicaset members correctly authenticating when being added (Issue #791, https://github.com/m4tty)
    • Fixed seek issue in gridstore when using stream (Issue #790)
    -
    -

    1.2.2 2012-12-03

    +
    +

    1.2.2 2012-12-03

    • Fix for journal write concern not correctly being passed under some circumstances.
    • Fixed correct behavior and re-auth for servers that get stepped down (Issue #779).
    -
    -

    1.2.1 2012-11-30

    +
    +

    1.2.1 2012-11-30

    • Fix for double callback on insert with w:0 specified (Issue #783)
    • Small cleanup of urlparser.
    -
    -

    1.2.0 2012-11-27

    +
    +

    1.2.0 2012-11-27

    @@ -540,7 +540,7 @@

    Navigation

    @@ -295,7 +295,7 @@

    Navigation

    @@ -219,7 +219,7 @@

    Navigation

    @@ -235,11 +235,11 @@

    Navigation

    @@ -557,11 +557,11 @@

    Navigation

    @@ -453,11 +453,11 @@

    Navigation

    @@ -403,11 +403,11 @@

    Navigation

    @@ -1012,11 +1012,11 @@

    Navigation

    @@ -244,11 +244,11 @@

    Navigation

    @@ -243,11 +243,11 @@

    Navigation

    @@ -261,11 +261,11 @@

    Navigation

    @@ -357,11 +357,11 @@

    Navigation

    @@ -1028,11 +1028,11 @@

    Navigation

    @@ -237,11 +237,11 @@

    Navigation

    @@ -235,11 +235,11 @@

    Navigation

    @@ -473,11 +473,11 @@

    Navigation

    @@ -260,11 +260,11 @@

    Navigation

    @@ -1028,11 +1028,11 @@

    Navigation

    @@ -1361,11 +1361,11 @@

    Navigation

    @@ -3397,11 +3397,11 @@

    Navigation

    @@ -1232,11 +1232,11 @@

    Navigation

    @@ -548,11 +548,11 @@

    Navigation

    @@ -2805,11 +2805,11 @@

    Navigation

    @@ -441,11 +441,11 @@

    Navigation

    @@ -2306,11 +2306,11 @@

    Navigation

    @@ -406,11 +406,11 @@

    Navigation

    @@ -493,11 +493,11 @@

    Navigation

    @@ -258,11 +258,11 @@

    Navigation

    @@ -253,11 +253,11 @@

    Navigation

    @@ -484,11 +484,11 @@

    Navigation

    @@ -307,11 +307,11 @@

    Navigation

    @@ -317,11 +317,11 @@

    Navigation

    @@ -48,50 +48,57 @@

    Navigation

    Changelog

    -

    1.2.6 2012-12-21

    +

    1.2.7 2012-12-23

    +
      +
    • Rolled back batches as they hang in certain situations
    • +
    • Fixes for NODE-25, keep reading from secondaries when primary goes down
    • +
    +
    +
    +

    1.2.6 2012-12-21

    -
    -

    1.2.5 2012-12-12

    +
    +

    1.2.5 2012-12-12

    • Fixed ssl regression, added more test coverage (Issue #800)
    • Added better error reporting to the Db.connect if no valid serverConfig setup found (Issue #798)
    -
    -

    1.2.4 2012-12-11

    +
    +

    1.2.4 2012-12-11

    • Fix to ensure authentication is correctly applied across all secondaries when using MongoClient.
    -
    -

    1.2.3 2012-12-10

    +
    +

    1.2.3 2012-12-10

    • Fix for new replicaset members correctly authenticating when being added (Issue #791, https://github.com/m4tty)
    • Fixed seek issue in gridstore when using stream (Issue #790)
    -
    -

    1.2.2 2012-12-03

    +
    +

    1.2.2 2012-12-03

    • Fix for journal write concern not correctly being passed under some circumstances.
    • Fixed correct behavior and re-auth for servers that get stepped down (Issue #779).
    -
    -

    1.2.1 2012-11-30

    +
    +

    1.2.1 2012-11-30

    • Fix for double callback on insert with w:0 specified (Issue #783)
    • Small cleanup of urlparser.
    -
    -

    1.2.0 2012-11-27

    +
    +

    1.2.0 2012-11-27

    @@ -540,11 +540,11 @@

    Navigation

    @@ -295,11 +295,11 @@

    Navigation

    @@ -219,11 +219,11 @@

    Navigation

    @@ -235,11 +235,11 @@

    Navigation

    @@ -147,11 +147,11 @@

    Mongo DB and Collections @@ -196,7 +196,7 @@

    And then there was CRUD

    A couple of variations on the theme of inserting a document as we can see. To understand why it’s important to understand how Mongo DB works during inserts of documents.

    -

    Mongo DB has asynchronous insert/update/remove operations. This means that when you issue an insert operation its a fire and forget operation where the database does not reply with the status of the insert operation. To retrieve the status of the operation you have to issue a query to retrieve the last error status of the connection. To make it simpler to the developer the driver implements the {safe:true} options so that this is done automatically when inserting the document. {safe:true} becomes especially important when you do update or remove as otherwise it’s not possible to determine the amount of documents modified or removed.

    +

    Mongo DB has asynchronous insert/update/remove operations. This means that when you issue an insert operation its a fire and forget operation where the database does not reply with the status of the insert operation. To retrieve the status of the operation you have to issue a query to retrieve the last error status of the connection. To make it simpler to the developer the driver implements the {w:1} options so that this is done automatically when inserting the document. {w:1} becomes especially important when you do update or remove as otherwise it’s not possible to determine the amount of documents modified or removed.

    Now let’s go through the different types of inserts shown in the code above.

    Taking advantage of the async behavior and not needing confirmation about the persisting of the data to Mongo DB we just fire off the insert (we are doing live analytics, loosing a couple of records does not matter).

    -
    collection.insert(doc2, {safe:true}, function(err, result) {});
    +
    collection.insert(doc2, {w:1}, function(err, result) {});
     
    -

    That document needs to stick. Using the {safe:true} option ensure you get the error back if the document fails to insert correctly.

    +

    That document needs to stick. Using the {w:1} option ensure you get the error back if the document fails to insert correctly.

    -
    collection.insert(lotsOfDocs, {safe:true}, function(err, result) {});
    +
    collection.insert(lotsOfDocs, {w:1}, function(err, result) {});
     
    @@ -260,13 +260,13 @@

    And then there was CRUD

    Now that the operations are outline let’s dig into the specific cases show in the code example.

    -
    collection.update({mykey:1}, {$set:{fieldtoupdate:2}}, {safe:true}, function(err, result) {});
    +
    collection.update({mykey:1}, {$set:{fieldtoupdate:2}}, {w:1}, function(err, result) {});
     
    -

    Right so this update will look for the document that has a field mykey equal to 1 and apply an update to the field fieldtoupdate setting the value to 2 . Since we are using the {safe:true} option the result parameter in the callback will return the value 1 indicating that 1 document was modified by the update statement.

    +

    Right so this update will look for the document that has a field mykey equal to 1 and apply an update to the field fieldtoupdate setting the value to 2 . Since we are using the {w:1} option the result parameter in the callback will return the value 1 indicating that 1 document was modified by the update statement.

    -
    collection.update({mykey:2}, {$push:{docs:{doc2:1}}}, {safe:true}, function(err, result) {});
    +
    collection.update({mykey:2}, {$push:{docs:{doc2:1}}}, {w:1}, function(err, result) {});
     
    @@ -304,11 +304,11 @@

    And then there was CRUD

    This leverages the fact that Mongo DB is asynchronous and that it does not return a result for insert/update/remove to allow for synchronous style execution. This particular remove query will remove the document where mykey equals 1 .

    -
    collection.remove({mykey:2}, {safe:true}, function(err, result) {});
    +
    collection.remove({mykey:2}, {w:1}, function(err, result) {});
     
    -

    This remove statement removes the document where mykey equals 2 but since we are using {safe:true} it will back to Mongo DB to get the status of the remove operation and return the number of documents removed in the result variable.

    +

    This remove statement removes the document where mykey equals 2 but since we are using {w:1} it will back to Mongo DB to get the status of the remove operation and return the number of documents removed in the result variable.

    collection.remove();
     
    @@ -337,7 +337,7 @@

    Time to Querycollection.find().toArray(function(err, items) {}); - var stream = collection.find({mykey:{$ne:2}}).streamRecords(); + var stream = collection.find({mykey:{$ne:2}}).stream(); stream.on("data", function(item) {}); stream.on("end", function() {}); @@ -356,7 +356,7 @@

    Time to Query
    var stream = collection.find({mykey:{$ne:2}}).streamRecords();
    +
           
     
    @@ -453,11 +453,11 @@ 

    Navigation

    @@ -403,11 +403,11 @@

    Navigation

    @@ -1012,11 +1012,11 @@

    Navigation

    @@ -244,11 +244,11 @@

    Navigation

    @@ -243,11 +243,11 @@

    Navigation

    @@ -261,11 +261,11 @@

    Navigation

    @@ -357,11 +357,11 @@

    Navigation

    @@ -1028,11 +1028,11 @@

    Navigation

    @@ -237,11 +237,11 @@

    Navigation

    @@ -235,11 +235,11 @@

    Navigation

    @@ -473,11 +473,11 @@

    Navigation

    @@ -260,11 +260,11 @@

    Navigation

    @@ -1028,11 +1028,11 @@

    Navigation

    @@ -1361,11 +1361,11 @@

    Navigation

    @@ -2288,7 +2288,7 @@

    mapReduce// Map function var map = function(){ - emit(test(this.timestamp.getYear()), 1); + emit(fn(this.timestamp.getYear()), 1); } // Reduce function @@ -2304,14 +2304,32 @@

    mapReducevar t = function(val){ return val+1; } // Execute the map reduce with the custom scope - collection.mapReduce(map, reduce, {scope:{test:new Code(t.toString())} - , out: {replace:'replacethiscollection'}}, function(err, collection) { + var o = {}; + o.scope = { fn: new Code(t.toString()) } + o.out = { replace: 'replacethiscollection' } + + collection.mapReduce(map, reduce, o, function(err, outCollection) { + assert.equal(null, err); // Find all entries in the map-reduce collection - collection.find().toArray(function(err, results) { + outCollection.find().toArray(function(err, results) { + assert.equal(null, err); assert.equal(2, results[0].value) - db.close(); + // mapReduce with scope containing plain function + var o = {}; + o.scope = { fn: t } + o.out = { replace: 'replacethiscollection' } + + collection.mapReduce(map, reduce, o, function(err, outCollection) { + assert.equal(null, err); + + // Find all entries in the map-reduce collection + outCollection.find().toArray(function(err, results) { + assert.equal(2, results[0].value) + db.close(); + }); + }); }); }); }); @@ -3397,11 +3415,11 @@

    Navigation

    @@ -134,6 +134,10 @@

    ConstantsCursor.GET_MORE +3 +Cursor performing a get more + @@ -1232,11 +1236,11 @@

    Navigation

    @@ -372,6 +372,48 @@

    destroy}); }); }); +} + +exports.shouldTriggerMassiveAmountOfGetMores = function(test) { +var docs = [] +var counter = 0; +var counter2 = 0; + +for(var i = 0; i < 1000; i++) { + docs.push({'a':i, bin: new Binary(new Buffer(256))}) +} + +var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 5, ssl:useSSL}), {w:0, native_parser: native_parser}); + +// Establish connection to db +db.open(function(err, db) { + db.createCollection('test_streaming_function_with_limit_for_fetching_3', function(err, collection) { + assert.ok(collection instanceof Collection); + + collection.insert(docs, {w:1}, function(err, ids) { + // Peform a find to get a cursor + var stream = collection.find({}).stream(); + var data = []; + + // For each data item + stream.on("data", function(item) { + counter++; + stream.pause() + stream.resume(); + counter2++; + }); + + // When the stream is done + stream.on("close", function() { + assert.equal(1000, counter); + assert.equal(1000, counter2); + db.close(); + test.done(); + }); + }); + }); +});

    @@ -548,11 +590,11 @@

    Navigation

    @@ -2805,11 +2805,11 @@

    Navigation

    @@ -78,6 +78,17 @@

    Constructor

    put

    Puts binary data to the grid

    +
    +
    Options
    +
      +
    • _id {Any}, unique id for this file
    • +
    • root {String}, root collection to use. Defaults to {GridStore.DEFAULT_ROOT_COLLECTION}.
    • +
    • content_type {String}, mime type of the file. Defaults to {GridStore.DEFAULT_CONTENT_TYPE}.
    • +
    • chunk_size {Number}, size for the chunk. Defaults to {Chunk.DEFAULT_CHUNK_SIZE}.
    • +
    • metadata {Object}, arbitrary data the user wants to store.
    • +
    +
    +
    put(data[, options], callback)
    @@ -134,6 +145,76 @@

    put}); +

    A simple example showing the usage of the put method.

    +
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +  // Create a new grid instance
    +  var grid = new Grid(db, 'fs');
    +  // Some data to write
    +  var originalData = new Buffer('Hello world');
    +  // Write data to grid
    +  var id = 123;
    +  grid.put(originalData, {_id: id}, function(err, result) {
    +    // Fetch the content
    +    grid.get(id, function(err, data) {
    +      assert.deepEqual(originalData.toString('base64'), data.toString('base64'));
    +
    +      db.close();
    +    });
    +  });
    +});
    +
    +
    +

    A simple example showing the usage of the put method.

    +
    var Db = require('mongodb').Db,
    +    MongoClient = require('mongodb').MongoClient,
    +    Server = require('mongodb').Server,
    +    ReplSetServers = require('mongodb').ReplSetServers,
    +    ObjectID = require('mongodb').ObjectID,
    +    Binary = require('mongodb').Binary,
    +    GridStore = require('mongodb').GridStore,
    +    Code = require('mongodb').Code,
    +    BSON = require('mongodb').pure().BSON,
    +    assert = require('assert');
    +
    +var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
    + {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false});
    +
    +// Establish connection to db
    +db.open(function(err, db) {
    +  // Create a new grid instance
    +  var grid = new Grid(db, 'fs');
    +  // Some data to write
    +  var originalData = new Buffer('Hello world');
    +  // Write data to grid
    +  var id = 'test';
    +  grid.put(originalData, {_id: id}, function(err, result) {
    +    assert.equal(result._id, id);
    +
    +    // Fetch the content
    +    grid.get(id, function(err, data) {
    +      assert.deepEqual(originalData.toString('base64'), data.toString('base64'));
    +
    +      db.close();
    +    });
    +  });
    +});
    +
    +
    @@ -62,8 +62,8 @@

    Constructor Arguments:
    • db (db) – A database instance to interact with.
    • -
    • id (objectid) – an unique ObjectID for this file
    • -
    • [filename] (string) – optional a filename for this file, no unique constrain on the field
    • +
    • [id] (any) – optional unique id for this file
    • +
    • [filename] (string) – optional filename for this file, no unique constrain on the field
    • mode (string) – set the mode for this file.
    • options (object) – optional properties to specify.
    @@ -2306,11 +2306,11 @@

    Navigation

    @@ -406,11 +406,11 @@

    Navigation

    @@ -493,11 +493,11 @@

    Navigation

    @@ -258,11 +258,11 @@

    Navigation

    @@ -253,11 +253,11 @@

    Navigation

    @@ -484,11 +484,11 @@

    Navigation

    @@ -307,11 +307,11 @@

    Navigation

    @@ -317,11 +317,11 @@

    Navigation

    @@ -48,14 +48,27 @@

    Navigation

    Changelog

    -

    1.2.7 2012-12-23

    +

    1.2.8 2013-01-07

    +
      +
    • Accept function in a Map Reduce scope object not only a function string (Issue #826, https://github.com/aheckmann)
    • +
    • Typo in db.authenticate caused a check (for provided connection) to return false, causing a connection AND onAll=true to be passed into __executeQueryCommand downstream (Issue #831, https://github.com/m4tty)
    • +
    • Allow gridfs objects to use non ObjectID ids (Issue #825, https://github.com/nailgun)
    • +
    • Removed the double wrap, by not passing an Error object to the wrap function (Issue #832, https://github.com/m4tty)
    • +
    • Fix connection leak (gh-827) for HA replicaset health checks (Issue #833, https://github.com/aheckmann)
    • +
    • Modified findOne to use nextObject instead of toArray avoiding a nextTick operation (Issue #836)
    • +
    • Fixes for cursor stream to avoid multiple getmore issues when one in progress (Issue #818)
    • +
    • Fixes .open replaying all backed up commands correctly if called after operations performed, (Issue #829 and #823)
    • +
    +
    +
    +

    1.2.7 2012-12-23

    • Rolled back batches as they hang in certain situations
    • Fixes for NODE-25, keep reading from secondaries when primary goes down
    -
    -

    1.2.6 2012-12-21

    +
    +

    1.2.6 2012-12-21

    @@ -540,11 +540,11 @@

    Navigation

    @@ -295,11 +295,11 @@

    Navigation

    @@ -219,11 +219,11 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -557,7 +557,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -403,7 +403,7 @@

    Navigation

    @@ -1012,7 +1012,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -243,7 +243,7 @@

    Navigation

    @@ -261,7 +261,7 @@

    Navigation

    @@ -357,7 +357,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -473,7 +473,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -1361,7 +1361,7 @@

    Navigation

    @@ -1502,6 +1502,26 @@

    find}); }); }); +} + +exports.shouldReturnInstanceofErrorWithBadFieldSelection = function(test) { +var db = new Db('integration_tests', new Server("127.0.0.1", 27017, + {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {w:0, native_parser: native_parser}); + +db.open(function(err, db) { + assert.equal(null, err); + + var col = db.collection('bad_field_selection'); + col.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {w:1}, function(err, result) { + assert.equal(null, err); + + col.find({}, {skip:1, limit:1, fields:{_id:1,b:0}}).toArray(function(err, docs) { + assert.ok(err instanceof Error); + db.close(); + test.done(); + }); + }); +}); @@ -3415,7 +3435,7 @@

    Navigation

    @@ -1236,7 +1236,7 @@

    Navigation

    @@ -590,7 +590,7 @@

    Navigation

    @@ -2805,7 +2805,7 @@

    Navigation

    @@ -522,7 +522,7 @@

    Navigation

    @@ -2306,7 +2306,7 @@

    Navigation

    @@ -406,7 +406,7 @@

    Navigation

    @@ -493,7 +493,7 @@

    Navigation

    @@ -258,7 +258,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -484,7 +484,7 @@

    Navigation

    @@ -307,7 +307,7 @@

    Navigation

    @@ -317,7 +317,7 @@

    Navigation

    @@ -48,7 +48,18 @@

    Navigation

    Changelog

    -

    1.2.8 2013-01-07

    +

    1.2.9 2013-01-15

    +
      +
    • Fixed bug in SSL support for MongoClient/Db.connect when discovering servers (Issue #849)
    • +
    • Connection string with no db specified should default to admin db (Issue #848)
    • +
    • Support port passed as string to Server class (Issue #844)
    • +
    • Removed noOpen support for MongoClient/Db.connect as auto discovery of servers for Mongod/Mongos makes it not possible (Issue #842)
    • +
    • Included toError wrapper code moved to utils.js file (Issue #839, #840)
    • +
    • Rewrote cursor handling to avoid process.nextTick using trampoline instead to avoid stack overflow, speedup about 40%
    • +
    +
    +
    +

    1.2.8 2013-01-07

    @@ -219,7 +219,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -48,16 +48,16 @@

    Navigation

    A Basic introduction to Mongo DB

    -

    Mongo DB has rapidly grown to become a popular database for web applications and is a perfect fit for Node.JS applications, letting you write Javascript for the client, backend and database layer. It’s schemaless nature is a better match to our constantly evolving data structures in web applications and the integrated support for location queries a bonus that it’s hard to ignore. Throw Replicasets for scaling and we are looking at really nice platform to grow your storage needs now and in the future.

    -

    Now to shamelessly plug my driver. It can be downloaded either using npm or fetched from the github repository. To install via npm do the following.

    +

    Mongo DB has rapidly grown to become a popular database for web applications and is a perfect fit for Node.JS applications, letting you write Javascript for the client, backend and database layer. Its schemaless nature is a better match to our constantly evolving data structures in web applications, and the integrated support for location queries is a bonus that’s hard to ignore. Throw in Replica Sets for scaling, and we’re looking at really nice platform to grow your storage needs now and in the future.

    +

    Now to shamelessly plug my driver. It can be downloaded via npm, or fetched from the github repository. To install via npm, do the following:

    npm install mongodb

    or go fetch it from github at https://github.com/christkv/node-mongodb-native

    -

    Once this business is taken care of let’s move through the types available for the driver and then how to connect to your Mongo DB instance before facing the usage of some crud operations.

    +

    Once this business is taken care of, let’s move through the types available for the driver and then how to connect to your Mongo DB instance before facing the usage of some CRUD operations.

    Mongo DB data types

    -

    So there is an important thing to keep in mind when working with Mongo DB and that is that there is a slight mapping difference between the types supported in Mongo DB and what is native types in Javascript. Let’s have a look at the types supported out of the box and then how types are promoted by the driver to try to fit as close to the native Javascript types as possible.

    +

    So there is an important thing to keep in mind when working with Mongo DB, and that is the slight mapping difference between types Mongo DB supports and native Javascript data types. Let’s have a look at the types supported out of the box and then how types are promoted by the driver to fit as close to native Javascript types as possible.

    @@ -453,7 +453,7 @@

    Navigation

    @@ -403,7 +403,7 @@

    Navigation

    @@ -1012,7 +1012,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -243,7 +243,7 @@

    Navigation

    @@ -261,7 +261,7 @@

    Navigation

    @@ -357,7 +357,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -473,7 +473,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -1361,7 +1361,7 @@

    Navigation

    @@ -3435,7 +3435,7 @@

    Navigation

    @@ -1236,7 +1236,7 @@

    Navigation

    @@ -590,7 +590,7 @@

    Navigation

    @@ -2548,7 +2548,7 @@

    stats

    Db.connect

    Connect to MongoDB using a url as documented at

    -

    www.mongodb.org/display/DOCS/Connections

    +

    docs.mongodb.org/manual/reference/connection-string/

    Options
    @@ -522,7 +522,7 @@

    Navigation

    @@ -2306,7 +2306,7 @@

    Navigation

    @@ -406,7 +406,7 @@

    Navigation

    @@ -208,7 +208,7 @@

    db

    MongoClient.connect

    Connect to MongoDB using a url as documented at

    -

    www.mongodb.org/display/DOCS/Connections

    +

    docs.mongodb.org/manual/reference/connection-string/

    Options
    @@ -258,7 +258,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -484,7 +484,7 @@

    Navigation

    @@ -83,6 +83,12 @@

    Constructor| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.2.9 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.2.10 documentation (index) »
  • @@ -75,6 +75,11 @@

    Constructor
  • readPreference {String, default:null}, set’s the read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST)
  • ssl {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support)
  • +
  • ssl_validate {Boolean, default:false}, validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • ssl_ca {Array, default:null}, Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • ssl_cert {Buffer/String, default:null}, String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • ssl_key {Buffer/String, default:null}, String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • ssl_pass {Buffer/String, default:null}, String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)
  • slaveOk {Boolean, default:false}, legacy option allowing reads from secondary, use readPrefrence instead.
  • poolSize {Number, default:5}, number of connections in the connection pool, set to 5 as default for legacy reasons.
  • socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
  • @@ -317,7 +322,7 @@

    Navigation

    @@ -1254,7 +1254,7 @@

    Navigation

    @@ -223,7 +223,7 @@

    Navigation

    @@ -343,7 +343,7 @@

    Navigation

    @@ -242,7 +242,7 @@

    Navigation

    @@ -515,7 +515,7 @@

    Navigation

    @@ -545,7 +545,7 @@

    Navigation

    @@ -241,7 +241,7 @@

    Navigation

    @@ -516,7 +516,7 @@

    Navigation

    @@ -194,7 +194,7 @@

    C

    -
    close() (built-in function), [1], [2], [3] +
    close() (built-in function), [1], [2], [3]
    @@ -236,7 +236,7 @@

    C

    -
    count() (built-in function), [1] +
    count() (built-in function), [1]
    @@ -266,7 +266,7 @@

    D

    - +
    -
    db() (built-in function), [1] +
    db() (built-in function), [1]
    @@ -356,7 +356,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -668,7 +668,7 @@

    O

    -
    open() (built-in function), [1], [2] +
    open() (built-in function), [1], [2]
    @@ -708,7 +708,7 @@

    P

    -
    put() (built-in function), [1] +
    put() (built-in function), [1]
    @@ -1142,7 +1142,7 @@

    Navigation

    @@ -115,7 +115,7 @@

    Web frameworks using MongoDB

    Watchers1516
    @@ -247,7 +247,7 @@

    Object Document Modeling LibrariesLast push -22:56:33 on 14/0/2013 +18:19:26 on 23/0/2013 Homepage http:// @@ -259,10 +259,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git Forks -345 +352 Watchers -2671 +2701 @@ -394,7 +394,7 @@

    Content Management SystemsLast push -22:5:5 on 6/0/2013 +3:51:41 on 25/0/2013 Homepage http://calip.so @@ -406,10 +406,10 @@

    Content Management Systemshttps://github.com/cliftonc/calipso.git Forks -168 +171 Watchers -1006 +1014 @@ -523,7 +523,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 2 Watchers -52 +53 @@ -595,7 +595,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 37 Watchers -279 +285 @@ -631,7 +631,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 7 Watchers -53 +54 @@ -652,7 +652,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -22:13:6 on 14/0/2013 +19:38:37 on 24/0/2013 Homepage http://http://i.tv @@ -674,42 +674,6 @@

    Wrapper libraries to ease the use of development or provide simple ODM like
    -

    mongodb-async

    -

    Thin & clean async wrapper for mongodb

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - -
    Activity Level../_images/active.png -
    Last push17:10:34 on 26/9/2012
    Homepagehttp://
    Urlhttps://github.com/zir/mongodb-async
    Clone Urlhttps://github.com/zir/mongodb-async.git
    Forks0
    Watchers2
    -
    -
    -

    mdoq-mongodb

    simplified mongodb-native api w/ middleware

    @@ -847,10 +811,10 @@

    REST api’s around MongoDB or resource based librarieshttps://github.com/tdegrunt/mongodb-rest.git Forks -44 +45 Watchers -192 +197 @@ -997,7 +961,7 @@

    Test helpers and librariesWatchers -34 +35 @@ -1017,11 +981,11 @@

    Tools or applications to manage your MongoDB’s Activity Level -../_images/nonactive.png +../_images/active.png Last push -11:26:34 on 18/0/2012 +23:52:49 on 20/0/2013 Homepage http:// @@ -1447,10 +1411,10 @@

    Libraries or Applications for analyticshttps://github.com/square/cube.git Forks -217 +220 Watchers -2363 +2377 @@ -1506,11 +1470,11 @@

    Libraries for the connect middleware Activity Level -../_images/nonactive.png +../_images/active.png Last push -17:45:52 on 12/7/2012 +17:52:14 on 21/0/2013 Homepage http:// @@ -1522,10 +1486,10 @@

    Libraries for the connect middlewarehttps://github.com/masylum/connect-mongodb.git Forks -59 +60 Watchers -184 +183 @@ -1546,7 +1510,7 @@

    Libraries for the connect middlewareLast push -0:43:24 on 19/11/2012 +15:2:26 on 21/0/2013 Homepage http://http://kcbanner.github.com/connect-mongo/ @@ -1558,10 +1522,10 @@

    Libraries for the connect middlewarehttps://github.com/kcbanner/connect-mongo.git Forks -58 +60 Watchers -182 +191 @@ -1600,7 +1564,7 @@

    Libraries or applications for continous integration33 Watchers -236 +237 @@ -1867,7 +1831,7 @@

    Navigation

    @@ -433,7 +433,7 @@

    Navigation

    @@ -391,7 +391,7 @@

    Navigation

    @@ -417,7 +417,7 @@

    Navigation

    @@ -413,7 +413,7 @@

    Navigation

    @@ -220,7 +220,7 @@

    Navigation

    @@ -323,7 +323,7 @@

    Navigation

    @@ -372,7 +372,7 @@

    Navigation

    @@ -540,7 +540,7 @@

    Navigation

    @@ -295,7 +295,7 @@

    Navigation

    @@ -219,7 +219,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -557,7 +557,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -403,7 +403,7 @@

    Navigation

    @@ -1012,7 +1012,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -243,7 +243,7 @@

    Navigation

    @@ -261,7 +261,7 @@

    Navigation

    @@ -357,7 +357,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -473,7 +473,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -1361,7 +1361,7 @@

    Navigation

    @@ -3435,7 +3435,7 @@

    Navigation

    @@ -1236,7 +1236,7 @@

    Navigation

    @@ -590,7 +590,7 @@

    Navigation

    @@ -990,18 +990,24 @@

    dereferencedb.open(function(err, db) { assert.equal(null, err); + // console.dir(db.serverConfig._Db) + // Get a second db var secondDb = db.db('integration_tests_2'); + // console.dir(secondDb.serverConfig._Db) + + // console.dir("================================= deref 0") // Create a dereference example secondDb.createCollection('test_deref_examples', function(err, collection) { + // console.dir("================================= deref 1") // Insert a document in the collection collection.insert({'a':1}, {w:1}, function(err, ids) { // Let's build a db reference and resolve it var dbRef = new DBRef('test_deref_examples', ids[0]._id, 'integration_tests_2'); - + // console.dir("================================= deref") // Resolve it including a db resolve db.dereference(dbRef, function(err, item) { assert.equal(1, item.a); @@ -2805,7 +2811,7 @@

    Navigation

    @@ -522,7 +522,7 @@

    Navigation

    @@ -2306,7 +2306,7 @@

    Navigation

    @@ -406,7 +406,7 @@

    Navigation

    @@ -493,7 +493,7 @@

    Navigation

    @@ -258,7 +258,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -484,7 +484,7 @@

    Navigation

    @@ -84,11 +84,11 @@

    Constructor| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.2.10 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.2.11 documentation (index) »
  • @@ -75,11 +75,11 @@

    Constructor
  • readPreference {String, default:null}, set’s the read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST)
  • ssl {Boolean, default:false}, use ssl connection (needs to have a mongod server with ssl support)
  • -
  • ssl_validate {Boolean, default:false}, validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
  • -
  • ssl_ca {Array, default:null}, Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
  • -
  • ssl_cert {Buffer/String, default:null}, String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
  • -
  • ssl_key {Buffer/String, default:null}, String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
  • -
  • ssl_pass {Buffer/String, default:null}, String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • sslValidate {Boolean, default:false}, validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • sslCA {Array, default:null}, Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • sslCert {Buffer/String, default:null}, String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • sslKey {Buffer/String, default:null}, String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
  • +
  • sslPass {Buffer/String, default:null}, String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)
  • slaveOk {Boolean, default:false}, legacy option allowing reads from secondary, use readPrefrence instead.
  • poolSize {Number, default:5}, number of connections in the connection pool, set to 5 as default for legacy reasons.
  • socketOptions {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
  • @@ -322,7 +322,7 @@

    Navigation

    @@ -48,7 +48,23 @@

    Navigation

    Changelog

    -

    1.2.9 2013-01-15

    +

    1.2.11 2013-01-29

    +
      +
    • Added fixes for handling type 2 binary due to PHP driver (Issue #864)
    • +
    • Moved callBackStore to Base class to have single unified store (Issue #866)
    • +
    • Ping strategy now reuses sockets unless they are closed by the server to avoid overhead
    • +
    +
    +
    +

    1.2.10 2013-01-25

    +
      +
    • Merged in SSL support for 2.4 supporting certificate validation and presenting certificates to the server.
    • +
    • Only open a new HA socket when previous one dead (Issue #859, #857)
    • +
    • Minor fixes
    • +
    +
    +
    +

    1.2.9 2013-01-15

    @@ -219,7 +219,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -557,7 +557,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -403,7 +403,7 @@

    Navigation

    @@ -1012,7 +1012,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -243,7 +243,7 @@

    Navigation

    @@ -261,7 +261,7 @@

    Navigation

    @@ -357,7 +357,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -473,7 +473,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -1361,7 +1361,7 @@

    Navigation

    @@ -51,7 +51,7 @@

    Navigation

    Collection()

    @@ -53,7 +53,7 @@

    Cursor()

    Constructor for a cursor object that handles all the operations on query result using find. This cursor object is unidirectional and cannot traverse backwards. Clients should not be creating a cursor directly, -but use find to acquire a cursor.

    +but use find to acquire a cursor. (INTERNAL TYPE)

    @@ -365,12 +365,13 @@

    count

    Determines how many result the query for this cursor will return

    -count(callback)
    +count(applySkipLimit, callback)

    @@ -1236,7 +1237,7 @@

    Navigation

    @@ -590,7 +590,7 @@

    Navigation

    @@ -2811,7 +2811,7 @@

    Navigation

    @@ -522,7 +522,7 @@

    Navigation

    @@ -2306,7 +2306,7 @@

    Navigation

    @@ -406,7 +406,7 @@

    Navigation

    @@ -493,7 +493,7 @@

    Navigation

    @@ -258,7 +258,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -484,7 +484,7 @@

    Navigation

    @@ -79,7 +79,7 @@

    Constructor| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.2.11 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.2.12 documentation (index) »
  • @@ -322,7 +322,7 @@

    Navigation

    @@ -48,23 +48,32 @@

    Navigation

    Changelog

    -

    1.2.11 2013-01-29

    +

    1.2.12 2013-02-13

    +
      +
    • Added limit/skip options to Collection.count (Issue #870)
    • +
    • Added applySkipLimit option to Cursor.count (Issue #870)
    • +
    • Enabled ping strategy as default for Replicaset if none specified (Issue #876)
    • +
    • Should correctly pick nearest server for SECONDARY/SECONDARY_PREFERRED/NEAREST (Issue #878)
    • +
    +
    +
    +

    1.2.11 2013-01-29

    • Added fixes for handling type 2 binary due to PHP driver (Issue #864)
    • Moved callBackStore to Base class to have single unified store (Issue #866)
    • Ping strategy now reuses sockets unless they are closed by the server to avoid overhead
    -
    -

    1.2.10 2013-01-25

    +
    +

    1.2.10 2013-01-25

    • Merged in SSL support for 2.4 supporting certificate validation and presenting certificates to the server.
    • Only open a new HA socket when previous one dead (Issue #859, #857)
    • Minor fixes
    -
    -

    1.2.9 2013-01-15

    +
    +

    1.2.9 2013-01-15

    Arguments:
      +
    • applySkipLimit (boolean) – if set to true will apply the skip and limits set on the cursor. Defaults to false.
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the number of results or null if an error occured.
    - +
    -
    db() (built-in function), [1] +
    db() (built-in function), [1]
    @@ -356,7 +356,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -668,7 +668,7 @@

    O

    -
    open() (built-in function), [1], [2] +
    open() (built-in function), [1], [2]
    @@ -708,7 +708,7 @@

    P

    -
    put() (built-in function), [1] +
    put() (built-in function), [1]
    @@ -1142,7 +1142,7 @@

    Navigation

    @@ -79,7 +79,7 @@

    Web frameworks using MongoDB

    Watchers1416
    @@ -115,7 +115,7 @@

    Web frameworks using MongoDBWatchers -16 +17 @@ -247,7 +247,7 @@

    Object Document Modeling LibrariesLast push -22:52:32 on 28/0/2013 +6:1:20 on 12/1/2013 Homepage http:// @@ -259,10 +259,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git Forks -355 +366 Watchers -2715 +2770 @@ -298,7 +298,7 @@

    Object Document Modeling LibrariesWatchers -51 +53 @@ -373,7 +373,7 @@

    Content Management SystemsWatchers -3 +4 @@ -406,10 +406,10 @@

    Content Management Systemshttps://github.com/cliftonc/calipso.git Forks -172 +176 Watchers -1018 +1023 @@ -487,7 +487,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 7 Watchers -41 +42 @@ -559,7 +559,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 12 Watchers -104 +103 @@ -580,7 +580,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like Last push -19:29:29 on 14/0/2013 +11:46:2 on 9/1/2013 Homepage http:// @@ -595,7 +595,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 38 Watchers -292 +304 @@ -631,7 +631,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 7 Watchers -54 +56 @@ -664,10 +664,10 @@

    Wrapper libraries to ease the use of development or provide simple ODM like https://github.com/idottv/node-mongodb-wrapper.git Forks -8 +9 Watchers -42 +44 @@ -814,7 +814,7 @@

    REST api’s around MongoDB or resource based librariesWatchers -200 +202 @@ -886,7 +886,7 @@

    REST api’s around MongoDB or resource based librariesWatchers -9 +10 @@ -925,7 +925,7 @@

    Test helpers and librariesWatchers -6 +7 @@ -961,7 +961,7 @@

    Test helpers and librariesWatchers -35 +36 @@ -1000,7 +1000,7 @@

    Tools or applications to manage your MongoDB’s0 Watchers -3 +4 @@ -1114,7 +1114,7 @@

    Logging libraries or applicationsWatchers -5 +6 @@ -1300,7 +1300,7 @@

    General frameworks over MongoDBWatchers -39 +43 @@ -1372,10 +1372,10 @@

    Translation libraries or frameworkshttps://github.com/masylum/dialect.git Forks -20 +22 Watchers -100 +103 @@ -1395,11 +1395,11 @@

    Libraries or Applications for analytics Activity Level -../_images/nonactive.png +../_images/active.png Last push -15:48:59 on 10/8/2012 +2:33:34 on 8/1/2013 Homepage http://http://square.github.com/cube @@ -1411,10 +1411,10 @@

    Libraries or Applications for analyticshttps://github.com/square/cube.git Forks -220 +228 Watchers -2386 +2412 @@ -1489,7 +1489,7 @@

    Libraries for the connect middlewareWatchers -183 +182 @@ -1522,10 +1522,10 @@

    Libraries for the connect middlewarehttps://github.com/kcbanner/connect-mongo.git Forks -60 +61 Watchers -191 +198 @@ -1561,10 +1561,10 @@

    Libraries or applications for continous integrationhttps://github.com/ryankee/concrete.git Forks -33 +34 Watchers -237 +244 @@ -1600,7 +1600,7 @@

    Exampe applicationshttps://github.com/gotik/nodejs-blackboard.git Forks -7 +8 Watchers 24 @@ -1831,7 +1831,7 @@

    Navigation

    @@ -433,7 +433,7 @@

    Navigation

    @@ -391,7 +391,7 @@

    Navigation

    @@ -417,7 +417,7 @@

    Navigation

    @@ -413,7 +413,7 @@

    Navigation

    @@ -220,7 +220,7 @@

    Navigation

    @@ -323,7 +323,7 @@

    Navigation

    @@ -372,7 +372,7 @@

    Navigation

    @@ -540,7 +540,7 @@

    Navigation

    @@ -295,7 +295,7 @@

    Navigation

    @@ -219,7 +219,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -557,7 +557,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -114,15 +114,19 @@

    ConstantsBinary.SUBTYPE_UUID +Binary.SUBTYPE_UUID_OLD 3 -UUID BSON type +OLD UUID BSON type -Binary.SUBTYPE_MD5 +Binary.SUBTYPE_UUID 4 +UUID BSON type + +Binary.SUBTYPE_MD5 +5 MD5 BSON type -Binary.SUBTYPE_USER_DEFINED +Binary.SUBTYPE_USER_DEFINED 128 User BSON type @@ -403,7 +407,7 @@

    Navigation

    @@ -1012,7 +1012,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -243,7 +243,7 @@

    Navigation

    @@ -261,7 +261,7 @@

    Navigation

    @@ -357,7 +357,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -473,7 +473,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -1361,7 +1361,7 @@

    Navigation

    @@ -425,15 +425,23 @@

    remove

    rename

    Renames the collection.

    +
    +
    Options
    +
      +
    • dropTarget {Boolean, default:false}, drop the target name collection if it previously exists.
    • +
    +
    +
    -rename(newName, callback)
    +rename(newName[, options], callback)
    @@ -3438,7 +3446,7 @@

    Navigation

    @@ -1237,7 +1237,7 @@

    Navigation

    @@ -590,7 +590,7 @@

    Navigation

    @@ -1543,9 +1543,16 @@

    dropCollection

    renameCollection

    Rename a collection.

    +
    +
    Options
    +
      +
    • dropTarget {Boolean, default:false}, drop the target name collection if it previously exists.
    • +
    +
    +
    -renameCollection(fromCollection, toCollection, callback)
    +renameCollection(fromCollection, toCollection[, options], callback)

    Arguments:
    • newName (string) – the new name of the collection.
    • +
    • [options] (object) – returns option results.
    • callback (function) – the callback accepting the result
    @@ -1553,6 +1560,7 @@

    renameCollection

    @@ -2811,7 +2819,7 @@

    Navigation

    @@ -522,7 +522,7 @@

    Navigation

    @@ -2306,7 +2306,7 @@

    Navigation

    @@ -406,7 +406,7 @@

    Navigation

    @@ -493,7 +493,7 @@

    Navigation

    @@ -258,7 +258,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -484,7 +484,7 @@

    Navigation

    @@ -79,7 +79,7 @@

    Constructor| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.2.12 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.2.13 documentation (index) »
  • @@ -322,7 +322,7 @@

    Navigation

    @@ -48,7 +48,17 @@

    Navigation

    Changelog

    -

    1.2.12 2013-02-13

    +

    1.2.13 2013-02-22

    +
      +
    • Allow strategy ‘none’ for repliaset if no strategy wanted (will default to round robin selection of servers on a set readPreference)
    • +
    • Fixed missing MongoErrors on some cursor methods (Issue #882)
    • +
    • Correctly returning a null for the db instance on MongoClient.connect when auth fails (Issue #890)
    • +
    • Added dropTarget option support for renameCollection/rename (Issue #891, help from https://github.com/jbottigliero)
    • +
    • Fixed issue where connection using MongoClient.connect would fail if first server did not exist (Issue #885)
    • +
    +
    +
    +

    1.2.12 2013-02-13

    Arguments:
    • fromCollection (string) – the name of the current collection we wish to rename.
    • toCollection (string) – the new name of the collection.
    • +
    • [options] (object) – returns option results.
    • callback (function) – this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from renameCollection or null if an error occured.
    - +
    -
    db() (built-in function), [1] +
    db() (built-in function), [1]
    @@ -356,7 +356,7 @@

    E

    -
    equals() (built-in function), [1], [2] +
    equals() (built-in function), [1], [2]
    @@ -668,7 +668,7 @@

    O

    -
    open() (built-in function), [1], [2] +
    open() (built-in function), [1], [2]
    @@ -708,7 +708,7 @@

    P

    -
    put() (built-in function), [1] +
    put() (built-in function), [1]
    @@ -1142,7 +1142,7 @@

    Navigation

    @@ -187,7 +187,7 @@

    Web frameworks using MongoDB

    Watchers2425
    @@ -247,7 +247,7 @@

    Object Document Modeling LibrariesLast push -6:1:20 on 12/1/2013 +17:2:30 on 21/1/2013 Homepage http:// @@ -259,10 +259,10 @@

    Object Document Modeling Librarieshttps://github.com/LearnBoost/mongoose.git Forks -366 +372 Watchers -2770 +2788 @@ -406,10 +406,10 @@

    Content Management Systemshttps://github.com/cliftonc/calipso.git Forks -176 +178 Watchers -1023 +1030 @@ -595,7 +595,7 @@

    Wrapper libraries to ease the use of development or provide simple ODM like 38 Watchers -304 +310 @@ -811,10 +811,10 @@

    REST api’s around MongoDB or resource based librarieshttps://github.com/tdegrunt/mongodb-rest.git Forks -45 +47 Watchers -202 +204 @@ -925,7 +925,7 @@

    Test helpers and librariesWatchers -7 +8 @@ -1300,7 +1300,7 @@

    General frameworks over MongoDBWatchers -43 +44 @@ -1310,42 +1310,6 @@

    General frameworks over MongoDB

    Translation libraries or frameworks

    -

    dialect-http

    -

    http client to manage your dialect translations

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - -
    Activity Level../_images/nonactive.png -
    Last push1:43:11 on 8/11/2011
    Homepagehttp://
    Urlhttps://github.com/masylum/dialect-http
    Clone Urlhttps://github.com/masylum/dialect-http.git
    Forks7
    Watchers27
    -
    -
    -

    dialect

    Translations for nodejs

    @@ -1375,7 +1339,7 @@

    Translation libraries or frameworksWatchers -103 +101 @@ -1411,10 +1375,10 @@

    Libraries or Applications for analyticshttps://github.com/square/cube.git Forks -228 +234 Watchers -2412 +2428 @@ -1522,10 +1486,10 @@

    Libraries for the connect middlewarehttps://github.com/kcbanner/connect-mongo.git Forks -61 +63 Watchers -198 +199 @@ -1534,42 +1498,6 @@

    Libraries for the connect middleware

    Libraries or applications for continous integration

    -
    -

    concrete

    -

    Simple continuous integration server written with NodeJS and CoffeeScript

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - -
    Activity Level../_images/nonactive.png -
    Last push20:18:30 on 9/6/2012
    Homepagehttp://http://ryankee.github.com/concrete
    Urlhttps://github.com/ryankee/concrete
    Clone Urlhttps://github.com/ryankee/concrete.git
    Forks34
    Watchers244
    -
    -

    @@ -433,7 +433,7 @@

    Navigation

    @@ -175,6 +175,12 @@

    Renaming collections

    +

    Passing the optional dropTarget boolean as the thrid parameter will allow overwritting of existing collections

    +
    +
    collection.rename(new_name, {dropTarget:true}, callback);
    +
    +
    +
    @@ -417,7 +417,7 @@

    Navigation

    @@ -413,7 +413,7 @@

    Navigation

    @@ -220,7 +220,7 @@

    Navigation

    @@ -323,7 +323,7 @@

    Navigation

    @@ -372,7 +372,7 @@

    Navigation

    @@ -540,7 +540,7 @@

    Navigation

    @@ -295,7 +295,7 @@

    Navigation

    @@ -219,7 +219,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -557,7 +557,7 @@

    Navigation

    @@ -453,7 +453,7 @@

    Navigation

    @@ -407,7 +407,7 @@

    Navigation

    @@ -205,32 +205,6 @@

    BSON.calculateObjectSize
    var Db = require('mongodb').Db,
    -    MongoClient = require('mongodb').MongoClient,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -// Create a simple object
    -var doc = {a: 1, func:function(){}}
    -// Calculate the size of the object without serializing the function
    -var size = BSON.calculateObjectSize(doc, false);
    -assert.equal(12, size);
    -// Calculate the size of the object serializing the function
    -size = BSON.calculateObjectSize(doc, true);
    -// Validate the correctness
    -assert.equal(36, size);
    -
    - -
    - -

    BSON.deserializeStream

    @@ -388,50 +295,6 @@

    BSON.deserializeStream

    -

    Examples

    -
    -

    A simple example showing the usage of BSON.deserializeStream function returning deserialized Javascript objects.

    -
    var Db = require('mongodb').Db,
    -    MongoClient = require('mongodb').MongoClient,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -// Create a simple object
    -var doc = {a: 1, func:function(){ console.log('hello world'); }}
    -// Serialize the object to a buffer, checking keys and serializing functions
    -var buffer = BSON.serialize(doc, true, true, true);
    -// Validate the correctness
    -assert.equal(65, buffer.length);
    -
    -// The array holding the number of retuned documents
    -var documents = new Array(1);
    -// Deserialize the object with no eval for the functions
    -var index = BSON.deserializeStream(buffer, 0, 1, documents, 0);
    -// Validate the correctness
    -assert.equal(65, index);
    -assert.equal(1, documents.length);
    -assert.equal(1, documents[0].a);
    -assert.equal('object', typeof documents[0].func);
    -
    -// Deserialize the object with eval for the functions caching the functions
    -// The array holding the number of retuned documents
    -var documents = new Array(1);
    -// Deserialize the object with no eval for the functions
    -var index = BSON.deserializeStream(buffer, 0, 1, documents, 0, {evalFunctions:true, cacheFunctions:true});
    -// Validate the correctness
    -assert.equal(65, index);
    -assert.equal(1, documents.length);
    -assert.equal(1, documents[0].a);
    -assert.equal('function', typeof documents[0].func);
    -
    -
    -
    - -

    deserializeStream

    @@ -609,52 +400,6 @@

    deserializeStream
    var Db = require('mongodb').Db,
    -    MongoClient = require('mongodb').MongoClient,
    -    Server = require('mongodb').Server,
    -    ReplSetServers = require('mongodb').ReplSetServers,
    -    ObjectID = require('mongodb').ObjectID,
    -    Binary = require('mongodb').Binary,
    -    GridStore = require('mongodb').GridStore,
    -    Code = require('mongodb').Code,
    -    BSON = require('mongodb').pure().BSON,
    -    assert = require('assert');
    -
    -// Create a simple object
    -var doc = {a: 1, func:function(){ console.log('hello world'); }}
    -// Create a BSON parser instance
    -var bson = new BSON();
    -// Serialize the object to a buffer, checking keys and serializing functions
    -var buffer = bson.serialize(doc, true, true, true);
    -// Validate the correctness
    -assert.equal(65, buffer.length);
    -
    -// The array holding the number of retuned documents
    -var documents = new Array(1);
    -// Deserialize the object with no eval for the functions
    -var index = bson.deserializeStream(buffer, 0, 1, documents, 0);
    -// Validate the correctness
    -assert.equal(65, index);
    -assert.equal(1, documents.length);
    -assert.equal(1, documents[0].a);
    -assert.equal('object', typeof documents[0].func);
    -
    -// Deserialize the object with eval for the functions caching the functions
    -// The array holding the number of retuned documents
    -var documents = new Array(1);
    -// Deserialize the object with no eval for the functions
    -var index = bson.deserializeStream(buffer, 0, 1, documents, 0, {evalFunctions:true, cacheFunctions:true});
    -// Validate the correctness
    -assert.equal(65, index);
    -assert.equal(1, documents.length);
    -assert.equal(1, documents[0].a);
    -assert.equal('function', typeof documents[0].func);
    -
    -

    - - - - @@ -1012,7 +658,7 @@

    Navigation

    @@ -244,7 +244,7 @@

    Navigation

    @@ -243,7 +243,7 @@

    Navigation

    @@ -261,7 +261,7 @@

    Navigation

    @@ -357,7 +357,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -237,7 +237,7 @@

    Navigation

    @@ -235,7 +235,7 @@

    Navigation

    @@ -473,7 +473,7 @@

    Navigation

    @@ -260,7 +260,7 @@

    Navigation

    @@ -1028,7 +1028,7 @@

    Navigation

    @@ -111,31 +111,28 @@

    buildInfoBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin3', 'admin3', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin3', 'admin3', function(err, result) { + assert.ok(result); - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - assert.ok(result); + // Retrive the build information for the MongoDB instance + adminDb.buildInfo(function(err, info) { + assert.ok(err == null); - // Retrive the build information for the MongoDB instance - adminDb.buildInfo(function(err, info) { - assert.ok(err == null); + adminDb.removeUser('admin3', function(err, result) { + assert.ok(result); - db.close(); - }); + db.close(); }); }); }); @@ -181,45 +178,41 @@

    serverStatusBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Grab a collection object + var collection = db.collection('test'); - // Grab a collection object - db.collection('test', function(err, collection) { + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {w: 1}, function(err, doc) { - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {w: 1}, function(err, doc) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin13', 'admin13', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin13', 'admin13', function(err, result) { - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { + // Retrive the server Info + adminDb.serverStatus(function(err, info) { + assert.equal(null, err); + assert.ok(info != null); - // Retrive the server Info - adminDb.serverStatus(function(err, info) { - assert.equal(null, err); - assert.ok(info != null); + adminDb.removeUser('admin13', function(err, result) { + assert.ok(result); - db.close(); - }) - }); - }); - }); - }); - }); - }); - }); + db.close(); + }); + }); + }); + }); + }); +}); @@ -260,38 +253,33 @@

    profilingLevelBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Grab a collection object + var collection = db.collection('test'); - // Grab a collection object - db.collection('test', function(err, collection) { + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {w: 1}, function(err, doc) { - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {w: 1}, function(err, doc) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin5', 'admin5', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin5', 'admin5', function(err, replies) { - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, replies) { + // Retrive the profiling level + adminDb.profilingLevel(function(err, level) { - // Retrive the profiling level - adminDb.profilingLevel(function(err, level) { - assert.equal("off", level); + adminDb.removeUser('admin5', function(err, result) { + assert.ok(result); - db.close(); - }); - }); + db.close(); }); }); }); @@ -338,31 +326,28 @@

    pingBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin9', 'admin9', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin9', 'admin9', function(err, result) { + assert.ok(result); - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - assert.ok(result); + // Ping the server + adminDb.ping(function(err, pingResult) { + assert.equal(null, err); - // Ping the server - adminDb.ping(function(err, pingResult) { - assert.equal(null, err); + adminDb.removeUser('admin9', function(err, result) { + assert.ok(result); - db.close(); - }); + db.close(); }); }); }); @@ -410,40 +395,34 @@

    authenticateBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - -// Establish connection to db +var db = new Db('test', new Server('locahost', 27017)); db.open(function(err, db) { + // Grab a collection object + var collection = db.collection('test'); - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Grab a collection object - db.collection('test', function(err, collection) { + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {w:1}, function(err, doc) { - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {w:1}, function(err, doc) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin2', 'admin2', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin2', 'admin2', function(err, result) { + assert.ok(result); - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - assert.ok(result); + adminDb.removeUser('admin2', function(err, result) { + assert.ok(result); - db.close(); - }); - }); - }); - }); - }); - }); - }); + db.close(); + }); + }); + }); + }); +}); @@ -485,31 +464,28 @@

    logoutBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin10', 'admin10', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin10', 'admin10', function(err, result) { + assert.ok(result); - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - assert.ok(result); + // Logout the user + adminDb.logout(function(err, result) { + assert.equal(true, result); - // Logout the user - adminDb.logout(function(err, result) { - assert.equal(true, result); + adminDb.removeUser('admin10', function(err, result) { + assert.ok(result); - db.close(); - }) + db.close(); }); }); }); @@ -566,27 +542,24 @@

    addUserBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin11', 'admin11', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin11', 'admin11', function(err, result) { + assert.ok(result); - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - assert.ok(result); + adminDb.removeUser('admin11', function(err, result) { + assert.ok(result); - db.close(); - }); + db.close(); }); }); }); @@ -640,40 +613,33 @@

    removeUserBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Add the new user to the admin database + adminDb.addUser('admin12', 'admin12', function(err, result) { - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - assert.ok(result); + // Authenticate using the newly added user + adminDb.authenticate('admin12', 'admin12', function(err, result) { + assert.ok(result); - // Remove the user - adminDb.removeUser('admin', function(err, result) { - assert.equal(null, err); - assert.equal(true, result); + // Remove the user + adminDb.removeUser('admin12', function(err, result) { + assert.equal(null, err); + assert.equal(true, result); - // Authenticate using the removed user should fail - adminDb.authenticate('admin', 'admin', function(err, result) { - assert.ok(err != null); - assert.ok(!result); + // Authenticate using the removed user should fail + adminDb.authenticate('admin12', 'admin12', function(err, result) { + assert.ok(err != null); + assert.ok(!result); - db.close(); - }); - }) + db.close(); }); - }); + }) }); }); }); @@ -719,67 +685,63 @@

    setProfilingLevelBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Grab a collection object + var collection = db.collection('test'); - // Grab a collection object - db.collection('test', function(err, collection) { + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {w: 1}, function(err, doc) { - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {w: 1}, function(err, doc) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin6', 'admin6', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin6', 'admin6', function(err, replies) { - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, replies) { + // Set the profiling level to only profile slow queries + adminDb.setProfilingLevel('slow_only', function(err, level) { - // Set the profiling level to only profile slow queries - adminDb.setProfilingLevel('slow_only', function(err, level) { + // Retrive the profiling level and verify that it's set to slow_only + adminDb.profilingLevel(function(err, level) { + assert.equal('slow_only', level); - // Retrive the profiling level and verify that it's set to slow_only - adminDb.profilingLevel(function(err, level) { - assert.equal('slow_only', level); + // Turn profiling off + adminDb.setProfilingLevel('off', function(err, level) { - // Turn profiling off - adminDb.setProfilingLevel('off', function(err, level) { + // Retrive the profiling level and verify that it's set to off + adminDb.profilingLevel(function(err, level) { + assert.equal('off', level); - // Retrive the profiling level and verify that it's set to off - adminDb.profilingLevel(function(err, level) { - assert.equal('off', level); + // Set the profiling level to log all queries + adminDb.setProfilingLevel('all', function(err, level) { - // Set the profiling level to log all queries - adminDb.setProfilingLevel('all', function(err, level) { + // Retrive the profiling level and verify that it's set to all + adminDb.profilingLevel(function(err, level) { + assert.equal('all', level); - // Retrive the profiling level and verify that it's set to all - adminDb.profilingLevel(function(err, level) { - assert.equal('all', level); + // Attempt to set an illegal profiling level + adminDb.setProfilingLevel('medium', function(err, level) { + assert.ok(err instanceof Error); + assert.equal("Error: illegal profiling level value medium", err.message); - // Attempt to set an illegal profiling level - adminDb.setProfilingLevel('medium', function(err, level) { - assert.ok(err instanceof Error); - assert.equal("Error: illegal profiling level value medium", err.message); + adminDb.removeUser('admin6', function(err, result) { + assert.ok(result); - db.close(); - }); - }) + db.close(); }); - }) - }); - }) - }); + }); + }) + }); + }) }); - }); + }) }); }); }); @@ -826,50 +788,46 @@

    profilingInfoBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Grab a collection object + var collection = db.collection('test'); - // Grab a collection object - db.collection('test', function(err, collection) { + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {w: 1}, function(doc) { - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {w: 1}, function(doc) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin7', 'admin7', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin7', 'admin7', function(err, replies) { - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, replies) { + // Set the profiling level to all + adminDb.setProfilingLevel('all', function(err, level) { - // Set the profiling level to all - adminDb.setProfilingLevel('all', function(err, level) { + // Execute a query command + collection.find().toArray(function(err, items) { - // Execute a query command - collection.find().toArray(function(err, items) { + // Turn off profiling + adminDb.setProfilingLevel('off', function(err, level) { - // Turn off profiling - adminDb.setProfilingLevel('off', function(err, level) { + // Retrive the profiling information + adminDb.profilingInfo(function(err, infos) { + assert.ok(infos.constructor == Array); + assert.ok(infos.length >= 1); + assert.ok(infos[0].ts.constructor == Date); + assert.ok(infos[0].millis.constructor == Number); - // Retrive the profiling information - adminDb.profilingInfo(function(err, infos) { - assert.ok(infos.constructor == Array); - assert.ok(infos.length >= 1); - assert.ok(infos[0].ts.constructor == Date); - assert.ok(infos[0].millis.constructor == Number); + adminDb.removeUser('admin7', function(err, result) { + assert.ok(result); - db.close(); - }); - }); + db.close(); }); }); }); @@ -921,31 +879,28 @@

    commandBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin4', 'admin4', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin4', 'admin4', function(err, result) { + assert.ok(result); - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - assert.ok(result); + // Retrive the build information using the admin command + adminDb.command({buildInfo:1}, function(err, info) { + assert.ok(err == null); - // Retrive the build information using the admin command - adminDb.command({buildInfo:1}, function(err, info) { - assert.ok(err == null); + adminDb.removeUser('admin4', function(err, result) { + assert.ok(result); - db.close(); - }); + db.close(); }); }); }); @@ -994,45 +949,41 @@

    validateCollectionBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { + // Grab a collection object + var collection = db.collection('test'); - // Grab a collection object - db.collection('test', function(err, collection) { + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {w: 1}, function(err, doc) { - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {w: 1}, function(err, doc) { + // Use the admin database for the operation + var adminDb = db.admin(); - // Use the admin database for the operation - db.admin(function(err, adminDb) { + // Add the new user to the admin database + adminDb.addUser('admin8', 'admin8', function(err, result) { - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { + // Authenticate using the newly added user + adminDb.authenticate('admin8', 'admin8', function(err, replies) { - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, replies) { + // Validate the 'test' collection + adminDb.validateCollection('test', function(err, doc) { - // Validate the 'test' collection - adminDb.validateCollection('test', function(err, doc) { + // Pre 1.9.1 servers + if(doc.result != null) { + assert.ok(doc.result != null); + assert.ok(doc.result.match(/firstExtent/) != null); + } else { + assert.ok(doc.firstExtent != null); + } - // Pre 1.9.1 servers - if(doc.result != null) { - assert.ok(doc.result != null); - assert.ok(doc.result.match(/firstExtent/) != null); - } else { - assert.ok(doc.firstExtent != null); - } + adminDb.removeUser('admin8', function(err, result) { + assert.ok(result); - db.close(); - }); - }); + db.close(); }); }); }); @@ -1079,22 +1030,19 @@

    listDatabasesBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: true, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Use the admin database for the operation - db.admin(function(err, adminDb) { + var adminDb = db.admin(); - // List all the available databases - adminDb.listDatabases(function(err, dbs) { - assert.equal(null, err); - assert.ok(dbs.databases.length > 0); + // List all the available databases + adminDb.listDatabases(function(err, dbs) { + assert.equal(null, err); + assert.ok(dbs.databases.length > 0); - db.close(); - }); + db.close(); }); }); @@ -1137,43 +1085,40 @@

    replSetGetStatusBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Drop the current database if it exists to avoid problems - db.dropDatabase(function(err, done) { - - // Grab a collection object - db.collection('test', function(err, collection) { - - // Force the creation of the collection by inserting a document - // Collections are not created until the first document is inserted - collection.insert({'a':1}, {w: 1}, function(err, doc) { - - // Use the admin database for the operation - db.admin(function(err, adminDb) { - - // Add the new user to the admin database - adminDb.addUser('admin', 'admin', function(err, result) { - - // Authenticate using the newly added user - adminDb.authenticate('admin', 'admin', function(err, result) { - - // Retrive the server Info, returns error if we are not - // running a replicaset - adminDb.replSetGetStatus(function(err, info) { - db.close(); - }) - }); - }); - }); - }); - }); - }); - }); + // Grab a collection object + var collection = db.collection('test'); + + // Force the creation of the collection by inserting a document + // Collections are not created until the first document is inserted + collection.insert({'a':1}, {w: 1}, function(err, doc) { + + // Use the admin database for the operation + var adminDb = db.admin(); + + // Add the new user to the admin database + adminDb.addUser('admin14', 'admin14', function(err, result) { + + // Authenticate using the newly added user + adminDb.authenticate('admin14', 'admin14', function(err, result) { + + // Retrive the server Info, returns error if we are not + // running a replicaset + adminDb.replSetGetStatus(function(err, info) { + + adminDb.removeUser('admin14', function(err, result) { + assert.ok(result); + + db.close(); + }); + }) + }); + }); + }); +}); @@ -1361,7 +1306,7 @@

    Navigation

    @@ -143,28 +143,21 @@

    insertBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); +var db = new Db('test', new Server('locahost', 27017)); +// Fetch a collection to insert document into +var collection = db.collection("simple_document_insert_collection_no_safe"); +// Insert a single document +collection.insert({hello:'world_no_safe'}); -// Establish connection to db -db.open(function(err, db) { - - // Fetch a collection to insert document into - var collection = db.collection("simple_document_insert_collection_no_safe"); - // Insert a single document - collection.insert({hello:'world_no_safe'}); - - // Wait for a second before finishing up, to ensure we have written the item to disk - setTimeout(function() { +// Wait for a second before finishing up, to ensure we have written the item to disk +setTimeout(function() { - // Fetch the document - collection.findOne({hello:'world_no_safe'}, function(err, item) { - assert.equal(null, err); - assert.equal('world_no_safe', item.hello); - db.close(); - }) - }, 1000); -}); + // Fetch the document + collection.findOne({hello:'world_no_safe'}, function(err, item) { + assert.equal(null, err); + assert.equal('world_no_safe', item.hello); + }) +}, 100);

    A batch document insert example, using safe mode to ensure document persistance on MongoDB

    @@ -179,28 +172,19 @@

    insertBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - -// Establish connection to db -db.open(function(err, db) { - - // Fetch a collection to insert document into - db.collection("batch_document_insert_collection_safe", function(err, collection) { - - // Insert a single document - collection.insert([{hello:'world_safe1'} - , {hello:'world_safe2'}], {w:1}, function(err, result) { - assert.equal(null, err); +var db = new Db('test', new Server('locahost', 27017)); +// Fetch a collection to insert document into +var collection = db.collection("batch_document_insert_collection_safe"); +// Insert a single document +collection.insert([{hello:'world_safe1'} + , {hello:'world_safe2'}], {w:1}, function(err, result) { + assert.equal(null, err); - // Fetch the document - collection.findOne({hello:'world_safe2'}, function(err, item) { - assert.equal(null, err); - assert.equal('world_safe2', item.hello); - db.close(); - }) - }); - }); + // Fetch the document + collection.findOne({hello:'world_safe2'}, function(err, item) { + assert.equal(null, err); + assert.equal('world_safe2', item.hello); + }) }); @@ -216,28 +200,19 @@

    insertBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - -// Establish connection to db -db.open(function(err, db) { - - // Fetch a collection to insert document into - db.collection("simple_document_insert_with_function_safe", function(err, collection) { - - // Insert a single document - collection.insert({hello:'world' - , func:function() {}}, {w:1, serializeFunctions:true}, function(err, result) { - assert.equal(null, err); +var db = new Db('test', new Server('locahost', 27017)); +// Fetch a collection to insert document into +var collection = db.collection("simple_document_insert_with_function_safe"); +// Insert a single document +collection.insert({hello:'world' + , func:function() {}}, {w:1, serializeFunctions:true}, function(err, result) { + assert.equal(null, err); - // Fetch the document - collection.findOne({hello:'world'}, function(err, item) { - assert.equal(null, err); - assert.ok("function() {}", item.code); - db.close(); - }) - }); - }); + // Fetch the document + collection.findOne({hello:'world'}, function(err, item) { + assert.equal(null, err); + assert.ok("function() {}", item.code); + }) }); @@ -253,47 +228,38 @@

    insertBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); +var db = new Db('test', new Server('locahost', 27017)); +// Only run the rest of the code if we have a mongodb server with version >= 1.9.1 +db.admin().serverInfo(function(err, result){ -// Establish connection to db -db.open(function(err, db) { + // Ensure we are running at least MongoDB v1.9.1 + if(parseInt((result.version.replace(/\./g, ''))) >= 191) { - // Only run the rest of the code if we have a mongodb server with version >= 1.9.1 - db.admin().serverInfo(function(err, result){ + // Create a collection + var collection = db.collection('keepGoingExample'); - // Ensure we are running at least MongoDB v1.9.1 - if(parseInt((result.version.replace(/\./g, ''))) >= 191) { - - // Create a collection - client.createCollection('keepGoingExample', function(err, collection) { + // Add an unique index to title to force errors in the batch insert + collection.ensureIndex({title:1}, {unique:true}, function(err, indexName) { - // Add an unique index to title to force errors in the batch insert - collection.ensureIndex({title:1}, {unique:true}, function(err, indexName) { + // Insert some intial data into the collection + collection.insert([{name:"Jim"} + , {name:"Sarah", title:"Princess"}], {w:1}, function(err, result) { - // Insert some intial data into the collection - collection.insert([{name:"Jim"} - , {name:"Sarah", title:"Princess"}], {w:1}, function(err, result) { + // Force keep going flag, ignoring unique index issue + collection.insert([{name:"Jim"} + , {name:"Sarah", title:"Princess"} + , {name:'Gump', title:"Gump"}], {w:1, keepGoing:true}, function(err, result) { - // Force keep going flag, ignoring unique index issue - collection.insert([{name:"Jim"} - , {name:"Sarah", title:"Princess"} - , {name:'Gump', title:"Gump"}], {w:1, keepGoing:true}, function(err, result) { - - // Count the number of documents left (should not include the duplicates) - collection.count(function(err, count) { - assert.equal(3, count); - db.close(); - }) - }); - }); + // Count the number of documents left (should not include the duplicates) + collection.count(function(err, count) { + assert.equal(3, count); + }) }); }); - } else { - db.close(); - test.done(); - } - }); + }); + } else { + test.done(); + } }); @@ -353,9 +319,7 @@

    removeBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -369,16 +333,12 @@

    remove// Remove all the document collection.remove(); - // Wait for a second to ensure command went through - setTimeout(function() { - - // Fetch all results - collection.find().toArray(function(err, items) { - assert.equal(null, err); - assert.equal(0, items.length); - db.close(); - }); - }, 1000); + // Fetch all results + collection.find().toArray(function(err, items) { + assert.equal(null, err); + assert.equal(0, items.length); + db.close(); + }); }); }) }); @@ -396,9 +356,7 @@

    removeBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -467,9 +425,7 @@

    renameBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -606,28 +562,25 @@

    saveBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Fetch the collection - db.collection("save_a_simple_document", function(err, collection) { - // Save a document with no safe option - collection.save({hello:'world'}); + var collection = db.collection("save_a_simple_document"); + // Save a document with no safe option + collection.save({hello:'world'}); - // Wait for a second - setTimeout(function() { + // Wait for a second + setTimeout(function() { - // Find the saved document - collection.findOne({hello:'world'}, function(err, item) { - assert.equal(null, err); - assert.equal('world', item.hello); - db.close(); - }); - }, 1000); - }); + // Find the saved document + collection.findOne({hello:'world'}, function(err, item) { + assert.equal(null, err); + assert.equal('world', item.hello); + db.close(); + }); + }, 1000); }); @@ -643,37 +596,34 @@

    saveBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Fetch the collection - db.collection("save_a_simple_document_modify_it_and_resave_it", function(err, collection) { + var collection = db.collection("save_a_simple_document_modify_it_and_resave_it"); - // Save a document with no safe option - collection.save({hello:'world'}, {w: 0}, function(err, result) { + // Save a document with no safe option + collection.save({hello:'world'}, {w: 0}, function(err, result) { - // Find the saved document - collection.findOne({hello:'world'}, function(err, item) { - assert.equal(null, err); - assert.equal('world', item.hello); + // Find the saved document + collection.findOne({hello:'world'}, function(err, item) { + assert.equal(null, err); + assert.equal('world', item.hello); - // Update the document - item['hello2'] = 'world2'; + // Update the document + item['hello2'] = 'world2'; - // Save the item with the additional field - collection.save(item, {w: 1}, function(err, result) { + // Save the item with the additional field + collection.save(item, {w: 1}, function(err, result) { - // Find the changed document - collection.findOne({hello:'world'}, function(err, item) { - assert.equal(null, err); - assert.equal('world', item.hello); - assert.equal('world2', item.hello2); + // Find the changed document + collection.findOne({hello:'world'}, function(err, item) { + assert.equal(null, err); + assert.equal('world', item.hello); + assert.equal('world2', item.hello2); - db.close(); - }); + db.close(); }); }); }); @@ -740,9 +690,7 @@

    updateBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -783,9 +731,7 @@

    updateBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -821,9 +767,7 @@

    updateBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -902,9 +846,7 @@

    distinctBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -943,9 +885,7 @@

    distinctBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1016,9 +956,7 @@

    count BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1084,9 +1022,7 @@

    dropBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1190,9 +1126,7 @@

    findAndModifyBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1297,9 +1231,7 @@

    findAndRemoveBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1411,9 +1343,7 @@

    findBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1449,9 +1379,7 @@

    findBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1487,9 +1415,7 @@

    findBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1513,26 +1439,6 @@

    find}); }); }); -} - -exports.shouldReturnInstanceofErrorWithBadFieldSelection = function(test) { -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4, ssl:useSSL}), {w:0, native_parser: native_parser}); - -db.open(function(err, db) { - assert.equal(null, err); - - var col = db.collection('bad_field_selection'); - col.insert([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {w:1}, function(err, result) { - assert.equal(null, err); - - col.find({}, {skip:1, limit:1, fields:{_id:1,b:0}}).toArray(function(err, docs) { - assert.ok(err instanceof Error); - db.close(); - test.done(); - }); - }); -}); @@ -1611,9 +1517,7 @@

    findOneBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1702,9 +1606,7 @@

    createIndexBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1744,9 +1646,7 @@

    createIndexBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1847,9 +1747,7 @@

    ensureIndexBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1932,9 +1830,7 @@

    indexInformationBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2009,9 +1905,7 @@

    dropIndexBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2108,9 +2002,7 @@

    reIndexBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2203,9 +2095,7 @@

    mapReduceBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2250,9 +2140,7 @@

    mapReduceBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2304,14 +2192,12 @@

    mapReduceBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a test collection - client.createCollection('test_map_reduce_functions_scope', function(err, collection) { + db.createCollection('test_map_reduce_functions_scope', function(err, collection) { // Insert some test documents collection.insert([{'user_id':1, 'timestamp':new Date()} @@ -2420,9 +2306,7 @@

    group BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2479,7 +2363,6 @@

    group // Correctly handle illegal function collection.group([], {}, {}, "5 ++ 5", function(err, results) { - assert.ok(err instanceof Error); assert.ok(err.message != null); // Use a function to select the keys used to group by @@ -2508,7 +2391,6 @@

    group // Correctly handle illegal function when using the EVAL method collection.group([], {}, {}, "5 ++ 5", false, function(err, results) { - assert.ok(err instanceof Error); assert.ok(err.message != null); db.close(); @@ -2527,7 +2409,6 @@

    group }); }); }); -} @@ -2568,9 +2449,7 @@

    optionsBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2629,9 +2508,7 @@

    isCappedBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2689,9 +2566,7 @@

    indexExistsBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2778,27 +2653,25 @@

    geoNearBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {w:0, auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); +var db = configuration.newDbInstance({w:0}, {poolSize:1}); // Establish connection to db db.open(function(err, db) { // Fetch the collection - db.collection("simple_geo_near_command", function(err, collection) { + var collection = db.collection("simple_geo_near_command"); - // Add a location based index - collection.ensureIndex({loc:"2d"}, function(err, result) { + // Add a location based index + collection.ensureIndex({loc:"2d"}, function(err, result) { - // Save a new location tagged document - collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {w:1}, function(err, result) { + // Save a new location tagged document + collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {w:1}, function(err, result) { - // Use geoNear command to find document - collection.geoNear(50, 50, {query:{a:1}, num:1}, function(err, docs) { - assert.equal(1, docs.results.length); + // Use geoNear command to find document + collection.geoNear(50, 50, {query:{a:1}, num:1}, function(err, docs) { + assert.equal(1, docs.results.length); - db.close(); - }); + db.close(); }); }); }); @@ -2856,27 +2729,24 @@

    geoHaystackSearchBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Fetch the collection - db.collection("simple_geo_haystack_command", function(err, collection) { + var collection = db.collection("simple_geo_haystack_command"); - // Add a location based index - collection.ensureIndex({loc: "geoHaystack", type: 1}, {bucketSize: 1}, function(err, result) { + // Add a location based index + collection.ensureIndex({loc: "geoHaystack", type: 1}, {bucketSize: 1}, function(err, result) { - // Save a new location tagged document - collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {w:1}, function(err, result) { + // Save a new location tagged document + collection.insert([{a:1, loc:[50, 30]}, {a:1, loc:[30, 50]}], {w:1}, function(err, result) { - // Use geoNear command to find document - collection.geoHaystackSearch(50, 50, {search:{a:1}, limit:1, maxDistance:100}, function(err, docs) { - assert.equal(1, docs.results.length); + // Use geoNear command to find document + collection.geoHaystackSearch(50, 50, {search:{a:1}, limit:1, maxDistance:100}, function(err, docs) { + assert.equal(1, docs.results.length); - db.close(); - }); + db.close(); }); }); }); @@ -2921,9 +2791,7 @@

    indexesBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2997,9 +2865,7 @@

    aggregateBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Some docs for insertion @@ -3015,30 +2881,29 @@

    aggregateif(parseInt((result.version.replace(/\./g, ''))) >= 210) { // Create a collection - db.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArray', function(err, collection) { - // Insert the docs - collection.insert(docs, {w: 1}, function(err, result) { - - // Execute aggregate, notice the pipeline is expressed as an Array - collection.aggregate([ - { $project : { - author : 1, - tags : 1 - }}, - { $unwind : "$tags" }, - { $group : { - _id : {tags : "$tags"}, - authors : { $addToSet : "$author" } - }} - ], function(err, result) { - assert.equal(null, err); - assert.equal('good', result[0]._id.tags); - assert.deepEqual(['bob'], result[0].authors); - assert.equal('fun', result[1]._id.tags); - assert.deepEqual(['bob'], result[1].authors); + var collection = db.collection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArray'); + // Insert the docs + collection.insert(docs, {w: 1}, function(err, result) { + + // Execute aggregate, notice the pipeline is expressed as an Array + collection.aggregate([ + { $project : { + author : 1, + tags : 1 + }}, + { $unwind : "$tags" }, + { $group : { + _id : {tags : "$tags"}, + authors : { $addToSet : "$author" } + }} + ], function(err, result) { + assert.equal(null, err); + assert.equal('good', result[0]._id.tags); + assert.deepEqual(['bob'], result[0].authors); + assert.equal('fun', result[1]._id.tags); + assert.deepEqual(['bob'], result[1].authors); - db.close(); - }); + db.close(); }); }); } else { @@ -3061,9 +2926,7 @@

    aggregateBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Some docs for insertion @@ -3079,30 +2942,29 @@

    aggregateif(parseInt((result.version.replace(/\./g, ''))) >= 210) { // Create a collection - client.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArguments', function(err, collection) { - // Insert the docs - collection.insert(docs, {w: 1}, function(err, result) { - // Execute aggregate, notice the pipeline is expressed as function call parameters - // instead of an Array. - collection.aggregate( - { $project : { - author : 1, - tags : 1 - }}, - { $unwind : "$tags" }, - { $group : { - _id : {tags : "$tags"}, - authors : { $addToSet : "$author" } - }} - , function(err, result) { - assert.equal(null, err); - assert.equal('good', result[0]._id.tags); - assert.deepEqual(['bob'], result[0].authors); - assert.equal('fun', result[1]._id.tags); - assert.deepEqual(['bob'], result[1].authors); + var collection = db.collection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArguments'); + // Insert the docs + collection.insert(docs, {w: 1}, function(err, result) { + // Execute aggregate, notice the pipeline is expressed as function call parameters + // instead of an Array. + collection.aggregate( + { $project : { + author : 1, + tags : 1 + }}, + { $unwind : "$tags" }, + { $group : { + _id : {tags : "$tags"}, + authors : { $addToSet : "$author" } + }} + , function(err, result) { + assert.equal(null, err); + assert.equal('good', result[0]._id.tags); + assert.deepEqual(['bob'], result[0].authors); + assert.equal('fun', result[1]._id.tags); + assert.deepEqual(['bob'], result[1].authors); - db.close(); - }); + db.close(); }); }); } else { @@ -3125,9 +2987,7 @@

    aggregateBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Some docs for insertion @@ -3143,30 +3003,29 @@

    aggregateif(parseInt((result.version.replace(/\./g, ''))) >= 210) { // Create a collection - client.createCollection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArguments', function(err, collection) { - // Insert the docs - collection.insert(docs, {w: 1}, function(err, result) { - // Execute aggregate, notice the pipeline is expressed as function call parameters - // instead of an Array. - collection.aggregate( - { $project : { - author : 1, - tags : 1 - }}, - { $unwind : "$tags" }, - { $group : { - _id : {tags : "$tags"}, - authors : { $addToSet : "$author" } - }} - , function(err, result) { - assert.equal(null, err); - assert.equal('good', result[0]._id.tags); - assert.deepEqual(['bob'], result[0].authors); - assert.equal('fun', result[1]._id.tags); - assert.deepEqual(['bob'], result[1].authors); + var collection = db.collection('shouldCorrectlyExecuteSimpleAggregationPipelineUsingArguments'); + // Insert the docs + collection.insert(docs, {w: 1}, function(err, result) { + // Execute aggregate, notice the pipeline is expressed as function call parameters + // instead of an Array. + collection.aggregate( + { $project : { + author : 1, + tags : 1 + }}, + { $unwind : "$tags" }, + { $group : { + _id : {tags : "$tags"}, + authors : { $addToSet : "$author" } + }} + , function(err, result) { + assert.equal(null, err); + assert.equal('good', result[0]._id.tags); + assert.deepEqual(['bob'], result[0].authors); + assert.equal('fun', result[1]._id.tags); + assert.deepEqual(['bob'], result[1].authors); - db.close(); - }); + db.close(); }); }); } else { @@ -3224,9 +3083,7 @@

    stats BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -3446,7 +3303,7 @@

    Navigation

    @@ -172,9 +172,7 @@

    rewindBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { var docs = []; @@ -254,9 +252,7 @@

    toArrayBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -321,16 +317,13 @@

    eachBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a collection db.createCollection('test_to_a_after_each', function(err, collection) { assert.equal(null, err); - assert.ok(collection instanceof Collection); // Insert a document in the collection collection.insert({'a':1}, {w:1}, function(err, ids) { @@ -397,9 +390,7 @@

    count BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -466,9 +457,7 @@

    sortBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -537,9 +526,7 @@

    limit BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -626,9 +613,7 @@

    skipBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -692,9 +677,7 @@

    batchSizeBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -753,9 +736,7 @@

    nextObjectBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -815,9 +796,7 @@

    explainBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -845,6 +824,13 @@

    explain

    stream

    Returns a Node ReadStream interface for this cursor.

    +
    +
    Options
    +
      +
    • transform {Function} function of type function(object) { return transformed }, allows for transformation of data before emitting.
    • +
    +
    +
    stream()
    @@ -872,9 +858,7 @@

    streamBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -944,9 +928,7 @@

    close BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1013,9 +995,7 @@

    isClosedBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1237,7 +1217,7 @@

    Navigation

    @@ -75,6 +75,11 @@

    Constructor +
    Options
    +
      +
    • transform {Function} function of type function(object) { return transformed }, allows for transformation of data before emitting.
    • +
    +
    Events
    @@ -156,9 +156,7 @@

    openBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { assert.equal(null, err); @@ -179,14 +177,11 @@

    openBSON = require('mongodb').pure().BSON, assert = require('assert'); -// Replica configuration var replSet = new ReplSetServers([ - new Server('localhost', 30000, { auto_reconnect: true } ), - new Server('localhost', 30001, { auto_reconnect: true } ), - new Server('localhost', 30002, { auto_reconnect: true } ) - ] -); - + new Server('localhost', 30000), + new Server('localhost', 30001), + new Server('localhost', 30002) +]); var db = new Db('integration_test_', replSet, {w:0}); db.open(function(err, p_db) { assert.equal(null, err); @@ -206,15 +201,11 @@

    openBSON = require('mongodb').pure().BSON, assert = require('assert'); -// Replica configuration -var replSet = new ReplSetServers( [ - new Server( RS.host, RS.ports[1], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[0], { auto_reconnect: true } ), - new Server( RS.host, RS.ports[2], { auto_reconnect: true } ) - ], - {rs_name:RS.name} -); - +var replSet = new ReplSetServers([ + new Server('localhost', 30000), + new Server('localhost', 30001), + new Server('localhost', 30002) +]); // Create db instance var db = new Db('integration_test_', replSet, {w:0, native_parser: (process.env['TEST_NATIVE'] != null)}); // Trigger test once whole set is up @@ -318,9 +309,7 @@

    dbBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { assert.equal(null, err); @@ -391,26 +380,23 @@

    close BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Fetch a collection - db.collection('shouldCorrectlyFailOnRetryDueToAppCloseOfDb', function(err, collection) { + var collection = db.collection('shouldCorrectlyFailOnRetryDueToAppCloseOfDb'); - // Insert a document - collection.insert({a:1}, {w:1}, function(err, result) { - assert.equal(null, err); + // Insert a document + collection.insert({a:1}, {w:1}, function(err, result) { + assert.equal(null, err); - // Force close the connection - db.close(true, function(err, result) { + // Force close the connection + db.close(true, function(err, result) { - // Attemp to insert should fail now with correct message 'db closed by application' - collection.insert({a:2}, {w:1}, function(err, result) { - assert.equal('db closed by application', err.message); - }); + // Attemp to insert should fail now with correct message 'db closed by application' + collection.insert({a:2}, {w:1}, function(err, result) { + assert.equal('db closed by application', err.message); }); }); }); @@ -429,9 +415,7 @@

    close BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { assert.equal(null, err); @@ -482,18 +466,14 @@

    admin BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w: 0, native_parser: false}); - -// Establish connection to db +var db = new Db('test', new Server('locahost', 27017)); db.open(function(err, db) { // Use the admin database for the operation - db.admin(function(err, adminDb) { - assert.equal(null, err); + var adminDb = db.admin() + assert.ok(adminDb != null); - db.close(); - }); + db.close(); }); @@ -536,9 +516,7 @@

    collectionsInfoBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { assert.equal(null, err); @@ -613,9 +591,7 @@

    collectionNamesBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { assert.equal(null, err); @@ -643,7 +619,8 @@

    collectionNames

    collection

    -

    Fetch a specific collection (containing the actual collection information)

    +

    Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can +can use it without a callback in the following way. var collection = db.collection(‘mycollection’);

    Options
    @@ -124,9 +124,7 @@

    putBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a new grid instance @@ -157,9 +155,7 @@

    putBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a new grid instance @@ -191,9 +187,7 @@

    putBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a new grid instance @@ -254,9 +248,7 @@

    getBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a new grid instance @@ -319,13 +311,11 @@

    deleteBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a new grid instance - var grid = new Grid(client, 'fs'); + var grid = new Grid(db, 'fs'); // Some data to write var originalData = new Buffer('Hello world'); // Write data to grid @@ -522,7 +512,7 @@

    Navigation

    @@ -173,7 +173,7 @@

    open

    Examples

    -

    A simple example showing opening a file using a filename, writing to it and saving it.

    +

    A simple example showing how to save a file with a filename allowing for multiple files with the same name

    var Db = require('mongodb').Db,
         MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
    @@ -185,31 +185,50 @@ 

    openBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Create a new instance of the gridstore - var gridStore = new GridStore(db, 'ourexamplefiletowrite.txt', 'w'); - - // Open the file + // Create a file and open it + var gridStore = new GridStore(db, new ObjectID(), "test_gs_getc_file", "w"); gridStore.open(function(err, gridStore) { + // Write some content to the file + gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) { + // Flush the file to GridFS + gridStore.close(function(err, fileData) { + assert.equal(null, err); - // Write some data to the file - gridStore.write('bar', function(err, gridStore) { - assert.equal(null, err); + // Create another file with same name and and save content to it + gridStore = new GridStore(db, new ObjectID(), "test_gs_getc_file", "w"); + gridStore.open(function(err, gridStore) { + // Write some content to the file + gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) { + // Flush the file to GridFS + gridStore.close(function(err, fileData) { + assert.equal(null, err); - // Close (Flushes the data to MongoDB) - gridStore.close(function(err, result) { - assert.equal(null, err); + // Open the file in read mode using the filename + var gridStore2 = new GridStore(db, "test_gs_getc_file", "r"); + gridStore2.open(function(err, gridStore) { - // Verify that the file exists - GridStore.exist(db, 'ourexamplefiletowrite.txt', function(err, result) { - assert.equal(null, err); - assert.equal(true, result); + // Read first character and verify + gridStore.getc(function(err, chr) { + assert.equal('h', chr); - db.close(); + // Open the file using an object id + gridStore2 = new GridStore(db, fileData._id, "r"); + gridStore2.open(function(err, gridStore) { + + // Read first character and verify + gridStore.getc(function(err, chr) { + assert.equal('h', chr); + + db.close(); + }) + }); + }); + }); + }); + }); }); }); }); @@ -217,7 +236,7 @@

    open});

    -

    A simple example showing opening a file using an ObjectID, writing to it and saving it.

    +

    A simple example showing opening a file using a filename, writing to it and saving it.

    -

    A simple example showing how to save a file with a filename allowing for multiple files with the same name

    +

    A simple example showing opening a file using an ObjectID, writing to it and saving it.

    var Db = require('mongodb').Db,
         MongoClient = require('mongodb').MongoClient,
         Server = require('mongodb').Server,
    @@ -276,52 +290,32 @@ 

    openBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { - // Create a file and open it - var gridStore = new GridStore(db, new ObjectID(), "test_gs_getc_file", "w"); - gridStore.open(function(err, gridStore) { - // Write some content to the file - gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) { - // Flush the file to GridFS - gridStore.close(function(err, fileData) { - assert.equal(null, err); + // Our file ID + var fileId = new ObjectID(); - // Create another file with same name and and save content to it - gridStore = new GridStore(db, new ObjectID(), "test_gs_getc_file", "w"); - gridStore.open(function(err, gridStore) { - // Write some content to the file - gridStore.write(new Buffer("hello, world!", "utf8"), function(err, gridStore) { - // Flush the file to GridFS - gridStore.close(function(err, fileData) { - assert.equal(null, err); + // Create a new instance of the gridstore + var gridStore = new GridStore(db, fileId, 'w'); - // Open the file in read mode using the filename - var gridStore2 = new GridStore(db, "test_gs_getc_file", "r"); - gridStore2.open(function(err, gridStore) { + // Open the file + gridStore.open(function(err, gridStore) { - // Read first character and verify - gridStore.getc(function(err, chr) { - assert.equal('h', chr); + // Write some data to the file + gridStore.write('bar', function(err, gridStore) { + assert.equal(null, err); - // Open the file using an object id - gridStore2 = new GridStore(db, fileData._id, "r"); - gridStore2.open(function(err, gridStore) { + // Close (Flushes the data to MongoDB) + gridStore.close(function(err, result) { + assert.equal(null, err); - // Read first character and verify - gridStore.getc(function(err, chr) { - assert.equal('h', chr); + // Verify that the file exists + GridStore.exist(db, fileId, function(err, result) { + assert.equal(null, err); + assert.equal(true, result); - db.close(); - }) - }); - }); - }); - }); - }); + db.close(); }); }); }); @@ -368,9 +362,7 @@

    writeFileBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -380,15 +372,15 @@

    writeFilevar gridStore = new GridStore(db, fileId, 'w'); // Read the filesize of file on disk (provide your own) - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; + var fileSize = fs.statSync('./test/tests/functional/gridstore/test_gs_weird_bug.png').size; // Read the buffered data for comparision reasons - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); + var data = fs.readFileSync('./test/tests/functional/gridstore/test_gs_weird_bug.png'); // Open the new file gridStore.open(function(err, gridStore) { // Write the file to gridFS - gridStore.writeFile('./test/gridstore/test_gs_weird_bug.png', function(err, doc) { + gridStore.writeFile('./test/tests/functional/gridstore/test_gs_weird_bug.png', function(err, doc) { // Read back all the written content and verify the correctness GridStore.read(db, fileId, function(err, fileData) { @@ -414,9 +406,7 @@

    writeFileBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -426,12 +416,12 @@

    writeFilevar gridStore = new GridStore(db, fileId, 'w'); // Read the filesize of file on disk (provide your own) - var fileSize = fs.statSync('./test/gridstore/test_gs_weird_bug.png').size; + var fileSize = fs.statSync('./test/tests/functional/gridstore/test_gs_weird_bug.png').size; // Read the buffered data for comparision reasons - var data = fs.readFileSync('./test/gridstore/test_gs_weird_bug.png'); + var data = fs.readFileSync('./test/tests/functional/gridstore/test_gs_weird_bug.png'); // Open a file handle for reading the file - var fd = fs.openSync('./test/gridstore/test_gs_weird_bug.png', 'r', 0666); + var fd = fs.openSync('./test/tests/functional/gridstore/test_gs_weird_bug.png', 'r', 0666); // Open the new file gridStore.open(function(err, gridStore) { @@ -491,9 +481,7 @@

    close BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -557,9 +545,7 @@

    chunkCollectionBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -574,7 +560,6 @@

    chunkCollection// Access the Chunk collection gridStore.chunkCollection(function(err, collection) { assert.equal(err, null); - assert.ok(collection instanceof Collection); db.close(); }); @@ -620,9 +605,7 @@

    unlinkBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -701,9 +684,7 @@

    collectionBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -718,7 +699,6 @@

    collection// Access the Chunk collection gridStore.collection(function(err, collection) { assert.equal(err, null); - assert.ok(collection instanceof Collection); db.close(); }); @@ -765,9 +745,7 @@

    readlinesBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -849,9 +827,7 @@

    rewindBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -942,13 +918,11 @@

    readBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Read in the content of a file - var data = fs.readFileSync('./test/gridstore/iya_logo_final_bw.jpg'); + var data = fs.readFileSync('./test/tests/functional/gridstore/iya_logo_final_bw.jpg'); // Create a new file var gs = new GridStore(db, "test", "w"); // Open the file @@ -1017,9 +991,7 @@

    tellBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a new file @@ -1103,9 +1075,7 @@

    seekBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a file and open it @@ -1233,9 +1203,7 @@

    eofBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1296,9 +1264,7 @@

    getcBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a file and open it @@ -1366,9 +1332,7 @@

    putsBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Open a file for writing @@ -1441,9 +1405,7 @@

    streamBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Open a file for reading @@ -1451,7 +1413,7 @@

    stream// Open a file for writing var gridStoreW = new GridStore(db, "test_gs_read_stream", "w"); // Read in the data of a file - var data = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png"); + var data = fs.readFileSync("./test/tests/functional/gridstore/test_gs_weird_bug.png"); var readLen = 0; var gotEnd = 0; @@ -1506,14 +1468,12 @@

    streamBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Open a file for writing var gridStoreWrite = new GridStore(db, "test_gs_read_stream_pipe", "w", {chunkSize:1024}); - gridStoreWrite.writeFile("./test/gridstore/test_gs_weird_bug.png", function(err, result) { + gridStoreWrite.writeFile("./test/tests/functional/gridstore/test_gs_weird_bug.png", function(err, result) { // Open the gridStore for reading and pipe to a file var gridStore = new GridStore(db, "test_gs_read_stream_pipe", "r"); gridStore.open(function(err, gridStore) { @@ -1522,7 +1482,7 @@

    stream// When the stream is finished close the database stream.on("end", function(err) { // Read the original content - var originalData = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png"); + var originalData = fs.readFileSync("./test/tests/functional/gridstore/test_gs_weird_bug.png"); // Ensure we are doing writing before attempting to open the file fs.readFile("./test_gs_weird_bug_streamed.tmp", function(err, streamedData) { // Compare the data @@ -1583,9 +1543,7 @@

    GridStore.existBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -1667,9 +1625,7 @@

    GridStore.listBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file id @@ -1717,7 +1673,7 @@

    GridStore.list}); // List the existing files in a different root collection where the file is not located - GridStore.list(client, 'my_fs', function(err, items) { + GridStore.list(db, 'my_fs', function(err, items) { var found = false; items.forEach(function(filename) { if(filename == 'foobar2') found = true; @@ -1810,15 +1766,13 @@

    GridStore.readBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Create a new file var gridStore = new GridStore(db, null, "w"); // Read in the content from a file, replace with your own - var data = fs.readFileSync("./test/gridstore/test_gs_weird_bug.png"); + var data = fs.readFileSync("./test/tests/functional/gridstore/test_gs_weird_bug.png"); // Open the file gridStore.open(function(err, gridStore) { @@ -1828,7 +1782,7 @@

    GridStore.readgridStore.close(function(err, result) { // Read in the whole file and check that it's the same content - GridStore.read(client, result._id, function(err, fileData) { + GridStore.read(db, result._id, function(err, fileData) { assert.equal(data.length, fileData.length); db.close(); @@ -1881,9 +1835,7 @@

    GridStore.readlinesBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -1961,9 +1913,7 @@

    GridStore.unlinkBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { @@ -2056,9 +2006,7 @@

    write BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // Our file ID @@ -2306,7 +2254,7 @@

    Navigation

    @@ -406,7 +406,7 @@

    Navigation

    @@ -493,7 +493,7 @@

    Navigation

    @@ -258,7 +258,7 @@

    Navigation

    @@ -253,7 +253,7 @@

    Navigation

    @@ -108,9 +108,7 @@

    pause BSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // File id @@ -182,9 +180,7 @@

    destroyBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // File id @@ -244,9 +240,7 @@

    resumeBSON = require('mongodb').pure().BSON, assert = require('assert'); -var db = new Db('integration_tests', new Server("127.0.0.1", 27017, - {auto_reconnect: false, poolSize: 1}), {w:0, native_parser: false}); - +var db = new Db('test', new Server('locahost', 27017)); // Establish connection to db db.open(function(err, db) { // File id @@ -484,7 +478,7 @@

    Navigation

    @@ -313,7 +313,7 @@

    Navigation

    @@ -80,7 +80,6 @@

    Constructor| GitHub
  • Jira
  • -
  • MongoDB Node.JS Driver 1.2.13 documentation (index) »
  • +
  • MongoDB Node.JS Driver 1.2.14 documentation (index) »
  • @@ -48,7 +48,22 @@

    Navigation

    Changelog

    -

    1.2.13 2013-02-22

    +

    1.2.14

    +
      +
    • Refactored test suite to speed up running of replicaset tests
    • +
    • Fix of async error handling when error happens in callback (Issue #909, https://github.com/medikoo)
    • +
    • Corrected a slaveOk setting issue (Issue #906, #905)
    • +
    • Fixed HA issue where ping’s would not go to correct server on HA server connection failure.
    • +
    • Uses setImmediate if on 0.10 otherwise nextTick for cursor stream
    • +
    • Fixed race condition in Cursor stream (NODE-31)
    • +
    • Fixed issues related to node 0.10 and process.nextTick now correctly using setImmediate where needed on node 0.10
    • +
    • Added support for maxMessageSizeBytes if available (DRIVERS-1)
    • +
    • Added support for authSource (2.4) to MongoClient URL and db.authenticate method (DRIVER-69/NODE-34)
    • +
    • Fixed issue in GridStore seek and GridStore read to correctly work on multiple seeks (Issue #895)
    • +
    +
    +
    +

    1.2.13 2013-02-22