Comments (9)
I'm sorry but I don't understand the relation of this issue with this project.
from memored.
i want to save this object in my cluster... but nothing result
from memored.
Could you provide more info about your problem?
What are all those require statements resolve to?
Bear in mind that you're trying to store something in a distributed cache system that rquires all cached values are serializable.
If you're trying to store functions, I'm not sure I understand what you're trying to accomplish.
from memored.
I want to save all mongoose model in a memory to use it every where...
in my program user make mongodb collection and i want save his model on memory that every core of cpu can use it...
from memored.
You're not supposed to store a Mongoose model into any cache system. If you want to store an instance of that model (the result of a query, for instance) you should serialize that instance (or instances) to a plain object (for example) and store that serialized object.
Remember that require acts as a singleton and only one instance of a required dependency is used in a nodejs process. It doesn't make sense to cache something that only exists once.
from memored.
how can i serialize it?
{
DefaultFlow: ƒ model(doc, fields, skipId)
$__insertMany: ƒ ()
$appliedHooks: true
$appliedMethods: true
$caught: true
$init: Promise {<resolved>: ƒ}
Query: ƒ ()
base: Mongoose {connections: Array(1), models: {…}, modelSchemas: {…}, options: {…}, _pluralize: ƒ, …}
collection: NativeCollection {collection: null, Promise: ƒ, opts: {…}, name: "defaultFlow", collectionName: "defaultFlow", …}
db: NativeConnection {base: Mongoose, collections: {…}, models: {…}, config: {…}, replica: false, …}
discriminators: undefined
events: EventEmitter {_events: {…}, _eventsCount: 0, _maxListeners: undefined}
hooks: Kareem {_pres: Map(8), _posts: Map(2)}
model: ƒ model(name)
modelName: "DefaultFlow"
paginate: ƒ paginate(query, options, callback)
schema: Schema {obj: {…}, paths: {…}, aliases: {…}, subpaths: {…}, virtuals: {…}, …}
Symbol(mongoose#Model): true
_middleware: Kareem {_pres: Map(7), _posts: Map(2)}
arguments: (...)
caller: (...)
length: 3
name: "model"
prototype: Model {db: NativeConnection, discriminators: undefined, …}
__proto__: ƒ Model(doc, fields, skipId)
[[FunctionLocation]]: model.js:4386
[[Scopes]]: Scopes[2]
Message: ƒ model(doc, fields, skipId)
Process: ƒ model(doc, fields, skipId)
Task: ƒ model(doc, fields, skipId)
Workflow: ƒ model(doc, fields, skipId)
}
JSON.stringify() not support it
from memored.
Again, I'm not sure what you're trying to achieve, but if you want to store a result from a database query, I guess you should use this Mongoose methods:
from memored.
in my application, users make and delete its own collection and filds...
i want to collect all mongoose model in one variable...
before i go on cluster every thing was good...
//model.js ==>
module.exports={
DefaultFlow: require('./shared/defaultFlow/defaultFlow'),
DefaultFlowChild: require('./shared/defaultFlow/defaultFlowChild'),
User: require('./auth/user'),
Task: require('./shared/Task/task'),
....
}
//in index.js==>
let model=require('./model);
model['Task'].findOne()...
model['User'].findOne()
i could change the model and push it any other model....
model[dynaCollection]=mongoose.model('dynaCollection');
but after i go on cluster... :(
i force to store all my models in sharing memory ...
because all core of cpu should know about the models of application...
unfortunately i cant do this and cant find any module to serialize model.js
from memored.
can you please help me
from memored.
Related Issues (11)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memored.