December 9th, 2013
In Technology
No Comments
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
Find all field names in MongoDb
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.
I am switching from PHP/Mysql to Clojure/MongoDb. In Clojure, hyphens in names are more idiomatic than underscores. So I wanted to find all the field names, so I could see where the underscores were. Having done a straight import of all of my database tables into a single MongoDb collection, I ran this Javascript at the Mongo shell to get all the field names.
var arrayOfFieldNames = [];
var items = db.tma.find();
while(items.hasNext()) {
item = items.next();
for(var index in item) {
arrayOfFieldNames[index] = index;
}
}
for (var index in arrayOfFieldNames) {
print(index);
}
February 8, 2022 9:33 am
From Michael S on How I recovered from Lyme Disease: I fasted for two weeks, no food, just water
"Did you have Bartonella, too? Seems it uses autogenesis..."