Giter VIP home page Giter VIP logo

Comments (4)

tywalch avatar tywalch commented on June 4, 2024 1

@aisflat439 I checked out your Playground (thank you for doing that btw, it is very helpful) and it looked like the error was that the product entity referenced warehouseId as a composite attribute but warehouseId was not defined in attributes. I changed that, and removed the export keywords (the playground doesn't like those right now) and everything is now running just fine:

https://electrodb.fun/?#code/PQKgBAsg9gJgpgGzARwK5wE4Es4GcA0YuccYGeqCALgUQBYCG5YA7llXWAGbZwB2MXGBDAAUKKwBbAA5QMVMAG8wAUT5V2AT0IBlTADcsAY1IBfbhiiSwAIkRwjVSzABGNgNzijUPrgVUGFwRSAF5bTShUDAB9AKC4aL4GSTgPLx8-MAAFZ1RHNQ0qTTAwvjgWVXUtAAowUTAleoawSVhEAC5G5ub9TFwsH06bAEYbfCbu-kLNIZzYPKoxiebiDEMTIbl4DFwl7tNx7oYqJywXVCo8TsVlhpYmODpI4gBJGGvb5qLpOCG-bD4AHM9t0wAdPtJco43h9QV9ND8-qcgSC4eQ0FhyO8wE50IdQeC4UkUrC4TiEb9bP8sCj8Wi4BisZ1cXA6c1CaD4LgjNhpBpBl0yd9KTZqbTPhzupDjJSbmTyYjbHxUJIXJhUey2Q1vKh1KS4cKhsrVeqtWC2ZKwDT4AAPK6C7rAYA4uhYIQIN00MCQ+aOXCfBpOq1UADkQikPwwXAcCnOCigAGsGJoIVCaPrQdIExm4VwcAhsTYsxq4d4ZFB+pdOgBtAC6Zoalu6uGzDrJecQhZbJdBZdklcp1aLabeNnrAbBErN93IT1QxDmMAWuBzzW8CGCjgGfCGM8ezzgi+XPYa1rgNqGgP6owb3tbcvl3HzhavWGGxdv2qs-fYg5se7nV4YDHW8mxWe8JwaDsC0va9u0-MA+wrX8a2HX0qFHcd5VMKdlhwxt8UUOJgnBABKdJfAUAB1B5ALgAotBKMAygqBiilqJoHwaVp4AQVdeh2bchhvT4pi0IYaNnA8e1WdYRS2PoNUtY5Tjje0uOaACDxhNtukNKlkWBW90VQTE4GxFkzTA4lZQnfTRUMk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7IOSTCpaYqk1OIMgsGJ0YkjyiRhGApF3BAA

Can you verify if this is what you'd expect?

from electrodb.

tywalch avatar tywalch commented on June 4, 2024

I can take a look at this more closely tonight 👍

from electrodb.

aisflat439 avatar aisflat439 commented on June 4, 2024

Thanks in advance! I think what I need is to create a service to manage the join.

from electrodb.

squio avatar squio commented on June 4, 2024

Just to chime in ... this is actually very helpful for me getting started with M2M relations, maybe this should be part of the documentation some time?

Also a question: I have almost the same situation BUT need to query on warehouseId to retrieve a single warehouse so I swapped the sk and pk as in this snippet:

const WarehouseEntity = new Entity( 
  // ...
  indexes: {
      warehouses: {
        collection: "warehouses",
        pk: {
          field: "pk",
          composite: ["warehouseId"],
        },
        sk: {
          field: "sk",
          composite: [],
        }
      },
  // ...
});

And then the very basic function:

async function getWarehouse(warehouseId: string) {
  return await WarehouseEntity.get({ warehouseId }).go();
}

Now my question: is this indeed the right approach for this access pattern or doesn't it matter at all?

from electrodb.

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.