1

For e.g. take a multiplication table similar to this https://www.mathsisfun.com/tables.html

Now I want to find out the multiplication of two numbers, lets say 7 and 9. what I will do is look for 7 in first column(or 7th row) and traverse that row until i'm at 9th column. and simply pick that value. thats exactly I want to do in mongoengine but not sure how to represent best so that I can query easily given both values(i.e. 7 and 9).

I know how to do it in SQL How to represent a 2-D data matrix in a database

Just wondering if NoSQL provides any other advantage that can simplify the schema as well easily query-able.

I can use ListField but I dont think I can query on that? I mean find a specific element efficiently without traversing whole list.

PS: multiplication table is just an example. I mean their could be a matrix of distance between two cities. in that case two input I will provide in my query would be city1 and city2. e.g.

d = CityDistance.objects.get(departure=city1, arrival=city2)
d.distance
Community
  • 1
  • 1
Wendy
  • 1,523
  • 3
  • 12
  • 16

0 Answers0