jbmusso / grex

JavaScript graph database client for TinkerPop2 Rexster
MIT License
46 stars 12 forks source link

What are the data types. #35

Closed kivo360 closed 10 years ago

kivo360 commented 10 years ago

What are the data types I can use in the Grex module? I noticed I was rather limited to strings and intergers. I want to try using things like dates, geographic data, booleans, etc. How can I figure our how to use those?

Again thanks for your time.

jbmusso commented 10 years ago

You should be able to use most datatypes. Could you please provide a short sample of your code in which you're having issues?

kivo360 commented 10 years ago

I'm not at my computer right now. But I was working with geo-locational data using an array. It looked a lot like the following.

query(g.addVertex({ loc: [17, 48] }));

The database was able to add it but I couldn't figure out the best practice to query the information.

kivo360 commented 10 years ago

Would it look anything like this:

gremlin> g.E.has('place',WITHIN,Geoshape.circle(37.97,23.72,50))
==>e[6J-o-2i][24-battled->36]
==>e[6L-o-2i][24-battled->40]
gremlin> g.E.has('place',WITHIN,Geoshape.circle(37.97,23.72,50)).collect {
   it.bothV.name.next(2) 
}
==>[hercules, hydra]
==>[hercules, nemean]
jbmusso commented 10 years ago

Just to be sure, could you please also post the dump of console.log(query.script) when you're back at your computer? I forgot to ask, but that might help figure out what's wrong.

You may have to generate a string using the new string format feature added in v0.6.0. gRex helpers may not completely support that for now (see https://github.com/gulthor/grex#building-a-gremlin-script-with-string-formatting-and-bound-parameters). I'm unsure if you're using v0.6.0 or not, but I strongly recommend using it :).

kivo360 commented 10 years ago

I grabbed the latest version. It's very nice looking.

jbmusso commented 10 years ago

Hi @kivo360, any luck?

kivo360 commented 10 years ago

I'm so sorry. I've been distracted by my new job lately. I'll jump on it today.

kivo360 commented 10 years ago

I seriously forgot to respond to this.

I figured out the answer. I had issues because I didn't run elastic search. It works as promised.