How to use raw string in mongodb aggregate queries using the java driver? [duplicate]










0
















This question already has an answer here:



  • Calculated group-by fields in MongoDB

    2 answers



  • Creating BSON object from JSON string

    9 answers



Mongodb aggregation queries are essentially an array of json objects. Is it possible to use the raw string via the Java driver ?



For example, in case of plain query that takes a json object, we can use the raw query by BasicDBObject.parse(..)



How do we use a similar approach for aggregation queries ?










share|improve this question













marked as duplicate by Neil Lunn mongodb
Users with the  mongodb badge can single-handedly close mongodb questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 13 '18 at 5:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Possible? Yes! Good idea? No. Unless you are writing something meant to present a "shell" of sorts to end users then you probably should be using the Java Driver BSON construction methods instead. Even a "shell" should probably be embedding a JavaScript engine and not just parsing JSON. This potentially has damaging things all over it if you just parse strings. Namely $out, especially with upcoming releases.

    – Neil Lunn
    Nov 13 '18 at 5:13















0
















This question already has an answer here:



  • Calculated group-by fields in MongoDB

    2 answers



  • Creating BSON object from JSON string

    9 answers



Mongodb aggregation queries are essentially an array of json objects. Is it possible to use the raw string via the Java driver ?



For example, in case of plain query that takes a json object, we can use the raw query by BasicDBObject.parse(..)



How do we use a similar approach for aggregation queries ?










share|improve this question













marked as duplicate by Neil Lunn mongodb
Users with the  mongodb badge can single-handedly close mongodb questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 13 '18 at 5:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Possible? Yes! Good idea? No. Unless you are writing something meant to present a "shell" of sorts to end users then you probably should be using the Java Driver BSON construction methods instead. Even a "shell" should probably be embedding a JavaScript engine and not just parsing JSON. This potentially has damaging things all over it if you just parse strings. Namely $out, especially with upcoming releases.

    – Neil Lunn
    Nov 13 '18 at 5:13













0












0








0









This question already has an answer here:



  • Calculated group-by fields in MongoDB

    2 answers



  • Creating BSON object from JSON string

    9 answers



Mongodb aggregation queries are essentially an array of json objects. Is it possible to use the raw string via the Java driver ?



For example, in case of plain query that takes a json object, we can use the raw query by BasicDBObject.parse(..)



How do we use a similar approach for aggregation queries ?










share|improve this question















This question already has an answer here:



  • Calculated group-by fields in MongoDB

    2 answers



  • Creating BSON object from JSON string

    9 answers



Mongodb aggregation queries are essentially an array of json objects. Is it possible to use the raw string via the Java driver ?



For example, in case of plain query that takes a json object, we can use the raw query by BasicDBObject.parse(..)



How do we use a similar approach for aggregation queries ?





This question already has an answer here:



  • Calculated group-by fields in MongoDB

    2 answers



  • Creating BSON object from JSON string

    9 answers







java mongodb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 5:08









Sourajit BasakSourajit Basak

519410




519410




marked as duplicate by Neil Lunn mongodb
Users with the  mongodb badge can single-handedly close mongodb questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 13 '18 at 5:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Neil Lunn mongodb
Users with the  mongodb badge can single-handedly close mongodb questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 13 '18 at 5:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Possible? Yes! Good idea? No. Unless you are writing something meant to present a "shell" of sorts to end users then you probably should be using the Java Driver BSON construction methods instead. Even a "shell" should probably be embedding a JavaScript engine and not just parsing JSON. This potentially has damaging things all over it if you just parse strings. Namely $out, especially with upcoming releases.

    – Neil Lunn
    Nov 13 '18 at 5:13

















  • Possible? Yes! Good idea? No. Unless you are writing something meant to present a "shell" of sorts to end users then you probably should be using the Java Driver BSON construction methods instead. Even a "shell" should probably be embedding a JavaScript engine and not just parsing JSON. This potentially has damaging things all over it if you just parse strings. Namely $out, especially with upcoming releases.

    – Neil Lunn
    Nov 13 '18 at 5:13
















Possible? Yes! Good idea? No. Unless you are writing something meant to present a "shell" of sorts to end users then you probably should be using the Java Driver BSON construction methods instead. Even a "shell" should probably be embedding a JavaScript engine and not just parsing JSON. This potentially has damaging things all over it if you just parse strings. Namely $out, especially with upcoming releases.

– Neil Lunn
Nov 13 '18 at 5:13





Possible? Yes! Good idea? No. Unless you are writing something meant to present a "shell" of sorts to end users then you probably should be using the Java Driver BSON construction methods instead. Even a "shell" should probably be embedding a JavaScript engine and not just parsing JSON. This potentially has damaging things all over it if you just parse strings. Namely $out, especially with upcoming releases.

– Neil Lunn
Nov 13 '18 at 5:13












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

這個網誌中的熱門文章

What does pagestruct do in Eviews?

Dutch intervention in Lombok and Karangasem

Channel Islands