Comments (10)
any workaround? do I need to create 1 service per table and communicate with each other?
from moleculer-db.
+1 Yeah, this is a key feature, that needs to be added.
from moleculer-db.
Any news on this?
from moleculer-db.
is it still open?
from moleculer-db.
Yes, but it won't be implemented in this version of moleculer-db.
from moleculer-db.
Im happy to take a look at implementing this. I don't think it's too difficult but we would need to decide how to change the api for update / find / delete etc.
@icebob do you have any ideas on how the interface should work?
from moleculer-db.
with modules
moleculer-db
moleculer-db-adapter-mongoose
u can make one service with multiple tables like this
const DbService = require("moleculer-db");
const MongooseAdapter = require("moleculer-db-adapter-mongoose");
const { MONGO_DB_URI } = process.env
const User = require("../model/user.model");
const Post = require("../model/post.model");
/*
...
*/
module.exports = {
adapter: new MongooseAdapter(MONGO_DB_URI),
mixins: [DbService],
model: {
User,
Post,
},
// and handle in this service in customHandle action
actions: {
customHandle: {
async handler(ctx) {
const { User, Post } = this.adapter.model;
const [users, posts] = await Promise.all([User.find(), Post.find()]
return { users, posts };
}
}
}
from moleculer-db.
Can we have a sneak peek with what's inside:
const User = require("../model/user.model");
I'm having the same problem. @JS-AK
from moleculer-db.
Is it possible with the sequelize adapter? Maybe show us what's inside the .model
file?
from moleculer-db.
Can we have a sneak peek with what's inside:
const User = require("../model/user.model");
I'm having the same problem. @JS-AK
const mongoose = require("mongoose");
const schema = new mongoose.Schema({
email: {type: String},
firstName: {type: String},
}, {timestamps: true});
module.exports = mongoose.model("User", schema);
from moleculer-db.
Related Issues (20)
- I can't query or in SQL SERVER. Please help me
- "server instance pool was destroyed" in a persistence service with mongo when mongo db restarts HOT 2
- issue with #235 HOT 4
- How to use mongoose transaction in moleculer-db-adapter-mongoose? HOT 1
- sequelize adapter: Returns an object with undefined _id if idField is not explicitly set HOT 1
- [Mongoose V7] : Connection.prototype.close() no longer accepts a callback HOT 2
- [SECURITY] automatically created molecular-db actions can't be authenticated HOT 3
- Virtuals with reference are not populated when using mongoose adapter HOT 1
- Bluebird library for promise management shouldn't be used anymore HOT 1
- Wrong SequelizeDbAdapter constructor argument type HOT 1
- Sequelize: What is the value of counting DISTINCT on a primary key? HOT 5
- Potential error in updateById and Mongoose adapter HOT 1
- [Mongoose adapter] Error in the log when starting two or more services HOT 4
- How to make upsert operation with moleculer db? HOT 1
- Redundant code HOT 1
- Irrelevant fields are not removed during creation HOT 1
- Custom Sequelize Datataype HOT 1
- Case insensitive search [moleculer-db-adapter-sequelize] HOT 1
- how to rewrite actions like insert/update HOT 1
- mongoose adapter trouble with connect HOT 15
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 moleculer-db.