5 AnswersNew Answer
Lisa F In MongoDB, these would be stored as collections named: - Users - Posts The Users collection would store documents containing information related to the User. The JSON structure would likely contain simple one-to-one attributes /properties like first_name, last_name, email, and password. It could also contain nested objects and arrays denoting one-to-many relationships like addresses and phone_numbers. The addresses and phone_numbers would be arrays of corresponding objects. The Posts collection would likewise contain data related to post content as well as a reference id to some user_id matched to a document in the Users collection.
A document is an integral part of how document-oriented nosql works. noSQL stores data as key, value pairs. Values are stored as a document. Usually in json.
let's go with a common example. a web app that tracked information about a user and also posts that the user makes. in a relational database you'd have two obvious tables...users and posts...one user can make many posts... how would you handle that in a document nosql database given the posts need to be identified with their user but happen over a period of time? Kail Galestorm
Hmmm not quite. If you think of it in terms of an object, a relational database will store an object across several tables. If you have an inventory object, for instance, you may have a product table, make table, detail table ect. One inventory object would be stored across all of those tables. In document oriented database each object would be stored in one document and each object can be different. Say you have an inventory item that is a banana and one that is a car. These would be difficult to capture in a relational db be cause the common fields between them would be few. In a document db there's no problem. I'm not an expert and it's a poor explanation but maybe that helps.
https://www.w3resource.com/mongodb/databases-documents-collections.php David Carroll tyty. I found this link very helpful too as it compares the terminology we use in relational databases to mongodb nosql databases. I now understand that a document means an object. a collection is a number of documents. thanks for helping me bridge this big difference in thinking about how to collect, store, and retrieve data. I am not clear on why nosql is insistent on using the word document vs object but it really helped me to understand that's what is meant by "document"