So, I'm using mongoDB and my queries return an array of objects. The objects look like this:
{
'_id': ObjectId('5ff891bc20cb7d29dc1d836c'),
'Model': 'X1150',
'Platform': 'Server',
'# of CPU Cores': 4,
'# of Threads': 4
}
Let's say I store this specific document in the variable doc
Now, I want to be able to compare the 'Platform' attribute with a string. In JavaScript, for example, I would do:
if (doc.Platform == 'Server') return 1;
but it doesn't seems to work in python (maybe because the attribute is a string?). How can I make this comparison correctly?
Thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…