local JSON = require("App42-Lua-API.JSON")
local dbName = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}"
local gp = require("App42-Lua-API.GeoTag")
gp:setLat(-73.70000);
gp:setLng(-40);
storageService:setGeoTag(gp);
storageService:insertJSONDocument(dbName, collectionName,json,callBack);
function callBack:onSuccess(object)
print("Response is :"..object:getStrResponse());
print("Response is :"..JSON:encode(object));
print("Dbname is "..object:getDbName());
print("Collection Name is "..object:getCollectionName());
print("getDocId is "..object:getJsonDocList():getDocId())
print("getCreatedAt is "..object:getJsonDocList():getCreatedAt());
print("getUpdatedAt is "..object:getJsonDocList():getUpdatedAt());
print("Doclist Name is "..JSON:encode(object:getJsonDocList():getJsonDoc()));
print("lat is "..JSON:encode(object:getJsonDocList():getLocation():getLat()));
print("lng is "..JSON:encode(object:getJsonDocList():getLocation():getLng()));
end
function callBack:onException(object)
print("Message is "..object:getAppErrorCode());
print("Message is "..object:getHttpErrorCode());
print("Message is "..object:getMessage());
print("Message is "..object:getDetails());
end