You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "AstraLuma (via GitHub)" <gi...@apache.org> on 2025/03/01 18:35:13 UTC

Re: [PR] Real Mango Docs [couchdb]

AstraLuma commented on code in PR #5432:
URL: https://github.com/apache/couchdb/pull/5432#discussion_r1976471365


##########
src/docs/src/ddocs/mango.rst:
##########
@@ -0,0 +1,922 @@
+.. Licensed under the Apache License, Version 2.0 (the "License"); you may not
+.. use this file except in compliance with the License. You may obtain a copy of
+.. the License at
+..
+..   http://www.apache.org/licenses/LICENSE-2.0
+..
+.. Unless required by applicable law or agreed to in writing, software
+.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+.. License for the specific language governing permissions and limitations under
+.. the License.
+
+=============
+Mango Queries
+=============
+
+In addition to :ref:`map/reduce views <viewfun>`, CouchDB supports an expressive
+query system called Mango.
+
+Mango consists of two major concepts:
+
+* Selectors, which are the queries, and are passed to the mango endpoints
+* Indexes, which are a specialization of design docs used in mango queries
+
+There are a few important endpoints for interacting with these concepts:
+
+* :http:post:`/{db}/_find`, which executes a query
+* :http:post:`/{db}/_explain`, which describes the execution of a query
+* :http:get:`/{db}/_index` and :http:post:`/{db}/_index`, which manage indexes
+
+.. _find/selectors:
+
+Selectors
+=========
+
+Selectors are expressed as a JSON object describing documents of interest.
+Within this structure, you can apply conditional logic using specially named
+fields.
+
+Whilst selectors have some similarities with MongoDB query documents, these
+arise from a similarity of purpose and do not necessarily extend to commonality
+of function or result.
+
+.. warning::
+
+    While CouchDB will happily store just about anything JSON, Mango has
+    limitations about what it can work with:
+
+    * Empty field names (``""``) cannot be queried ("One or more conditions is
+      missing a field name.")
+    * Field names starting with ``$`` cannot be queried ("Invalid operator: $")
+    * Fields at the root of the document starting with ``_`` cannot be queried

Review Comment:
   Oops, that must have been a mistake in my experimentation. Going back, it looks like you're right.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org