--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/ZCrH0sPrfv8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/b0d65491-01ae-4254-9013-a6b5b22badb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
{ file_type: "alice", data: "morealica", stuff: "junk", myid: 1 }, { file_type: "bob", other: "diffbob", myid: 1}, { file_type: "charlie", stuff: "charliestuff", myid: 1} { file_type: "alice", data: "morelica", stuff: "diffjunk", myid: 2}, { file_type: "bob", other: "whatbob", myid: 2} { file_type: "charlie", stuff:"nocharlie", myid: 2}
db.collection.aggregate([
{$match:{"file_type":"alice"}},
{$group:{_id:"$stuff", count:{$sum:1}}}
]);
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
{ data: "morealica", stuff: "junk", more_data : // i do not need "file_type: alice" here
[
{ file_type: "bob", other: "diffbob"},
{ file_type: "charlie", stuff: "charliestuff"}, {}, ....]}
in sql I would have one table for alice and use alice's key as foreign key in an other table that has the data for bob, charlie, ...
# TABLE
alice_key foreign key,
int type, bob, charlie, doris,...
varchar key,
varchar value
where type is bob, charlie then index on alice_key and type with another index on key
but i did not know if that was mongo correct.
Each file_type has different keys and unknown number of key-value pairs.
The searching in mongo of this schema is still beyond my understand at this time.
thanks