Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code and Pointers Error

I keep getting an error when creating to create a new object in server code. AllI am doing is creating a object in a database that holds two pointers. But I get this each time:

preError: '_id' is missing for pointer column 'groupType ( @ 66 : 18 ) - throw e;/pre

This is the code I am using:

precode
var group_id = Collection.createObject(dbid, "groups", {
"groupName": groupName,
"contactEmail" : group_contactEmail,
"contactNumber" : group_contactNumber,
"contactName" : group_contactName,
"qLimit" : group_qLimit,
"mLimit" : group_mLimit,
"qRate" : group_qRate,
"mRate" : group_mRate,
"groupCode" : groupCode,
"active" : "0",
"groupType" : {'collName' : 'group_types','id' : group_type_id }
}, token).id;
/code/pre

The code is no different what I use in the app, but is there another way to do it in Server Code ?

Thanks

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Server Code and Pointers Error

Hi Addy,

Is it a line 18?
pre}, token).id;/preYou should remove "id".

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code and Pointers Error

Thank you, I knew it would be something simple!!!

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code and Pointers Error

I tried that, and thought about it, but tested it anyway, and i am still getting the same error message:

pre Error: '_id' is missing for pointer column 'groupType ( @ 66 : 18 ) - throw e/pre

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code and Pointers Error

I do not have a line 66 in the script my end.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Server Code and Pointers Error

Addy,

Would you kindly let me know does variable group_type_id contain a valid id from the collection group_types?

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code and Pointers Error

Yes, from console, this is what is being sent:

pre&groupContactNumber=0123456789987&groupTypeID=53aad472e4b0b42167b745e3/pre

Above the code here is how the id it moved into group_id

prevar group_type_id = request.get('groupTypeID');/pre

And that id does belong to a object in a collection.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Server Code and Pointers Error

Addy,

Could you please provide us with the entire script? (You may e-mail to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a if you don't want to post it here)

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code and Pointers Error

Sent this via email, but i really need a quick response if at all possible.

Thanks

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Server Code and Pointers Error

Hi Addy,

Collection.createObject returns an object that contains id and date created, so replace:prevar group_id = Collection.createObject(...);/preWith:prevar group = Collection.createObject(...);
var group_id = group._id;/preAnd so on for other objects...

Return to “Issues”