I'm new to mangodibi and I have a mosaic document like this
{ "AZ", "First": "AAA", "Address": {"street": "stave", "city", "_id", "title": "ABC 123", "author": {"last" : "New York"}}}
I am using the Mongodaby Java Client and the above document is
{"_id": 1, "title ":" Abc123 "," author_last ":" zzz "," author_first ":" aaa "," author_address_street ":" stvalue "," author_address_city ":" new york "}
Is it possible that MongoDB Java Using the client is using the MongoDB query without modifying the results in Java.
Update
It is possible to convert to the required format in munoclite, I have to change my mind and get the required format. For some Java code must be added
this' which does not actually use "customer" or "driver library", the same The only way to do this is to change the "Fields in Reactions". Your most practical way to do this:
db.collection.aggregate ([{"$ project": {"title": 1, " Author_last ":" $ author.last "," author_first ":" $ author.first "," author_address_street ":" $ author.address.street "," author_addressrib ":" $ author.address.city "}}])
Translation is very easy in any language, but it shows you basic principles.
So the syntax (in the original driver) is created: <("author", "1") .append ("author_last", "$ author", "$ author", "append "(" author_address_street "," $ author.address.street "), .append (" author_addressrib "," $ author.address.city ") .append (" author_first "," $ writer.first ").) ; Collection.aggregate (project);
If you can not specify the key in this way, then your only real option on the server is mapReduce. As above, It would be better to do this in customer feedback:
db.co Llection.mapReduce (function () {var item = {}; var id = this._id; delete it. _id; var obj = this; Object.keys (obj) .for eca (function (key) {if (typeof ( Obj [key] == "object" (for object.kiz (ozj [key]) each (function (all) {if (typhus (key) [key] [subkey] == "object") {object. Keys (keys ["key"] .for unit (key + "_" + everybody + "_" + subsub) = oz [key] [all] [subseb];}}} and {item [key + "_" + Amit (id, item);}, function () {} [object] [everybody] [all];}};} other {object [key] = oz Ez [key];}}); , // need a reduction {"out": {"inline": 1}})
I understand that, but I just typed it as much as possible syntax problems But the idea should be relevant. You may also need some more complex depending on your actual data.
The issue is, you need JavaScript execution to "transpose" your document on the server to use this method.
Otherwise, do this in code because you are repeating the cursor just like that.
No comments:
Post a Comment