Giter VIP home page Giter VIP logo

Comments (10)

d0whc3r avatar d0whc3r commented on June 11, 2024 2

any workaround? do I need to create 1 service per table and communicate with each other?

from moleculer-db.

mradkov avatar mradkov commented on June 11, 2024 1

+1 Yeah, this is a key feature, that needs to be added.

from moleculer-db.

b0bben avatar b0bben commented on June 11, 2024 1

Any news on this?

from moleculer-db.

Hexenon avatar Hexenon commented on June 11, 2024

is it still open?

from moleculer-db.

icebob avatar icebob commented on June 11, 2024

Yes, but it won't be implemented in this version of moleculer-db.

from moleculer-db.

tobydeh avatar tobydeh commented on June 11, 2024

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.

JS-AK avatar JS-AK commented on June 11, 2024

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.

cavinpabua avatar cavinpabua commented on June 11, 2024

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.

truesteps avatar truesteps commented on June 11, 2024

Is it possible with the sequelize adapter? Maybe show us what's inside the .model file?

from moleculer-db.

JS-AK avatar JS-AK commented on June 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.