Mongoid and extended JSON





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm trying to bypass a JSON aggregation query to aggregation pipeline of MongoDB.



For doing that I have this endpoint on my RoR app



def index
Lead.collection.aggregate(JSON.parse(params[:query]))
end


And I send this JSON from my frontend



[
{
"$match": {
"statuses.created_at": {
"$gte": {
"$date": "1539369174"
}
}
}
}
]


The problem is that I'm not getting no result because "$date" filter is not working properly.



In mongo shell I'm getting results.










share|improve this question

























  • Can you clarify "not working"? Do you get an error? No results?

    – Timo Geusch
    Nov 23 '18 at 19:08











  • I'm not getting results with Mongoid but I'm getting results doing the same query in MongoDB shell

    – ppascualv
    Nov 23 '18 at 19:13






  • 1





    There is a format spec for "MongoDB extended JSON" but the Ruby driver knows nothing of this and does not support it. I'm not aware of any third party implementation for ruby either, but projects exist in other languages you could use for reference i.e extended-json. Just to also note that your timestamp value in the date appears to be in seconds, where the spec is for milliseconds, So even the source data appears incorrect.

    – Neil Lunn
    Nov 23 '18 at 21:30






  • 1





    I will say that it appears somewhat ironic that the only reason the ruby driver does not support this is because the assigned maintainer did not appear to "get the memo" at the time the task was assigned. The history seems to indicate they saw "JSON" and just dismissed it as having nothing to do with them. See RUBY-780 for details

    – Neil Lunn
    Nov 23 '18 at 21:39


















0















I'm trying to bypass a JSON aggregation query to aggregation pipeline of MongoDB.



For doing that I have this endpoint on my RoR app



def index
Lead.collection.aggregate(JSON.parse(params[:query]))
end


And I send this JSON from my frontend



[
{
"$match": {
"statuses.created_at": {
"$gte": {
"$date": "1539369174"
}
}
}
}
]


The problem is that I'm not getting no result because "$date" filter is not working properly.



In mongo shell I'm getting results.










share|improve this question

























  • Can you clarify "not working"? Do you get an error? No results?

    – Timo Geusch
    Nov 23 '18 at 19:08











  • I'm not getting results with Mongoid but I'm getting results doing the same query in MongoDB shell

    – ppascualv
    Nov 23 '18 at 19:13






  • 1





    There is a format spec for "MongoDB extended JSON" but the Ruby driver knows nothing of this and does not support it. I'm not aware of any third party implementation for ruby either, but projects exist in other languages you could use for reference i.e extended-json. Just to also note that your timestamp value in the date appears to be in seconds, where the spec is for milliseconds, So even the source data appears incorrect.

    – Neil Lunn
    Nov 23 '18 at 21:30






  • 1





    I will say that it appears somewhat ironic that the only reason the ruby driver does not support this is because the assigned maintainer did not appear to "get the memo" at the time the task was assigned. The history seems to indicate they saw "JSON" and just dismissed it as having nothing to do with them. See RUBY-780 for details

    – Neil Lunn
    Nov 23 '18 at 21:39














0












0








0








I'm trying to bypass a JSON aggregation query to aggregation pipeline of MongoDB.



For doing that I have this endpoint on my RoR app



def index
Lead.collection.aggregate(JSON.parse(params[:query]))
end


And I send this JSON from my frontend



[
{
"$match": {
"statuses.created_at": {
"$gte": {
"$date": "1539369174"
}
}
}
}
]


The problem is that I'm not getting no result because "$date" filter is not working properly.



In mongo shell I'm getting results.










share|improve this question
















I'm trying to bypass a JSON aggregation query to aggregation pipeline of MongoDB.



For doing that I have this endpoint on my RoR app



def index
Lead.collection.aggregate(JSON.parse(params[:query]))
end


And I send this JSON from my frontend



[
{
"$match": {
"statuses.created_at": {
"$gte": {
"$date": "1539369174"
}
}
}
}
]


The problem is that I'm not getting no result because "$date" filter is not working properly.



In mongo shell I'm getting results.







ruby-on-rails mongodb mongoid






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 12:19







ppascualv

















asked Nov 23 '18 at 19:00









