Comments (7)
We have the same problem over here.
Actually this can be solved with a smart collection of sub-documents, with a one-to-many relationship between the parent document and the sub-documents, by implementing the json-api.
The "id" of each subdocument should contain both the the id of the parent document and the id of the sub-document to avoid collisions between two sub-documents with the same id that reside in two different parent documents. This can be skipped if the sub-documents' ids are unique (i.e. when they are autogenerated by mongoose). Also, each subdocument should have a reference to its exactly-one parent document, and an index for its position inside the parent document array.
The references themselves the be implemented with Liana smart relationships.
Paging can also be a non-trivial because of the ordering. It could be solved by sorting the subdocuments first by the parent-id and then by their own subdocument-id.
Flattening all the models could annoying, especially if you are actually modeling a tree structure, i.e. "Project" containing an array of "Sections", containing an array of "Tasks". This is one of the greatest advantages of NoSql - you can simply load the document with Robo3t or other clients, load the document, and see the tree-structure without needing to write code for populating all the arrays of references.
from forest-express-mongoose.
Hi @Listu, we'll look at your issue next week!
from forest-express-mongoose.
Hey @Listu we were wondering if you could give us a sample of data you had in your database. A Society document with the embedded members. Thanks !
from forest-express-mongoose.
Of course @root-io
Hope it helps !
`
{
"_id" : ObjectId("5b8fde138e931929505a087a"),
"updatedAt" : ISODate("2018-09-17T09:11:03.086Z"),
"createdAt" : ISODate("2018-09-05T13:45:56.398Z"),
"name" : "SPT",
"address" : {
"place_id" : "ChIJfXRynsNv5kcRZ9ypL-zaaoI",
"country" : "France",
"city" : "Paris",
"area" : "Paris",
"street" : "37 Rue Marbeuf",
"postal_code" : "75008",
"coordinates" : [
48.86967500000001,
2.305317000000059
],
"_id" : ObjectId("5b8fde138e931929505a0882")
},
"invitations" : [ ],
"status" : 0,
"stripe" : "**************",
"billingFrequency" : 2,
"billings" : [
{
"_id" : ObjectId("5b8fde138e931929505a0878"),
"address" : {
"place_id" : "ChIJfXRynsNv5kcRZ9ypL-zaaoI",
"country" : "France",
"city" : "Paris",
"area" : "Paris",
"street" : "37 Rue Marbeuf",
"postal_code" : "75008",
"coordinates" : [
48.86967500000001,
2.305317000000059
],
"_id" : ObjectId("5b8fde138e931929505a0879")
},
"nic" : "63214",
"siren" : "123654789",
"capital" : 15000,
"raison" : "SPT",
"service" : null
},
{
"_id" : ObjectId("5b9f6ee870be0f42d0a0384e"),
"address" : {
"place_id" : "ChIJfXRynsNv5kcRZ9ypL-zaaoI",
"city" : "Paris",
"area" : "Paris",
"country" : "France",
"postal_code" : "75008",
"street" : "37 Rue Marbeuf",
"coordinates" : [
48.86967500000001,
2.305317000000059
],
"_id" : ObjectId("5b9f6ee870be0f42d0a0384f")
},
"capital" : 10000,
"nic" : "12355",
"siren" : "123456789",
"raison" : "TEST",
"service" : "Yolo"
}
],
"members" : [
{
"updatedAt" : ISODate("2018-09-05T13:45:56.396Z"),
"createdAt" : ISODate("2018-09-05T13:45:56.396Z"),
"user" : ObjectId("5b8fde128e931929505a085d"),
"billing" : ObjectId("5b8fde138e931929505a0878"),
"politic" : {
"_id" : ObjectId("5b8fdd468e931929505a0776"),
"rental" : {
"maxprice" : 100
},
"price" : {
"min" : 0,
"max" : 500,
"_id" : ObjectId("5b8fdd468e931929505a0777")
},
"stars" : {
"min" : 1,
"max" : 5,
"_id" : ObjectId("5b8fdd468e931929505a0778")
}
},
"_id" : ObjectId("5b8fde138e931929505a087b"),
"roles" : [
"executive"
]
},
{
"updatedAt" : ISODate("2018-09-17T09:11:03.085Z"),
"createdAt" : ISODate("2018-09-17T09:10:52.029Z"),
"user" : ObjectId("5b9f6f9b70be0f42d0a03881"),
"politic" : {
"flight" : {
"price" : {
"max" : 1100,
"min" : 0
},
"class" : "business"
},
"_id" : ObjectId("5b9f6fa770be0f42d0a03aac"),
"rental" : {
"maxprice" : 100
},
"price" : {
"min" : 0,
"max" : 500,
"_id" : ObjectId("5b9f6fa770be0f42d0a03aad")
},
"stars" : {
"min" : 2,
"max" : 5,
"_id" : ObjectId("5b9f6fa770be0f42d0a03aae")
}
},
"billing" : ObjectId("5b9f6ee870be0f42d0a0384e"),
"_id" : ObjectId("5b9f6f9c70be0f42d0a03888"),
"roles" : [
"traveler"
]
}
],
"__v" : 1
}
`
from forest-express-mongoose.
Hi @Listu, this is currently a limitation of our platform.
In the case of arrays of embedded document that contain only keys/values with a "single depth level", these arrays will appear in the "Related Data" section.
For more complex documents in embedded arrays, as the edition may be very complex, we display a JSON field to manipulate the data. This is clearly not an ideal usage, but at least you can read and manipulate the data. We definitely need to work on this.
from forest-express-mongoose.
Ok so we have to change our model, wait an improvement or dev our own dashboard. Thank you for the help.
from forest-express-mongoose.
Any news on this ?
from forest-express-mongoose.
Related Issues (20)
- TypeError: Class constructor ObjectId cannot be invoked without 'new' HOT 4
- export ResourceSerializer in type definition
- Forest Admin UI incorrectly display nested field HOT 2
- Smart Ations fields hooks endpoint cannot authenticate HOT 5
- Is this still supported? HOT 2
- Update document example from documentation doesn't seem to work HOT 1
- TypeError: RecordsRemover is not a constructor HOT 3
- Forest Admin Dashboard display mongoose mixed data type as [object,object]
- Forestadmin with Typescript project and MongoDB Atlas Free Plan
- Should be able to specify location of .forestadmin-schema.json HOT 1
- Non-Date types that store Date values cannot be rendered as a time-based Chart HOT 1
- Nested Enum types do not have values in the schema and crash the Create page in the UI HOT 7
- Smart relationship does not query the route HOT 4
- Smart actions - primaryKeys not generated in forestadmin schema HOT 2
- Smart Relationships are all empty in 7.8.4 and after
- Weird behaviour with certain model names HOT 1
- Having trouble connecting HOT 2
- Impossible to delete values in array field
- Can't user react components for smart views
- Vulnerability Notice on moment-timezone. HOT 1
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 forest-express-mongoose.