Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Inserting

kchodorow edited this page Sep 14, 2010 · 1 revision

Usage

http://localhost:27080/dbname/cname/_insert

Description

Inserts one or more documents into a collection.

Request Type

POST

Arguments

Required arguments:

  • docs=array_of_docs (array of objects)

Optional arguments:

  • safe=boolean (0 or 1)

Return Values

{
    "status" : {
        "ok" : 1,
        "err" : null,
        "n" : 0
    }
    "oids" : [
        {"$oid" : doc1_id},
        {"$oid" : doc2_id},
        ...
    ]
}

docX_id is a string representation of the inserted id, e.g., “4b9fad111d41c82cae000000”. The “status” field will only be included if you specify “safe”.

Example

Inserting two documents ({"x" : 2} and {"x" : 3}) into the namespace foo.bar.

$ curl --data 'docs=[{"x":2},{"x":3}]' 'http://localhost:27080/foo/bar/_insert'
Clone this wiki locally