Apache Zeppelin db.collection.find Problem

500
user291903
db.$.find( {}, { $: [ { $eq: "$" } ] } ).table() 

Wenn ich den oben aufgeführten Code in Zeppelin ausführen, soll er im Schlüssel nach einem exakten Ergebnis suchen, das auf dem Wert basiert, den ich in das Feld $ eingebe, aber er filtert ihn nicht. Es zeigt nur alle Daten. Irgendwelche Ideen warum? und wie zu beheben?

1
Möglicherweise werden die Daten angezeigt, die Sie jetzt erhalten, und die erwarteten Daten sowie die Abfrage, die ich denke. Ich kenne MongoDB nicht, aber das sieht aus wie Daten im JSON-Format, aber vielleicht funktioniert die Logik mit dieser Sprache. Können Sie auf jeden Fall alle Testdaten und Ergebnisse angeben, die Sie jetzt erhalten, und die gewünschten Ergebnisse anzeigen? Pimp Juice IT vor 6 Jahren 0

1 Antwort auf die Frage

0
Stennie

The MongoDB interpreter for Zeppelin uses the same syntax as the mongo shell: db.collection.find(query, projection).

Your first parameter of {} matches all documents. The second parameter will be interpreted as a projection (although your syntax is unnecessarily complex).

Since $eq is equivalent to and you only have a single value, your query can be more clearly expressed as:

db.$.find({ $: "$" }).table() 

If your intent is to provide a more generic input form (rather than prompting for a single key/value pair) you might want to placeholder the query and projection instead, eg:

empty = {} // Placeholder for empty documents db.$.find($,$).table() 

In this second example your query would be expressed as { field: "value" } in the Zeppelin input form. You could also specify additional query criteria and a projection for fields to include in the results.