New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

brainy-sync

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brainy-sync - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

src/mongodb/collection.js

2

package.json

@@ -7,3 +7,3 @@ {

"version": "0.0.3",
"version": "0.0.4",
"main": "./src/index",

@@ -10,0 +10,0 @@

if (typeof define !== 'function') { var define = require('amdefine')(module); }
define([
'mongodb',
'underscore',
'./collection',
'./model'
], function(mongodb, _, cSync, mSync) {
define(function() {
var Server = mongodb.Server,
Db = mongodb.Db;
return function(adapter_name, config) {
var adapter = require('./' + adapter_name + '/index');
return adapter(config);
};
return function(config) {
var host = config.host,
port = config.port,
name = config.name,
connection = new Server(host, port);
var client = new Db(name, connection, {
w: 1
});
client.open(function(err, client) { });
return function(method, resource, options) {
var is_collection = resource.models,
name = resource.urlRoot || resource.url,
sync = is_collection? cSync: mSync,
attrs = options.attr || _.extend(resource.toJSON(options), options.data || {});
var success = options.success;
options.success = function(resp) {
if (success) success(resource, resp, options);
resource.trigger('sync', resource, resp, options);
};
var error = options.error;
options.error = function(status) {
if (error) error(resource, status, options);
resource.trigger('error', resource, status, options);
};
var params = {
// capped: true,
// size: 100000
};
(function(name, attrs, options) {
client.createCollection(name, function(err, collection) {
sync[method](collection, attrs, options);
});
})(name, attrs, options);
resource.trigger('request', resource, null, options);
};
}
});
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