Mongoose / Mongo structure for data map

enter image description here

Hi, I have some data and I need help finding the right data structure to display it. My goal is to have a map similar to the image above. Different physical objects will have information about latitude and longitude, but the circular radius will be determined by different statistics on each site. The user will be able to choose which data set they would like to see. Approximately 26 datasets. Only one set of places.

My data is as follows:

Locations (approximately 5000 pieces)

var locSchema = mongoose.Schema({
 name : 'string',
 siteID : 'number',
 address1 : 'string',
 address2 : 'string',
 loc: {type: [Number], index: '2dsphere'}
});

Specific data (approximately 12,000 pieces)

var dataSchema = mongoose.Schema({
  providerNumber : "number",  //The "siteID" of the site.
  date : "date",
  volume : "number",
  cost : "number",
  label : "string",  //There are 26 different stats each with a different label
  siteID : "oid"  //The oid of the site
});

My first assumption was that they should be a single collection with each piece of data stored as an array:

name : 'string',
siteID : 'number',
address1 : 'string',
address2 : 'string',
loc: {type: [Number], index: '2dsphere'},
data : [
   {
     providerNumber : "number",  //The "siteID" of the site.
     date : "date",
     volume : "number",
     cost : "number",
     label : "string",  //There are 26 different stats each with a different label
     siteID : "oid"  //The oid of the site
   },
   ...
]

, ​​ Mongoose, . , , , .

, : 1. ? 2. Mongoose? 3. - ?

+1
1

, , . , . , , . :

var schema = mongoose.Schema({
  name: String,
  siteID: Number,
  address1: String,
  address2: String
  loc: { type: [Number], index: '2dsphere' }
  date: Date,
  volume: Number,
  cost:  Number,
  label: String
});

, (, 1 ..), , , dataSchema , locSchema. // . mongo aggregation, , .

0

All Articles