
    h
                         d Z ddlZddlmZmZ ddlmZ  eej                  dd       Z	e	dk\  r1ej                  j                  ej                  j                        Z
nej                  Z
	 d
dZdd	Zy)zE
Helper functions, constants, and types to aid with PyMongo support.
    N)binary	json_util)OperationFailure      )uuid_representationc                    |dk(  ryi }|||d<   |||d<   |dvr||d<   |||d<   t         dk\  r	  | j                  dd	|i|S | j	                  |      }	|j                         D ]  \  }
}t        |	|
      } ||      }	 d|v xs d|v }|	j                  |      S # t        $ r4}t         d
k\  r t        |      }d|v rd|v sd|v s	d|v sd|v s Y d}~d}~ww xY w)z9Pymongo>3.7 deprecates count in favour of count_documentsr   Nskiplimit)Nhint	collation      filterr   znot allowed in this contextz$wherez$geoNearz$nearz$nearSphere)with_limit_and_skip )PYMONGO_VERSIONcount_documentsr   strfinditemsgetattrcount)
collectionr   r   r   r   r   kwargserrmessagecursoroptionoption_valuecursor_methodr   s                 Y/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/mongoengine/pymongo_support.pyr   r      s;    zFvw:v'{ & 	-:--FVFvFF* __V$F & -/|,- !F*?g.?<<,?<@@3   	$& #hG-8'!W,')$/ %	s   B 	C'*CCc                     t         dk\  r| j                         }n| j                         }|s!|D cg c]  }|j                  d      r| }}|S c c}w )zJPymongo>3.7 deprecates collection_names in favour of list_collection_namesr   zsystem.)r   list_collection_namescollection_names
startswith)dbinclude_system_collectionscollectionscs       r%   r'   r'   E   sS    & ..0))+%"-MQQ\\)5LqMM Ns   AA)NNNN)F)__doc__pymongobsonr   r   pymongo.errorsr   tupleversion_tupler   LEGACY_JSON_OPTIONSwith_optionsUuidRepresentationPYTHON_LEGACYDEFAULT_JSON_OPTIONSr   r'   r       r%   <module>r:      s     " +--bq12 d#77DD"55CC E  $88 EI.Ab
r9   