Skip to content

Commit

Permalink
fixup! fixup! fixup! migrated pymongo from insert to insert_one/many
Browse files Browse the repository at this point in the history
  • Loading branch information
dill0wn committed Jun 28, 2024
1 parent af69d2e commit d9b4cbe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/src/ming_odm_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def snippet1():
TAGS = ['foo', 'bar', 'snafu', 'mongodb']

# Insert the documents through PyMongo so that Ming is not involved
session.db.wiki_page.insert([
session.db.wiki_page.insert_many([
dict(title='Page %s' % idx, text='Text of Page %s' %idx, tags=random.sample(TAGS, 2)) for idx in range(10)
])

Expand All @@ -134,7 +134,7 @@ def snippet5():
next(session.db.wiki_page.find()).get('metadata')

def snippet6():
session.db.mymodel.insert(dict(name='desrever'))
session.db.mymodel.insert_one(dict(name='desrever'))
session.db.mymodel.find_one()

# Apply migration to version 1 and then to version 2
Expand Down
4 changes: 2 additions & 2 deletions docs/src/ming_odm_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def snippet1_2():

def snippet1_3():
Contact.query.remove({})
session.db.contact.insert(dict(name='Invalid Contact',
email='this-is-invalid'))
session.db.contact.insert_one(dict(name='Invalid Contact',
email='this-is-invalid'))

try:
c1 = Contact.query.find().first()
Expand Down
4 changes: 2 additions & 2 deletions docs/src/ming_welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class __mongometa__:


def snippet1():
session.db.wiki_page.insert({'title': 'FirstPage',
'text': 'This is my first page'})
session.db.wiki_page.insert_one({'title': 'FirstPage',
'text': 'This is my first page'})
session.db.wiki_page.find_one({'title': 'FirstPage'})


Expand Down

0 comments on commit d9b4cbe

Please sign in to comment.