Dear All,
I’m new to MongoDB. I’m trying to built query to access all the customers whose “tier” is “Bronze”. Below is the sample document. Any help is really appreciated.
Your storage of the tier_and_details seems a little strange, are you using the ID of the relationship between the two as a key?
You may be better having the tier_and_details as an array of items, each of which has the _id field (which you already have anyway).
With the data in this shape it’ll be hard to look for data as the path is different on every document, unless I’m missing something?
Dear John,
Thanks for quick support.
As mentioned earlier I’m new to MongoDB. I got the data in json file and I imported it using import utility without any errors. Hence thought this also a valid document structure.
I’ll try to fix the document structure by putting all the subdocuments as array.