iirc, the command function can execute any type of operation, including insert, try with the command like in the next docs:

  - http://docs.mongodb.org/manual/reference/command/insert/#dbcmd.insert

Cheers,
Daniel

On 29/06/15 11:33, Kelvin Chua wrote:
according to that documentation, inserting a document uses

mongoc_collection_insert (collection, MONGOC_INSERT_NONE, doc, NULL, &error)

which I cannot find in ndb_mongodb.

is this really supported? or should be added to the module?

Kelvin Chua

On Mon, Jun 29, 2015 at 3:40 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,

the exported functions are wrapper around the MongoDB C API, so the commands should work like described in the API, see:

http://api.mongodb.org/c/current/index.html

Cheers,
Daniel


On 27/06/15 16:46, Kelvin Chua wrote:

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



_______________________________________________
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

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com

_______________________________________________
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



-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com