mongoose Mongodb schema (nodejs) One to many Mapping - mongodb

Hi i am new to mongodb
I have the following requirement for a music library application
I need to design this tabular data into mongoose schema
I need to query comments based on album,user
Somebody help me.Thanks in advance

Here is the detailed description for beginners on how to design mongo schemas
http://blog.mongodb.org/post/87200945828/6-rules-of-thumb-for-mongodb-schema-design-part-1

Related

Few questions about NoSQL/MongDB

I am new to NoSQL/MongoDB. Can someone please help answer a few questions. It would be very helpful if you can please reply in the same format. Thank you
Do all NoSQL databases store data in a plan text format?
Do they all store in JSON format or does mongoDB only store in JSON format?
How do you query a NoSQL/MongoDB? What tool and what languge? Example, you query Oracle SQL database with TOAD/SQL developer using the SQL language. How would you query mongoDB and with what language? Which IDE do you use?
I know learning "R" is popular. Can I query mongoDB with R?

can anyone identify the bug in this mongodb query?

can anybody identify bug in following mongodb code. I need to collect two tables as much linke JOIN in mysql. BUt I dont know how exactly do it as I am new to mongodb.
customers.aggregate([{"$unwind":"$orders"},{"$lookup":{"from":"orders","localField":"_id","foreignField":"cust_id","as":"orders"}},{"$unwind":"$orders"},{"$match":{"$and":[{"cancelled_time":{"$gte":"2019-04-06 06:01:12"},"created_at":{"$lte":"2019-06-06 06:01:12"}}]}},{"$group":{"_id":{"month":{"$month":"$created_at"}},"count":{"$sum":1}}}])
thanks
I am new to mongodb. please help
customers.aggregate([{"$unwind":"$orders"},{"$lookup":{"from":"orders","localField":"_id","foreignField":"cust_id","as":"orders"}},{"$unwind":"$orders"},{"$match":{"$and":[{"cancelled_time":{"$gte":"2019-04-06 06:01:12"},"created_at":{"$lte":"2019-06-06 06:01:12"}}]}},{"$group":{"_id":{"month":{"$month":"$created_at"}},"count":{"$sum":1}}}])
expected result would list dialogues form both collections

NoSQL for RDBMS users

I am beginners in NoSQL . I am coming from RDBMS database system. I am very confuse how to manage one to many and many to many relationship in NoSQL and database schema design I need a proper guideline where i understand the concept of relational mapping in NoSQL.
If any good book suggestion or any best tutorial .
Thanks in advance
In mongo you can create sub documents as array . Or if you are creating different collection , then you have to use lookup.
It is better to learning mongo feature using official web site. Because sometimes you get legacy code in tutorial.only you need to figure out the term to search.

Convert a relational logical schema model(in oracle) into elasticsearch nosql logical schema less

Could you please suggest me how to do a schema design(nosql) in elasticsearch.
As per my requirement we have already 'relational logical schema' (which is oracle schema) but we are building new version of software which has chosen ES as a NoSql Solution.
How to start the schema design in ES.
Thanks in advance
Regards,
Jaas
I am new on Elasticsearch and I am not sure if I got your question, but I haven't created a schema on Elasticsearch I just converted my data for json format and indexed it.

Mongodb database schema diagram

How can I create a Mongodb database schema diagram?
I read the documentation in mongodb.org, but it is was not clear for me. Maybe Someone can help me with this, i have a db with embebed documents.
While MongoDB is a schemaless database there are a couple generators out there which do a nice job of creating a json schema representation. I find it particularly useful when looking for strategies for sharding or migrating. The output is very nice and the code is easily readable. I've personally adapted it to generate HTML tables and PDFs.
https://github.com/variety/variety
MongoDB has a flexible schema. Therefore, you can not list all fields unless fetching all documents in a collection. An alternative is defining schema in some kind of data structure(struct, associative array, class or other user defined structrue) or config file and then print it in diagram format.