MongoDB return all the fields in a collection -
is there query returning fields (keys) exist in collection?
due fact mongodb has flexible document structure, fields alter doc doc in collection, query fields in collection.
f.e. {"color":"red", "shape":"round", "radius":3}, {"color":"green", "shape":"square", "length":2, "width":3}
this docs in same collection. query homecoming - {"color", "shape", "radius", "length", "width"}
thank you.
due fact each document in collection can have different numbers of keys there no way of doing this, mongodb holds no (unlike sql) meta info keys exist within collection.
there few tools of help here:
https://github.com/variety/variety https://github.com/skratchdot/mongodb-schema/and here related question answers:
mongodb names of keys in collection mongodb
No comments:
Post a Comment