Вопрос по mongodb – MongoDB - как запросить вложенный элемент внутри коллекции?

54

Error: User Rate Limit Exceeded

[
    {
        "_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" : "",
            },

Error: User Rate Limit Exceeded

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();

Error: User Rate Limit Exceeded

Спасибо!

Ваш Ответ

3   ответа
96

Error: User Rate Limit Exceededadvertisers.nameError: User Rate Limit Exceeded

db.agencies.find({
 "advertisers.created_at": {
   $gte: start,
   $lt: end
  }
 },
{
 _id: 1,
  program_ids: 1,
  "advertisers.name": 1
 }
}).limit(1).toArray();

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded
Все под данными в вопросе. То есть Условия неправильные
2

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

    "_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" : "",
        },
        { ... }

Error: User Rate Limit Exceededadvertisers.created_atError: User Rate Limit Exceeded

db.agencies.find( { 'advertisers.created_at' : { {$gte : start , $lt : end} ... }
Error: User Rate Limit Exceededadvertisers { name : true }Error: User Rate Limit Exceeded
3
db.agencies.find( 
{ "advertisers.created_at" : {$gte : start , $lt : end} } , 
{ program_ids : 1 , advertisers.name : 1   } 
).limit(1).pretty();
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded

Похожие вопросы