Some summaries from Mongo

var timestamp = _id.toString().substring( 0, 8 );
var date = new Date( parseInt( timestamp, 16 ) * 1000 );


For mongo join table query, you must use DBCursor and his hasNext method.


The calling method of findAndModify is slightly different from the normal update, and it is a little slower because it has to wait for the response from the database. This is handy for manipulating queries and performing other operations that require get-and-assign style atomicity.

The value corresponding to each key in the findAndModify command is shown below.
findAndModify character channeling, collection name.
query query document, the condition used to retrieve the document.
sort The criteria for sorting the results.
update modifier document, the update performed on the found document.
remove Boolean type, indicating whether to delete the document.
new Boolean type, indicating whether to return the document before the update or the document after the update. The default is the pre-update document.
There must be one and only one of "update" and "remove". If no documents are matched, the command returns an error.

This command is somewhat restricted. It can only process one document at a time, nor can it perform upsert operations, only update existing documents.
Compared to normal updates, findAndModify is slower. The approximate time is equivalent to the time required for one lookup, one update and one getLastError to execute sequentially.

db.runCommand("findAndModify":collection name,"query":{query condition},"

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327043302&siteId=291194637