Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query "undefined" fields at the backend

Hi,

How can I use the Query space clarified below in order to query fields with null/undefined values:

Image

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,

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Query "undefined" fields at the backend

Hello,

Try this: codeyour_colname: { $exists: true}/code

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query "undefined" fields at the backend

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,

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Query "undefined" fields at the backend

Hello,

Instead of "Update_Timestamp" you need to use "Oracle_Flag", try next snippet:
pre{"Oracle_Flag": { $exists: true}}/pre

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query "undefined" fields at the backend

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

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

Query "undefined" fields at the backend

Hello Hawk,

Sorry for delay. Please try next
pre{"Outlet_Code": { "$set": "1234"}}/pre

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query "undefined" fields at the backend

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,

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query "undefined" fields at the backend

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.

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query "undefined" fields at the backend

Hi Yurii,

I tried as follows:

Image

Is there anything not right with my statement:
pre{"operations":{"$set":{"item":"Coffee"}}}/pre

Thanks,

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query "undefined" fields at the backend

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.

Return to “Issues”