Home > database >  How can the independent use mongo query in the income of a document one of the keys
How can the independent use mongo query in the income of a document one of the keys

Time:09-24

Such as through the db. Test. Find_one () query to a document, and its value to variable a, the following code
A=db. Test. Find_one ()
A
{" _id ":" ObjectId (" 4 cla8a56c603000000007ecb "), "timestring" : "the 2014-05-01 00:01onsaturday (UK time)", "Type" : "the Book"}
Excuse me, I want to in this document timestring keys "2014-05-01 00:01onsaturday (UK time)" separate out and used as an independent variable values, to give a variable ac, such as
Ac="2014-05-01 00:01onsaturday (UK time)"
How can we achieve?
Thank you very much!
Early to wish you all a happy Lantern Festival!

CodePudding user response:

A=the a.f indOne ({}, {timestring _id: 0:1})

CodePudding user response:

reference 1st floor rucypli response:
& gt; A=the a.f indOne ({}, {timestring _id: 0:1})

Thank you, according to your method, the results shown in figure, a is still a document, just only includes a keys


In addition, the timestring, actually is a string, excuse me, are under the pymongo, with what method can be original. CSV document read in the string is stored as a variable?
Thank you

CodePudding user response:

It is ok to write a js in mongoshell,

CodePudding user response:

  • Related