I have some data that look like this:
[ { "_id" : ObjectId("4e2f2af16f1e7e4c2000000a"), "advertisers" : [ { "created_at" : ISODate("2011-07-26T21:02:19Z"), "category" : "Infinity Pro Spin Air Brush", "updated_at" : ISODate("2011-07-26T21:02:19Z"), "lowered_name" : "conair", "twitter_name" : "", "facebook_page_url" : "", "website_url" : "", "user_ids" : [ ], "blog_url" : "", },
and I thought that such a query would give the advertiser ID:
var start = new Date(2011, 1, 1); > var end = new Date(2011, 12, 12); > db.agencies.find( { "created_at" : {$gte : start , $lt : end} } , { _id : 1 , program_ids : 1 , advertisers { name : 1 } } ).limit(1).toArray();
But my request did not work. Any idea how I can add fields inside nested elements to the list of fields I want to get?
Thank!
mongodb
Genadinik Jun 04 2018-12-12T00: 00Z
source share