Socket
Socket
Sign inDemoInstall

mongodb

Package Overview
Dependencies
Maintainers
1
Versions
562
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongodb - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

CONTRIBUTING.md

2

lib/mongodb/collection.js

@@ -740,2 +740,3 @@ /**

* - **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
*

@@ -940,2 +941,3 @@ * @param {Object} query query object to locate the object to modify

* - **readPreference** {String}, the preferred read preference (Server.PRIMARY, Server.PRIMARY_PREFERRED, Server.SECONDARY, Server.SECONDARY_PREFERRED, Server.NEAREST).
* - **partial** {Boolean, default:false}, specify if the cursor should return partial results when querying against a sharded system
*

@@ -942,0 +944,0 @@ * @param {Object} query query object to locate the object to modify

@@ -35,2 +35,3 @@ var QueryCommand = require('./query_command').QueryCommand,

DbCommand.SYSTEM_COMMAND_COLLECTION = "$cmd";
DbCommand.SYSTEM_JS_COLLECTION = "system.js";

@@ -37,0 +38,0 @@ // New commands

3

lib/mongodb/commands/query_command.js

@@ -260,2 +260,3 @@ var BaseCommand = require('./base_command').BaseCommand,

QueryCommand.OPTS_AWAIT_DATA = 32;
QueryCommand.OPTS_EXHAUST = 64;
QueryCommand.OPTS_EXHAUST = 64;
QueryCommand.OPTS_PARTIAL = 128;

@@ -18,2 +18,3 @@ var utils = require('./connection_utils'),

this.socketOptions.port = port;
this.socketOptions.domainSocket = false;
this.bson = bson;

@@ -24,2 +25,5 @@ // PoolSize is always + 1 for special reserved "measurment" socket (like ping, stats etc)

// Check if the host is a socket
if(host.match(/^\//)) this.socketOptions.domainSocket = true;
// Set default settings for the socket options

@@ -26,0 +30,0 @@ utils.setIntegerParameter(this.socketOptions, 'timeout', 0);

@@ -13,3 +13,5 @@ var utils = require('./connection_utils'),

// Store all socket options
this.socketOptions = socketOptions ? socketOptions : {host:'localhost', port:27017};
this.socketOptions = socketOptions ? socketOptions : {host:'localhost', port:27017, domainSocket:false};
// Set keep alive default if not overriden
if(!this.socketOptions.keepAlive && process.platform !== "sunos") this.socketOptions.keepAlive = 100;
// Id for the connection

@@ -19,2 +21,4 @@ this.id = id;

this.connected = false;
// Set if this is a domain socket
this.domainSocket = this.socketOptions.domainSocket;

@@ -87,3 +91,8 @@ //

// Create new connection instance
this.connection = net.createConnection(this.socketOptions.port, this.socketOptions.host);
if(!this.domainSocket) {
this.connection = net.createConnection(this.socketOptions.port, this.socketOptions.host);
} else {
this.connection = net.createConnection(this.socketOptions.host);
}
// Set options on the socket

@@ -128,4 +137,7 @@ this.connection.setTimeout(this.socketOptions.connectTimeoutMS != null ? this.socketOptions.connectTimeoutMS : this.socketOptions.timeout);

var binaryCommand = command[i].toBinary()
if(!this.socketOptions['disableDriverBSONSizeCheck'] && binaryCommand.length > this.maxBsonSize) return callback(new Error("Document exceeds maximal allowed bson size of " + this.maxBsonSize + " bytes"));
if(this.logger != null && this.logger.doDebug) this.logger.debug("writing command to mongodb", binaryCommand);
if(!this.socketOptions['disableDriverBSONSizeCheck'] && binaryCommand.length > this.maxBsonSize)
return callback(new Error("Document exceeds maximal allowed bson size of " + this.maxBsonSize + " bytes"));
if(this.logger != null && this.logger.doDebug)
this.logger.debug("writing command to mongodb", binaryCommand);
var r = this.writeSteam.write(binaryCommand);

@@ -135,4 +147,8 @@ }

var binaryCommand = command.toBinary()
if(!this.socketOptions['disableDriverBSONSizeCheck'] && binaryCommand.length > this.maxBsonSize) return callback(new Error("Document exceeds maximal allowed bson size of " + this.maxBsonSize + " bytes"));
if(this.logger != null && this.logger.doDebug) this.logger.debug("writing command to mongodb", binaryCommand);
if(!this.socketOptions['disableDriverBSONSizeCheck'] && binaryCommand.length > this.maxBsonSize)
return callback(new Error("Document exceeds maximal allowed bson size of " + this.maxBsonSize + " bytes"));
if(this.logger != null && this.logger.doDebug)
this.logger.debug("writing command to mongodb", binaryCommand);
var r = this.writeSteam.write(binaryCommand);

@@ -139,0 +155,0 @@ }

@@ -478,9 +478,7 @@ var Connection = require('./connection').Connection,

// Make sure we have the right reference
if (self._state.addresses[instanceServer.host + ":" + instanceServer.port] != instanceServer) {
// Close the connection before deleting
if(self._state.addresses[instanceServer.host + ":" + instanceServer.port])
self._state.addresses[instanceServer.host + ":" + instanceServer.port].close();
}
var oldServer = self._state.addresses[userProvidedServerString]
if (oldServer && oldServer !== instanceServer) oldServer.close();
delete self._state.addresses[userProvidedServerString];
delete self._state.addresses[instanceServer.host + ":" + instanceServer.port];
if (self._state.addresses[me] && self._state.addresses[me] !== instanceServer) self._state.addresses[me].close();
self._state.addresses[me] = instanceServer;

@@ -487,0 +485,0 @@

@@ -32,2 +32,7 @@ var Connection = require('./connection').Connection,

if(!(this instanceof Server)) return new Server(host, port, options);
// Ensure correct values
if(port != null && typeof port == 'object') {
options = port;
port = Connection.DEFAULT_PORT;
}

@@ -296,3 +301,3 @@ var self = this;

// chained is for findAndModify as it does not respect write concerns
if(callbackInfo && callbackInfo.callback && Array.isArray(callbackInfo.info.chained)) {
if(callbackInfo && callbackInfo.callback && callbackInfo.info && Array.isArray(callbackInfo.info.chained)) {
// Check if callback has already been fired (missing chain command)

@@ -384,3 +389,3 @@ var chained = callbackInfo.info.chained;

});
} else if(callbackInfo && callbackInfo.callback) {
} else if(callbackInfo && callbackInfo.callback && callbackInfo.info) {
// Parse the body

@@ -387,0 +392,0 @@ mongoReply.parseBody(message, connectionPool.bson, callbackInfo.info.raw, function(err) {

@@ -40,7 +40,8 @@ var QueryCommand = require('./commands/query_command').QueryCommand,

* @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.
* @param {Boolean} exhaust have the server send all the documents at once as getMore packets.
* @param {Boolean} partial have the sharded system return a partial result from mongos.
*/
function Cursor(db, collection, selector, fields, skip, limit
, sort, hint, explain, snapshot, timeout, tailable, batchSize, slaveOk, raw, read
, returnKey, maxScan, min, max, showDiskLoc, comment, awaitdata, numberOfRetries, dbName, tailableRetryInterval, exhaust) {
, returnKey, maxScan, min, max, showDiskLoc, comment, awaitdata, numberOfRetries, dbName, tailableRetryInterval, exhaust, partial) {
this.db = db;

@@ -73,2 +74,3 @@ this.collection = collection;

this.exhaust = exhaust || false;
this.partial = partial || false;

@@ -422,2 +424,6 @@ this.totalNumberOfRecords = 0;

if(self.partial) {
queryOptions |= QueryCommand.OPTS_PARTIAL;
}
// limitValue of -1 is a special case used by Db#eval

@@ -664,18 +670,6 @@ var numberToReturn = self.limitValue == -1 ? -1 : limitRequest(self);

/**
* 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
* @ignore
*/
Cursor.prototype.streamRecords = function(options) {
console.log("[WARNING] streamRecords method is deprecated, please use stream method which is much faster");
var args = Array.prototype.slice.call(arguments, 0);

@@ -682,0 +676,0 @@ options = args.length ? args.shift() : {};

{ "name" : "mongodb"
, "description" : "A node.js driver for MongoDB"
, "keywords" : ["mongodb", "mongo", "driver", "db"]
, "version" : "1.1.7"
, "version" : "1.1.8"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"

@@ -55,3 +55,4 @@ , "contributors" : [ "Aaron Heckmann",

"John Le Drew",
"Lucasfilm Singapore"]
"Lucasfilm Singapore",
"Roman Shtylman"]

@@ -63,3 +64,3 @@ , "repository" : { "type" : "git"

, "dependencies" : {
"bson": "0.1.3"
"bson": "0.1.4"
}

@@ -66,0 +67,0 @@ , "devDependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc