Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
-
Mac OS X 10.8 with MongoDB 2.4.1
*Location*: http://docs.mongodb.org/manual/reference/operator/sort/
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.28.10 (KHTML, like Gecko) Version/6.0.3 Safari/536.28.10
*Referrer*: http://docs.mongodb.org/manual/reference/operator/setOnInsert/
*Screen Resolution*: 1920 x 1200
*repo*: docs
*source*: reference/operator/sort
Mac OS X 10.8 with MongoDB 2.4.1 *Location*: http://docs.mongodb.org/manual/reference/operator/sort/ *User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.28.10 (KHTML, like Gecko) Version/6.0.3 Safari/536.28.10 *Referrer*: http://docs.mongodb.org/manual/reference/operator/setOnInsert/ *Screen Resolution*: 1920 x 1200 *repo*: docs *source*: reference/operator/sort
Description
From Python, I do this:
collection.update(
,
{
'$setOnInsert':
,
'$push': {
'entries': {
'$each': [values],
'$sort':
,
'$slice': -5000
}
}
}, upsert=True, safe=False)
Sometimes this works as expected. Othertimes, with identical input and no change to the code, I get a record full of $slice, $each and $sort elements. Like this:
{
"_id": "127.0.0.1/1365794488242",
"ip": "127.0.0.1",
"ts": 1365798897.709374,
"entries": [
,
{ "message": "Got here!", "ts": 1365798897.699 },
{ "name": "value", "name2": "value2", "ts": 1365798933.084 },
{ "message": "Got here!", "ts": 1365798933.085 },
{ "name": "value", "name2": "value2", "ts": 1365798965.257 },
{ "text": "Got here!", "ts": 1365798965.258 },
{ "ts": 1365799274.568 },
{ "text": "", "ts": 1365799274.569 },
{ "counted": "5", "junked": "7", "text": "[object Object]", "ts": 1365799274.57 },
{ "name": "value", "name2": "value2", "ts": 1365799323.372 },
{ "text": "", "ts": 1365799323.373 },
{ "counted": "5", "junked": "7", "text": "[object Object]", "ts": 1365799323.374 },
{ "name": "value", "name2": "value2", "ts": 1365799363.186 },
{ "text": "Got here!", "ts": 1365799363.187 },
{ "counted": "5", "junked": "7", "text": "And here!", "ts": 1365799363.188 }, {
"$slice": -5000,
"$each": [
],
"$sort":
}, {
"$slice": -5000,
"$each": [
],
"$sort":
}, {
"$slice": -5000,
"$each": [
],
"$sort":
}, {
"$slice": -5000,
"$each": [
],
"$sort":
}, {
"$slice": -5000,
"$each": [
],
"$sort":
}, {
"$slice": -5000,
"$each": [
],
"$sort":
}
]
}