As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Original query: "onPostSave" BL remove query doesn't seem to work although no errors are flagged. BL at the bottom of this email.
Questions from Kinvey:
1. Could you provide us with some data so that we can identify the specific transactions that were not deleted?
Sure - the id in the "activeTransactions" collection is: 589f367d7c76a9f516b63e05
I'll leave this there for now - but this transaction should have been removed by the BL. The weird thing is, the log is telling me the remove method was executed successfully, but the data is still there.
2. Does the record you are trying to delete contain the ID "589b7f702262fa7555d80d6f"
I believe that one of the records. But I've deleted it manually now.
3. Are you attempting to delete the record using the DELETE method?
I'm using the "remove" method remove(query, callback)
4. Do you experience the same problem when attempting to delete the record using the app and also using the Kinvey API console?
Only experience the problem through the app & BL. The records can be manually deleted through the console.
Business Logic "onPostSave" (activeTransactions collection):
(problem code in bold)
function onPostSave(request, response, modules) {
var collectionAccess = modules.collectionAccess
, logger = modules.logger
, body = request.body
, buyerEmail = body.buyerEmail
, buyerFirstName = body.buyerFirstName
, fxISO = body.fxISO
, fxCostAmount = body.fxCostAmount
, sellerEmail = body.sellerEmail
, sellerName = body.sellerName
, lxISO = body.lxISO
, lxPurchaseAmount = body.lxPurchaseAmount
, id = body._id
, progress = body.transactionProgress
, query = {"_id" : id};
//weirdly this query works-> , query = {"buyerEmail": buyerEmail};
Ramesh Indran
Original query: "onPostSave" BL remove query doesn't seem to work although no errors are flagged. BL at the bottom of this email.
Questions from Kinvey:
1. Could you provide us with some data so that we can identify the specific transactions that were not deleted?
Sure - the id in the "activeTransactions" collection is: 589f367d7c76a9f516b63e05
I'll leave this there for now - but this transaction should have been removed by the BL. The weird thing is, the log is telling me the remove method was executed successfully, but the data is still there.
2. Does the record you are trying to delete contain the ID "589b7f702262fa7555d80d6f"
I believe that one of the records. But I've deleted it manually now.
3. Are you attempting to delete the record using the DELETE method?
I'm using the "remove" method remove(query, callback)
4. Do you experience the same problem when attempting to delete the record using the app and also using the Kinvey API console?
Only experience the problem through the app & BL. The records can be manually deleted through the console.
Business Logic "onPostSave" (activeTransactions collection):
(problem code in bold)
function onPostSave(request, response, modules) {
var collectionAccess = modules.collectionAccess
, logger = modules.logger
, body = request.body
, buyerEmail = body.buyerEmail
, buyerFirstName = body.buyerFirstName
, fxISO = body.fxISO
, fxCostAmount = body.fxCostAmount
, sellerEmail = body.sellerEmail
, sellerName = body.sellerName
, lxISO = body.lxISO
, lxPurchaseAmount = body.lxPurchaseAmount
, id = body._id
, progress = body.transactionProgress
, query = {"_id" : id};
//weirdly this query works-> , query = {"buyerEmail": buyerEmail};
logger.info(buyerEmail + ": " + progress);
//logger.info("id:" + id);
if (progress == "Sale complete" || progress == "Buyer cancelled payment" || progress == "Buyer cancelled" || progress == "Seller cancelled" || progress == "Payment error") {
collectionAccess.collection('previousTransactions')
.insert(body, function (err, docs) {
if (err) {
logger.error('Data transfer fail: '+ err);
response.body.debug = err;
response.complete(500);
} else {
// previousTransaction dataStore insert complete
logger.info(buyerEmail +": " + progress + " --previousTransaction DataStore Update");
collectionAccess.collection('activeTransactions')
.remove(query, function (err, docs) {
if (err) {
logger.error('Data transfer fail: '+ err);
response.body.debug = err;
response.complete(500);
} else {
// activeTransaction dataStore delete complete
logger.info(buyerEmail +": " + progress + " --activeTransaction DataStore Delete");
response.continue();
}
});
}
});
}
response.continue();
}
Ramesh,
You will have to use the collectionAccess.objectID() to convert the string to Object Type.
Please take a look at:
http://devcenter.kinvey.com/html5/reference/business-logic/reference.html#objectid-noteSample code below:
collectionAccess.collection('xyz')
.remove(query, function (err, docs) {
if (err) {
logger.error('Data transfer fail: '+ err);
response.body.debug = err;
response.complete(500);
} else {
response.continue();
}
});
Thanks,
Pranav
Kinvey
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstWani
Hi Ramesh,
Can you edit query = {"_id" : id} in your code according to the warning given here: http://devcenter.kinvey.com/rest/reference/business-logic/reference.html#objectid-note?
Let me know once you have tried this out.
Regards,
Wani
Kinvey Support
Ramesh Indran
Hi Wani
Thank you for the link. I've changed the query from:
query = {"_id" : id}
to
query = {_id : id};
but it's still not removing the entry from the collection, neither is it throwing up an error in the logger.
Thoughts?
Thanks
Ramesh
Pranav J
Ramesh,
You will have to use the collectionAccess.objectID() to convert the string to Object Type.
Please take a look at:
http://devcenter.kinvey.com/html5/reference/business-logic/reference.html#objectid-noteSample code below:
collectionAccess.collection('xyz')
.remove(query, function (err, docs) {
if (err) {
logger.error('Data transfer fail: '+ err);
response.body.debug = err;
response.complete(500);
} else {
response.continue();
}
});
Thanks,
Pranav
Kinvey
Ramesh Indran
Hi Pranav
That worked. Thank you very much.
Ramesh
Pranav J
Glad it is working. Happy to help!
Thanks,
Pranav
Kinvey
-
How do I access query string values for GET and DELETE requests?
-
Basic Authentication in Business Logic
-
How do I cascade delete entities from related collections?
-
All BL failing with Violation Error
-
How do I send push notifications?
-
Whenever I try to query by _id, I get zero results
-
receiving SOCKETTIMEDOUT when requesting external http response
-
Unique Constraints on a collection column?
-
Need some help with grouping
-
Accessing Endpoint from Collection Hook
See all 342 topics