Page 1 of 1

Database Access through Javascript

Posted: Thu May 15, 2014 2:09 pm
by Doo Dad

Hi

I was trying to put together some queries on server side code but I cant fine any examples of accessing a database directly from JavaScript code.

Of course there are many examples using Curl ... but no examples showing how to make a query using JavaScript on the server side .

Example: How would I query the users database to select users who's username started with the letter 'A' for example ....

Select _id,username from users where Upper(username) like 'A%'

this is a very typical simple query ... can someone provide an example how how to do this i server code ?

That would be quite helpful.

Thanks
DD


Database Access through Javascript

Posted: Thu May 15, 2014 2:47 pm
by Evgene Karachevtsev

Hello,

Here you can find examples how to send request to Appery.io DB from servercode: http://docs.appery.io/tutorials/build...
to get user with name like "A...." you should specify where parameter:

code'where={"userName": {"$regex": "A"}}' /code

Here you can find more about DB queries: http://docs.appery.io/documentation/b...


Database Access through Javascript

Posted: Thu May 15, 2014 6:07 pm
by Doo Dad

Thanks !