я хочу запросить двойные вложенные даты в mongodb - PullRequest
1 голос
/ 23 сентября 2019
----------Query i have tried---------- 
db.getCollection('rates').aggregate([
{ $match: { "userId" : "5d4c4f69341b7b1746c80d13"}},
{ $unwind: '$ratewithdate.daywiserates'},{$match : {"$and" :  
    [{"ratewithdate.daywiserates.date" :{$gte :new ISODate("2019-09- 
 23T00:00:00.000Z")} },
     {"ratewithdate.daywiserates.date" :{$lte :new ISODate("2019-09- 
 27T00:00:00.000Z")}}]}}])
-------------------------------------------------------------
In My query is here i want to know the query between two dates ,i want 
get the data between two dates in the array? am unable to do that ,can 
any one send me query,
here my question is i want get the date range from given date to next 30 
days,i have tried with aggregate but data become slow..can any one suggest 
any better solution for the making query formation 
i have tried with aggregation as well find queries am not able find any 
results,my goal here is find get the data between two dates,for example 
if i selected 2019-09-23T10:43:14.239Z thi date from this date i wanna i  
want to show the data.
please send me your value able suggestions to, am not bale to query with 
double nested array queries in mongodb,please send me your value able 
suggestions to,am not bale to query with double nested array queries in 
mongodb please send me your value able suggestions to,
am not bale to query with double nested array queries in mongodb.

пожалуйста, присылайте мне свои полезные предложения, я не связываю запросы для запросов с двойным вложенным массивом в mongodb, пожалуйста, присылайте мне свои ценные предложения, я не связываю запросы с двойными вложенными массивами в mongodb, пожалуйстаПрисылайте мне свои ценные предложения, я не собираюсь запрашивать запросы с двойным вложенным массивом в mongodb

 {
     "_id" : ObjectId("5d85fec2e8652a5c20ae1bff"),
       "alloted_roomid" : [],
       "name" : "working_rate3",
       "description" : "bitcpin",
       "type" : "room",
         "value" : null,
       "inclusive" : "General",
       "refundable" : {
        "cancellationWindow" : "",
        "outsideWindowPenalty" : "",
       "insideWindowPenalty" : ""
     },
"nonRefundable" : true,
"cancellationWindow" : "",
"daysWiseRate" : "30",
"insideWindowPenalty" : "",
"outsideWindowPenalty" : "",
"deviations" : 980,
"policy" : "",
"funds" : "nonRefundable",
"vat" : 890,
"other_tax" : 90,
"roomRates" : [ 
    {
        "_id" : ObjectId("5d85fec2e8652a5c20ae1c00"),
        "roomId" : ObjectId("5d7c8f2950a6c766c64b2a46"),
        "roomName" : "Basic",
        "rate" : 9888
    }
],
"userId" : "5d4c4f69341b7b1746c80d13",
"hotelCode" : 10034,
"ratewithdate" : [ 
    {
        "_id" : ObjectId("5d85fec2e8652a5c20ae1c01"),
        "roomCategory" : "Basic",
        "roomId" : ObjectId("5d7c8f2950a6c766c64b2a46"),
        "createdAt" : ISODate("2019-09-21T10:43:14.243Z"),
        "daywiserates" : [ 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c1f"),
                "date" : ISODate("2019-09-21T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c1e"),
                "date" : ISODate("2019-09-22T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c1d"),
                "date" : ISODate("2019-09-23T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c1c"),
                "date" : ISODate("2019-09-24T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c1b"),
                "date" : ISODate("2019-09-25T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c1a"),
                "date" : ISODate("2019-09-26T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c19"),
                "date" : ISODate("2019-09-27T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c18"),
                "date" : ISODate("2019-09-28T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c17"),
                "date" : ISODate("2019-09-29T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c16"),
                "date" : ISODate("2019-09-30T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c15"),
                "date" : ISODate("2019-10-01T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c14"),
                "date" : ISODate("2019-10-02T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c13"),
                "date" : ISODate("2019-10-03T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c12"),
                "date" : ISODate("2019-10-04T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c11"),
                "date" : ISODate("2019-10-05T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c10"),
                "date" : ISODate("2019-10-06T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c0f"),
                "date" : ISODate("2019-10-07T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c0e"),
                "date" : ISODate("2019-10-08T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c0d"),
                "date" : ISODate("2019-10-09T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c0c"),
                "date" : ISODate("2019-10-10T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c0b"),
                "date" : ISODate("2019-10-11T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c0a"),
                "date" : ISODate("2019-10-12T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c09"),
                "date" : ISODate("2019-10-13T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c08"),
                "date" : ISODate("2019-10-14T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c07"),
                "date" : ISODate("2019-10-15T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c06"),
                "date" : ISODate("2019-10-16T10:43:14.239Z"),
                "rate" : 9888
            }, 
            {
                "_id" : ObjectId("5d85fec2e8652a5c20ae1c05"),
                "date" : ISODate("2019-10-17T10:43:14.239Z"),
                "rate" : 9888
            }, 

        ]
    }
],
"id" : "rat-W262IxTjk",
"__v" : 0

}

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...