tried with JSON.stringify

var cypherQuery='MERGE (user:Person ' + node + ') ON CREATE SET 
user.created = timestamp() ON MATCH SET user.lastSeen = timestamp() RETURN 
user';


Cypher query -  MERGE (user:Person 
{"name":"shekar","email":"[email protected]","payload":"null","type":"user"}) 
ON CREATE SET user.created = timestamp() ON MATCH SET user.lastSeen = 
timestamp() RETURN user

resulting error:
errorError: Invalid input '"': expected whitespace, an identifier, '}' or 
UnsignedInteger (line 1, column 21)
"MERGE (user:Person 
{"name":"shekar","email":"[email protected]","payload":"null","type":"user"}) 
ON CREATE SET user.created = timestamp() ON MATCH SET user.lastSeen = 
timestamp() RETURN user"
                     ^

- Shekar


On Thursday, 13 February 2014 03:04:57 UTC-8, Shekar Tippur wrote:
>
> Michael -
> I have trimmed my node object
>
> { name: 'shekar',
>   email: '[email protected]',
>   friends: undefined,
>   payload: 'null',
>   type: 'user' }
>
> I am not sure why the merge statement is being interpreted as an array.
> Here is how I am constructing the merge statement
>
>         var cypherQuery='MERGE (user:Person ' + node + ') ON CREATE SET 
> user.created = timestamp() ON MATCH SET user.lastSeen = timestamp() RETURN 
> user';
>
> and the resulting cypher is ..
>
> "MERGE (user:Person [object Object]) ON CREATE SET user.created = 
> timestamp() ON MATCH SET user.lastSeen = timestamp() RETURN user"
>
> - Shekar
>
> On Thursday, 13 February 2014 00:58:48 UTC-8, Michael Hunger wrote:
>>
>> At least you cannot do maps or nested collections as properties.
>> You would have to model them differently (e.g. individual properties or a 
>> linked node or serialized)
>>
>> Michael
>>
>> Am 12.02.2014 um 20:02 schrieb Shekar Tippur <[email protected]>:
>>
>> Michael -
>>
>> I have taken it directly from https://www.npmjs.org/package/node-neo4j
>>
>> without converting to a string, I get the below error
>>
>> Error: Response body is empty
>>
>> There is nothing on neo4j log.
>>
>> - Shekar
>>
>> On Wednesday, 12 February 2014 10:00:56 UTC-8, Michael Hunger wrote:
>>>
>>> Where did you get that example from?
>>> Why do you convert the map into a string?
>>> Try Aseems examples first and work from there
>>>
>>> Michael
>>>
>>> Sent from mobile device
>>>
>>> Am 12.02.2014 um 18:44 schrieb Shekar Tippur <[email protected]>:
>>>
>>> Hello -
>>>
>>> I am trying to insert a node ..
>>>
>>> {"name":"shekar","email":"[email protected]
>>> ","payload":[{"friend":"blah"},{"friend":"abc"}],"type":"user"}
>>>
>>> I am using node-neo4j library.
>>>
>>> Here is the code snippet..
>>>
>>>     var encodedNode=JSON.stringify(node);
>>>     console.log("In addNode");
>>>     console.log(encodedNode);
>>>     db.insertNode(encodedNode,function(err, addnode){
>>>         if(err) throw cb("error in inserting node " + err,{status:err, 
>>> id:null});
>>>
>>>         // Output node properties.
>>>         console.log(addnode.data);
>>>
>>>         // Output node id.
>>>         console.log(addnode.id);
>>>         cb(null,{status:"Node added",id:addnode.id});
>>>     });
>>>
>>> Appreciate any help ..
>>>
>>> I see a exception on the logs
>>>
>>> 09:40:23.905 [qtp476501171-1057] WARN  o.e.jetty.servlet.ServletHandler 
>>> - /db/data/node
>>> java.lang.ArrayIndexOutOfBoundsException: 1
>>> at 
>>> org.neo4j.server.rest.repr.formats.UrlFormFormat.readMap(UrlFormFormat.java:99)
>>>  
>>> ~[neo4j-server-2.0.0.jar:2.0.0]
>>> at 
>>> org.neo4j.server.rest.web.RestfulGraphDatabase.createNode(RestfulGraphDatabase.java:239)
>>>  
>>> ~[neo4j-server-2.0.0.jar:2.0.0]
>>> at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) ~[na:na]
>>> at 
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>  
>>> ~[na:1.7.0_45]
>>> at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
>>> at 
>>> com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)
>>>  
>>> ~[neo4j-server-2.0.0.jar:2.0.0]
>>> at 
>>> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at 
>>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
>>>  
>>> ~[jersey-server-1.9.jar:1.9]
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 
>>> ~[javax.servlet-3.0.0.v201112011016.jar:na]
>>> at 
>>> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698) 
>>> ~[jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1506)
>>>  
>>> ~[jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)
>>>  
>>> ~[neo4j-server-2.0.0.jar:2.0.0]
>>> at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477)
>>>  
>>> ~[jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) 
>>> [jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211)
>>>  
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
>>>  
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432) 
>>> [jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
>>>  
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)
>>>  
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
>>>  
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) 
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>>>  
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at org.eclipse.jetty.server.Server.handle(Server.java:445) 
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268) 
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229) 
>>> [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
>>>  
>>> [jetty-io-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
>>>  
>>> [jetty-util-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at 
>>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
>>>  
>>> [jetty-util-9.0.5.v20130815.jar:9.0.5.v20130815]
>>> at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Neo4j" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to