limit the number of records returned from the ec_curvedata table

8 views
Skip to first unread message

Dumisani Nxumamalo

unread,
Jul 11, 2023, 7:18:42 AM7/11/23
to lmfdb-support
hi all,

am currently trying to download  elliptic curves over Q without a potential CM number. There's over 2 mill records and am only interested in 2900 randomly selected records.  i've tried limiting my query using the limit(x) method but i keep on getting an error. It appears the limit() method is incompatible with the search() method used to query the ec_curvedata table.  Is there a way around this?

thanks in advance. best,

Dumisani

Edgar Costa

unread,
Jul 11, 2023, 9:08:40 AM7/11/23
to Dumisani Nxumamalo, lmfdb-support
There are many ways to do this, but given that potential CM is rare, here is an example that just tries to avoid these rare rows:

sage: foo = set(db.ec_curvedata.search({'cm': {'$ne': 0}}, 'id'))
2023-07-11 09:06:50,616 - Search iterator for ec_curvedata {'cm': {'$ne': 0}} required a total of 2.7196309566497803s
2023-07-11 09:06:50,616 - Search iterator for ec_curvedata {'cm': {'$ne': 0}} required a total of 2.7196309566497803s
sage: m = db.ec_curvedata.max('id')
sage: bar = [elt for elt in [ZZ.random_element(m) for _ in range(3000)] if elt not in foo]
sage: len(bar)
2996
sage: data = list(db.ec_curvedata.search({'id': {'$in': bar[:2900]}}, 'lmfdb_label'))

--
You received this message because you are subscribed to the Google Groups "lmfdb-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmfdb-suppor...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/lmfdb-support/08a0860f-0ad8-4d66-9218-d7ff2d9e7dd5n%40googlegroups.com.

Edgar Costa

unread,
Jul 12, 2023, 9:52:11 AM7/12/23
to Dumisani Nxumamalo, lmfdb-support
We no longer use MongoDB, but we kept much of its language.
The best way to learn is to look at how we use it inside the code that serves LMFDB.
Here is a summary of all the fancy keywords are here, that are very similar to MongoDB

On Tue, Jul 11, 2023 at 11:12 AM Dumisani Nxumamalo <gudun...@gmail.com> wrote:
Thanks again Edgar, this is very helpful.

am new to MongoDB is there a reference you can perhaps recommend which can help navigate through these queries? A lot of what pops on google has not been very helpful.

thanks again.
Reply all
Reply to author
Forward
0 new messages