Hi Darek,
.find(); will return a cursor, which can be enumerated to acquire the document at that position.
In your case you will want to use findOne, which returns an object reference. You can access fields by using dot notation i.e.
var document = collection.findOne({"_id": "Menu_Stand"});
var object = document.levelDetails;
var displayName = object.displayName;
Happy to help - Patrick.
Derek Lam
Hello,
I am using the following code to get an item from Meta Collection:
var metaDataCollection = Spark.metaCollection("Collection1");
var data = metaDataCollection.find({"_id":"Menu_Stand"});
I have item like the following, how do I access to LevelDetails so I can get the displayName and cointAmount in cloud code, I want to get the value from there and assign it to player for example?
Thanks.