ppascualvppascualv

967621




967621













  • Can you clarify "not working"? Do you get an error? No results?

    – Timo Geusch
    Nov 23 '18 at 19:08











  • I'm not getting results with Mongoid but I'm getting results doing the same query in MongoDB shell

    – ppascualv
    Nov 23 '18 at 19:13






  • 1





    There is a format spec for "MongoDB extended JSON" but the Ruby driver knows nothing of this and does not support it. I'm not aware of any third party implementation for ruby either, but projects exist in other languages you could use for reference i.e extended-json. Just to also note that your timestamp value in the date appears to be in seconds, where the spec is for milliseconds, So even the source data appears incorrect.

    – Neil Lunn
    Nov 23 '18 at 21:30






  • 1





    I will say that it appears somewhat ironic that the only reason the ruby driver does not support this is because the assigned maintainer did not appear to "get the memo" at the time the task was assigned. The history seems to indicate they saw "JSON" and just dismissed it as having nothing to do with them. See RUBY-780 for details

    – Neil Lunn
    Nov 23 '18 at 21:39



















  • Can you clarify "not working"? Do you get an error? No results?

    – Timo Geusch
    Nov 23 '18 at 19:08











  • I'm not getting results with Mongoid but I'm getting results doing the same query in MongoDB shell

    – ppascualv
    Nov 23 '18 at 19:13






  • 1





    There is a format spec for "MongoDB extended JSON" but the Ruby driver knows nothing of this and does not support it. I'm not aware of any third party implementation for ruby either, but projects exist in other languages you could use for reference i.e extended-json. Just to also note that your timestamp value in the date appears to be in seconds, where the spec is for milliseconds, So even the source data appears incorrect.

    – Neil Lunn
    Nov 23 '18 at 21:30






  • 1





    I will say that it appears somewhat ironic that the only reason the ruby driver does not support this is because the assigned maintainer did not appear to "get the memo" at the time the task was assigned. The history seems to indicate they saw "JSON" and just dismissed it as having nothing to do with them. See RUBY-780 for details

    – Neil Lunn
    Nov 23 '18 at 21:39

















Can you clarify "not working"? Do you get an error? No results?

– Timo Geusch
Nov 23 '18 at 19:08





Can you clarify "not working"? Do you get an error? No results?

– Timo Geusch
Nov 23 '18 at 19:08













I'm not getting results with Mongoid but I'm getting results doing the same query in MongoDB shell

– ppascualv
Nov 23 '18 at 19:13





I'm not getting results with Mongoid but I'm getting results doing the same query in MongoDB shell

– ppascualv
Nov 23 '18 at 19:13




1




1





There is a format spec for "MongoDB extended JSON" but the Ruby driver knows nothing of this and does not support it. I'm not aware of any third party implementation for ruby either, but projects exist in other languages you could use for reference i.e extended-json. Just to also note that your timestamp value in the date appears to be in seconds, where the spec is for milliseconds, So even the source data appears incorrect.

– Neil Lunn
Nov 23 '18 at 21:30





There is a format spec for "MongoDB extended JSON" but the Ruby driver knows nothing of this and does not support it. I'm not aware of any third party implementation for ruby either, but projects exist in other languages you could use for reference i.e extended-json. Just to also note that your timestamp value in the date appears to be in seconds, where the spec is for milliseconds, So even the source data appears incorrect.

– Neil Lunn
Nov 23 '18 at 21:30




1




1





I will say that it appears somewhat ironic that the only reason the ruby driver does not support this is because the assigned maintainer did not appear to "get the memo" at the time the task was assigned. The history seems to indicate they saw "JSON" and just dismissed it as having nothing to do with them. See RUBY-780 for details

– Neil Lunn
Nov 23 '18 at 21:39





I will say that it appears somewhat ironic that the only reason the ruby driver does not support this is because the assigned maintainer did not appear to "get the memo" at the time the task was assigned. The history seems to indicate they saw "JSON" and just dismissed it as having nothing to do with them. See RUBY-780 for details

– Neil Lunn
Nov 23 '18 at 21:39












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451793%2fmongoid-and-extended-json%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451793%2fmongoid-and-extended-json%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?