MongoDB Query Questions

  mongodb, question

When writing the query, I feel that the current data structure contains an array, and now I want to match from this array and return this array to the client.
Filter out the orders that contain our restaurant’s dishes.

{
 "_id" : "xSrtZDCqJHNbAXGPe",
 "type" : "takeaway",
 "state" : "new",
 "customer" : {
 "openId" : "oFTzvsxQNk6pYeTwTsZ-mkUGTMVM",
 "name": "Zhang Haozhe",
 "mobile" : "13354261882",
 "campus": "North China University East Campus",
 "building": "Area A of the First Teaching Building",
 "room" : "301"
 },
 "items" : [
 {
 "_id" : "HEFFXf4SrpoSwm2ng",
 "name": "Pork chop rice with sauce flavor",
 "unit": "share",
 "price" : 10,
 "vendor": "Wang Ji Gourmet".
 "image" : "QjTbqCq89Gb43ER2C",
 "imageSUrl" : "/cfs/files/takeaway/QjTbqCq89Gb43ER2C/6YWx6aaZ54yq5o6S6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-s",
 "imageMUrl" : "/cfs/files/takeaway/QjTbqCq89Gb43ER2C/6YWx6aaZ54yq5o6S6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-m",
 "imageLUrl" : "/cfs/files/takeaway/QjTbqCq89Gb43ER2C/6YWx6aaZ54yq5o6S6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-l",
 "amount" : 1
 },
 {
 "_id" : "3WRCcJ68iPWsstqG4",
 "name": "Maotai-flavor braised pork rice",
 "unit": "share",
 "price" : 10,
 "vendor": "Wang Ji Gourmet".
 "image" : "bqnnFyTM6u6J2Qnjo",
 "imageSUrl" : "/cfs/files/takeaway/bqnnFyTM6u6J2Qnjo/6YWx6aaZ5Y2k6IKJ6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-s",
 "imageMUrl" : "/cfs/files/takeaway/bqnnFyTM6u6J2Qnjo/6YWx6aaZ5Y2k6IKJ6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-m",
 "imageLUrl" : "/cfs/files/takeaway/bqnnFyTM6u6J2Qnjo/6YWx6aaZ5Y2k6IKJ6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-l",
 "amount" : 2
 },
 {
 "_id" : "w4BNrrM8aWoTR2fqd",
 "name": "Pan Shaomei Pork Rice",
 "unit": "share",
 "price" : 10,
 "vendor": "Wang Ji Gourmet".
 "image" : "FqTTadroGpcieaERZ",
 "imageSUrl" : "/cfs/files/takeaway/FqTTadroGpcieaERZ/5p2_54On5qKF6IKJ6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-s",
 "imageMUrl" : "/cfs/files/takeaway/FqTTadroGpcieaERZ/5p2_54On5qKF6IKJ6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-m",
 "imageLUrl" : "/cfs/files/takeaway/FqTTadroGpcieaERZ/5p2_54On5qKF6IKJ6aWt.jpg?  token=eyJhdXRoVG9rZW4iOiJ6WlNQVEZiVnpRVmdSQUVhbnlPQVBDaDRfX0I4RDRjUTI4X3ZhdTdnZjJRIn0%3D&store=takeaway-l",
 "amount" : 1
 }
 ],
 "orderNo" : 3,
 "orderTime" : "2016-03-23 04:10:45"
 }

I want to match from this array of items.vendor, will match the successfulvendorReturn to the right merchant, for example, I matchVendor ===' Wang Ji Gourmet'Then, if the match is successful, the order will be returned to the merchant’s client so that the merchant can see what they have sold.

Ask the great gods to give a thought. sql is not very good.

I publish in meteor

Meteor.publish('orders', function() {
 Return db.yourtable.find ({'items.vendor'}, {'items' {$ elemmatch: {vendor:' wangji cuisine'}});
 });