This repository was archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 327
/
Copy pathclass.mongomaxkey.html
111 lines (91 loc) · 5.57 KB
/
class.mongomaxkey.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>The MongoMaxKey class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />
</head>
<body class="docs"><div class="navbar navbar-fixed-top">
<div class="navbar-inner clearfix">
<ul class="nav" style="width: 100%">
<li style="float: left;"><a href="class.mongominkey.html">« MongoMinKey</a></li>
<li style="float: right;"><a href="class.mongotimestamp.html">MongoTimestamp »</a></li>
</ul>
</div>
</div>
<div id="breadcrumbs" class="clearfix">
<ul class="breadcrumbs-container">
<li><a href="index.html">PHP Manual</a></li>
<li><a href="mongo.types.html">Types</a></li>
<li>The MongoMaxKey class</li>
</ul>
</div>
<div id="layout">
<div id="layout-content"><div id="class.mongomaxkey" class="reference">
<h1 class="title">The MongoMaxKey class</h1>
<div class="partintro"><p class="verinfo">(PECL mongo >= 1.0.2)</p>
<div class="warning"><strong class="warning">Warning</strong>
<p class="para">This extension that defines this class
is deprecated. Instead, the <a href="" class="link">MongoDB</a> extension should be used.
Alternatives to this class include:</p>
<ul class="simplelist">
<li class="member"><strong class="classname">MongoDB\BSON\MaxKey</strong></li>
</ul>
</div>
<div class="section" id="mongomaxkey.intro">
<h2 class="title">Introduction</h2>
<p class="para">
<strong class="classname">MongoMaxKey</strong> is an special type used by the database
that compares greater than all other possible BSON values. Thus, if a query
is sorted by a given field in ascending order, any document with a
<strong class="classname">MongoMaxKey</strong> as its value will be returned last.
</p>
<p class="para">
<strong class="classname">MongoMaxKey</strong> has no associated fields, methods, or
constants. It is merely the "greatest" value that can be represented in the
database.
</p>
<blockquote class="note"><p><strong class="note">Note</strong>:
<span class="simpara">
<strong class="classname">MongoMaxKey</strong> is used internally by MongoDB for
indexing and sharding. There is generally no reason to use this class in
an application.
</span>
</p></blockquote>
</div>
<div class="section" id="mongomaxkey.synopsis">
<h2 class="title">Class synopsis</h2>
<div class="classsynopsis">
<div class="ooclass"></div>
<div class="classsynopsisinfo">
<span class="ooclass">
<strong class="classname">MongoMaxKey</strong>
</span>
{</div>
}</div>
</div>
<div class="section" id="mongomaxkey.example">
<h2 class="title">Using <strong class="classname">MongoMaxKey</strong> as a value</h2>
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br /><br />$collection</span><span style="color: #007700">-></span><span style="color: #0000BB">insert</span><span style="color: #007700">(array(</span><span style="color: #DD0000">"task" </span><span style="color: #007700">=> </span><span style="color: #DD0000">"dishes"</span><span style="color: #007700">, </span><span style="color: #DD0000">"doBy" </span><span style="color: #007700">=> new </span><span style="color: #0000BB">MongoMaxKey</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-></span><span style="color: #0000BB">insert</span><span style="color: #007700">(array(</span><span style="color: #DD0000">"task" </span><span style="color: #007700">=> </span><span style="color: #DD0000">"staff meeting"</span><span style="color: #007700">, </span><span style="color: #DD0000">"doBy" </span><span style="color: #007700">=> new </span><span style="color: #0000BB">MongoDate</span><span style="color: #007700">(</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"+4 days"</span><span style="color: #007700">))));<br /><br /></span><span style="color: #0000BB">$cursor </span><span style="color: #007700">= </span><span style="color: #0000BB">$collection</span><span style="color: #007700">-></span><span style="color: #0000BB">find</span><span style="color: #007700">()-></span><span style="color: #0000BB">sort</span><span style="color: #007700">(array(</span><span style="color: #DD0000">"doBy" </span><span style="color: #007700">=> </span><span style="color: #0000BB">1</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
<p class="para">
The cursor will return the staff meeting document followed by the dishes
document. The dishes document will always be returned last, regardless of
what else is added to the collection (unless other documents are added with
<strong class="classname">MongoMaxKey</strong> in their "doBy" field).
</p>
</div>
<div class="simplesect">
<h3 class="title">See Also</h3>
<ul class="simplelist">
<li class="member"><a href="class.mongominkey.html" class="classname">MongoMinKey</a></li>
</ul>
</div>
</div>
</div>
</div></div></body></html>