Page 1 of 2
Query "undefined" fields at the backend
Posted: Tue Jan 27, 2015 8:46 am
by Hawk
Hi,
How can I use the Query space clarified below in order to query fields with null/undefined values:
I tried all the following :
pre{"Oracle_Flag": ""}
{"Oracle_Flag": undefined}
{"Oracle_Flag": "undefined"}
{"Oracle_Flag": " "}/pre
It did not show any record although there are some of them with value "Oracle_Flag" empty. I tried with none empty values and it works.
Thanks,
Query "undefined" fields at the backend
Posted: Tue Jan 27, 2015 5:50 pm
by Alena Prykhodko
Hello,
Try this: codeyour_colname: { $exists: true}/code
Query "undefined" fields at the backend
Posted: Thu Jan 29, 2015 7:32 am
by Hawk
Hi Alena,
I've tried this and gives me "incorrect query". Notice I'm querying column (e.g. Update_Timestamp) to display records with Update_Timestamp is null. So using this:
preUpdate_Timestamp: { $exists: true} /pre
In the query field, returned "incorrect query".
Another question, can I perform "update/PUT" query from this query field in the image above? For example I want to update one of the columns in the collection with "where" parameter. How can I do that?
Thanks,
Query "undefined" fields at the backend
Posted: Fri Jan 30, 2015 5:14 pm
by Alena Prykhodko
Hello,
Instead of "Update_Timestamp" you need to use "Oracle_Flag", try next snippet:
pre{"Oracle_Flag": { $exists: true}}/pre
Query "undefined" fields at the backend
Posted: Fri Feb 06, 2015 7:46 am
by Hawk
Hi Alena,
Can I use this query space to update records? I tried something like this:
pre{"Outlet_Code": { $set: "1234"}}/pre
But I get error "Mongo error: error code is '17287'"
Cannot update from here?
Thanks
Query "undefined" fields at the backend
Posted: Mon Feb 09, 2015 4:17 pm
by Evgene Karachevtsev
Hello Hawk,
Sorry for delay. Please try next
pre{"Outlet_Code": { "$set": "1234"}}/pre
Query "undefined" fields at the backend
Posted: Tue Feb 10, 2015 2:37 am
by Hawk
Hi Evgene,
I tried that and I got the same error. In the browser console I got
preFailed to load resource: the server responded with a status of 400 (Bad Request)/pre.
When I open the error, I found:
pre{"code":"DBOL002","description":"database id not specified"}/pre
Thanks,
Query "undefined" fields at the backend
Posted: Wed Feb 11, 2015 5:14 am
by Yurii Orishchuk
Hi Hawk,
Operations should be an object as well as "$set".
So please open "request" tab of the service and set this parameters like on the screen shot:
http://prntscr.com/63o1nm/direct
Then on the "test" tab you will get following:
http://prntscr.com/63o1x3/direct
Regards.
Query "undefined" fields at the backend
Posted: Wed Feb 11, 2015 7:13 am
by Hawk
Hi Yurii,
I tried as follows:
Is there anything not right with my statement:
pre{"operations":{"$set":{"item":"Coffee"}}}/pre
Thanks,
Query "undefined" fields at the backend
Posted: Thu Feb 12, 2015 1:59 am
by Yurii Orishchuk
Hi Hawk,
That field could be used only for "where" parameter. And could not contain other parameters like "operations".
Please use update service in your app. Like in screenshots above.
Regards.