quoting it would tell mongo that it is a string, not a function. just like quoting now() in mysql.

for the sake of completeness, i tried it as well but it fails with the same error message. the whole insert command works on mongo's console so i know it is correct.

my guess is there is some quirks with the way it handles the syntax just like nodejs' issues with the syntax. it's not something you can copy and paste to mongo's console. but the question is, where is the documentation on it?
on nodejs, it is very clear on the docmentation that there might be some extra parameters before the callbacks.

On Jun 27, 2015 10:10 PM, "Alex Balashov" <abalashov@evaristesys.com> wrote:
I don't think the 'time' value is valid. If it incorporates whitespace, it needs to be: "new Date()".

--
Alex Balashov | Principal | Evariste Systems LLC
303 Perimeter Center North, Suite 300
Atlanta, GA 30346
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/http://www.csrpswitch.com/

Sent from my BlackBerry.
From: Kelvin Chua
Sent: Saturday, June 27, 2015 10:05
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Reply To: Kamailio (SER) - Users Mailing List
Subject: [SR-Users] invalid char in json text

Playing around with ndb_mongodb

getting this error:

ERROR: ndb_mongodb [mongodb_client.c:262]: mongodbc_exec_cmd(): Failed to run command: lexical error: invalid char in json text

query is very simple:
db.cdrs.insert({time:new Date(),src_user:"kelvin",term_ani:"14112",src_domain:"domain.com",src_ip:"0",dst_ouser:"18188",dst_user:"18112",dst_domain:"domain.com"})

which is inside a pv
mongodb_cmd("mgs1", "datab", "cdrs", "$var(MNG_MISSED)", "mgr1");

tried this:
insert({time:new Date(),src_user:"kelvin",term_ani:"14112",src_domain:"domain.com",src_ip:"0",dst_ouser:"18188",dst_user:"18112",dst_domain:"domain.com"})

and other combinations, same error

any ideas? i guess we need some more examples on the documentation


Kelvin Chua


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users