New to Mongodb,trying to get _id after mongodb insert without a round trip.
$.ajax( { url: "https://api.mongolab.com/api/1/databases/xxx/collections/xx?apiKey=xxx",
data: JSON.stringify( [ { "x" : 2,"c1" : 34,"c2" : getUrlVars()["c2"]} ] ),
type: "POST",
contentType: "application/json" } );
Thanks
edit: Solved buy removing square bracers JSON.stringify( { "x" : 2,"c1" : 34,"c2" : getUrlVars()["c2"]} )