Skip to content

Instantly share code, notes, and snippets.

@xgqfrms-GitHub
Last active June 4, 2017 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms-GitHub/f51920e16277785f7418c03bd4f9e220 to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/f51920e16277785f7418c03bd4f9e220 to your computer and use it in GitHub Desktop.
mlab, mongodb, db, json, api, free , online,

mlab, mongodb, db, json, api, free , online

https://mlab.com/

https://api.mlab.com/api/1/databases/node-mongodb/collections/test?apiKey=pa4Yku0O7y6CHLqKwDGlLKSfkdPfQprR

在正文中指定空列表等同于删除与查询匹配的文档。

    

    

// {"id": 2017003, "name": "test", "age": 27}

$.ajax({
    url: "https://api.mlab.com/api/1/databases/node-mongodb/collections/test?apiKey=pa4Yku0O7y6CHLqKwDGlLKSfkdPfQprR",
    data: JSON.stringify([]),
    type: "PUT",
    contentType: "application/json" 
});

$.ajax({
    url: "https://api.mlab.com/api/1/databases/node-mongodb/collections/test?apiKey=pa4Yku0O7y6CHLqKwDGlLKSfkdPfQprR",
    type: "DELETE",
    accepts: {
        contentType: "application/json",
    },
    async: true,
    timeout: 300000,
    success: function (data) {
        console.log(data);
     },
    error: function (xhr, status, err) {
        console.log(xhr, status, err);
    }
});
@xgqfrms-GitHub
Copy link
Author

write to db ???

    // TODO ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment