Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
/couchdb-pythonPublic archive

method for mango query#324

Open
pirr wants to merge7 commits intodjc:master
base:master
Choose a base branch
Loading
frompirr:mango_query
Open

method for mango query#324

pirr wants to merge7 commits intodjc:masterfrompirr:mango_query

Conversation

pirr
Copy link

@pirrpirr commentedSep 27, 2017
edited
Loading

I suggest implementation for mango query (only CouchDB 2)http://docs.couchdb.org/en/2.1.0/api/database/find.html.

I used django's filter implementation.
data = db.filter(field__subfield1__...__mango_operator = value)

data = db.filter(Q(field1__subfield1__...__mango_operator = value)                          | Q(field2__subfield1__...__mango_operator = value)                          & Q(field3__subfield1__...__mango_operator = value))

Work:

  1. Combination operators:http://docs.couchdb.org/en/2.1.0/api/database/find.html#combination-operators, except: $elemMatch, $allMatch.
  2. Condition operatorshttp://docs.couchdb.org/en/2.1.0/api/database/find.html#condition-operators,
    not tested types: Object, Array-$size, Miscellaneous - $mod.
  3. Sort, limit, fields and other request json object but need testhttp://docs.couchdb.org/en/2.1.0/api/database/find.html#db-find

I will work on update. In first I would add Array operators - $elemMatch, $allMatch.

@pirrpirr mentioned this pull requestSep 27, 2017
@pirr
Copy link
Author

pirr commentedOct 3, 2017
edited
Loading

I added support for $elemMatch, maybe $allMatch (not tested).
aaf0395

feats: [{subfeat: 1, ...}, {subfeat: 2, ...}]db.filter(feats_L_elemMatch__subfeat__eq = 1)feats: ['FOO', 'BAR']db.filter(feats_L_elemMatch__regex = '(?i)fo')

"_L_" - define "feats" field as list
"elemMatch__subfeat__eq" - selector on "subfeat" field

This can be bad implementation. I will be glad to suggestions.

@djc
Copy link
Owner

djc commentedOct 5, 2017

As you can seehere, there are some test failures caused by this PR. Can you look at those and make sure they no longer fail?

@pirr
Copy link
Author

pirr commentedOct 5, 2017

I fixed doctest. But travis log error:

couchdb.http.ServerError: (400, ('bad_request', 'Referer header required.'))

I not get this error in local test log.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@pirr@djc

[8]ページ先頭

©2009-2025 Movatter.jp