Ich möchte eine MAX-Abfrage in MongoDB mit Where-Klausel erstellen.Max Abfrage in Mongodb mit Where-Klausel
Ich versuche, diese
db.Collection.aggregate({$group : {_id : "$P_ID", massi : {$max : "$b_val"}}},{P_ID:'XYZ',experiment:'abc'});
Meine WHERE-Klausel {P_ID:'XYZ',experiment:'abc'}
ist
Ich weiß nicht, warum, aber diese Abfrage nicht funktionieren diesen Fehler erhalten:
assert: command failed: {
"ok" : 0,
"errmsg" : "A pipeline stage specification object must contain exactly one field.",
"code" : 16435
} : aggregate failed
[email protected]/mongo/shell/utils.js:25:13
[email protected]/mongo/shell/assert.js:13:14
[email protected]/mongo/shell/assert.js:287:5
[email protected]/mongo/shell/collection.js:1312:5
@(shell):1:1
2016-10-15T11:55:31.459+0200 E QUERY [thread1] Error: command failed: {
"ok" : 0,
"errmsg" : "A pipeline stage specification object must contain exactly one field.",
"code" : 16435
} : aggregate failed :
[email protected]/mongo/shell/utils.js:25:13
[email protected]/mongo/shell/assert.js:13:14
[email protected]/mongo/shell/assert.js:287:5
[email protected]/mongo/shell/collection.js:1312:5
@(shell):1:1