I’m new to MongoDB. I’m trying to design my DB but i dont understand if this makes sense.
I have my data currently saved in a json and it is like this: (see end of msg)
Is MongoDB the right DB for me?
When I try to search for a device id it returns me all of the info of that user (query: {“devices.id”: 1} ) and I only wanted to receive the device object.
Note: i have several users and as of now i have my DB organized like this
Thanks in advance
AppDB (Database)
user1@email-com (colection)
user2@email-com (colection)
user3@email-com (colection)
…
{
"email": "user1@email-com",
"name": "user1",
"password": "",
"devices": [
{
"id": 1,
"type": "XXX",
...
},
{
...
},
],
"cards": {
"pc": [
[
{
"i": "0",
"x": 0,
"y": 0,
"w": 1,
"h": 2
},
{
...
},
],
[
...
],
],
"mobile": [
[
{
"i": "0",
"x": 0,
"y": 0,
"w": 1,
"h": 2
},
{
...
},
]
],
"tablet": [
...
],
},
"notifications": [
{
"id": 0,
"msg": "hello world"
},
{
...
},
]
}