+ 2

What is meant by a nosql "document"?

I tend to think of a document as a specific type of file, typically a Word document. But in nosql terminology does "document" merely refer to a text file of data such as a json file format ??? ty

12th Nov 2019, 12:53 PM
Lisa F
Lisa F - avatar
5 Respostas
+ 2
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.
20th Nov 2019, 8:31 AM
David Carroll
David Carroll - avatar
+ 1
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.
12th Nov 2019, 9:15 PM
Kail Galestorm
Kail Galestorm - avatar
+ 1
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
17th Nov 2019, 1:28 PM
Lisa F
Lisa F - avatar
0
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.
16th Nov 2019, 1:23 AM
Kail Galestorm
Kail Galestorm - avatar
0
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"
22nd Nov 2019, 11:59 AM
Lisa F
Lisa F - avatar