rapidfacture / mongoose-multi Goto Github PK
View Code? Open in Web Editor NEWNPM Module: Create Mongoose connections to severals DBs; short, mongoDB like syntax for requests.
NPM Module: Create Mongoose connections to severals DBs; short, mongoDB like syntax for requests.
The file index.js
line 105:
connections[name] = mongoose.createConnection(url, options);
Causing the following warning:
the server/replset/mongos options are deprecated, all their options are supported at the top level of the options object [poolSize,ssl,sslValidate,sslCA,sslCert,sslKey,sslPass,sslCRL,autoReconnect,noDelay,keepAlive,keepAliveInitialDelay,connectTimeoutMS,family,socketTimeoutMS,reconnectTries,reconnectInterval,ha,haInterval,replicaSet,secondaryAcceptableLatencyMS,acceptableLatencyMS,connectWithNoPrimary,authSource,w,wtimeout,j,forceServerObjectId,serializeFunctions,ignoreUndefined,raw,bufferMaxEntries,readPreference,pkFactory,promiseLibrary,readConcern,maxStalenessSeconds,loggerLevel,logger,promoteValues,promoteBuffers,promoteLongs,domainsEnabled,checkServerIdentity,validateOptions,appname,auth,user,password,authMechanism,compression,fsync,readPreferenceTags,numberOfRetries,auto_reconnect,minSize,monitorCommands,retryWrites]
In order to fix we need to update the server
in the options (move it to top level).
Node 8.9.4
NPM 5.6.0
I am currently doing...
db.{db_name}.mongooseConnection.close();
is that the right way?
if my collection is Settings dont work and if is settings works OK,
schema.js WORKS OK!
module.exports = {
settings: new Schema( { // collection
options: {type: Array, required: false},
})
}
->db.app.settings.find({}).exec((err, data)) DATA has value
in mongodb collection name is **settings**
schema.js DOESN`T WORK
module.exports = {
Settings: new Schema( { // collection
options: {type: Array, required: false},
})
}
->db.app.Settings.find({}).exec((err, data)) DATA is empty
in mongodb collection name is **Settings**
I have 2 connections and when I disconnect I get the following message and a long pause before I get the shutting down message. How can I close the connections and shutdown immediately?
[mongoose-multi] DB local disconnected, mongodb://*******************************************
[mongoose-multi] DB global disconnected, mongodb://********************************************
........(long pause...)
[mongoose-multi] shutting down application for restart: Try to reconnet DB.
Hi,
I am getting this error when I have embedded documents.
my schema file looks like this where I have a labelSchema and customerSchema has a field which is array of labelSchema:
when I try to create a document of type customer in application database I get the error above,
this has something to do with embedded schema for embedded docs, if I just defined the CustomerSchema with labels as nested path instead
it works,
Hi! I get this simple warning knowing (I think) for all of us:
(node:30216) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
I cant find any solution for this warning. Can anyone help with this?
Thanks.
Versions:
"mongoose": "^5.3.1"
"mongoose-multi": "^0.4.2"
Other dependecies:
"ini": "^1.3.5",
"uuid": "^3.3.2",
"ws": "^6.0.0"
I am trying to run mongoose-multi\example\production
this example then i am getting below error
D:\Demos\multimongoose1>node example.js
D:\Demos\multimongoose1\node_modules\mongoose-multi\index.js:85 startConnection(conName, url, schemaFile[conName], options);
^ TypeError: Cannot read property 'application' of undefined at Object.module.exports.start (D:\Demos\multimongoose1\node_modules\mongoose-multi\index.js:85:47) at Object.<anonymous> (D:\Demos\multimongoose1\example.js:20:24) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Function.Module.runMain (internal/modules/cjs/loader.js:741:12) at startup (internal/bootstrap/node.js:285:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
log.critical('tried extract schemas, please Check your Schema folder, an error occured: ' + error);
^
TypeError: log.critical is not a function
at Object.module.exports.start (/hassan/webapps/dizio/dizio-node/node_modules/mongoose-multi/index.js:63:14)
at Object. (/hassan/webapps/dizio/dizio-node/scripts/multidbtest.js:6:22)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
Db.prototype.authenticate method will no longer be available in the next major release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple credentials on a socket. Please authenticate using MongoClient.connect with auth credentials.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.